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

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

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

ProgressDialog.setProgressPercentFormat介绍

暂无

代码示例

代码示例来源:origin: andDevW/getChromium

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();
}

代码示例来源:origin: Microsoft/AppCenter-SDK-Android

/**
 * Show download progress.
 */
@SuppressWarnings("deprecation")
private void showDownloadProgress() {
  mProgressDialog = new android.app.ProgressDialog(mForegroundActivity);
  mProgressDialog.setTitle(R.string.appcenter_distribute_downloading_mandatory_update);
  mProgressDialog.setCancelable(false);
  mProgressDialog.setProgressStyle(android.app.ProgressDialog.STYLE_HORIZONTAL);
  mProgressDialog.setIndeterminate(true);
  mProgressDialog.setProgressNumberFormat(null);
  mProgressDialog.setProgressPercentFormat(null);
  showAndRememberDialogActivity(mProgressDialog);
}

代码示例来源:origin: proninyaroslav/libretorrent

@Override
  public Dialog onCreateDialog(Bundle savedInstanceState)
  {
    Bundle args = getArguments();
    int title = args.getInt(TAG_TITLE);
    String message = args.getString(TAG_MESSAGE);
    int progress = args.getInt(TAG_PROGRESS);
    boolean isIndeterminate = args.getBoolean(TAG_IS_INDETERMINATE);
    boolean isCancelable = args.getBoolean(TAG_IS_CANCELABLE);

    ProgressDialog dialog = new ProgressDialog(getActivity());
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && dialog.getWindow() != null)
      dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setTitle(title);
    dialog.setMessage(message);
    dialog.setIndeterminate(isIndeterminate);
    dialog.setCancelable(isCancelable);
    dialog.setProgressNumberFormat(null);
    dialog.setProgressPercentFormat(null);
    dialog.setProgress(progress);

    return dialog;
  }
}

代码示例来源:origin: OceanLabs/Android-Print-SDK

/*****************************************************
 *
 * Called to create a dialog.
 *
 *****************************************************/
@Override
public AlertDialog onCreateDialog( Bundle savedInstanceState )
 {
 // If there isn't already a progress dialog - create one now
 if ( mProgressDialog == null )
  {
  mProgressDialog = new ProgressDialog( getActivity() );
  mProgressDialog.setIndeterminate( true );
  mProgressDialog.setProgressStyle( ProgressDialog.STYLE_HORIZONTAL );
  mProgressDialog.setProgressPercentFormat( null );
  mProgressDialog.setProgressNumberFormat( null );   // Don't display the "N/100" text
  mProgressDialog.setTitle( R.string.kitesdk_Loading_catalogue);
  }
 setCancelable( true );
 return ( mProgressDialog );
 }

代码示例来源:origin: linkedin/shaky-android

@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;
  }
}

代码示例来源:origin: OceanLabs/Android-Print-SDK

progressDialog.setProgressPercentFormat( null );
progressDialog.setMessage( getString( R.string.kitesdk_order_submission_message_posted) );
break;
progressDialog.setProgressPercentFormat( null );
progressDialog.setMessage( getString( R.string.kitesdk_order_submission_message_received) );
break;
progressDialog.setProgressPercentFormat( null );
progressDialog.setMessage( getString( R.string.kitesdk_order_submission_message_accepted) );
break;
progressDialog.setProgressPercentFormat( null );
progressDialog.setMessage( state.name() );
break;

代码示例来源:origin: Microsoft/AppCenter-SDK-Android

/**
 * Update progress dialog for mandatory update.
 */
synchronized void updateProgressDialog(ReleaseDetails releaseDetails, DownloadProgress downloadProgress) {
  /* If not canceled and U.I. context did not change. */
  if (releaseDetails == mReleaseDetails && mProgressDialog != null) {
    /* If file size is known update downloadProgress bar. */
    if (downloadProgress.getTotalSize() >= 0) {
      /* When we switch from indeterminate to determinate */
      if (mProgressDialog.isIndeterminate()) {
        /* Configure the progress dialog determinate style. */
        mProgressDialog.setProgressPercentFormat(NumberFormat.getPercentInstance());
        mProgressDialog.setProgressNumberFormat(mForegroundActivity.getString(R.string.appcenter_distribute_download_progress_number_format));
        mProgressDialog.setIndeterminate(false);
        mProgressDialog.setMax((int) (downloadProgress.getTotalSize() / MEBIBYTE_IN_BYTES));
      }
      mProgressDialog.setProgress((int) (downloadProgress.getCurrentSize() / MEBIBYTE_IN_BYTES));
    }
    /* And schedule the next check. */
    HandlerUtils.getMainHandler().postAtTime(new Runnable() {
      @Override
      public void run() {
        checkDownload(mContext, DistributeUtils.getStoredDownloadId(), true);
      }
    }, HANDLER_TOKEN_CHECK_PROGRESS, SystemClock.uptimeMillis() + CHECK_PROGRESS_TIME_INTERVAL_IN_MILLIS);
  }
}

相关文章