本文整理了Java中android.app.ProgressDialog.setButton()
方法的一些代码示例,展示了ProgressDialog.setButton()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ProgressDialog.setButton()
方法的具体详情如下:
包路径:android.app.ProgressDialog
类名称:ProgressDialog
方法名:setButton
暂无
代码示例来源:origin: stackoverflow.com
ProgressDialog dlg = new ProgressDialog(this);
dlg.setButton(ProgressDialog.BUTTON_NEUTRAL,
"Close",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//button click stuff here
}
});
dlg.show();
dlg.getButton(ProgressDialog.BUTTON_NEUTRAL).setEnabled(false);
//or alternatively
//dlg.getButton(ProgressDialog.BUTTON_NEUTRAL).setVisibility(View.INVISIBLE);
代码示例来源:origin: tagtime/TagTime
private Dialog progressDialog() {
mProgress = new ProgressDialog(ManageData.this);
mProgress.setIcon(R.drawable.alert_dialog_icon);
mProgress.setTitle(R.string.saving_log);
mProgress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mProgress.setButton("Hide", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Just make dialog go away (Do I need to do anything?)
}
});
mProgress.setButton2("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Cancel the save
}
});
return mProgress;
}
代码示例来源:origin: offensive-security/nethunter-app
public DownloadChroot(Context context) {
this.context = context;
mProgressDialog = new ProgressDialog(context);
mProgressDialog.setCancelable(false);
mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
cancel(true);
}
});
}
代码示例来源:origin: stackoverflow.com
ProgressDialog dialog = new ProgressDialog(this);
dialog.setButton(AlertDialog.BUTTON_POSITIVE, "confirm",
(DialogInterface.OnClickListener) null);
dialog.setButton(AlertDialog.BUTTON_NEGATIVE, "cancel",
(DialogInterface.OnClickListener) null);
dialog.show();
Button btConfirm = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) btConfirm
.getLayoutParams();
params.weight = 3;
代码示例来源:origin: stackoverflow.com
.setProgressStyle(ProgressDialog.STYLE_SPINNER);
dialog.setMessage("Recording...");
dialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Stop",
dialogStopListener);
代码示例来源:origin: namndbka/QDict
private void showProgressDialog() {
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setMessage(getResources().getString(R.string.keywords_search));
mProgressDialog.setCancelable(false);
mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
mDictions.cancelLookup();
dialog.cancel();
}
});
mProgressDialog.show();
}
代码示例来源:origin: stackoverflow.com
public class Test extends Activity
{
public static final int DIALOG_DOWNLOAD_PROGRESS = 0;
private Button startBtn;
private ProgressDialog mProgressDialog;
private final String KEY_TITLE = "Afromusics_file";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mProgressDialog.setCancelable(true);
mProgressDialog.setButton(ProgressDialog.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//Cancel download task
mProgressDialog.cancel();
}
});
}
}
代码示例来源: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: stackoverflow.com
private final ProgressDialog progressDialog;
public MyAsyncTask(Context context) {
super(context);
progressDialog = new ProgressDialog(context);
progressDialog.setTitle(R.string.title);
progressDialog.setButton(
DialogInterface.BUTTON_NEGATIVE,
context.getResources().getString(R.string.abort),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
MyAsyncTask.this.cancel(true);
progressDialog.dismiss();
}
}
);
progressDialog.show();
}
@Override
protected void onProgressUpdate(String... params) {
progressDialog.setMessage(params[0]);
}
代码示例来源:origin: brainysoon/cyberCar
private void showDownlaodProgressBar() {
mProgressDialog = new ProgressDialog(context);
mProgressDialog.setMessage("正在下载...");
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setButton("取消下载", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mProgressDialog.dismiss();
mInteruptFlag = true;
afterUpdate.toDoAfterUpdate();
}
});
mProgressDialog.setCanceledOnTouchOutside(false);
mProgressDialog.setProgress(0);
mProgressDialog.setMax(100);
mProgressDialog.show();
}
代码示例来源:origin: evernote/evernote-sdk-android
protected void showDialog() {
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
EvernoteLoginTask task = (EvernoteLoginTask) TaskExecutor.getInstance().getTask(mTaskKey);
if (task != null) {
task.cancel();
}
onResult(false, task);
}
};
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setIndeterminate(true);
mProgressDialog.setMessage(getString(R.string.esdk_loading));
mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(android.R.string.cancel), onClickListener);
mProgressDialog.setCancelable(false);
mProgressDialog.show();
}
代码示例来源:origin: stackoverflow.com
ProgressDialog loadingDialog = ProgressDialog.show(activity.this, "", "Loading...",
true, false);
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2500);
runOnUiThread(new Runnable() {
public void run() {
loadingDialog.dismiss();
loadingDialog.setButton(ProgressDialog.BUTTON_NEUTRAL,
"Close",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//button click stuff here
}
});
loadingDialog.show();
loadingDialog.getButton(ProgressDialog.BUTTON_NEUTRAL).setVisibility(View.INVISIBLE);
}
}
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
代码示例来源:origin: thuryn/your-local-weather
private void detectLocation() {
if (WidgetRefreshIconService.isRotationActive) {
return;
}
mProgressDialog = new ProgressDialog(MainActivity.this);
mProgressDialog.setMessage(getString(R.string.progressDialog_gps_locate));
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mProgressDialog.setIndeterminate(true);
mProgressDialog.setCancelable(false);
mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
dialog.dismiss();
} catch (SecurityException e) {
appendLog(MainActivity.this, TAG, "Cancellation error", e);
}
}
});
updateNetworkLocation();
mProgressDialog.show();
refreshDialogHandler = new Handler(Looper.getMainLooper());
}
代码示例来源:origin: stackoverflow.com
final ProgressDialog pd = new ProgressDialog(ctx);
pd.setTitle(R.string.creating_a_gif);
pd.setMessage(ctx.getString(R.string.preprocessing));
pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
float duration = (float) (mModel.getGifEndPosition() - mModel.getGifStartPosition());
int totalFrames = (int) ((duration / SECOND_IN_MILLIS) * mModel.getFps());
pd.setMax(totalFrames);
pd.setIndeterminate(false); //<--- change to false
pd.setCancelable(false);
pd.setCanceledOnTouchOutside(false);
pd.setButton(DialogInterface.BUTTON_NEGATIVE,
ctx.getString(android.R.string.cancel),
(dialogInterface, i) -> FFmpeg.getInstance(ctx).killRunningProcesses());
pd.show();
mBuilder.setProgressListener((f, ft) -> {
pd.setMessage(ctx.getString(R.string.frames_processed));
pd.setIndeterminate(false);
new Thread(() -> {
pd.setProgress(f);
pd.setSecondaryProgress(f);
}).start();
});
mBuilder.setCompleteListener(pathToGif -> {
pd.dismiss();
goToPreview(pathToGif);
});
代码示例来源:origin: sunfusheng/FirUpdater
public void showDownloadDialog(Context context, int progress) {
if (progressDialog == null) {
progressDialog = new ProgressDialog(context);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setCancelable(false);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setMax(100);
progressDialog.setTitle("正在下载");
progressDialog.setButton(DialogInterface.BUTTON_POSITIVE, "后台下载", (dialog, which) -> {
if (onClickDownloadDialogListener != null) {
onClickDownloadDialogListener.onClickBackgroundDownload(dialog);
}
});
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "取消", (dialog, which) -> {
if (onClickDownloadDialogListener != null) {
onClickDownloadDialogListener.onClickCancelDownload(dialog);
}
});
progressDialog.show();
progressDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#333333"));
progressDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.parseColor("#9a9a9a"));
}
if (progressDialog.isShowing()) {
progressDialog.setProgress(progress);
}
}
代码示例来源:origin: evernote/evernote-sdk-android
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
setCancelable(false);
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
EvernoteLoginTask task = (EvernoteLoginTask) TaskExecutor.getInstance().getTask(mTaskKey);
if (task != null) {
task.cancel();
}
onResult(false, task);
}
};
ProgressDialog progressDialog = new ProgressDialog(getActivity());
progressDialog.setIndeterminate(true);
progressDialog.setMessage(getString(R.string.esdk_loading));
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(android.R.string.cancel), onClickListener);
progressDialog.setCancelable(isCancelable());
return progressDialog;
}
代码示例来源:origin: redfish64/TinyTravelTracker
dialog.setButton(ProgressDialog.BUTTON_NEGATIVE, getText(android.R.string.cancel),
new DialogInterface.OnClickListener() {
代码示例来源:origin: qqq3/good-weather
mProgressDialog.setIndeterminate(true);
mProgressDialog.setCancelable(false);
mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
代码示例来源:origin: stackoverflow.com
mProgressDialog.setTitle(R.string.lbl_recording);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mProgressDialog.setButton("Stop recording", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
mProgressDialog.dismiss();
代码示例来源:origin: stackoverflow.com
mProgressDialog.setTitle(R.string.lbl_recording);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mProgressDialog.setButton("Stop recording", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
mProgressDialog.dismiss();
内容来源于网络,如有侵权,请联系作者删除!