Search in sources :

Example 91 with DialogInterface

use of android.content.DialogInterface in project android_frameworks_base by AOSPA.

the class MainActivity method showDialog.

private void showDialog(String message) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(message).setTitle("OSU");
    builder.setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialogInterface) {
            dialogInterface.cancel();
            finish();
        }
    });
    AlertDialog dialog = builder.create();
    dialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) TaskStackBuilder(android.app.TaskStackBuilder)

Example 92 with DialogInterface

use of android.content.DialogInterface in project android_frameworks_base by AOSPA.

the class PowerNotificationWarnings method showStartSaverConfirmation.

private void showStartSaverConfirmation() {
    if (mSaverConfirmation != null)
        return;
    final SystemUIDialog d = new SystemUIDialog(mContext);
    d.setTitle(R.string.battery_saver_confirmation_title);
    d.setMessage(com.android.internal.R.string.battery_saver_description);
    d.setNegativeButton(android.R.string.cancel, null);
    d.setPositiveButton(R.string.battery_saver_confirmation_ok, mStartSaverMode);
    d.setShowForAllUsers(true);
    d.setOnDismissListener(new OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            mSaverConfirmation = null;
        }
    });
    d.show();
    mSaverConfirmation = d;
}
Also used : SystemUIDialog(com.android.systemui.statusbar.phone.SystemUIDialog) DialogInterface(android.content.DialogInterface) OnDismissListener(android.content.DialogInterface.OnDismissListener)

Example 93 with DialogInterface

use of android.content.DialogInterface in project weex-example by KalicyZhou.

the class WXPageActivity method showDevOptionsDialog.

public void showDevOptionsDialog() {
    if (mDevOptionsDialog != null || !mIsDevSupportEnabled || ActivityManager.isUserAMonkey()) {
        return;
    }
    LinkedHashMap<String, DevOptionHandler> options = new LinkedHashMap<>();
    /* register standard options */
    options.put(getString(R.string.scan_qr_code), new DevOptionHandler() {

        @Override
        public void onOptionSelected() {
            IntentIntegrator integrator = new IntentIntegrator(WXPageActivity.this);
            integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
            integrator.setPrompt("Scan a barcode");
            //integrator.setCameraId(0);  // Use a specific camera of the device
            integrator.setBeepEnabled(true);
            integrator.setOrientationLocked(false);
            integrator.setBarcodeImageEnabled(true);
            integrator.setPrompt(getString(R.string.capture_qrcode_prompt));
            integrator.initiateScan();
        }
    });
    options.put(getString(R.string.page_refresh), new DevOptionHandler() {

        @Override
        public void onOptionSelected() {
            createWeexInstance();
            renderPage();
        }
    });
    if (mCustomDevOptions.size() > 0) {
        options.putAll(mCustomDevOptions);
    }
    final DevOptionHandler[] optionHandlers = options.values().toArray(new DevOptionHandler[0]);
    mDevOptionsDialog = new AlertDialog.Builder(WXPageActivity.this).setItems(options.keySet().toArray(new String[0]), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            optionHandlers[which].onOptionSelected();
            mDevOptionsDialog = null;
        }
    }).setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            mDevOptionsDialog = null;
        }
    }).create();
    mDevOptionsDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
    mDevOptionsDialog.show();
}
Also used : DevOptionHandler(com.alibaba.weex.commons.util.DevOptionHandler) DialogInterface(android.content.DialogInterface) IntentIntegrator(com.google.zxing.integration.android.IntentIntegrator) LinkedHashMap(java.util.LinkedHashMap)

Example 94 with DialogInterface

use of android.content.DialogInterface in project android_frameworks_base by AOSPA.

the class NekoLand method showNameDialog.

private void showNameDialog(final Cat cat) {
    final Context context = new ContextThemeWrapper(this, android.R.style.Theme_Material_Light_Dialog_NoActionBar);
    // TODO: Move to XML, add correct margins.
    View view = LayoutInflater.from(context).inflate(R.layout.edit_text, null);
    final EditText text = (EditText) view.findViewById(android.R.id.edit);
    text.setText(cat.getName());
    text.setSelection(cat.getName().length());
    final int size = context.getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
    Drawable catIcon = cat.createIcon(this, size, size).loadDrawable(this);
    new AlertDialog.Builder(context).setTitle(" ").setIcon(catIcon).setView(view).setPositiveButton(android.R.string.ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            cat.logRename(context);
            cat.setName(text.getText().toString().trim());
            mPrefs.addCat(cat);
        }
    }).show();
}
Also used : Context(android.content.Context) EditText(android.widget.EditText) AlertDialog(android.app.AlertDialog) ContextThemeWrapper(android.view.ContextThemeWrapper) DialogInterface(android.content.DialogInterface) Drawable(android.graphics.drawable.Drawable) OnClickListener(android.content.DialogInterface.OnClickListener) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 95 with DialogInterface

use of android.content.DialogInterface in project Small by wequick.

the class UIUtils method alert.

public static void alert(Context context, String tips) {
    AlertDialog dlg = new AlertDialog.Builder(context).setMessage("lib.utils: " + tips).setPositiveButton("OK", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    }).create();
    dlg.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface)

Aggregations

DialogInterface (android.content.DialogInterface)2727 AlertDialog (android.app.AlertDialog)1227 View (android.view.View)877 Intent (android.content.Intent)708 TextView (android.widget.TextView)653 AlertDialog (android.support.v7.app.AlertDialog)644 EditText (android.widget.EditText)426 ImageView (android.widget.ImageView)308 OnClickListener (android.content.DialogInterface.OnClickListener)285 LayoutInflater (android.view.LayoutInflater)242 SuppressLint (android.annotation.SuppressLint)225 AdapterView (android.widget.AdapterView)220 ListView (android.widget.ListView)220 ArrayList (java.util.ArrayList)213 Dialog (android.app.Dialog)179 Context (android.content.Context)179 File (java.io.File)160 OnClickListener (android.view.View.OnClickListener)157 Bundle (android.os.Bundle)146 Activity (android.app.Activity)143