use of android.content.DialogInterface.OnClickListener in project android_packages_apps_crDroidSettings by crdroidandroid.
the class IconPickerActivity method getIconPackDialog.
private Dialog getIconPackDialog(Context context) {
final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View view = inflater.inflate(R.layout.dialog_iconpack, null);
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
final IconPackageAdapter adapter = new IconPackageAdapter(this);
final ListView listView = (ListView) view.findViewById(R.id.iconpack_list);
final Dialog dialog;
adapter.load();
dialog = builder.setTitle(getString(R.string.icon_pack_picker_dialog_title)).setView(view).setOnCancelListener(this).setNegativeButton(android.R.string.cancel, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
onCancel(dialog);
}
}).create();
listView.setAdapter(adapter);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ResolveInfo info = adapter.getItem(position);
String packageName = info.activityInfo.packageName;
Intent intent = new Intent();
intent.setClassName("com.android.settings", "com.crdroid.settings.fragments.navbar.IconPackGridActivity");
intent.putExtra("icon_package_name", packageName);
dialog.dismiss();
startActivityForResult(intent, ICON_PACK_ICON_RESULT);
}
});
return dialog;
}
use of android.content.DialogInterface.OnClickListener in project YhLibraryForAndroid by android-coco.
the class YHViewInject method getExitDialog.
/**
* 返回一个退出确认对话框
*/
public void getExitDialog(final Context context, String title, String ok, String cancel, OnClickListener l) {
if (StringUtils.isEmpty(ok)) {
ok = "确定";
}
if (StringUtils.isEmpty(cancel)) {
cancel = "取消";
}
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(title);
builder.setCancelable(false);
builder.setNegativeButton(cancel, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.setPositiveButton(ok, l);
builder.create();
builder.show();
}
use of android.content.DialogInterface.OnClickListener in project android_packages_apps_Dialer by LineageOS.
the class EnableWifiCallingPrompt method createDialog.
@Override
public Pair<Dialog, CharSequence> createDialog(@NonNull final Context context, DialerCall call) {
Assert.isNotNull(context);
DisconnectCause cause = call.getDisconnectCause();
CharSequence message = cause.getDescription();
Dialog dialog = new AlertDialog.Builder(context).setMessage(message).setPositiveButton(R.string.incall_enable_wifi_calling_button, (OnClickListener) (dialog1, which) -> openWifiCallingSettings(context)).setNegativeButton(android.R.string.cancel, null).create();
return new Pair<>(dialog, message);
}
use of android.content.DialogInterface.OnClickListener in project android_packages_apps_Dialer by LineageOS.
the class ClearFrequentsDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Context context = getActivity().getApplicationContext();
final ContentResolver resolver = getActivity().getContentResolver();
final OnClickListener okListener = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (!PermissionsUtil.hasContactsReadPermissions(context)) {
return;
}
final ProgressDialog progressDialog = ProgressDialog.show(getContext(), getString(R.string.clearFrequentsProgress_title), null, true, true);
final AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
resolver.delete(ContactsContract.DataUsageFeedback.DELETE_USAGE_URI, null, null);
return null;
}
@Override
protected void onPostExecute(Void result) {
progressDialog.dismiss();
}
};
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
};
return new AlertDialog.Builder(getActivity()).setTitle(R.string.clearFrequentsConfirmation_title).setMessage(R.string.clearFrequentsConfirmation).setNegativeButton(android.R.string.cancel, null).setPositiveButton(android.R.string.ok, okListener).setCancelable(true).create();
}
use of android.content.DialogInterface.OnClickListener in project android_packages_apps_Settings by omnirom.
the class ZenModeRuleSettingsBase method showDeleteRuleDialog.
private void showDeleteRuleDialog() {
final AlertDialog dialog = new AlertDialog.Builder(mContext).setMessage(getString(R.string.zen_mode_delete_rule_confirmation, mRule.getName())).setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.zen_mode_delete_rule_button, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_ZEN_DELETE_RULE_OK);
mDeleting = true;
removeZenRule(mId);
}
}).show();
final View messageView = dialog.findViewById(android.R.id.message);
if (messageView != null) {
messageView.setTextDirection(View.TEXT_DIRECTION_LOCALE);
}
}
Aggregations