Java Code Examples for android.content.DialogInterface#OnKeyListener

The following examples show how to use android.content.DialogInterface#OnKeyListener . 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: DialogsUtils.java    From q-municate-android with Apache License 2.0 5 votes vote down vote up
public static void disableCancelableDialog(MaterialDialog materialDialog) {
    // Disable the back button
    DialogInterface.OnKeyListener keyListener = new DialogInterface.OnKeyListener() {
        @Override
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            return keyCode == KeyEvent.KEYCODE_BACK;
        }
    };
    materialDialog.setOnKeyListener(keyListener);

    materialDialog.setCanceledOnTouchOutside(false);
}
 
Example 2
Source File: BaseBuilder.java    From GetApk with MIT License 4 votes vote down vote up
public T keyListener(@NonNull DialogInterface.OnKeyListener listener) {
    this.keyListener = listener;
    return (T) this;
}
 
Example 3
Source File: AlertDialog.java    From CompatAlertDialog with Apache License 2.0 4 votes vote down vote up
@Override
public Builder setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) {
    builder.setOnKeyListener(onKeyListener);
    return this;
}
 
Example 4
Source File: AlertDialog.java    From CompatAlertDialog with Apache License 2.0 4 votes vote down vote up
public Builder setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) {
    builder.setOnKeyListener(onKeyListener);
    return this;
}
 
Example 5
Source File: AlertDialogWrapper.java    From talk-android with MIT License 4 votes vote down vote up
public Builder setOnKeyListener(@NonNull DialogInterface.OnKeyListener listener) {
    builder.keyListener(listener);
    return this;
}
 
Example 6
Source File: TalkDialog.java    From talk-android with MIT License 4 votes vote down vote up
public Builder keyListener(@NonNull DialogInterface.OnKeyListener listener) {
    this.keyListener = listener;
    return this;
}
 
Example 7
Source File: AlertDialogFragment.java    From QuickDevFramework with Apache License 2.0 4 votes vote down vote up
public AlertDialogFragment setOnKeyListener(DialogInterface.OnKeyListener keyListener) {
    this.keyListener = keyListener;
    return this;
}
 
Example 8
Source File: AlertDialogFragment.java    From Android-Next with Apache License 2.0 4 votes vote down vote up
public void setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) {
    mParams.mOnKeyListener = onKeyListener;
}
 
Example 9
Source File: AlertDialogFragment.java    From Android-Next with Apache License 2.0 4 votes vote down vote up
public Builder setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) {
    mParams.mOnKeyListener = onKeyListener;
    return this;
}
 
Example 10
Source File: AlertDialogFragment.java    From Android-Next with Apache License 2.0 4 votes vote down vote up
public void setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) {
    mParams.mOnKeyListener = onKeyListener;
}
 
Example 11
Source File: AlertDialogFragment.java    From Android-Next with Apache License 2.0 4 votes vote down vote up
public Builder setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) {
    mParams.mOnKeyListener = onKeyListener;
    return this;
}
 
Example 12
Source File: BaseDialog.java    From AndroidProject with Apache License 2.0 2 votes vote down vote up
/**
 * 设置一个按键监听器
 *
 * @param listener       按键监听器对象
 * @deprecated           请使用 {@link #setOnKeyListener(BaseDialog.OnKeyListener)}
 */
@Deprecated
@Override
public void setOnKeyListener(@Nullable DialogInterface.OnKeyListener listener) {
    super.setOnKeyListener(listener);
}
 
Example 13
Source File: AlertDialog.java    From CompatAlertDialog with Apache License 2.0 votes vote down vote up
Builder setOnKeyListener(DialogInterface.OnKeyListener onKeyListener);