use of org.odk.collect.android.utilities.AuthDialogUtility 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;
}
use of org.odk.collect.android.utilities.AuthDialogUtility in project collect by opendatakit.
the class FormDownloadListActivity method createAuthDialog.
private void createAuthDialog() {
viewModel.setAlertShowing(false);
AuthDialogUtility authDialogUtility = new AuthDialogUtility();
if (viewModel.getUrl() != null && viewModel.getUsername() != null && viewModel.getPassword() != null) {
authDialogUtility.setCustomUsername(viewModel.getUsername());
authDialogUtility.setCustomPassword(viewModel.getPassword());
}
DialogUtils.showDialog(authDialogUtility.createDialog(this, this, viewModel.getUrl()), this);
}
use of org.odk.collect.android.utilities.AuthDialogUtility in project collect by opendatakit.
the class FormDownloadList method onCreateDialog.
@Override
protected Dialog onCreateDialog(int id) {
switch(id) {
case PROGRESS_DIALOG:
Collect.getInstance().getActivityLogger().logAction(this, "onCreateDialog.PROGRESS_DIALOG", "show");
progressDialog = new ProgressDialog(this);
DialogInterface.OnClickListener loadingButtonListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Collect.getInstance().getActivityLogger().logAction(this, "onCreateDialog.PROGRESS_DIALOG", "OK");
// we use the same progress dialog for both
// so whatever isn't null is running
dialog.dismiss();
if (downloadFormListTask != null) {
downloadFormListTask.setDownloaderListener(null);
downloadFormListTask.cancel(true);
downloadFormListTask = null;
}
if (downloadFormsTask != null) {
showDialog(CANCELLATION_DIALOG);
downloadFormsTask.cancel(true);
}
}
};
progressDialog.setTitle(getString(R.string.downloading_data));
progressDialog.setMessage(alertMsg);
progressDialog.setIcon(android.R.drawable.ic_dialog_info);
progressDialog.setIndeterminate(true);
progressDialog.setCancelable(false);
progressDialog.setButton(getString(R.string.cancel), loadingButtonListener);
return progressDialog;
case AUTH_DIALOG:
Collect.getInstance().getActivityLogger().logAction(this, "onCreateDialog.AUTH_DIALOG", "show");
alertShowing = false;
return new AuthDialogUtility().createDialog(this, this, null);
case CANCELLATION_DIALOG:
cancelDialog = new ProgressDialog(this);
cancelDialog.setTitle(getString(R.string.canceling));
cancelDialog.setMessage(getString(R.string.please_wait));
cancelDialog.setIcon(android.R.drawable.ic_dialog_info);
cancelDialog.setIndeterminate(true);
cancelDialog.setCancelable(false);
return cancelDialog;
}
return null;
}
Aggregations