Search in sources :

Example 71 with OnClickListener

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;
}
Also used : AlertDialog(android.app.AlertDialog) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) DialogInterface(android.content.DialogInterface) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) ResolveInfo(android.content.pm.ResolveInfo) ListView(android.widget.ListView) Dialog(android.app.Dialog) AlertDialog(android.app.AlertDialog) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.content.DialogInterface.OnClickListener)

Example 72 with OnClickListener

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();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener)

Example 73 with OnClickListener

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);
}
Also used : AlertDialog(android.app.AlertDialog) Assert(com.android.dialer.common.Assert) Context(android.content.Context) LogUtil(com.android.dialer.common.LogUtil) DialerCall(com.android.incallui.call.DialerCall) OnClickListener(android.content.DialogInterface.OnClickListener) Pair(android.util.Pair) Dialog(android.app.Dialog) Intent(android.content.Intent) NonNull(android.support.annotation.NonNull) DisconnectCause(android.telecom.DisconnectCause) DisconnectCause(android.telecom.DisconnectCause) AlertDialog(android.app.AlertDialog) Dialog(android.app.Dialog) Pair(android.util.Pair)

Example 74 with OnClickListener

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();
}
Also used : Context(android.content.Context) DialogInterface(android.content.DialogInterface) AsyncTask(android.os.AsyncTask) OnClickListener(android.content.DialogInterface.OnClickListener) ProgressDialog(android.app.ProgressDialog) ContentResolver(android.content.ContentResolver)

Example 75 with OnClickListener

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);
    }
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener) View(android.view.View)

Aggregations

OnClickListener (android.content.DialogInterface.OnClickListener)264 DialogInterface (android.content.DialogInterface)259 AlertDialog (android.app.AlertDialog)161 View (android.view.View)75 TextView (android.widget.TextView)52 Intent (android.content.Intent)44 SuppressLint (android.annotation.SuppressLint)41 Context (android.content.Context)35 AlertDialog (android.support.v7.app.AlertDialog)32 LayoutInflater (android.view.LayoutInflater)30 EditText (android.widget.EditText)30 Activity (android.app.Activity)27 Bundle (android.os.Bundle)25 OnCancelListener (android.content.DialogInterface.OnCancelListener)21 ImageView (android.widget.ImageView)17 Builder (android.app.AlertDialog.Builder)16 Dialog (android.app.Dialog)16 ProgressDialog (android.app.ProgressDialog)15 Paint (android.graphics.Paint)15 AdapterView (android.widget.AdapterView)15