Search in sources :

Example 1 with DayNightProgressDialog

use of org.odk.collect.android.views.DayNightProgressDialog in project collect by opendatakit.

the class InstanceUploaderActivity method onCreateDialog.

@Override
protected Dialog onCreateDialog(int id) {
    switch(id) {
        case PROGRESS_DIALOG:
            progressDialog = new DayNightProgressDialog(this);
            DialogInterface.OnClickListener loadingButtonListener = new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    instanceServerUploaderTask.cancel(true);
                    instanceServerUploaderTask.setUploaderListener(null);
                    finish();
                }
            };
            progressDialog.setTitle(getString(R.string.uploading_data));
            progressDialog.setMessage(alertMsg);
            progressDialog.setIndeterminate(true);
            progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progressDialog.setCancelable(false);
            progressDialog.setButton(getString(R.string.cancel), loadingButtonListener);
            return progressDialog;
        case AUTH_DIALOG:
            Timber.i("onCreateDialog(AUTH_DIALOG): for upload of %d instances!", instancesToSend.length);
            AuthDialogUtility authDialogUtility = new AuthDialogUtility();
            if (username != null && password != null && url != null) {
                authDialogUtility.setCustomUsername(username);
                authDialogUtility.setCustomPassword(password);
            }
            return authDialogUtility.createDialog(this, this, this.url);
    }
    return null;
}
Also used : DialogInterface(android.content.DialogInterface) DayNightProgressDialog(org.odk.collect.android.views.DayNightProgressDialog) AuthDialogUtility(org.odk.collect.android.utilities.AuthDialogUtility)

Example 2 with DayNightProgressDialog

use of org.odk.collect.android.views.DayNightProgressDialog in project collect by opendatakit.

the class FormDownloadListActivity method createCancelDialog.

private void createCancelDialog() {
    cancelDialog = new DayNightProgressDialog(this);
    cancelDialog.setTitle(getString(R.string.canceling));
    cancelDialog.setMessage(getString(R.string.please_wait));
    cancelDialog.setIndeterminate(true);
    cancelDialog.setCancelable(false);
    viewModel.setCancelDialogShowing(true);
    DialogUtils.showDialog(cancelDialog, this);
}
Also used : DayNightProgressDialog(org.odk.collect.android.views.DayNightProgressDialog)

Example 3 with DayNightProgressDialog

use of org.odk.collect.android.views.DayNightProgressDialog in project collect by opendatakit.

the class BearingActivity method setupBearingDialog.

/**
 * Sets up the look and actions for the progress dialog while the compass is
 * searching.
 */
private void setupBearingDialog() {
    // dialog displayed while fetching bearing
    bearingDialog = new DayNightProgressDialog(this);
    DialogInterface.OnClickListener geopointButtonListener = new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            switch(which) {
                case DialogInterface.BUTTON_POSITIVE:
                    returnBearing();
                    break;
                case DialogInterface.BUTTON_NEGATIVE:
                    bearingDecimal = null;
                    finish();
                    break;
            }
        }
    };
    // back button doesn't cancel
    bearingDialog.setCancelable(false);
    bearingDialog.setIndeterminate(true);
    bearingDialog.setTitle(getString(R.string.getting_bearing));
    bearingDialog.setMessage(getString(R.string.please_wait_long));
    bearingDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.accept_bearing), geopointButtonListener);
    bearingDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel_location), geopointButtonListener);
}
Also used : DialogInterface(android.content.DialogInterface) DayNightProgressDialog(org.odk.collect.android.views.DayNightProgressDialog)

Example 4 with DayNightProgressDialog

use of org.odk.collect.android.views.DayNightProgressDialog in project collect by opendatakit.

the class GoogleDriveActivity method onCreateDialog.

@Override
protected Dialog onCreateDialog(int id) {
    switch(id) {
        case PROGRESS_DIALOG:
            ProgressDialog progressDialog = new DayNightProgressDialog(this);
            DialogInterface.OnClickListener loadingButtonListener = new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    getFileTask.cancel(true);
                    getFileTask.setGoogleDriveFormDownloadListener(null);
                }
            };
            progressDialog.setTitle(getString(R.string.downloading_data));
            progressDialog.setMessage(alertMsg);
            progressDialog.setIndeterminate(true);
            progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progressDialog.setCancelable(false);
            progressDialog.setButton(getString(R.string.cancel), loadingButtonListener);
            return progressDialog;
        case GOOGLE_USER_DIALOG:
            MaterialAlertDialogBuilder gudBuilder = new MaterialAlertDialogBuilder(this);
            gudBuilder.setTitle(getString(R.string.no_google_account));
            gudBuilder.setMessage(getString(R.string.google_set_account));
            gudBuilder.setPositiveButton(R.string.ok, (dialog, which) -> finish());
            gudBuilder.setCancelable(false);
            return gudBuilder.create();
    }
    return null;
}
Also used : DialogInterface(android.content.DialogInterface) DayNightProgressDialog(org.odk.collect.android.views.DayNightProgressDialog) DayNightProgressDialog(org.odk.collect.android.views.DayNightProgressDialog) ProgressDialog(android.app.ProgressDialog) MaterialAlertDialogBuilder(com.google.android.material.dialog.MaterialAlertDialogBuilder)

Example 5 with DayNightProgressDialog

use of org.odk.collect.android.views.DayNightProgressDialog in project collect by opendatakit.

the class GoogleSheetsUploaderProgressDialog method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    super.onCreateDialog(savedInstanceState);
    setRetainInstance(true);
    setCancelable(false);
    dialog = new DayNightProgressDialog(getActivity());
    dialog.setTitle(getString(R.string.uploading_data));
    dialog.setMessage(getString(R.string.please_wait));
    dialog.setCancelable(false);
    dialog.setIndeterminate(true);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setButton(getString(R.string.cancel), (dialog1, which) -> onSendingFormsCanceled.onSendingFormsCanceled());
    return dialog;
}
Also used : DayNightProgressDialog(org.odk.collect.android.views.DayNightProgressDialog) NonNull(androidx.annotation.NonNull)

Aggregations

DayNightProgressDialog (org.odk.collect.android.views.DayNightProgressDialog)6 DialogInterface (android.content.DialogInterface)3 ProgressDialog (android.app.ProgressDialog)1 NonNull (androidx.annotation.NonNull)1 MaterialAlertDialogBuilder (com.google.android.material.dialog.MaterialAlertDialogBuilder)1 DeleteInstancesTask (org.odk.collect.android.tasks.DeleteInstancesTask)1 AuthDialogUtility (org.odk.collect.android.utilities.AuthDialogUtility)1