List of usage examples for android.app AlertDialog.Builder setIcon
public void setIcon(Drawable icon)
From source file:com.koushikdutta.superuser.MainActivity.java
protected void doWhatsNew() { if (WHATS_NEW.equals(Settings.getString(this, "whats_new"))) return;/* w w w . j av a2 s.c o m*/ saveWhatsNew(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.whats_new); builder.setIcon(R.drawable.ic_launcher); builder.setMessage(WHATS_NEW); builder.setPositiveButton(R.string.rate, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent i = new Intent(); i.setData(Uri.parse("market://details?id=com.koushikdutta.superuser")); startActivity(i); } }); builder.setNegativeButton(android.R.string.cancel, null); builder.create().show(); }
From source file:piuk.blockchain.android.ui.WalletActivity.java
private void checkLowStorageAlert() { final Intent stickyIntent = registerReceiver(null, new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW)); if (stickyIntent != null) { final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setTitle(R.string.wallet_low_storage_dialog_title); builder.setMessage(R.string.wallet_low_storage_dialog_msg); builder.setPositiveButton(R.string.wallet_low_storage_dialog_button_apps, new DialogInterface.OnClickListener() { public void onClick(final DialogInterface dialog, final int id) { startActivity(/* www . j av a 2 s . c o m*/ new Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS)); finish(); } }); builder.setNegativeButton(R.string.button_dismiss, null); builder.show(); } }
From source file:com.securecomcode.text.ConversationListFragment.java
private void handleDeleteAllSelected() { AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); alert.setIcon(Dialogs.resolveIcon(getActivity(), R.attr.dialog_alert_icon)); alert.setTitle(R.string.ConversationListFragment_delete_threads_question); alert.setMessage(// w w w. ja va 2 s . c o m R.string.ConversationListFragment_are_you_sure_you_wish_to_delete_all_selected_conversation_threads); alert.setCancelable(true); alert.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final Set<Long> selectedConversations = ((ConversationListAdapter) getListAdapter()) .getBatchSelections(); if (!selectedConversations.isEmpty()) { new AsyncTask<Void, Void, Void>() { private ProgressDialog dialog; @Override protected void onPreExecute() { dialog = ProgressDialog.show(getActivity(), getSherlockActivity().getString(R.string.ConversationListFragment_deleting), getSherlockActivity() .getString(R.string.ConversationListFragment_deleting_selected_threads), true, false); } @Override protected Void doInBackground(Void... params) { DatabaseFactory.getThreadDatabase(getActivity()) .deleteConversations(selectedConversations); MessageNotifier.updateNotification(getActivity(), masterSecret); return null; } @Override protected void onPostExecute(Void result) { dialog.dismiss(); if (actionMode != null) { actionMode.finish(); actionMode = null; } } }.execute(); } } }); alert.setNegativeButton(android.R.string.cancel, null); alert.show(); }
From source file:de.grobox.blitzmail.SendActivity.java
private void showError(String text) { // close notification first mNotifyManager.cancel(0);/*ww w. j ava 2 s . com*/ AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.app_name) + " - " + getString(R.string.error)); builder.setMessage(text); builder.setIcon(android.R.drawable.ic_dialog_alert); // Add the buttons builder.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User clicked Cancel button, close this Activity finish(); } }); // Create and show the AlertDialog AlertDialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(false); dialog.show(); }
From source file:monakhv.android.samlib.SamlibPreferencesActivity.java
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { updateSummary(key);//w w w. j av a 2s . co m if (key.equals(getString(R.string.pref_key_theme))) { AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setTitle(R.string.Attention); String msg = getString(R.string.change_theme_alert); adb.setMessage(msg); adb.setIcon(android.R.drawable.ic_dialog_alert); adb.setPositiveButton(R.string.Yes, changeThemeListener); adb.setNegativeButton(R.string.No, changeThemeListener); adb.create(); adb.show(); } }
From source file:de.grobox.blitzmail.MainActivity.java
private void addSendNowPref(final Context c) { JSONObject mails = MailStorage.getMails(this); if (mails != null && mails.length() > 0) { PreferenceCategory targetCategory = (PreferenceCategory) findPreference("pref_sending"); Preference pref = new Preference(this); pref.setKey("pref_send_now"); pref.setTitle(R.string.pref_send_now); pref.setSummary(// ww w.j a v a 2 s.c o m String.format(getResources().getString(R.string.pref_send_now_summary), mails.length())); pref.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { if (BuildConfig.PRO) sendNow(); else { AlertDialog.Builder builder = new AlertDialog.Builder(c); builder.setTitle(c.getString(R.string.app_name)); builder.setMessage(c.getString(R.string.error_lite_version)); builder.setIcon(android.R.drawable.ic_dialog_info); // Add the buttons builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Uri uri = Uri.parse( "https://play.google.com/store/apps/details?id=de.grobox.blitzmail.pro"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); if (intent.resolveActivity(c.getPackageManager()) != null) { c.startActivity(intent); } dialog.dismiss(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); // Create and show the AlertDialog AlertDialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(false); dialog.show(); } return true; } }); targetCategory.addPreference(pref); } }
From source file:de.grobox.blitzmail.NotificationHandlerActivity.java
@Override protected void onNewIntent(Intent intent) { Bundle extras = intent.getExtras();/* ww w . ja va2s.c o m*/ // show dialog for server errors if (extras != null && extras.getString("ContentTitle").equals(getString(R.string.error))) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.app_name) + " - " + getString(R.string.error)); builder.setMessage(extras.getString("ContentText")); builder.setIcon(android.R.drawable.ic_dialog_alert); // Add the buttons builder.setNegativeButton(getResources().getString(R.string.dismiss), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { deleteMail(); // User clicked Cancel button, close this Activity finish(); } }); builder.setNeutralButton(getResources().getString(R.string.send_later), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User clicked Cancel button if (BuildConfig.PRO) { // close this Activity finish(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(getString(R.string.app_name)); builder.setMessage(getString(R.string.error_lite_version)); builder.setIcon(android.R.drawable.ic_dialog_info); // Add the buttons builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface lite_dialog, int id) { Uri uri = Uri.parse( "https://play.google.com/store/apps/details?id=de.grobox.blitzmail.pro"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } lite_dialog.dismiss(); finish(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface lite_dialog, int id) { lite_dialog.dismiss(); finish(); } }); // Create and show the AlertDialog AlertDialog lite_dialog = builder.create(); lite_dialog.setCanceledOnTouchOutside(false); lite_dialog.show(); } } }); builder.setPositiveButton(getResources().getString(R.string.try_again), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Prepare start of new activity Intent intent = new Intent(context, SendActivity.class); intent.setAction("BlitzMailReSend"); intent.putExtra("mail", mMail.toString()); finish(); startActivity(intent); } }); // Create and show the AlertDialog AlertDialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(false); dialog.show(); } else { // close activity finish(); } }
From source file:org.sufficientlysecure.keychain.ui.dialog.DeleteKeyDialogFragment.java
/** * Creates dialog/*w ww . j a va2s.co m*/ */ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final FragmentActivity activity = getActivity(); mMessenger = getArguments().getParcelable(ARG_MESSENGER); final long deleteKeyRingRowId = getArguments().getLong(ARG_DELETE_KEY_RING_ROW_ID); final int keyType = getArguments().getInt(ARG_KEY_TYPE); // TODO: better way to do this? String userId = activity.getString(R.string.unknownUserId); if (keyType == Id.type.public_key) { PGPPublicKeyRing keyRing = ProviderHelper.getPGPPublicKeyRingByRowId(activity, deleteKeyRingRowId); userId = PgpHelper.getMainUserIdSafe(activity, PgpHelper.getMasterKey(keyRing)); } else { PGPSecretKeyRing keyRing = ProviderHelper.getPGPSecretKeyRingByRowId(activity, deleteKeyRingRowId); userId = PgpHelper.getMainUserIdSafe(activity, PgpHelper.getMasterKey(keyRing)); } AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.warning); builder.setMessage(getString(keyType == Id.type.public_key ? R.string.keyDeletionConfirmation : R.string.secretKeyDeletionConfirmation, userId)); builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setPositiveButton(R.string.btn_delete, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (keyType == Id.type.public_key) { ProviderHelper.deletePublicKeyRing(activity, deleteKeyRingRowId); } else { ProviderHelper.deleteSecretKeyRing(activity, deleteKeyRingRowId); } dismiss(); sendMessageToHandler(MESSAGE_OKAY); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dismiss(); } }); return builder.create(); }
From source file:dtu.ds.warnme.app.activity.MainActivity.java
@Override public void onCredentialsExpired() { updateUserInterface();//w w w . ja v a 2 s .c o m AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert).setTitle(R.string.credentials_expired) .setMessage(R.string.credentials_expired_desc) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Nothing to do here... } }); dialogBuilder.show(); }
From source file:at.jclehner.rxdroid.SplashScreenActivity.java
@SuppressWarnings("deprecation") @Override/* ww w. j ava 2 s .c om*/ protected Dialog onCreateDialog(int id, Bundle args) { if (id == R.id.db_error_dialog) { final AlertDialog.Builder ab = new AlertDialog.Builder(SplashScreenActivity.this); ab.setTitle(R.string._title_error); ab.setIcon(android.R.drawable.ic_dialog_alert); ab.setCancelable(false); ab.setNegativeButton(R.string._btn_exit, SplashScreenActivity.this); ab.setPositiveButton(R.string._btn_reset, SplashScreenActivity.this); ab.setMessage(""); return ab.create(); } return super.onCreateDialog(id, args); }