android.app.ProgressDialog.getProgress()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中android.app.ProgressDialog.getProgress()方法的一些代码示例,展示了ProgressDialog.getProgress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ProgressDialog.getProgress()方法的具体详情如下:
包路径:android.app.ProgressDialog
类名称:ProgressDialog
方法名:getProgress

ProgressDialog.getProgress介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public ProgressDialogAssert hasProgress(int progress) {
 isNotNull();
 int actualProgress = actual.getProgress();
 assertThat(actualProgress) //
   .overridingErrorMessage("Expected progress <%s> but was <%s>.", progress, actualProgress) //
   .isEqualTo(progress);
 return this;
}

代码示例来源:origin: WVector/AppUpdate

public static void setProgress(long current) {
  if (sHorizontalProgressDialog == null) {
    return;
  }
  sHorizontalProgressDialog.setProgress(((int) current) / (1024 * 1024));
  if (sHorizontalProgressDialog.getProgress() >= sHorizontalProgressDialog.getMax()) {
    sHorizontalProgressDialog.dismiss();
    sHorizontalProgressDialog = null;
  }
}

代码示例来源:origin: WVector/AppUpdate

public static void setProgress(int current) {
  if (sHorizontalProgressDialog == null) {
    return;
  }
  sHorizontalProgressDialog.setProgress(current);
  if (sHorizontalProgressDialog.getProgress() >= sHorizontalProgressDialog.getMax()) {
    sHorizontalProgressDialog.dismiss();
    sHorizontalProgressDialog = null;
  }
}

代码示例来源:origin: WVector/AppUpdate

public static void onLoading(long total, long current) {
    if (sHorizontalProgressDialog == null) {
      return;
    }
    if (current == 0) {
      sHorizontalProgressDialog.setMax(((int) total) / (1024 * 1024));
    }
    sHorizontalProgressDialog.setProgress(((int) current) / (1024 * 1024));
    if (sHorizontalProgressDialog.getProgress() >= sHorizontalProgressDialog.getMax()) {
      sHorizontalProgressDialog.dismiss();
      sHorizontalProgressDialog = null;
    }
  }
}

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldSetProgress() {
 assertThat(dialog.getProgress()).isEqualTo(0);
 dialog.setProgress(42);
 assertThat(dialog.getProgress()).isEqualTo(42);
}

代码示例来源:origin: stackoverflow.com

if(mProgressDialog.getProgress()==mProgressDialog.getMax()){
 mProgressDialog.dismiss();
 Toast.makeText(fa, "File Downloaded", Toast.LENGTH_SHORT).show();

代码示例来源:origin: stackoverflow.com

final ProgressDialog progressDialog = new ProgressDialog(v.getContext());

progressDialog.setCancelable(false);
progressDialog.setMessage(v.getContext().getText(R.string.defaultQuantities));
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setMax(100);

new CountDownTimer(250, 250) {
  public void onTick(long millisUntilFinished) {
  }

  public void onFinish() {
    if (progressDialog.getProgress() < 100) {
    progressDialog.show();
    }
  }
}.start();

代码示例来源:origin: com.squareup.assertj/assertj-android

public ProgressDialogAssert hasProgress(int progress) {
 isNotNull();
 int actualProgress = actual.getProgress();
 assertThat(actualProgress) //
   .overridingErrorMessage("Expected progress <%s> but was <%s>.", progress, actualProgress) //
   .isEqualTo(progress);
 return this;
}

代码示例来源:origin: stackoverflow.com

ProgressDialog pbarDialog =  new ProgressDialog( mContext ); 
pbarDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
pbarDialog.setMessage("Loading...");
pbarDialog.setCancelable(false);
pbarDialog.setMax(100);
 pbarDialog .setProgress(0);
 pbarDialog.show();
  while ((bytesRead = fileIn.read(buffer)) > 0) {
          out.write(buffer, 0, buffer.length);
   //get the previous value of progress bar 
          int old_value = pbarDialog .getProgress();
          //calculate how much did you read from the file
          int new_read =(int)( ((float)  bytesRead/f.length()) )*100 ) ;
          //add the new read to the old_value
          int value = new_read+old_value;
          pbarDialog.setProgress(value);              
   System.out.println("SO sendFile" + bytesRead +filename);
        }
 pbarDialog.dismiss();

代码示例来源:origin: stackoverflow.com

