本文整理了Java中android.app.Dialog.setOnCancelListener()
方法的一些代码示例,展示了Dialog.setOnCancelListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dialog.setOnCancelListener()
方法的具体详情如下:
包路径:android.app.Dialog
类名称:Dialog
方法名:setOnCancelListener
暂无
代码示例来源:origin: robolectric/robolectric
@Implementation
protected void setOnCancelListener(DialogInterface.OnCancelListener listener) {
this.onCancelListener = listener;
directlyOn(realDialog, Dialog.class).setOnCancelListener(listener);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void canSetAndGetOnCancelListener() {
Dialog dialog = new Dialog(context);
DialogInterface.OnCancelListener onCancelListener = dialog1 -> {};
dialog.setOnCancelListener(onCancelListener);
assertThat(onCancelListener).isSameAs(shadowOf(dialog).getOnCancelListener());
}
代码示例来源:origin: yanjiabin/ExtendDialog
/**
* 设置监听
*/
public ExtendsDialog setOnCancelListener(OnCancelListener listener) {
mDialog.setOnCancelListener(listener);
return this;
}
代码示例来源:origin: JustinRoom/JSCKit
/**
* Constructor.
*
* @param loadingDialog loading dialog
* @param ifShowDialog Show loadingDialog if true else not.
*/
public LoadingDialogObserver(Dialog loadingDialog, boolean ifShowDialog) {
this.loadingDialog = loadingDialog;
this.ifShowDialog = ifShowDialog;
if (loadingDialog != null)
loadingDialog.setOnCancelListener(this);
}
代码示例来源:origin: luoshihai/XXDialog
/**
* 设置监听
*/
public XXDialog setOnCancelListener(OnCancelListener listener) {
mDialog.setOnCancelListener(listener);
return this;
}
代码示例来源:origin: JustinRoom/CameraMaskDemo
/**
* Constructor.
*
* @param loadingDialog loading dialog
* @param ifShowDialog Show loadingDialog if true else not.
*/
public LoadingDialogObserver(Dialog loadingDialog, boolean ifShowDialog) {
this.loadingDialog = loadingDialog;
this.ifShowDialog = ifShowDialog;
if (loadingDialog != null)
loadingDialog.setOnCancelListener(this);
}
代码示例来源:origin: JustinRoom/WheelViewDemo
/**
* Constructor.
*
* @param loadingDialog loading dialog
* @param ifShowDialog Show loadingDialog if true else not.
*/
public LoadingDialogObserver(Dialog loadingDialog, boolean ifShowDialog) {
this.loadingDialog = loadingDialog;
this.ifShowDialog = ifShowDialog;
if (loadingDialog != null)
loadingDialog.setOnCancelListener(this);
}
代码示例来源:origin: gumingwei/WellSwipe
public SwipeDialog setOnCancelListener(DialogInterface.OnCancelListener listener) {
mDialog.setOnCancelListener(listener);
return this;
}
代码示例来源:origin: happyKen/commonUtil
public void setOnCancelListener(DialogInterface.OnCancelListener listener) {
mDialog.setOnCancelListener(listener);
}
代码示例来源:origin: Odoo-mobile/framework
public DatePicker(Context context, Calendar date) {
final Calendar c = (date != null) ? date : Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
mDialog = new DatePickerDialog(context, this, year, month, day);
mDialog.setOnCancelListener(this);
}
代码示例来源:origin: jaredsburrows/android-gradle-java-app-template
/**
* Check if device has the correct Google Play Services version.
*
* @param activity Current activity.
* @param availability New instance of GoogleApiAvailability.
* @return True if there was a successful connection ot Google Play Services.
*/
public static boolean hasGooglePlayServices(@NonNull Activity activity, @NonNull GoogleApiAvailability availability) {
final int result = availability.isGooglePlayServicesAvailable(activity);
if (result == ConnectionResult.SUCCESS) {
return true;
} else {
final Dialog dialog = availability.getErrorDialog(activity, result, 0);
// Let user use the application
dialog.setOnCancelListener(DialogInterface::cancel);
dialog.show();
}
return false;
}
}
代码示例来源:origin: org.robolectric/framework
@Implementation
public void setOnCancelListener(DialogInterface.OnCancelListener listener) {
this.onCancelListener = listener;
directlyOn(realDialog, Dialog.class).setOnCancelListener(listener);
}
代码示例来源:origin: org.robolectric/shadows-core
@Implementation
public void setOnCancelListener(DialogInterface.OnCancelListener listener) {
this.onCancelListener = listener;
directlyOn(realDialog, Dialog.class).setOnCancelListener(listener);
}
代码示例来源:origin: org.robolectric/shadows-core-v23
@Implementation
public void setOnCancelListener(DialogInterface.OnCancelListener listener) {
this.onCancelListener = listener;
directlyOn(realDialog, Dialog.class).setOnCancelListener(listener);
}
代码示例来源:origin: org.robolectric/shadows-framework
@Implementation
protected void setOnCancelListener(DialogInterface.OnCancelListener listener) {
this.onCancelListener = listener;
directlyOn(realDialog, Dialog.class).setOnCancelListener(listener);
}
代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart
/**
* 初始化
*
* @param isCancel
*/
private void init(boolean isCancel) {
if (progressDialog == null) return;
mDialog = progressDialog.getDialog();
if (mDialog == null) return;
mDialog.setCancelable(isCancel);
if (isCancel) {
mDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
ProgressDialogCallBack.this.onCancelProgress();
}
});
}
}
代码示例来源:origin: ShonLin/QuickDevFramework
@Override
protected void onResume() {
super.onResume();
alertDialogFragment.getDialog().setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
});
alertDialogFragment.getDialog().setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
finish();
}
});
}
代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart
/**
* 初始化
*
* @param isCancel 对话框是否可以取消
*/
private void init(boolean isCancel) {
if (progressDialog == null) return;
mDialog = progressDialog.getDialog();
if (mDialog == null) return;
mDialog.setCancelable(isCancel);
if (isCancel) {
mDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
ProgressSubscriber.this.onCancelProgress();
}
});
}
}
代码示例来源:origin: autume/CircleProgressDialog
public void showDialog() {
mDialog.show();
mDialog.setContentView(R.layout.dialog_circle_progress);
mDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
final Intent intent = new Intent(ACTION_DIALOG_CANCEL);
mContext.sendBroadcast(intent);
isShowing = false;
}
});
progressTextView = (TextView) mDialog.findViewById(R.id.progreeTextView);
RotateLoading mRotateLoading = (RotateLoading) mDialog.findViewById(R.id.rotateloading);
LinearLayout layout = (LinearLayout) mDialog.findViewById(R.id.llProgress);
layout.setLayoutParams(new LinearLayout.LayoutParams(dialogSize, dialogSize));
mRotateLoading.setWidth(progressWidth);
mRotateLoading.setColor(progressColor);
mRotateLoading.setShadowOffset(shadowOffset);
progressTextView.setTextColor(textColor);
progressTextView.setText(text);
mRotateLoading.start();
isShowing = true;
}
代码示例来源:origin: jaredsburrows/android-gradle-java-app-template
private void failTest(@IntRange(from = ConnectionResult.SUCCESS,
to = ConnectionResult.RESTRICTED_PROFILE) int error) {
expect(mockSingleton.isGooglePlayServicesAvailable(mockActivity)).andReturn(error);
expect(mockSingleton.getErrorDialog(mockActivity, error, 0)).andReturn(mockDialog);
mockDialog.setOnCancelListener(anyObject(DialogInterface.OnCancelListener.class));
expectLastCall().once();
mockDialog.show();
expectLastCall().once();
replayAll(mockActivity, mockDialog);
assertThat(hasGooglePlayServices(mockActivity, GoogleApiAvailability.getInstance()), is(false));
verifyAll();
}
}
内容来源于网络,如有侵权,请联系作者删除!