Simplify some AlertDialog.Builder calls.

This commit is contained in:
B. Petersen
2017-10-09 17:40:19 +02:00
parent 175a4ddf95
commit 28c86b4784
13 changed files with 71 additions and 90 deletions
@@ -466,7 +466,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(context.getString(R.string.AreYouSureDeleteThisChat));
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if( MrMailbox.deleteChat((int)dialog_id)!=0 ) {
@@ -478,7 +478,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
} else if (id == ID_MUTE) {
toggleMute();
@@ -497,12 +497,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
String info_str = MrMailbox.getMsgInfo(getFirstSelectedId());
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(info_str);
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
;
}
});
builder.setPositiveButton(R.string.OK, null);
showDialog(builder.create());
actionBar.hideActionMode();
updateVisibleRowsFast();
@@ -1480,7 +1475,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
int chatId = MrMailbox.createChatByContactId(fromId);
@@ -1494,7 +1489,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskStartChatWith), name)));
showDialog(builder.create());
}
@@ -2355,7 +2350,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private void createDeleteMessagesAlert() {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.AreYouSureDeleteMessages, selectedMessagesIds.size(), selectedMessagesIds.size()));
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
@@ -2376,7 +2371,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
}
});
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
}
@@ -2746,13 +2741,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if( isMailto )
{
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setPositiveButton(mContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
createChat(urlFinal);
createChat(urlFinal);
}
});
builder.setNegativeButton(mContext.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
builder.setMessage(AndroidUtilities.replaceTags(String.format(mContext.getString(R.string.AskStartChatWith), urlTitle)));
showDialog(builder.create());
}
@@ -1408,13 +1408,13 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
builder.setMessage(ApplicationLoader.applicationContext.getString(R.string.ClearRecentEmoji));
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.ClearButton).toUpperCase(), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.ClearButton, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
emojiView.clearRecentEmoji();
}
});
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
parentFragment.showDialog(builder.create());
}
});
@@ -428,7 +428,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
int belonging_chat_id = MrMailbox.createChatByContactId(user.id);
@@ -439,7 +439,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
}
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskStartChatWith), name)));
showDialog(builder.create());
}
@@ -588,14 +588,14 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (!pm.isIgnoringBatteryOptimizations(ApplicationLoader.applicationContext.getPackageName())) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(AndroidUtilities.replaceTags(ApplicationLoader.applicationContext.getString(R.string.PermissionBattery)));
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
askForIgnoreBatteryOptimization();
}
});
builder.setCancelable(false);
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), new DialogInterface.OnClickListener() {
builder.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
askForOtherPermissons();
@@ -802,7 +802,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
didSelectResult(dialog_id, false, false);
}
});
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
} else {
if (delegate != null) {
@@ -577,7 +577,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
{
final String createChatWithFinal = createChatWith;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
int chatId = MrMailbox.createChatByContactId(MrMailbox.createContact("", createChatWithFinal));
@@ -591,7 +591,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
}
});
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
builder.setMessage(AndroidUtilities.replaceTags(String.format(ApplicationLoader.applicationContext.getString(R.string.AskStartChatWith), createChatWith)));
builder.show();
}
@@ -786,7 +786,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(msg.trim());
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.PermissionOpenSettings, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
@@ -800,7 +800,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
}
}
});
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
builder.show();
return;
}
@@ -382,7 +382,7 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
});
numberPicker.setWrapSelectorWheel(false);
builder.setView(numberPicker);
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
which = numberPicker.getValue();
@@ -1018,7 +1018,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showAlertDialog(builder);
*/
}
@@ -1471,7 +1471,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
mentionsAdapter.clearRecentHashtags();
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showAlertDialog(builder);
return true;
}
@@ -2004,13 +2004,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
builder.setMessage(ApplicationLoader.applicationContext.getString(R.string.DiscardChanges));
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
switchToEditMode(0);
}
});
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showAlertDialog(builder);
} else {
switchToEditMode(0);
@@ -252,14 +252,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
else {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(context.getString(R.string.AreYouSureBlockContact));
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
MrMailbox.blockContact(user_id, 1);
finishFragment(); /* got to the parent, this is important eg. when editing blocking in the BlockedUserActivitiy. Moreover, this saves us updating all the states in the profile */
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
}
}
@@ -267,7 +267,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
{
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(context.getString(R.string.AreYouSureDeleteContact));
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if( MrMailbox.deleteContact(user_id)==0 ) {
@@ -279,7 +279,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
}
else if (id == ID_ADD_SHORTCUT)
@@ -379,14 +379,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
{
String info_str = MrMailbox.getContactEncrInfo(user_id);
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(ApplicationLoader.applicationContext.getString(R.string.Encryption));
builder.setTitle(R.string.Encryption);
builder.setMessage(AndroidUtilities.replaceTags(info_str));
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
;
}
});
builder.setPositiveButton(R.string.OK, null);
showDialog(builder.create());
}
else if(position==startChatRow)
@@ -403,7 +398,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
String name = MrMailbox.getContact(user_id).getNameNAddr();
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
int belonging_chat_id = MrMailbox.createChatByContactId(user_id);
@@ -417,7 +412,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskStartChatWith), name)));
showDialog(builder.create());
}
@@ -435,14 +430,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
else {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
MrMailbox.addContactToChat(chat_id, added_user_id);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MrMailbox.UPDATE_MASK_CHAT_MEMBERS);
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
String name = MrMailbox.getContact(added_user_id).getDisplayName();
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskAddMemberToGroup), name)));
showDialog(builder.create());
@@ -482,14 +477,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
public void onClick(DialogInterface dialogInterface, int i) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
MrMailbox.removeContactFromChat(chat_id, curr_user_id);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MrMailbox.UPDATE_MASK_CHAT_MEMBERS);
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
String name = MrMailbox.getContact(curr_user_id).getDisplayName();
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskRemoveMemberFromGroup), name)));
showDialog(builder.create());
@@ -532,7 +527,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
items = new CharSequence[]{context.getString(R.string.FromCamera), context.getString(R.string.FromGalley), context.getString(R.string.Delete)};
}
builder.setTitle(context.getString(R.string.EditImage));
builder.setTitle(R.string.EditImage);
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
@@ -543,7 +538,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} else if (i == 2) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(context.getString(R.string.AskDeleteGroupImage));
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if( MrMailbox.setChatImage(chat_id, null)!=0 ) {
@@ -551,7 +546,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
@@ -149,7 +149,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) {
if (i == settingsVibrateRow) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(context.getString(R.string.Vibrate));
builder.setTitle(R.string.Vibrate);
builder.setItems(new CharSequence[]{
context.getString(R.string.Disabled),
context.getString(R.string.Default),
@@ -177,7 +177,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
}
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
} else if (i == settingsNotificationsRow) {
if (getParentActivity() == null) {
@@ -212,7 +212,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
NotificationCenter.getInstance().postNotificationName(NotificationCenter.notificationsSettingsUpdated);
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
} else if (i == settingsSoundRow) {
try {
@@ -261,9 +261,9 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(context.getString(R.string.LedColor));
builder.setTitle(R.string.LedColor);
builder.setView(linearLayout);
builder.setPositiveButton(context.getString(R.string.Set), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.Set, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int which) {
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
@@ -273,7 +273,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
listView.invalidateViews();
}
});
builder.setNeutralButton(context.getString(R.string.Disabled), new DialogInterface.OnClickListener() {
builder.setNeutralButton(R.string.Disabled, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
@@ -283,7 +283,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
listView.invalidateViews();
}
});
builder.setNegativeButton(context.getString(R.string.Default), new DialogInterface.OnClickListener() {
builder.setNegativeButton(R.string.Default, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
@@ -296,7 +296,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
showDialog(builder.create());
} else if (i == settingsPriorityRow) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(context.getString(R.string.NotificationsPriority));
builder.setTitle(R.string.NotificationsPriority);
builder.setItems(new CharSequence[]{
context.getString(R.string.Default),
context.getString(R.string.NotificationsPriorityDefault),
@@ -317,7 +317,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
}
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
} else if (i == smartRow) {
if (getParentActivity() == null) {
@@ -412,9 +412,9 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
textView.setLayoutParams(layoutParams1);
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(context.getString(R.string.SmartNotifications));
builder.setTitle(R.string.SmartNotifications);
builder.setView(linearLayout);
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
@@ -425,7 +425,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
}
}
});
builder.setNegativeButton(context.getString(R.string.Disabled), new DialogInterface.OnClickListener() {
builder.setNegativeButton(R.string.Disabled, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
@@ -248,7 +248,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
else if( i==rowMailSecurity || i==rowSendSecurity )
{
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(ApplicationLoader.applicationContext.getString(R.string.SecurityTitle));
builder.setTitle(R.string.SecurityTitle);
builder.setItems(new CharSequence[]{
ApplicationLoader.applicationContext.getString(R.string.Automatic),
"SSL/TLS", /*1*/
@@ -276,7 +276,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
listView.invalidateViews();
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
}
@@ -400,12 +400,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
else if( ! MrMailbox.m_lastErrorString.isEmpty() ){
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(errorString);
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
;
}
});
builder.setPositiveButton(R.string.OK, null);
showDialog(builder.create());
}
}
@@ -148,11 +148,7 @@ public class SettingsNameActivity extends BaseFragment {
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(execute_result);
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
builder.setPositiveButton(R.string.OK, null);
showDialog(builder.create());
return;
}
@@ -228,8 +228,8 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(context.getString(R.string.AskResetNotifications));
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
builder.setNegativeButton(R.string.Cancel, null);
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
@@ -284,9 +284,9 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
colorPickerView.setColor(preferences.getInt(i == messageLedRow? "MessagesLed" : "GroupLed", NotificationsController.DEF_LED_COLOR));
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(context.getString(R.string.LedColor));
builder.setTitle(R.string.LedColor);
builder.setView(linearLayout);
builder.setPositiveButton(context.getString(R.string.Set), new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.Set, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int which) {
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
@@ -300,7 +300,7 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
listView.invalidateViews();
}
});
builder.setNeutralButton(context.getString(R.string.Disabled), new DialogInterface.OnClickListener() {
builder.setNeutralButton(R.string.Disabled, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
@@ -314,7 +314,7 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
listView.invalidateViews();
}
});
builder.setNegativeButton(context.getString(R.string.Default), new DialogInterface.OnClickListener() {
builder.setNegativeButton(R.string.Default, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
@@ -331,7 +331,7 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
showDialog(builder.create());
} else if (i == messageVibrateRow || i == groupVibrateRow) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(context.getString(R.string.Vibrate));
builder.setTitle(R.string.Vibrate);
builder.setItems(new CharSequence[]{
context.getString(R.string.Disabled),
context.getString(R.string.Default),
@@ -364,11 +364,11 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
}
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
} else if (i == messagePriorityRow || i == groupPriorityRow || i == inappPriorityRow ) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(context.getString(R.string.NotificationsPriority));
builder.setTitle(R.string.NotificationsPriority);
builder.setItems(new CharSequence[]{
context.getString(R.string.NotificationsPriorityDefault),
context.getString(R.string.NotificationsPriorityHigh),
@@ -389,11 +389,11 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
}
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
} else if (i == repeatRow) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(context.getString(R.string.RepeatNotifications));
builder.setTitle(R.string.RepeatNotifications);
builder.setItems(new CharSequence[]{
context.getString(R.string.Disabled),
context.getResources().getQuantityString(R.plurals.Minutes, 5, 5),
@@ -426,7 +426,7 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
}
}
});
builder.setNegativeButton(context.getString(R.string.Cancel), null);
builder.setNegativeButton(R.string.Cancel, null);
showDialog(builder.create());
}
if (view instanceof TextCheckCell) {
@@ -111,7 +111,7 @@ public class WelcomeActivity extends Activity implements NotificationCenter.Noti
new AlertDialog.Builder(WelcomeActivity.this)
.setTitle(ApplicationLoader.applicationContext.getString(R.string.AppName) + " v" + getVersion())
.setMessage("© 2017 Delta Chat contributors" + "\n\n" + MrMailbox.getInfo() + "\n\n" + getAndroidInfo())
.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), null)
.setPositiveButton(R.string.OK, null)
.show();
}
});
@@ -277,7 +277,7 @@ public class WelcomeActivity extends Activity implements NotificationCenter.Noti
else {
new AlertDialog.Builder(this)
.setMessage(ApplicationLoader.applicationContext.getString(R.string.PermissionStorage))
.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
.setPositiveButton(R.string.PermissionOpenSettings, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {