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()));
}
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);
}
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();
}
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;
}
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();
}
Aggregations