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