本文整理了Java中android.app.ProgressDialog.setProgressNumberFormat()
方法的一些代码示例,展示了ProgressDialog.setProgressNumberFormat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ProgressDialog.setProgressNumberFormat()
方法的具体详情如下:
包路径:android.app.ProgressDialog
类名称:ProgressDialog
方法名:setProgressNumberFormat
暂无
代码示例来源:origin: WVector/AppUpdate
@SuppressLint("NewApi")
public static void showHorizontalProgressDialog(Activity context, String msg, boolean isShowSize) {
cancel();
if (sHorizontalProgressDialog == null) {
sHorizontalProgressDialog = new ProgressDialog(context);
sHorizontalProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
sHorizontalProgressDialog.setCanceledOnTouchOutside(false);
if (isShowSize)
sHorizontalProgressDialog.setProgressNumberFormat("%2dMB/%1dMB");
}
if (!TextUtils.isEmpty(msg)) {
sHorizontalProgressDialog.setMessage(msg);
}
sHorizontalProgressDialog.show();
}
代码示例来源:origin: k9mail/k-9
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Bundle args = getArguments();
long size = args.getLong(ARG_SIZE);
String message = args.getString(ARG_MESSAGE);
final SizeUnit sizeUnit = SizeUnit.getAppropriateFor(size);
messagingListener = new SimpleMessagingListener() {
@Override
public void updateProgress(int progress) {
dialog.setProgress(sizeUnit.valueInSizeUnit(progress));
}
};
messagingController = MessagingController.getInstance(getActivity());
messagingController.addListener(messagingListener);
dialog = new ProgressDialog(getActivity());
dialog.setMessage(message);
dialog.setMax(sizeUnit.valueInSizeUnit(size));
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setProgress(0);
dialog.setProgressNumberFormat("%1d/%2d " + sizeUnit.shortName);
dialog.show();
return dialog;
}
代码示例来源:origin: hiteshbpatel/Android_Blog_Projects
public void run() {
// TODO Auto-generated method stub
mProgressDialog.setMessage(task);
mProgressDialog.setIndeterminate(false);
mProgressDialog.setMax(100);
mProgressDialog.setProgressNumberFormat(null);
mProgressDialog
.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.show();
}
};
代码示例来源:origin: stackoverflow.com
ProgressDialog dialog;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
dialog = new ProgressDialog(getContext());
dialog.setProgressNumberFormat(null);
} else {
dialog = new ProgressDialog(getContext()) {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
Field field = ProgressDialog.class.getDeclaredField("mProgressNumber");
field.setAccessible(true);
TextView textView = (TextView)field.get(this);
field.setAccessible(false);
textView.setVisibility(View.GONE);
} catch (Exception e) {
// Ignore the exception ... We'll just let the dialog show the bytes. It's not ideal but it works.
Log.w("ProgressDialog", "Failed to hide the progress number via reflection.", e);
}
}
};
}
// Further configure the dialog ...
dialog.show();
代码示例来源:origin: microshow/RxFFmpeg
public static ProgressDialog openProgressDialog(Context context) {
ProgressDialog mProgressDialog = new ProgressDialog(context);
final int totalProgressTime = 100;
mProgressDialog.setMessage("正在转换视频,请稍后...");
mProgressDialog.setButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//中断 ffmpeg
RxFFmpegInvoke.getInstance().exit();
}
});
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setProgressNumberFormat("");
mProgressDialog.setCancelable(false);
mProgressDialog.setMax(totalProgressTime);
mProgressDialog.show();
return mProgressDialog;
}
代码示例来源:origin: n76/wifi_backend
@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;
}
代码示例来源:origin: hiteshbpatel/Android_Blog_Projects
public void run() {
// TODO Auto-generated method stub
mProgressDialog.setMessage("Receiving...");
mProgressDialog.setIndeterminate(false);
mProgressDialog.setMax(100);
mProgressDialog.setProgress(0);
mProgressDialog.setProgressNumberFormat(null);
// mProgressDialog.setCancelable(false);
mProgressDialog
.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.show();
}
};
代码示例来源: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: n76/wifi_backend
@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;
}
代码示例来源: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: voroshkov/Chorus-RF-Laptimer
pd.setIndeterminate(false);
pd.setCancelable(false);
pd.setProgressNumberFormat(null);
pd.show();
AppState.getInstance().clearOldCalibrationTimes();
代码示例来源: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
/*****************************************************
*
* 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( false );
mProgressDialog.setProgressStyle( ProgressDialog.STYLE_HORIZONTAL );
mProgressDialog.setProgressNumberFormat( null ); // Don't display the "N/100" text
mProgressDialog.setTitle( R.string.kitesdk_alert_dialog_title_processing);
mProgressDialog.setMessage( getString( R.string.kitesdk_alert_dialog_message_processing) );
mProgressDialog.setMax( 100 );
}
setCancelable( false );
return ( mProgressDialog );
}
代码示例来源:origin: stackoverflow.com
dialog.setIndeterminate(false);
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
dialog.setProgressNumberFormat(null);
dialog.setProgress(0);
dialog.show();
代码示例来源:origin: antest1/kcanotify
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setCancelable(false);
mProgressDialog.setProgressNumberFormat("%1d file(s)");
代码示例来源: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);
}
}
代码示例来源:origin: antest1/kcanotify
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setCancelable(false);
mProgressDialog.setProgressNumberFormat("%1d file(s)");
is_destroyed = false;
代码示例来源:origin: antest1/kcanotify
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setCancelable(false);
mProgressDialog.setProgressNumberFormat("%1d file(s)");
内容来源于网络,如有侵权,请联系作者删除!