From f44955380fb7a063a9b327dfa3ca7f2457e87dec Mon Sep 17 00:00:00 2001 From: DrKLO Date: Fri, 11 Jul 2014 01:15:39 +0400 Subject: [PATCH] Fix some issues https://github.com/DrKLO/Telegram/issues/468 https://github.com/DrKLO/Telegram/issues/464 https://github.com/DrKLO/Telegram/issues/394 https://github.com/DrKLO/Telegram/issues/334 --- TMessagesProj/build.gradle | 2 +- .../telegram/android/MessagesController.java | 31 ++++--- .../android/NotificationsController.java | 31 +++---- .../org/telegram/messenger/Utilities.java | 12 ++- .../java/org/telegram/ui/ChatActivity.java | 89 +++++++++++-------- .../org/telegram/ui/ChatProfileActivity.java | 6 +- .../org/telegram/ui/ContactsActivity.java | 27 ++++-- .../java/org/telegram/ui/LaunchActivity.java | 4 +- .../org/telegram/ui/MessagesActivity.java | 56 ++++++++++-- .../org/telegram/ui/SettingsActivity.java | 4 +- .../org/telegram/ui/SettingsBlockedUsers.java | 2 +- .../org/telegram/ui/UserProfileActivity.java | 6 +- .../src/main/res/values-ar/strings.xml | 13 ++- .../src/main/res/values-de/strings.xml | 13 ++- .../src/main/res/values-es/strings.xml | 13 ++- .../src/main/res/values-it/strings.xml | 13 ++- .../src/main/res/values-nl/strings.xml | 13 ++- .../src/main/res/values-pt-rBR/strings.xml | 13 ++- .../src/main/res/values-pt-rPT/strings.xml | 13 ++- TMessagesProj/src/main/res/values/strings.xml | 14 ++- 20 files changed, 272 insertions(+), 103 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 373a298ac..4686d3019 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -82,7 +82,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 19 - versionCode 270 + versionCode 272 versionName "1.6.0" } } diff --git a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java index e09cfbe28..40340d796 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java @@ -2075,15 +2075,24 @@ public class MessagesController implements NotificationCenter.NotificationCenter performSendMessageRequest(reqSend, newMsgObj, null); } } else if (type == 8) { - reqSend.media = new TLRPC.TL_inputMediaUploadedAudio(); - reqSend.media.duration = audio.duration; - reqSend.media.mime_type = audio.mime_type; - DelayedMessage delayedMessage = new DelayedMessage(); - delayedMessage.sendRequest = reqSend; - delayedMessage.type = 3; - delayedMessage.obj = newMsgObj; - delayedMessage.audioLocation = audio; - performSendDelayedMessage(delayedMessage); + if (audio.access_hash == 0) { + reqSend.media = new TLRPC.TL_inputMediaUploadedAudio(); + reqSend.media.duration = audio.duration; + reqSend.media.mime_type = audio.mime_type; + DelayedMessage delayedMessage = new DelayedMessage(); + delayedMessage.sendRequest = reqSend; + delayedMessage.type = 3; + delayedMessage.obj = newMsgObj; + delayedMessage.audioLocation = audio; + performSendDelayedMessage(delayedMessage); + } else { + TLRPC.TL_inputMediaAudio media = new TLRPC.TL_inputMediaAudio(); + media.id = new TLRPC.TL_inputAudio(); + media.id.id = audio.id; + media.id.access_hash = audio.access_hash; + reqSend.media = media; + performSendMessageRequest(reqSend, newMsgObj, null); + } } } else { TLRPC.TL_decryptedMessage reqSend = new TLRPC.TL_decryptedMessage(); @@ -2767,14 +2776,14 @@ public class MessagesController implements NotificationCenter.NotificationCenter }); } - public void addUserToChat(int chat_id, final TLRPC.User user, final TLRPC.ChatParticipants info) { + public void addUserToChat(int chat_id, final TLRPC.User user, final TLRPC.ChatParticipants info, int count_fwd) { if (user == null) { return; } TLRPC.TL_messages_addChatUser req = new TLRPC.TL_messages_addChatUser(); req.chat_id = chat_id; - req.fwd_limit = 50; + req.fwd_limit = count_fwd; req.user_id = getInputUser(user); ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() { diff --git a/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java b/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java index b65c3e2be..d7d4ce214 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java @@ -501,30 +501,27 @@ public class NotificationsController { continue; } - Integer currentCount = pushDialogs.get(dialog_id); - if (currentCount == null) { - currentCount = 0; - } - pushDialogs.put(dialog_id, ++currentCount); - pushMessagesDict.put(messageObject.messageOwner.id, messageObject); - Boolean value = settingsCache.get(dialog_id); + boolean isChat = (int)dialog_id < 0; + popup = preferences.getInt(isChat ? "popupGroup" : "popupAll", 0); if (value == null) { int notify_override = preferences.getInt("notify2_" + dialog_id, 0); - boolean isChat = (int)dialog_id < 0; - if (notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0) { - value = false; - } else { - popup = preferences.getInt(isChat ? "popupGroup" : "popupAll", 0); - value = popup != 0; - } + value = !(notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0); settingsCache.put(dialog_id, value); } if (value) { - popupMessages.add(0, messageObject); + if (popup != 0) { + popupMessages.add(0, messageObject); + } + pushMessagesDict.put(messageObject.messageOwner.id, messageObject); + pushMessages.add(0, messageObject); + + Integer currentCount = pushDialogs.get(dialog_id); + if (currentCount == null) { + currentCount = 0; + } + pushDialogs.put(dialog_id, ++currentCount); } - pushMessagesDict.put(messageObject.messageOwner.id, messageObject); - pushMessages.add(0, messageObject); } if (!popupMessages.isEmpty() && oldCount != popupMessages.size()) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java index 906654005..9085e859d 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java @@ -140,10 +140,14 @@ public class Utilities { public static Integer parseInt(String value) { Integer val = 0; - Matcher matcher = pattern.matcher(value); - if (matcher.find()) { - String num = matcher.group(0); - val = Integer.parseInt(num); + try { + Matcher matcher = pattern.matcher(value); + if (matcher.find()) { + String num = matcher.group(0); + val = Integer.parseInt(num); + } + } catch (Exception e) { + FileLog.e("tmessages", e); } return val; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index c004ec46e..0fe0aa50c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -85,7 +85,6 @@ import org.telegram.ui.Views.TimerButton; import java.io.File; import java.util.ArrayList; import java.util.Collections; -import java.util.Comparator; import java.util.HashMap; import java.util.concurrent.Semaphore; @@ -792,7 +791,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure)); + builder.setMessage(LocaleController.getString("AreYouSureDeleteThisChat", R.string.AreYouSureDeleteThisChat)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override @@ -2306,7 +2305,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure)); + builder.setMessage(LocaleController.getString("AreYouSureShareMyContactInfo", R.string.AreYouSureShareMyContactInfo)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override @@ -2829,9 +2828,58 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } + private void processForwardFromMe(MessageObject messageObject, long did) { + if (messageObject == null) { + return; + } + if (messageObject.messageOwner.media != null && !(messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaEmpty)) { + if (messageObject.messageOwner.media.photo instanceof TLRPC.TL_photo) { + MessagesController.getInstance().sendMessage((TLRPC.TL_photo)messageObject.messageOwner.media.photo, null, did); + } else if (messageObject.messageOwner.media.audio instanceof TLRPC.TL_audio) { + MessagesController.getInstance().sendMessage((TLRPC.TL_audio)messageObject.messageOwner.media.audio, did); + } else if (messageObject.messageOwner.media.video instanceof TLRPC.TL_video) { + MessagesController.getInstance().sendMessage((TLRPC.TL_video)messageObject.messageOwner.media.video, null, did); + } else if (messageObject.messageOwner.media.document instanceof TLRPC.TL_document) { + MessagesController.getInstance().sendMessage((TLRPC.TL_document)messageObject.messageOwner.media.document, null, did); + } else if (messageObject.messageOwner.media.geo instanceof TLRPC.TL_geoPoint) { + MessagesController.getInstance().sendMessage(messageObject.messageOwner.media.geo.lat, messageObject.messageOwner.media.geo._long, did); + } else { + MessagesController.getInstance().sendMessage(messageObject, did); + } + } else if (messageObject.messageOwner.message != null) { + MessagesController.getInstance().sendMessage(messageObject.messageOwner.message, did); + } else { + MessagesController.getInstance().sendMessage(messageObject, did); + } + } + @Override - public void didSelectDialog(MessagesActivity activity, long did) { + public void didSelectDialog(MessagesActivity activity, long did, boolean param) { if (dialog_id != 0 && (forwaringMessage != null || !selectedMessagesIds.isEmpty())) { + if (forwaringMessage != null) { + if (forwaringMessage.messageOwner.id > 0) { + if (!param) { + MessagesController.getInstance().sendMessage(forwaringMessage, did); + } else { + processForwardFromMe(forwaringMessage, did); + } + } + forwaringMessage = null; + } else { + ArrayList ids = new ArrayList(selectedMessagesIds.keySet()); + Collections.sort(ids); + for (Integer id : ids) { + if (id > 0) { + if (!param) { + MessagesController.getInstance().sendMessage(selectedMessagesIds.get(id), did); + } else { + processForwardFromMe(selectedMessagesIds.get(id), did); + } + } + } + selectedMessagesCanCopyIds.clear(); + selectedMessagesIds.clear(); + } if (did != dialog_id) { int lower_part = (int)did; if (lower_part != 0) { @@ -2847,44 +2895,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not presentFragment(new ChatActivity(args)); removeSelfFromStack(); - if (forwaringMessage != null) { - if (forwaringMessage.messageOwner.id > 0) { - MessagesController.getInstance().sendMessage(forwaringMessage, did); - } - forwaringMessage = null; - } else { - ArrayList ids = new ArrayList(selectedMessagesIds.keySet()); - Collections.sort(ids); - for (Integer id : ids) { - if (id > 0) { - MessagesController.getInstance().sendMessage(selectedMessagesIds.get(id), did); - } - } - selectedMessagesCanCopyIds.clear(); - selectedMessagesIds.clear(); - } } else { activity.finishFragment(); } } else { activity.finishFragment(); - if (forwaringMessage != null) { - MessagesController.getInstance().sendMessage(forwaringMessage, did); - forwaringMessage = null; - } else { - ArrayList ids = new ArrayList(selectedMessagesIds.keySet()); - Collections.sort(ids, new Comparator() { - @Override - public int compare(Integer lhs, Integer rhs) { - return lhs.compareTo(rhs); - } - }); - for (Integer id : ids) { - MessagesController.getInstance().sendMessage(selectedMessagesIds.get(id), did); - } - selectedMessagesCanCopyIds.clear(); - selectedMessagesIds.clear(); - } chatListView.setSelection(messages.size() + 1); scrollToTopOnResume = true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java index edd21c47c..115c41405 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java @@ -258,8 +258,8 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen } @Override - public void didSelectContact(TLRPC.User user) { - MessagesController.getInstance().addUserToChat(chat_id, user, info); + public void didSelectContact(TLRPC.User user, String param) { + MessagesController.getInstance().addUserToChat(chat_id, user, info, Utilities.parseInt(param)); } @Override @@ -680,7 +680,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure)); + builder.setMessage(LocaleController.getString("AreYouSureDeleteAndExit", R.string.AreYouSureDeleteAndExit)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java index a67f82d9b..abb1a5f0b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java @@ -15,9 +15,12 @@ import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; +import android.text.InputType; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.EditorInfo; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.EditText; @@ -71,7 +74,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter private ContactsActivityDelegate delegate; public static interface ContactsActivityDelegate { - public abstract void didSelectContact(TLRPC.User user); + public abstract void didSelectContact(TLRPC.User user, String param); } public ContactsActivity(Bundle args) { @@ -215,7 +218,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter if (ignoreUsers != null && ignoreUsers.containsKey(user.id)) { return; } - didSelectResult(user, true); + didSelectResult(user, true, null); } else { if (createSecretChat) { creatingChat = true; @@ -273,7 +276,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter if (ignoreUsers != null && ignoreUsers.containsKey(user.id)) { return; } - didSelectResult(user, true); + didSelectResult(user, true, null); } else { if (createSecretChat) { creatingChat = true; @@ -338,7 +341,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter return fragmentView; } - private void didSelectResult(final TLRPC.User user, boolean useAlert) { + private void didSelectResult(final TLRPC.User user, boolean useAlert, String param) { if (useAlert && selectAlertString != null) { if (getParentActivity() == null) { return; @@ -346,17 +349,29 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setMessage(LocaleController.formatStringSimple(selectAlertString, Utilities.formatName(user.first_name, user.last_name))); + final EditText editText = new EditText(getParentActivity()); + editText.setTextSize(18); + editText.setText("50"); + editText.setGravity(Gravity.CENTER); + editText.setInputType(InputType.TYPE_CLASS_NUMBER); + editText.setImeOptions(EditorInfo.IME_ACTION_DONE); + builder.setView(editText); builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { - didSelectResult(user, false); + didSelectResult(user, false, editText.getText().toString()); } }); builder.setNegativeButton(R.string.Cancel, null); showAlertDialog(builder); + ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams)editText.getLayoutParams(); + if (layoutParams != null) { + layoutParams.rightMargin = layoutParams.leftMargin = AndroidUtilities.dp(10); + editText.setLayoutParams(layoutParams); + } } else { if (delegate != null) { - delegate.didSelectContact(user); + delegate.didSelectContact(user, param); delegate = null; } finishFragment(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index c64f25794..f9b627349 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -413,7 +413,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats); Bundle args = new Bundle(); args.putBoolean("onlySelect", true); - args.putString("selectAlertString", LocaleController.getString("ForwardMessagesTo", R.string.ForwardMessagesTo)); + args.putString("selectAlertString", LocaleController.getString("SendMessagesTo", R.string.SendMessagesTo)); MessagesActivity fragment = new MessagesActivity(args); fragment.setDelegate(this); presentFragment(fragment, false, true); @@ -437,7 +437,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen } @Override - public void didSelectDialog(MessagesActivity messageFragment, long dialog_id) { + public void didSelectDialog(MessagesActivity messageFragment, long dialog_id, boolean param) { if (dialog_id != 0) { int lower_part = (int)dialog_id; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java index 1056bb7bf..979fba570 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java @@ -17,6 +17,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.AdapterView; +import android.widget.CheckBox; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; @@ -75,7 +76,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter private final static int messages_list_menu_settings = 5; public static interface MessagesActivityDelegate { - public abstract void didSelectDialog(MessagesActivity fragment, long dialog_id); + public abstract void didSelectDialog(MessagesActivity fragment, long dialog_id, boolean param); } public MessagesActivity(Bundle args) { @@ -277,7 +278,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter } } if (onlySelect) { - didSelectResult(dialog_id, true); + didSelectResult(dialog_id, true, false); } else { Bundle args = new Bundle(); int lower_part = (int)dialog_id; @@ -325,8 +326,18 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter if (which == 0) { MessagesController.getInstance().deleteDialog(selectedDialog, 0, true); } else if (which == 1) { - MessagesController.getInstance().deleteUserFromChat((int) -selectedDialog, MessagesController.getInstance().users.get(UserConfig.getClientUserId()), null); - MessagesController.getInstance().deleteDialog(selectedDialog, 0, false); + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setMessage(LocaleController.getString("AreYouSureDeleteAndExit", R.string.AreYouSureDeleteAndExit)); + builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); + builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + MessagesController.getInstance().deleteUserFromChat((int) -selectedDialog, MessagesController.getInstance().users.get(UserConfig.getClientUserId()), null); + MessagesController.getInstance().deleteDialog(selectedDialog, 0, false); + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showAlertDialog(builder); } } }); @@ -334,7 +345,21 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter builder.setItems(new CharSequence[]{LocaleController.getString("ClearHistory", R.string.ClearHistory), LocaleController.getString("Delete", R.string.Delete)}, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - MessagesController.getInstance().deleteDialog(selectedDialog, 0, which == 0); + if (which == 0) { + MessagesController.getInstance().deleteDialog(selectedDialog, 0, true); + } else { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setMessage(LocaleController.getString("AreYouSureDeleteThisChat", R.string.AreYouSureDeleteThisChat)); + builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); + builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + MessagesController.getInstance().deleteDialog(selectedDialog, 0, false); + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showAlertDialog(builder); + } } }); } @@ -454,7 +479,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter this.delegate = delegate; } - private void didSelectResult(final long dialog_id, boolean useAlert) { + private void didSelectResult(final long dialog_id, boolean useAlert, final boolean param) { if (useAlert && selectAlertString != null) { if (getParentActivity() == null) { return; @@ -485,17 +510,32 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter } builder.setMessage(LocaleController.formatStringSimple(selectAlertString, Utilities.formatName(user.first_name, user.last_name))); } + CheckBox checkBox = null; + if (delegate instanceof ChatActivity) { + checkBox = new CheckBox(getParentActivity()); + checkBox.setText(LocaleController.getString("ForwardFromMyName", R.string.ForwardFromMyName)); + checkBox.setChecked(false); + builder.setView(checkBox); + } + final CheckBox checkBoxFinal = checkBox; builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { - didSelectResult(dialog_id, false); + didSelectResult(dialog_id, false, checkBoxFinal != null && checkBoxFinal.isChecked()); } }); builder.setNegativeButton(R.string.Cancel, null); showAlertDialog(builder); + if (checkBox != null) { + ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams)checkBox.getLayoutParams(); + if (layoutParams != null) { + layoutParams.rightMargin = layoutParams.leftMargin = AndroidUtilities.dp(10); + checkBox.setLayoutParams(layoutParams); + } + } } else { if (delegate != null) { - delegate.didSelectDialog(MessagesActivity.this, dialog_id); + delegate.didSelectDialog(MessagesActivity.this, dialog_id, param); delegate = null; } else { finishFragment(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java index 98e7a4015..3ac4d2356 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java @@ -334,7 +334,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure)); + builder.setMessage(LocaleController.getString("AreYouSureSessions", R.string.AreYouSureSessions)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override @@ -950,7 +950,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure)); + builder.setMessage(LocaleController.getString("AreYouSureLogout", R.string.AreYouSureLogout)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsers.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsers.java index 5d590cacf..54345daf2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsers.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsers.java @@ -256,7 +256,7 @@ public class SettingsBlockedUsers extends BaseFragment implements NotificationCe } @Override - public void didSelectContact(TLRPC.User user) { + public void didSelectContact(TLRPC.User user, String param) { if (user == null || blockedContactsDict.containsKey(user.id)) { return; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java index 9d1c47c1d..f2925fa2f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java @@ -140,7 +140,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen finishFragment(); } else if (id == block_contact) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure)); + builder.setMessage(LocaleController.getString("AreYouSureBlockContact", R.string.AreYouSureBlockContact)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override @@ -186,7 +186,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure)); + builder.setMessage(LocaleController.getString("AreYouSureDeleteContact", R.string.AreYouSureDeleteContact)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override @@ -445,7 +445,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen } @Override - public void didSelectDialog(MessagesActivity messageFragment, long dialog_id) { + public void didSelectDialog(MessagesActivity messageFragment, long dialog_id, boolean param) { if (dialog_id != 0) { Bundle args = new Bundle(); args.putBoolean("scrollToTopOnResume", true); diff --git a/TMessagesProj/src/main/res/values-ar/strings.xml b/TMessagesProj/src/main/res/values-ar/strings.xml index ed9f320e7..f10e5c393 100644 --- a/TMessagesProj/src/main/res/values-ar/strings.xml +++ b/TMessagesProj/src/main/res/values-ar/strings.xml @@ -361,9 +361,20 @@ هذا المستخدم ليس لديه تيليجرام بعد ، هل ترغب في دعوته الآن؟ هل أنت متأكد؟ هل تريد إضافة جهة اتصال؟ - إلى المجموعة؟ %1$s هل تريد إضافة + Add %1$s to the group?\n\nNumber of last messages to forward: ؟%1$s هل تريد إعادة توجيه الرسائل إلى هل تريد حذف هذه الدردشة؟ + Send messages to %1$s? + Are you sure you want to logout? + Are you sure you want to terminate all other sessions? + Are you sure you want to delete and leave group? + Are you sure you want to delete this chat? + Are you sure that you want to share your contact info? + Are you sure you want to block this contact? + Are you sure you want to unblock this contact? + Are you sure you want to delete this contact? + Are you sure you want to start secret chat? + forward from my name تيليجرام diff --git a/TMessagesProj/src/main/res/values-de/strings.xml b/TMessagesProj/src/main/res/values-de/strings.xml index baa8ca46a..e3584e2f4 100644 --- a/TMessagesProj/src/main/res/values-de/strings.xml +++ b/TMessagesProj/src/main/res/values-de/strings.xml @@ -361,9 +361,20 @@ Dieser Benutzer hat noch kein Telegram. Möchtest du ihn einladen? Bist du sicher? Kontakt hinzufügen? - %1$s zur Gruppe hinzufügen? + Add %1$s to the group?\n\nNumber of last messages to forward: Nachrichten an %1$s weiterleiten? Diesen Chat löschen? + Send messages to %1$s? + Are you sure you want to logout? + Are you sure you want to terminate all other sessions? + Are you sure you want to delete and leave group? + Are you sure you want to delete this chat? + Are you sure that you want to share your contact info? + Are you sure you want to block this contact? + Are you sure you want to unblock this contact? + Are you sure you want to delete this contact? + Are you sure you want to start secret chat? + forward from my name Telegram diff --git a/TMessagesProj/src/main/res/values-es/strings.xml b/TMessagesProj/src/main/res/values-es/strings.xml index 8f0f7a43f..8dbf8860a 100644 --- a/TMessagesProj/src/main/res/values-es/strings.xml +++ b/TMessagesProj/src/main/res/values-es/strings.xml @@ -361,9 +361,20 @@ Este usuario no tiene Telegram aún. ¿Enviarle una invitación? ¿Estás seguro? ¿Añadir contacto? - ¿Añadir a %1$s al grupo? + Add %1$s to the group?\n\nNumber of last messages to forward: ¿Reenviar mensajes a %1$s? ¿Eliminar este chat? + Send messages to %1$s? + Are you sure you want to logout? + Are you sure you want to terminate all other sessions? + Are you sure you want to delete and leave group? + Are you sure you want to delete this chat? + Are you sure that you want to share your contact info? + Are you sure you want to block this contact? + Are you sure you want to unblock this contact? + Are you sure you want to delete this contact? + Are you sure you want to start secret chat? + forward from my name Telegram diff --git a/TMessagesProj/src/main/res/values-it/strings.xml b/TMessagesProj/src/main/res/values-it/strings.xml index fc3a0a580..b5d372459 100644 --- a/TMessagesProj/src/main/res/values-it/strings.xml +++ b/TMessagesProj/src/main/res/values-it/strings.xml @@ -361,9 +361,20 @@ Questo utente non ha ancora Telegram, vuoi invitarlo? Sei sicuro? Vuoi aggiungere il contatto? - Vuoi aggiungere %1$s al gruppo? + Add %1$s to the group?\n\nNumber of last messages to forward: Vuoi inoltrare i messaggi a %1$s? Vuoi eliminare questa chat? + Send messages to %1$s? + Are you sure you want to logout? + Are you sure you want to terminate all other sessions? + Are you sure you want to delete and leave group? + Are you sure you want to delete this chat? + Are you sure that you want to share your contact info? + Are you sure you want to block this contact? + Are you sure you want to unblock this contact? + Are you sure you want to delete this contact? + Are you sure you want to start secret chat? + forward from my name Telegram diff --git a/TMessagesProj/src/main/res/values-nl/strings.xml b/TMessagesProj/src/main/res/values-nl/strings.xml index d5729dabf..a619042ee 100644 --- a/TMessagesProj/src/main/res/values-nl/strings.xml +++ b/TMessagesProj/src/main/res/values-nl/strings.xml @@ -361,9 +361,20 @@ Deze gebruiker heeft nog geen Telegram. Wil je een uitnodiging sturen? Weet je het zeker? Contact toevoegen? - %1$s toevoegen aan de groep? + Add %1$s to the group?\n\nNumber of last messages to forward: Berichten doorsturen naar %1$s? Dit gesprek verwijderen? + Send messages to %1$s? + Are you sure you want to logout? + Are you sure you want to terminate all other sessions? + Are you sure you want to delete and leave group? + Are you sure you want to delete this chat? + Are you sure that you want to share your contact info? + Are you sure you want to block this contact? + Are you sure you want to unblock this contact? + Are you sure you want to delete this contact? + Are you sure you want to start secret chat? + forward from my name Telegram diff --git a/TMessagesProj/src/main/res/values-pt-rBR/strings.xml b/TMessagesProj/src/main/res/values-pt-rBR/strings.xml index 2d0d4c09d..c55d07fa8 100644 --- a/TMessagesProj/src/main/res/values-pt-rBR/strings.xml +++ b/TMessagesProj/src/main/res/values-pt-rBR/strings.xml @@ -361,9 +361,20 @@ Este usuário ainda não possui Telegram, deseja enviar um convite? Você tem certeza? Adicionar contato? - Adicionar %1$s ao grupo? + Add %1$s to the group?\n\nNumber of last messages to forward: Encaminhar mensagem para %1$s? Apagar esta conversa? + Send messages to %1$s? + Are you sure you want to logout? + Are you sure you want to terminate all other sessions? + Are you sure you want to delete and leave group? + Are you sure you want to delete this chat? + Are you sure that you want to share your contact info? + Are you sure you want to block this contact? + Are you sure you want to unblock this contact? + Are you sure you want to delete this contact? + Are you sure you want to start secret chat? + forward from my name Telegram diff --git a/TMessagesProj/src/main/res/values-pt-rPT/strings.xml b/TMessagesProj/src/main/res/values-pt-rPT/strings.xml index ac23ff2f3..8a2936a52 100644 --- a/TMessagesProj/src/main/res/values-pt-rPT/strings.xml +++ b/TMessagesProj/src/main/res/values-pt-rPT/strings.xml @@ -361,9 +361,20 @@ Este utilizador ainda não tem o Telegram. Quer enviar um convite? Tem a certeza? Adicionar contacto? - Adicionar %1$s ao grupo? + Add %1$s to the group?\n\nNumber of last messages to forward: Reencaminhar mensagens para %1$s? Eliminar este chat? + Send messages to %1$s? + Are you sure you want to logout? + Are you sure you want to terminate all other sessions? + Are you sure you want to delete and leave group? + Are you sure you want to delete this chat? + Are you sure that you want to share your contact info? + Are you sure you want to block this contact? + Are you sure you want to unblock this contact? + Are you sure you want to delete this contact? + Are you sure you want to start secret chat? + forward from my name Telegram diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml index 14d0d36dc..8b676e2b4 100644 --- a/TMessagesProj/src/main/res/values/strings.xml +++ b/TMessagesProj/src/main/res/values/strings.xml @@ -361,9 +361,21 @@ This user does not have Telegram yet, send an invitation? Are you sure? Add contact? - Add %1$s to the group? + Add %1$s to the group?\n\nNumber of last messages to forward: Forward messages to %1$s? Delete this chat? + Send messages to %1$s? + Are you sure you want to logout? + Are you sure you want to terminate all other sessions? + Are you sure you want to delete and leave group? + Are you sure you want to delete this chat? + Are you sure that you want to share your contact info? + Are you sure you want to block this contact? + Are you sure you want to unblock this contact? + Are you sure you want to delete this contact? + Are you sure you want to start secret chat? + forward from my name + Telegram