@Implementation protected void setOnCancelListener(DialogInterface.OnCancelListener listener) { this.onCancelListener = listener; directlyOn(realDialog, Dialog.class).setOnCancelListener(listener); }
@Test public void canSetAndGetOnCancelListener() { Dialog dialog = new Dialog(context); DialogInterface.OnCancelListener onCancelListener = dialog1 -> {}; dialog.setOnCancelListener(onCancelListener); assertThat(onCancelListener).isSameAs(shadowOf(dialog).getOnCancelListener()); }
/** * 设置监听 */ public ExtendsDialog setOnCancelListener(OnCancelListener listener) { mDialog.setOnCancelListener(listener); return this; }
/** * 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); }
/** * 设置监听 */ public XXDialog setOnCancelListener(OnCancelListener listener) { mDialog.setOnCancelListener(listener); return this; }
/** * 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); }
/** * 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); }
public SwipeDialog setOnCancelListener(DialogInterface.OnCancelListener listener) { mDialog.setOnCancelListener(listener); return this; }
public void setOnCancelListener(DialogInterface.OnCancelListener listener) { mDialog.setOnCancelListener(listener); }
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); }
/** * 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; } }
@Implementation public void setOnCancelListener(DialogInterface.OnCancelListener listener) { this.onCancelListener = listener; directlyOn(realDialog, Dialog.class).setOnCancelListener(listener); }
@Implementation public void setOnCancelListener(DialogInterface.OnCancelListener listener) { this.onCancelListener = listener; directlyOn(realDialog, Dialog.class).setOnCancelListener(listener); }
@Implementation public void setOnCancelListener(DialogInterface.OnCancelListener listener) { this.onCancelListener = listener; directlyOn(realDialog, Dialog.class).setOnCancelListener(listener); }
@Implementation protected void setOnCancelListener(DialogInterface.OnCancelListener listener) { this.onCancelListener = listener; directlyOn(realDialog, Dialog.class).setOnCancelListener(listener); }
/** * 初始化 * * @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(); } }); } }
@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(); } }); }
/** * 初始化 * * @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(); } }); } }
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; }
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(); } }