Java Code Examples for android.app.ProgressDialog#setProgressNumberFormat()

The following examples show how to use android.app.ProgressDialog#setProgressNumberFormat() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CollectDataDialog.java    From shaky-android with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ProgressDialog dialog = new ProgressDialog(getActivity(), R.style.AppCompatAlertDialog) {
        @Override
        public void onBackPressed() {
            // don't call super, so the back button won't close the dialog
        }
    };
    dialog.setTitle(R.string.shaky_collecting_feedback);
    dialog.setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    dialog.setIndeterminate(true);
    dialog.setProgressPercentFormat(null);
    dialog.setProgressNumberFormat(null);
    return dialog;
}
 
Example 2
Source File: UpdaterActivity.java    From Pix-Art-Messenger with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //set activity
    setContentView(R.layout.activity_updater);
    this.mTheme = findTheme();
    setTheme(this.mTheme);

    textView = findViewById(R.id.updater);

    mProgressDialog = new ProgressDialog(UpdaterActivity.this) {
        //show warning on back pressed
        @Override
        public void onBackPressed() {
            showCancelDialog();
        }
    };
    mProgressDialog.setMessage(getString(R.string.download_started));
    mProgressDialog.setProgressNumberFormat(null);
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgressDialog.setCancelable(false);
    mProgressDialog.setCanceledOnTouchOutside(false);
}
 
Example 3
Source File: OperationProgressDialog.java    From wifi_backend with GNU General Public License v3.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final int maxProgress = getMaxProgress();

    progressDialog = new ProgressDialog(getActivity());
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setIndeterminate(maxProgress == 0);
    progressDialog.setTitle(getMessage());
    progressDialog.setMax(getMaxProgress());
    progressDialog.setProgressNumberFormat(null);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);

    return progressDialog;
}
 
Example 4
Source File: WebViewManager.java    From GotoBrowser with GNU General Public License v3.0 5 votes vote down vote up
public static void setDownloadProgressDialog(ProgressDialog progress) {
    progress.setCancelable(false);
    progress.setProgressNumberFormat(null);
    progress.setProgressPercentFormat(null);
    progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progress.setIndeterminate(true);
}
 
Example 5
Source File: SaveTools.java    From Gallery-example with GNU General Public License v3.0 5 votes vote down vote up
protected void onPreExecute() {
    count = getLastInt(activity) + 1;
    progressDialog = new ProgressDialog(activity);
    progressDialog.setMessage(activity.getString(R.string.saving_crop));
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setIndeterminate(true);
    progressDialog.setProgressNumberFormat(null);
    progressDialog.setProgressPercentFormat(null);
    progressDialog.show();
}
 
Example 6
Source File: ApplyWallpaper.java    From Gallery-example with GNU General Public License v3.0 5 votes vote down vote up
protected void onPreExecute() {

            progressDialog = new ProgressDialog(activity);
            progressDialog.setMessage(activity.getString(R.string.applying_wallpaper));
            progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            progressDialog.setIndeterminate(true);
            progressDialog.setProgressNumberFormat(null);
            progressDialog.setProgressPercentFormat(null);
            progressDialog.show();
        }
 
Example 7
Source File: DeleteFileUtils.java    From Gallery-example with GNU General Public License v3.0 5 votes vote down vote up
protected void onPreExecute() {

            progressDialog = new ProgressDialog(activity);
            progressDialog.setMessage(activity.getString(R.string.deleting));
            progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            progressDialog.setIndeterminate(true);
            progressDialog.setProgressNumberFormat(null);
            progressDialog.setProgressPercentFormat(null);
            progressDialog.setCancelable(false);
            progressDialog.show();
        }
 
Example 8
Source File: GetChromium.java    From getChromium with GNU General Public License v3.0 5 votes vote down vote up
private void showProgress() {
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgressDialog.setTitle(getString(R.string.progress_title));
    mProgressDialog.setMessage(getString(R.string.progress_detail));
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setCancelable(false);
    mProgressDialog.setProgress(0);
    mProgressDialog.setProgressNumberFormat(null);
    mProgressDialog.setProgressPercentFormat(null);
    mProgressDialog.show();
}
 
Example 9
Source File: UpdateCheckActivity.java    From kcanotify with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    is_finishing = isFinishing();
    mProgressDialog = new ProgressDialog(UpdateCheckActivity.this);
    mProgressDialog.setMessage(getStringWithLocale(R.string.download_progress));
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgressDialog.setCancelable(false);
    mProgressDialog.setProgressNumberFormat("%1d file(s)");

    if (!is_finishing) {
        mProgressDialog.show();
    }
}
 
