Search in sources :

Example 41 with OnCancelListener

use of android.content.DialogInterface.OnCancelListener in project AndFrameWorks by scwang90.

the class BaseMoreFooter method onViewCreated.

@Override
public void onViewCreated() {
    super.onViewCreated();
    mLayout.setOnClickListener(new SafeListener((OnCancelListener) v -> triggerLoadMore()));
}
Also used : SafeListener(com.andframe.listener.SafeListener) OnCancelListener(android.content.DialogInterface.OnCancelListener)

Example 42 with OnCancelListener

use of android.content.DialogInterface.OnCancelListener in project android_packages_apps_Dialer by LineageOS.

the class CallLogAdapter method showDeleteSelectedItemsDialog.

private void showDeleteSelectedItemsDialog() {
    SparseArray<String> voicemailsToDeleteOnConfirmation = selectedItems.clone();
    new AlertDialog.Builder(mActivity, R.style.AlertDialogCustom).setCancelable(true).setTitle(mActivity.getResources().getQuantityString(R.plurals.delete_voicemails_confirmation_dialog_title, selectedItems.size())).setPositiveButton(R.string.voicemailMultiSelectDeleteConfirm, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int button) {
            LogUtil.i("CallLogAdapter.showDeleteSelectedItemsDialog", "onClick, these items to delete " + voicemailsToDeleteOnConfirmation);
            deleteSelectedItems(voicemailsToDeleteOnConfirmation);
            mActionMode.finish();
            dialog.cancel();
            Logger.get(mActivity).logImpression(DialerImpression.Type.MULTISELECT_DELETE_ENTRY_VIA_CONFIRMATION_DIALOG);
        }
    }).setOnCancelListener(new OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialogInterface) {
            Logger.get(mActivity).logImpression(DialerImpression.Type.MULTISELECT_CANCEL_CONFIRMATION_DIALOG_VIA_CANCEL_TOUCH);
            dialogInterface.cancel();
        }
    }).setNegativeButton(R.string.voicemailMultiSelectDeleteCancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int button) {
            Logger.get(mActivity).logImpression(DialerImpression.Type.MULTISELECT_CANCEL_CONFIRMATION_DIALOG_VIA_CANCEL_BUTTON);
            dialog.cancel();
        }
    }).show();
    Logger.get(mActivity).logImpression(DialerImpression.Type.MULTISELECT_DISPLAY_DELETE_CONFIRMATION_DIALOG);
}
Also used : DialogInterface(android.content.DialogInterface) CallIntentBuilder(com.android.dialer.callintent.CallIntentBuilder) OnCancelListener(android.content.DialogInterface.OnCancelListener)

Example 43 with OnCancelListener

use of android.content.DialogInterface.OnCancelListener in project android_packages_apps_Dialer by LineageOS.

the class InCallActivityCommon method showWifiFailedDialog.

public void showWifiFailedDialog(final DialerCall call) {
    if (call.showWifiHandoverAlertAsToast()) {
        LogUtil.i("InCallActivityCommon.showWifiFailedDialog", "as toast");
        Toast.makeText(inCallActivity, R.string.video_call_lte_to_wifi_failed_message, Toast.LENGTH_SHORT).show();
        return;
    }
    dismissPendingDialogs();
    AlertDialog.Builder builder = new AlertDialog.Builder(inCallActivity).setTitle(R.string.video_call_lte_to_wifi_failed_title);
    // This allows us to use the theme of the dialog instead of the activity
    View dialogCheckBoxView = View.inflate(builder.getContext(), R.layout.video_call_lte_to_wifi_failed, null);
    final CheckBox wifiHandoverFailureCheckbox = (CheckBox) dialogCheckBoxView.findViewById(R.id.video_call_lte_to_wifi_failed_checkbox);
    wifiHandoverFailureCheckbox.setChecked(false);
    dialog = builder.setView(dialogCheckBoxView).setMessage(R.string.video_call_lte_to_wifi_failed_message).setOnCancelListener(new OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            onDialogDismissed();
        }
    }).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int id) {
            call.setDoNotShowDialogForHandoffToWifiFailure(wifiHandoverFailureCheckbox.isChecked());
            dialog.cancel();
            onDialogDismissed();
        }
    }).create();
    LogUtil.i("InCallActivityCommon.showWifiFailedDialog", "as dialog");
    dialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) CheckBox(android.widget.CheckBox) View(android.view.View) OnCancelListener(android.content.DialogInterface.OnCancelListener)

