Java Code Examples for android.content.DialogInterface#OnCancelListener

The following examples show how to use android.content.DialogInterface#OnCancelListener . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WaitingDialog.java    From SendBird-Android with MIT License 6 votes vote down vote up
public static void show(final Context context, final boolean cancelable, final int layoutResId, final DialogInterface.OnCancelListener listener) {
    dismiss();

    mainHandler.post(() -> {
        Log.d(TAG, ">> WaitingDialog::show()");
        waitingDialog = getWaitingDialog(context);
        // here we set layout of progress dialog
        if (layoutResId <= 0) {
            waitingDialog.setContentView(R.layout.view_waiting_dialog);
        } else {
            waitingDialog.setContentView(layoutResId);
        }
        waitingDialog.setCancelable(cancelable);
        if (listener != null) {
            waitingDialog.setOnCancelListener(listener);
        }
        waitingDialog.show();
    });
}
 
Example 2
Source File: WaitingDialog.java    From SendBird-Android with MIT License 6 votes vote down vote up
public static void show(final Context context, final boolean cancelable, final int layoutResId, final DialogInterface.OnCancelListener listener) {
    dismiss();

    mainHandler.post(() -> {
        Log.d(TAG, ">> WaitingDialog::show()");
        waitingDialog = getWaitingDialog(context);
        // here we set layout of progress dialog
        if (layoutResId <= 0) {
            waitingDialog.setContentView(R.layout.view_waiting_dialog);
        } else {
            waitingDialog.setContentView(layoutResId);
        }
        waitingDialog.setCancelable(cancelable);
        if (listener != null) {
            waitingDialog.setOnCancelListener(listener);
        }
        waitingDialog.show();
    });
}
 
Example 3
Source File: MaterialDatePicker.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Override
public final void onCancel(@NonNull DialogInterface dialogInterface) {
  for (DialogInterface.OnCancelListener listener : onCancelListeners) {
    listener.onCancel(dialogInterface);
  }
  super.onCancel(dialogInterface);
}
 
Example 4
Source File: WeixinUtil.java    From android-common-utils with Apache License 2.0 5 votes vote down vote up
private static ProgressDialog show(Context context, CharSequence title,
                                  CharSequence message, boolean indeterminate,
                                  boolean cancelable, DialogInterface.OnCancelListener cancelListener) {
    ProgressDialog dialog = new ProgressDialog(context,ProgressDialog.THEME_HOLO_LIGHT);
    dialog.setTitle(title);
    dialog.setMessage(message);
    dialog.setIndeterminate(indeterminate);
    dialog.setCancelable(cancelable);
    dialog.setOnCancelListener(cancelListener);
    dialog.show();
    return dialog;
}
 
Example 5
Source File: BaseActivity.java    From JD-Test with Apache License 2.0 5 votes vote down vote up
protected void showProgressDialog(String msg , DialogInterface.OnCancelListener listener){
    if(loadingDialog == null){
        loadingDialog = DialogUtil.createLoadingDialog(this, msg, listener);
    }else if(!loadingDialog.isShowing()){
        loadingDialog.show();
    }

}
 
Example 6
Source File: MobileNetworkWarningDialog.java    From SkyTube with GNU General Public License v3.0 5 votes vote down vote up
@Override
public MobileNetworkWarningDialog onNegativeOrCancel(@NonNull DialogInterface.OnCancelListener callback) {
	this.onNegativeCallback = (dialog, action) -> {
	    if (dialog.isPromptCheckBoxChecked()) {
               SkyTubeApp.getSettings().setWarningMobilePolicy(Policy.BLOCK);
           }
           // no need to call the 'callback', as the cancelListener will be called.
       };
	this.cancelListener = callback;
	return this;
}
 
Example 7
Source File: AlertDialogFragment.java    From Android-Next with Apache License 2.0 4 votes vote down vote up
public void setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
    mParams.mOnCancelListener = onCancelListener;
}
 
Example 8
Source File: TimePickerDialog.java    From date_picker_converter with Apache License 2.0 4 votes vote down vote up
public void setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
    mOnCancelListener = onCancelListener;
}
 
Example 9
Source File: LoadingScreenDialog.java    From MusicPlayer with GNU General Public License v3.0 4 votes vote down vote up
public void setOnCancelListener(DialogInterface.OnCancelListener listener) {
    mOnCancelListener = listener;
}
 
