2016-07-02 16:03:31 +00:00
|
|
|
package com.android_app.matan.ara.sagi.thesocialnotework;
|
|
|
|
|
|
|
|
import android.app.ProgressDialog;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.os.AsyncTask;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by JERLocal on 7/2/2016.
|
|
|
|
*/
|
|
|
|
public class HeavyWorker extends AsyncTask< String , Context , Void > {
|
|
|
|
|
|
|
|
private ProgressDialog progressDialog ;
|
|
|
|
private Context targetCtx ;
|
|
|
|
|
|
|
|
public HeavyWorker ( Context context ) {
|
|
|
|
this.targetCtx = context ;
|
|
|
|
progressDialog = new ProgressDialog ( targetCtx ) ;
|
|
|
|
progressDialog.setCancelable ( false ) ;
|
|
|
|
progressDialog.setMessage ( "Retrieving data..." ) ;
|
|
|
|
progressDialog.setTitle ( "Please wait" ) ;
|
|
|
|
progressDialog.setIndeterminate ( true ) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
@ Override
|
|
|
|
protected void onPreExecute ( ) {
|
|
|
|
progressDialog.show ( ) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
@ Override
|
|
|
|
protected Void doInBackground ( String ... params ) {
|
|
|
|
// Do Your WORK here
|
|
|
|
|
2016-07-06 11:00:51 +00:00
|
|
|
// MainActivity ps = (MainActivity) targetCtx;
|
|
|
|
// ps.getAllNotes();
|
2016-07-02 16:03:31 +00:00
|
|
|
|
|
|
|
return null ;
|
|
|
|
}
|
|
|
|
|
|
|
|
@ Override
|
|
|
|
protected void onPostExecute ( Void result ) {
|
|
|
|
if(progressDialog != null && progressDialog.isShowing()){
|
|
|
|
progressDialog.dismiss ( ) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|