Android Open Source - PharmaApp Load Data Dialog






From Project

Back to project page PharmaApp.

License

The source code is released under:

MIT License

If you think the Android project PharmaApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package mobi.pharmaapp.view;
/*from w  w w  .jav a  2s. c  om*/
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.AsyncTask;
import mobi.pharmaapp.R;
import mobi.pharmaapp.util.JSONPharmacyScraper;

/**
 *
 * @author see /AUTHORS
 */
public class LoadDataDialog extends AsyncTask<Void, Void, Integer> {

    private final Activity parent;
    protected ProgressDialog dialog;
    private boolean force;

    public LoadDataDialog(Activity parent) {
        this(parent, false);
    }

    public LoadDataDialog(Activity parent, boolean force) {
        this.parent = parent;
        dialog = new ProgressDialog(parent);
        this.force = force;
    }

    @Override
    protected void onPreExecute() {
        dialog.setMessage(parent.getString(R.string.loading_data));
        dialog.show();
    }

    @Override
    protected Integer doInBackground(Void... params) {
        return JSONPharmacyScraper.loadData(force);
    }

    @Override
    protected void onPostExecute(Integer result) {
        dialog.dismiss();
        if (result.intValue() == 1) {
            showErrorDialogAndExit();
        }
    }

    protected void showErrorDialogAndExit() {
        AlertDialog.Builder alert = new AlertDialog.Builder(parent);
        alert.setTitle(parent.getString(R.string.internet_conn_error_title));
        alert.setMessage(parent.getString(R.string.internet_conn_error_msg_pharmlist));
        alert.setPositiveButton(parent.getString(R.string.ok), new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
            }
        });
        alert.show();
    }
}




Java Source Code List

mobi.pharmaapp.models.DataModel.java
mobi.pharmaapp.models.UserModel.java
mobi.pharmaapp.util.JSONEmergencyPharmacyScraper.java
mobi.pharmaapp.util.JSONPharmacyScraper.java
mobi.pharmaapp.util.LocalConstants.java
mobi.pharmaapp.util.Location.java
mobi.pharmaapp.util.PharmacyAlphComparator.java
mobi.pharmaapp.util.PharmacyComparator.java
mobi.pharmaapp.util.Pharmacy.java
mobi.pharmaapp.view.AboutActivity.java
mobi.pharmaapp.view.DashboardLayout.java
mobi.pharmaapp.view.EmergencyPharmacistsActivity.java
mobi.pharmaapp.view.InfoPopup.java
mobi.pharmaapp.view.LoadDataDialog.java
mobi.pharmaapp.view.LoadEmergencyDataDialog.java
mobi.pharmaapp.view.LocateActivity.java
mobi.pharmaapp.view.MainActivity.java
mobi.pharmaapp.view.MapOverlayItem.java
mobi.pharmaapp.view.PharmacyAdapter.java
mobi.pharmaapp.view.SearchActivity.java