Example 10
Source File: ProgressFragmentDialog.java    From Bluefruit_LE_Connect_Android_V2 with MIT License 4 votes vote down vote up
public void setOnCancelListener(DialogInterface.OnCancelListener listener) {
    mCancelListener = listener;
}
 
Example 11
Source File: PersianDatePickerDialog.java    From PersianDateRangePicker with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unused")
public void setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
  mOnCancelListener = onCancelListener;
}
 
Example 12
Source File: TimePickerDialog.java    From AssistantBySDK with Apache License 2.0 4 votes vote down vote up
public void setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
    mOnCancelListener = onCancelListener;
}
 
Example 13
Source File: DatePickerDialog.java    From AssistantBySDK with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unused")
public void setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
    mOnCancelListener = onCancelListener;
}
 
Example 14
Source File: BaseActivity.java    From JD-Test with Apache License 2.0 4 votes vote down vote up
protected void showProgressDialog(DialogInterface.OnCancelListener listener){
    this.showProgressDialog(null ,listener);
}
 
Example 15
Source File: TimePickerDialog.java    From AlarmOn with Apache License 2.0 4 votes vote down vote up
public void setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
    mOnCancelListener = onCancelListener;
}
 
Example 16
Source File: DatePickerDialog.java    From MaterialDateTimePicker with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unused")
public void setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
    mOnCancelListener = onCancelListener;
}
 
Example 17
Source File: TimePickerDialog.java    From Blackbulb with GNU General Public License v3.0 4 votes vote down vote up
public void setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
    mOnCancelListener = onCancelListener;
}
 
Example 18
Source File: GooglePlayServicesUtil.java    From android_external_GmsLib with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a dialog to address the provided errorCode. The returned dialog displays a localized
 * message about the error and upon user confirmation (by tapping on dialog) will direct them
 * to the Play Store if Google Play services is out of date or missing, or to system settings
 * if Google Play services is disabled on the device.
 *
 * @param errorCode      error code returned by {@link #isGooglePlayServicesAvailable(Context)} call.
 *                       If errorCode is {@link ConnectionResult#SUCCESS} then null is returned.
 * @param activity       parent activity for creating the dialog, also used for identifying
 *                       language to display dialog in.
 * @param requestCode    The requestCode given when calling startActivityForResult.
 * @param cancelListener The {@link DialogInterface.OnCancelListener} to invoke if the dialog
 *                       is canceled.
 */
@Deprecated
public static Dialog getErrorDialog(int errorCode, Activity activity, int requestCode, DialogInterface.OnCancelListener cancelListener) {
    return GoogleApiAvailability.getInstance().getErrorDialog(activity, errorCode, requestCode, cancelListener);
}
 
Example 19
Source File: GooglePlayServicesUtil.java    From android_external_GmsLib with Apache License 2.0 2 votes vote down vote up
/**
 * @param errorCode      error code returned by {@link #isGooglePlayServicesAvailable(Context)} call.
 *                       If errorCode is {@link ConnectionResult#SUCCESS} then null is returned.
 * @param activity       parent activity for creating the dialog, also used for identifying
 *                       language to display dialog in.
 * @param requestCode    The requestCode given when calling startActivityForResult.
 * @param cancelListener The {@link DialogInterface.OnCancelListener} to invoke if the dialog
 *                       is canceled.
 * @return true if the dialog is shown, false otherwise.
 * @throws RuntimeException if API level is below 11 and activity is not a {@link android.support.v4.app.FragmentActivity}.
 */
@Deprecated
public static boolean showErrorDialogFragment(int errorCode, Activity activity, int requestCode, DialogInterface.OnCancelListener cancelListener) {
    return showErrorDialogFragment(errorCode, activity, null, requestCode, cancelListener);
}
 
Example 20
Source File: MaterialDatePicker.java    From material-components-android with Apache License 2.0 2 votes vote down vote up
/**
 * The supplied listener is called when the user cancels the picker via back button or a touch
 * outside the view. It is not called when the user clicks the cancel button. To add a listener
 * for use when the user clicks the cancel button, use {@link
 * MaterialDatePicker#addOnNegativeButtonClickListener}.
 */
public boolean addOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
  return onCancelListeners.add(onCancelListener);
}