if(mProgressDialog.getProgress()==mProgressDialog.getMax()){
 mProgressDialog.dismiss();

代码示例来源:origin: stackoverflow.com

if(mProgressDialog.getProgress()==mProgressDialog.getMax()){
 mProgressDialog.dismiss();
 Toast.makeText(fa, "File Downloaded", Toast.LENGTH_SHORT).show();

代码示例来源:origin: stackoverflow.com

try {
  while (barProgressDialog.getProgress() <= barProgressDialog.getMax()) {
    Thread.sleep(2000);
    barProgressDialog.incrementProgressBy(2);
    if (barProgressDialog.getProgress() == barProgressDialog.getMax()) {
      barProgressDialog.dismiss();

代码示例来源:origin: stackoverflow.com

protected Void doInBackground(Void... arg) {
     while (progressDialog.getProgress() < 100) {
       publishProgress(doSomeTasks());

代码示例来源:origin: stackoverflow.com

public void run() {
  try {
    while (barraProgreso.getProgress() <= barraProgreso.getMax()) {
      Thread.sleep(1000);
      if(barraProgreso.getProgress() == barraProgreso.getMax()){
        barraProgreso.dismiss();

代码示例来源:origin: openbmap/radiocells-scanner-android

/**
 * Creates or restores a progress dialogs
 * This dialog is not shown until calling showExportDialog() explicitly
 * @param newDialog
 *
 */
private void initUploadTaskDialog(final boolean newDialog) {
  if (newDialog) {
    mUploadProgress = new ProgressDialog(this);
    mUploadProgress.setCancelable(false);
    mUploadProgress.setIndeterminate(true);
    final String defaultTitle = getResources().getString(R.string.preparing_export);
    final String defaultMessage = getResources().getString(R.string.please_stay_patient);
    mUploadProgress.setTitle(defaultTitle);
    mUploadProgress.setMessage(defaultMessage);
    mUploadTaskFragment.retainProgress(defaultTitle, defaultMessage, mUploadProgress.getProgress());
  } else {
    mUploadProgress = new ProgressDialog(this);
    mUploadProgress.setCancelable(false);
    mUploadProgress.setIndeterminate(true);
    mUploadTaskFragment.restoreProgress(mUploadProgress);
  }
}

代码示例来源:origin: openbmap/radiocells-scanner-android

/**
 * Creates or restores a progress dialogs
 * This dialog is not shown until calling showExportDialog() explicitly
 * @param newDialog
 */
private void initSaveGpxTaskDialog(final boolean newDialog) {
  if (newDialog) {
    mSaveGpxProgress = new ProgressDialog(this);
    mSaveGpxProgress.setCancelable(false);
    mSaveGpxProgress.setIndeterminate(true);
    final String defaultTitle = getResources().getString(R.string.exporting_gpx);
    final String defaultMessage = getResources().getString(R.string.please_stay_patient);
    mSaveGpxProgress.setTitle(defaultTitle);
    mSaveGpxProgress.setMessage(defaultMessage);
    mUploadTaskFragment.retainProgress(defaultTitle, defaultMessage, mSaveGpxProgress.getProgress());
  } else {
    mSaveGpxProgress = new ProgressDialog(this);
    mSaveGpxProgress.setCancelable(false);
    mSaveGpxProgress.setIndeterminate(true);
    mSaveGpxTaskFragment.restoreProgress(mSaveGpxProgress);
  }
}

代码示例来源:origin: stackoverflow.com

public void handleMessage(Message msg) {
  progressDialog.setProgress(100 * msg.arg1 / msg.arg2);
  if (progressDialog.getProgress() == progressDialog.getMax()) {
    progressDialog.dismiss();

代码示例来源:origin: stackoverflow.com

try {
  while (barProgressDialog.getProgress() <= barProgressDialog
      .getMax()) {
        barProgressDialog.incrementProgressBy(2);
        if (barProgressDialog.getProgress() == barProgressDialog
            .getMax()) {
          barProgressDialog.dismiss();

代码示例来源:origin: stackoverflow.com

public void run() {
          try {
 while (progressDoalog.getProgress() <= progressDoalog
.getMax()) {
  Thread.sleep(200);
  handle.sendMessage(handle.obtainMessage());
  if (progressDoalog.getProgress() == progressDoalog
.getMax()) {
   progressDoalog.dismiss();

代码示例来源:origin: stackoverflow.com

while (barProgressDialog.getProgress() <= barProgressDialog.getMax()) {
  if (barProgressDialog.getProgress() == barProgressDialog.getMax()) {

相关文章