Example 10
Source File: UpgradeAppTask.java    From SkyTube with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
	// setup the download dialog and display it
	downloadDialog = new ProgressDialog(context);
	downloadDialog.setMessage(context.getString(R.string.downloading));
	downloadDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	downloadDialog.setProgress(0);
	downloadDialog.setMax(100);
	downloadDialog.setCancelable(false);
	downloadDialog.setProgressNumberFormat(null);
	downloadDialog.show();
}
 
Example 11
Source File: PostingActivity.java    From Dashchan with Apache License 2.0 5 votes vote down vote up
@Override
public void onSendPostStart(boolean progressMode) {
	progressDialog = new ProgressDialog(this);
	progressDialog.setCancelable(true);
	progressDialog.setCanceledOnTouchOutside(false);
	if (progressMode) {
		progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
		progressDialog.setProgressNumberFormat("%1$d / %2$d KB");
	}
	progressDialog.setOnCancelListener(sendPostCancelListener);
	progressDialog.setButton(ProgressDialog.BUTTON_POSITIVE, getString(R.string.action_minimize),
			sendPostMinimizeListener);
	onSendPostChangeProgressState(progressMode, SendPostTask.ProgressState.CONNECTING, -1, -1);
	progressDialog.show();
}
 
Example 12
Source File: ResetProgressDialog.java    From wifi_backend with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog progressDialog = new ProgressDialog(getActivity());
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage(getString(R.string.data_reset));
    progressDialog.setProgressNumberFormat(null);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);

    return progressDialog;
}
 
Example 13
Source File: ShutdownThread.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private static ProgressDialog showShutdownDialog(Context context) {
    // Throw up a system dialog to indicate the device is rebooting / shutting down.
    ProgressDialog pd = new ProgressDialog(context);

    // Path 1: Reboot to recovery for update
    //   Condition: mReason startswith REBOOT_RECOVERY_UPDATE
    //
    //  Path 1a: uncrypt needed
    //   Condition: if /cache/recovery/uncrypt_file exists but
    //              /cache/recovery/block.map doesn't.
    //   UI: determinate progress bar (mRebootHasProgressBar == True)
    //
    // * Path 1a is expected to be removed once the GmsCore shipped on
    //   device always calls uncrypt prior to reboot.
    //
    //  Path 1b: uncrypt already done
    //   UI: spinning circle only (no progress bar)
    //
    // Path 2: Reboot to recovery for factory reset
    //   Condition: mReason == REBOOT_RECOVERY
    //   UI: spinning circle only (no progress bar)
    //
    // Path 3: Regular reboot / shutdown
    //   Condition: Otherwise
    //   UI: spinning circle only (no progress bar)

    // mReason could be "recovery-update" or "recovery-update,quiescent".
    if (mReason != null && mReason.startsWith(PowerManager.REBOOT_RECOVERY_UPDATE)) {
        // We need the progress bar if uncrypt will be invoked during the
        // reboot, which might be time-consuming.
        mRebootHasProgressBar = RecoverySystem.UNCRYPT_PACKAGE_FILE.exists()
                && !(RecoverySystem.BLOCK_MAP_FILE.exists());
        pd.setTitle(context.getText(com.android.internal.R.string.reboot_to_update_title));
        if (mRebootHasProgressBar) {
            pd.setMax(100);
            pd.setProgress(0);
            pd.setIndeterminate(false);
            pd.setProgressNumberFormat(null);
            pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            pd.setMessage(context.getText(
                        com.android.internal.R.string.reboot_to_update_prepare));
        } else {
            if (showSysuiReboot()) {
                return null;
            }
            pd.setIndeterminate(true);
            pd.setMessage(context.getText(
                        com.android.internal.R.string.reboot_to_update_reboot));
        }
    } else if (mReason != null && mReason.equals(PowerManager.REBOOT_RECOVERY)) {
        if (RescueParty.isAttemptingFactoryReset()) {
            // We're not actually doing a factory reset yet; we're rebooting
            // to ask the user if they'd like to reset, so give them a less
            // scary dialog message.
            pd.setTitle(context.getText(com.android.internal.R.string.power_off));
            pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
            pd.setIndeterminate(true);
        } else {
            // Factory reset path. Set the dialog message accordingly.
            pd.setTitle(context.getText(com.android.internal.R.string.reboot_to_reset_title));
            pd.setMessage(context.getText(
                        com.android.internal.R.string.reboot_to_reset_message));
            pd.setIndeterminate(true);
        }
    } else {
        if (showSysuiReboot()) {
            return null;
        }
        pd.setTitle(context.getText(com.android.internal.R.string.power_off));
        pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
        pd.setIndeterminate(true);
    }
    pd.setCancelable(false);
    pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);

    pd.show();
    return pd;
}