Example 44 with OnCancelListener

use of android.content.DialogInterface.OnCancelListener in project android_packages_apps_Dialer by LineageOS.

the class CreateCustomSmsDialogFragment method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    super.onCreateDialog(savedInstanceState);
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    View view = View.inflate(builder.getContext(), R.layout.fragment_custom_sms_dialog, null);
    editText = (EditText) view.findViewById(R.id.custom_sms_input);
    if (savedInstanceState != null) {
        editText.setText(savedInstanceState.getCharSequence(ARG_ENTERED_TEXT));
    }
    builder.setCancelable(true).setView(view).setPositiveButton(R.string.call_incoming_custom_message_send, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            FragmentUtils.getParentUnsafe(CreateCustomSmsDialogFragment.this, CreateCustomSmsHolder.class).customSmsCreated(editText.getText().toString().trim());
            dismiss();
        }
    }).setNegativeButton(R.string.call_incoming_custom_message_cancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            dismiss();
        }
    }).setOnCancelListener(new OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialogInterface) {
            dismiss();
        }
    }).setTitle(R.string.call_incoming_respond_via_sms_custom_message);
    final AlertDialog customMessagePopup = builder.create();
    customMessagePopup.setOnShowListener(new OnShowListener() {

        @Override
        public void onShow(DialogInterface dialogInterface) {
            ((AlertDialog) dialogInterface).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
        }
    });
    editText.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            Button sendButton = customMessagePopup.getButton(DialogInterface.BUTTON_POSITIVE);
            sendButton.setEnabled(editable != null && editable.toString().trim().length() != 0);
        }
    });
    customMessagePopup.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    customMessagePopup.getWindow().addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    return customMessagePopup;
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) View(android.view.View) OnShowListener(android.content.DialogInterface.OnShowListener) Button(android.widget.Button) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) OnCancelListener(android.content.DialogInterface.OnCancelListener) NonNull(android.support.annotation.NonNull)

Example 45 with OnCancelListener

use of android.content.DialogInterface.OnCancelListener in project android_packages_apps_Dialer by MoKee.

the class WifiCallUtils method showWifiCallDialog.

public static void showWifiCallDialog(final Context context) {
    String promptMessage = context.getString(com.android.dialer.R.string.alert_call_no_cellular_coverage);
    AlertDialog.Builder diaBuilder = new AlertDialog.Builder(context);
    diaBuilder.setMessage(promptMessage);
    diaBuilder.setPositiveButton(com.android.internal.R.string.ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            Intent intent = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS);
            context.startActivity(intent);
        }
    });
    diaBuilder.setOnCancelListener(new OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
        }
    });
    diaBuilder.create().show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) OnCancelListener(android.content.DialogInterface.OnCancelListener)

Aggregations

OnCancelListener (android.content.DialogInterface.OnCancelListener)58 DialogInterface (android.content.DialogInterface)54 AlertDialog (android.app.AlertDialog)23 OnClickListener (android.content.DialogInterface.OnClickListener)18 View (android.view.View)13 Context (android.content.Context)12 ProgressDialog (android.app.ProgressDialog)11 TextView (android.widget.TextView)11 Intent (android.content.Intent)10 OnDismissListener (android.content.DialogInterface.OnDismissListener)7 Dialog (android.app.Dialog)6 SharedPreferences (android.content.SharedPreferences)6 TypedArray (android.content.res.TypedArray)6 ArrayList (java.util.ArrayList)6 Drawable (android.graphics.drawable.Drawable)5 LocaleList (android.os.LocaleList)5 LayoutInflater (android.view.LayoutInflater)5 InputMethodInfo (android.view.inputmethod.InputMethodInfo)5 InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)5 CompoundButton (android.widget.CompoundButton)5