diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 603c8aa9e..e01ec1f62 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -83,7 +83,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 19 - versionCode 299 + versionCode 302 versionName "1.7.0" } } diff --git a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java index 8bee85a29..60857b092 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java @@ -92,6 +92,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter public boolean enableJoined = true; public int fontSize = AndroidUtilities.dp(16); + public int maxGroupCount = 200; + public int maxBroadcastCount = 100; private TLRPC.ChatParticipants currentChatInfo = null; private int chatParticipantsId = 0; @@ -191,9 +193,26 @@ public class MessagesController implements NotificationCenter.NotificationCenter SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); enableJoined = preferences.getBoolean("EnableContactJoined", true); preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); + maxGroupCount = preferences.getInt("maxGroupCount", 200); + maxBroadcastCount = preferences.getInt("maxBroadcastCount", 100); fontSize = preferences.getInt("fons_size", 16); } + public void updateConfig(final TLRPC.TL_config config) { + Utilities.RunOnUIThread(new Runnable() { + @Override + public void run() { + maxBroadcastCount = config.broadcast_size_max; + maxGroupCount = config.chat_size_max; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putInt("maxGroupCount", maxGroupCount); + editor.putInt("maxBroadcastCount", maxBroadcastCount); + editor.commit(); + } + }); + } + public void addSupportUser() { TLRPC.TL_userForeign user = new TLRPC.TL_userForeign(); user.phone = "333"; @@ -4485,38 +4504,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter } NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); } - if (!markAsReadMessages.isEmpty()) { - for (Integer id : markAsReadMessages) { - MessageObject obj = dialogMessage.get(id); - if (obj != null) { - obj.messageOwner.unread = false; - updateMask |= UPDATE_MASK_READ_DIALOG_MESSAGE; - } - } - } - if (!markAsReadEncrypted.isEmpty()) { - for (HashMap.Entry entry : markAsReadEncrypted.entrySet()) { - NotificationCenter.getInstance().postNotificationName(messagesReadedEncrypted, entry.getKey(), entry.getValue()); - long dialog_id = (long)(entry.getKey()) << 32; - TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id); - if (dialog != null) { - MessageObject message = dialogMessage.get(dialog.top_message); - if (message != null && message.messageOwner.date <= entry.getValue()) { - message.messageOwner.unread = false; - updateMask |= UPDATE_MASK_READ_DIALOG_MESSAGE; - } - } - } - } - if (!deletedMessages.isEmpty()) { - NotificationCenter.getInstance().postNotificationName(messagesDeleted, deletedMessages); - for (Integer id : deletedMessages) { - MessageObject obj = dialogMessage.get(id); - if (obj != null) { - obj.deleted = true; - } - } - } if (printChangedArg) { updateMask |= UPDATE_MASK_USER_PRINT; } @@ -4542,9 +4529,44 @@ public class MessagesController implements NotificationCenter.NotificationCenter Utilities.RunOnUIThread(new Runnable() { @Override public void run() { + int updateMask = 0; if (!markAsReadMessages.isEmpty()) { NotificationCenter.getInstance().postNotificationName(messagesReaded, markAsReadMessages); NotificationsController.getInstance().processReadMessages(markAsReadMessages, 0, 0, 0); + + for (Integer id : markAsReadMessages) { + MessageObject obj = dialogMessage.get(id); + if (obj != null) { + obj.messageOwner.unread = false; + updateMask |= UPDATE_MASK_READ_DIALOG_MESSAGE; + } + } + } + if (!markAsReadEncrypted.isEmpty()) { + for (HashMap.Entry entry : markAsReadEncrypted.entrySet()) { + NotificationCenter.getInstance().postNotificationName(messagesReadedEncrypted, entry.getKey(), entry.getValue()); + long dialog_id = (long)(entry.getKey()) << 32; + TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id); + if (dialog != null) { + MessageObject message = dialogMessage.get(dialog.top_message); + if (message != null && message.messageOwner.date <= entry.getValue()) { + message.messageOwner.unread = false; + updateMask |= UPDATE_MASK_READ_DIALOG_MESSAGE; + } + } + } + } + if (!deletedMessages.isEmpty()) { + NotificationCenter.getInstance().postNotificationName(messagesDeleted, deletedMessages); + for (Integer id : deletedMessages) { + MessageObject obj = dialogMessage.get(id); + if (obj != null) { + obj.deleted = true; + } + } + } + if (updateMask != 0) { + NotificationCenter.getInstance().postNotificationName(updateInterfaces, updateMask); } } }); @@ -4734,7 +4756,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter TLObject object = TLClassStore.Instance().TLdeserialize(is, is.readInt32()); BuffersStorage.getInstance().reuseFreeBuffer(is); if (object != null) { - int from_id = chat.admin_id; if (from_id == UserConfig.getClientUserId()) { from_id = chat.participant_id; @@ -4943,6 +4964,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter pendingEncMessagesToDelete.addAll(serviceMessage.action.random_ids); } return null; + } else { + return null; } } else { FileLog.e("tmessages", "unkown message " + object); @@ -4951,9 +4974,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter FileLog.e("tmessages", "unkown TLObject"); } } else { + BuffersStorage.getInstance().reuseFreeBuffer(is); FileLog.e("tmessages", "fingerprint mismatch"); } - BuffersStorage.getInstance().reuseFreeBuffer(is); return null; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java index 706fb5e3d..f3b44c331 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java @@ -781,6 +781,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. processRequestQueue(RPCRequest.RPCRequestClassTransportMask, 0); } + MessagesController.getInstance().updateConfig(config); } updatingDcSettings = false; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java index 4991bd324..11cbb918a 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java @@ -509,7 +509,6 @@ public class FileLoadOperation { } } }); - } } } @@ -675,7 +674,11 @@ public class FileLoadOperation { return; } httpTask = new DownloadImageTask(); - httpTask.doInBackground(httpUrl); + if (android.os.Build.VERSION.SDK_INT >= 11) { + httpTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null); + } else { + httpTask.execute(null, null, null); + } } private void processRequestResult(RequestInfo requestInfo, TLRPC.TL_error error) { diff --git a/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java index 666b6556d..21a109395 100644 --- a/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java @@ -39,7 +39,6 @@ public class MessageObject { public int contentType; public ArrayList photoThumbs; public Bitmap imagePreview; - public PhotoObject previewPhoto; public String dateKey; public boolean deleted = false; public float audioProgress; @@ -138,10 +137,6 @@ public class MessageObject { messageText = LocaleController.getString("ActionAddUser", R.string.ActionAddUser).replace("un2", "").replace("un1", ""); } } else if (message.action instanceof TLRPC.TL_messageActionChatEditPhoto) { - photoThumbs = new ArrayList(); - for (TLRPC.PhotoSize size : message.action.photo.sizes) { - photoThumbs.add(new PhotoObject(size, preview)); - } if (isFromMe()) { messageText = LocaleController.getString("ActionYouChangedPhoto", R.string.ActionYouChangedPhoto); } else { @@ -242,22 +237,8 @@ public class MessageObject { } } else if (message.media != null && !(message.media instanceof TLRPC.TL_messageMediaEmpty)) { if (message.media instanceof TLRPC.TL_messageMediaPhoto) { - photoThumbs = new ArrayList(); - for (TLRPC.PhotoSize size : message.media.photo.sizes) { - PhotoObject obj = new PhotoObject(size, preview); - photoThumbs.add(obj); - if (imagePreview == null && obj.image != null) { - imagePreview = obj.image; - } - } messageText = LocaleController.getString("AttachPhoto", R.string.AttachPhoto); } else if (message.media instanceof TLRPC.TL_messageMediaVideo) { - photoThumbs = new ArrayList(); - PhotoObject obj = new PhotoObject(message.media.video.thumb, preview); - photoThumbs.add(obj); - if (imagePreview == null && obj.image != null) { - imagePreview = obj.image; - } messageText = LocaleController.getString("AttachVideo", R.string.AttachVideo); } else if (message.media instanceof TLRPC.TL_messageMediaGeo) { messageText = LocaleController.getString("AttachLocation", R.string.AttachLocation); @@ -266,11 +247,6 @@ public class MessageObject { } else if (message.media instanceof TLRPC.TL_messageMediaUnsupported) { messageText = LocaleController.getString("UnsuppotedMedia", R.string.UnsuppotedMedia); } else if (message.media instanceof TLRPC.TL_messageMediaDocument) { - if (!(message.media.document.thumb instanceof TLRPC.TL_photoSizeEmpty)) { - photoThumbs = new ArrayList(); - PhotoObject obj = new PhotoObject(message.media.document.thumb, preview); - photoThumbs.add(obj); - } messageText = LocaleController.getString("AttachDocument", R.string.AttachDocument); } else if (message.media instanceof TLRPC.TL_messageMediaAudio) { messageText = LocaleController.getString("AttachAudio", R.string.AttachAudio); @@ -335,6 +311,80 @@ public class MessageObject { dateKey = String.format("%d_%02d_%02d", dateYear, dateMonth, dateDay); generateLayout(); + generateThumbs(false, preview); + } + + public void generateThumbs(boolean update, int preview) { + if (messageOwner instanceof TLRPC.TL_messageService) { + if (messageOwner.action instanceof TLRPC.TL_messageActionChatEditPhoto) { + if (!update) { + photoThumbs = new ArrayList(); + for (TLRPC.PhotoSize size : messageOwner.action.photo.sizes) { + photoThumbs.add(new PhotoObject(size, preview)); + } + } else if (photoThumbs != null && !photoThumbs.isEmpty()) { + for (PhotoObject photoObject : photoThumbs) { + for (TLRPC.PhotoSize size : messageOwner.action.photo.sizes) { + if (size instanceof TLRPC.TL_photoSizeEmpty) { + continue; + } + if (size.type.equals(photoObject.photoOwner.type)) { + photoObject.photoOwner.location = size.location; + break; + } + } + } + } + } + } else if (messageOwner.media != null && !(messageOwner.media instanceof TLRPC.TL_messageMediaEmpty)) { + if (messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) { + if (!update) { + photoThumbs = new ArrayList(); + for (TLRPC.PhotoSize size : messageOwner.media.photo.sizes) { + PhotoObject obj = new PhotoObject(size, preview); + photoThumbs.add(obj); + if (imagePreview == null && obj.image != null) { + imagePreview = obj.image; + } + } + } else if (photoThumbs != null && !photoThumbs.isEmpty()) { + for (PhotoObject photoObject : photoThumbs) { + for (TLRPC.PhotoSize size : messageOwner.media.photo.sizes) { + if (size instanceof TLRPC.TL_photoSizeEmpty) { + continue; + } + if (size.type.equals(photoObject.photoOwner.type)) { + photoObject.photoOwner.location = size.location; + break; + } + } + } + } + } else if (messageOwner.media instanceof TLRPC.TL_messageMediaVideo) { + if (!update) { + photoThumbs = new ArrayList(); + PhotoObject obj = new PhotoObject(messageOwner.media.video.thumb, preview); + photoThumbs.add(obj); + if (imagePreview == null && obj.image != null) { + imagePreview = obj.image; + } + } else if (photoThumbs != null && !photoThumbs.isEmpty() && messageOwner.media.video.thumb != null) { + PhotoObject photoObject = photoThumbs.get(0); + photoObject.photoOwner.location = messageOwner.media.video.thumb.location; + } + } if (messageOwner.media instanceof TLRPC.TL_messageMediaDocument) { + if (!(messageOwner.media.document.thumb instanceof TLRPC.TL_photoSizeEmpty)) { + if (!update) { + photoThumbs = new ArrayList(); + PhotoObject obj = new PhotoObject(messageOwner.media.document.thumb, preview); + photoThumbs.add(obj); + } else if (photoThumbs != null && !photoThumbs.isEmpty() && messageOwner.media.document.thumb != null) { + PhotoObject photoObject = photoThumbs.get(0); + photoObject.photoOwner.location = messageOwner.media.video.thumb.location; + } + } + } + } } public String getFileName() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java b/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java index 949dced5d..2285ef327 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java @@ -8,7 +8,6 @@ package org.telegram.ui; -import android.app.Activity; import android.app.AlarmManager; import android.app.Application; import android.app.PendingIntent; @@ -93,34 +92,6 @@ public class ApplicationLoader extends Application { UserConfig.loadConfig(); if (UserConfig.getCurrentUser() != null) { - boolean changed = false; - SharedPreferences preferences = applicationContext.getSharedPreferences("Notifications", MODE_PRIVATE); - int v = preferences.getInt("v", 0); - if (v != 1) { - SharedPreferences preferences2 = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); - SharedPreferences.Editor editor = preferences2.edit(); - if (preferences.contains("view_animations")) { - editor.putBoolean("view_animations", preferences.getBoolean("view_animations", false)); - } - if (preferences.contains("selectedBackground")) { - editor.putInt("selectedBackground", preferences.getInt("selectedBackground", 1000001)); - } - if (preferences.contains("selectedColor")) { - editor.putInt("selectedColor", preferences.getInt("selectedColor", 0)); - } - if (preferences.contains("fons_size")) { - editor.putInt("fons_size", preferences.getInt("fons_size", 16)); - } - editor.commit(); - editor = preferences.edit(); - editor.putInt("v", 1); - editor.remove("view_animations"); - editor.remove("selectedBackground"); - editor.remove("selectedColor"); - editor.remove("fons_size"); - editor.commit(); - } - MessagesController.getInstance().users.put(UserConfig.getClientUserId(), UserConfig.getCurrentUser()); ConnectionsManager.getInstance().applyCountryPortNumber(UserConfig.getCurrentUser().phone); ConnectionsManager.getInstance().initPushConnection(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java index cde0be595..52ba8e91f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java @@ -60,9 +60,11 @@ public class ChatBaseCell extends BaseCell { private static Drawable checkDrawable; private static Drawable halfCheckDrawable; private static Drawable clockDrawable; + private static Drawable broadcastDrawable; private static Drawable checkMediaDrawable; private static Drawable halfCheckMediaDrawable; private static Drawable clockMediaDrawable; + private static Drawable broadcastMediaDrawable; private static Drawable errorDrawable; protected static Drawable mediaBackgroundDrawable; private static TextPaint timePaintIn; @@ -177,6 +179,8 @@ public class ChatBaseCell extends BaseCell { clockMediaDrawable = getResources().getDrawable(R.drawable.msg_clock_photo); errorDrawable = getResources().getDrawable(R.drawable.msg_warning); mediaBackgroundDrawable = getResources().getDrawable(R.drawable.phototime); + broadcastDrawable = getResources().getDrawable(R.drawable.broadcast3); + broadcastMediaDrawable = getResources().getDrawable(R.drawable.broadcast4); timePaintIn = new TextPaint(TextPaint.ANTI_ALIAS_FLAG); timePaintIn.setTextSize(AndroidUtilities.dp(12)); @@ -569,6 +573,7 @@ public class ChatBaseCell extends BaseCell { boolean drawCheck2 = false; boolean drawClock = false; boolean drawError = false; + boolean isBroadcast = (int)(currentMessageObject.getDialogId() >> 32) == 1; if (currentMessageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { drawCheck1 = false; @@ -601,30 +606,42 @@ public class ChatBaseCell extends BaseCell { clockMediaDrawable.draw(canvas); } } - if (drawCheck2) { - if (!media) { - if (drawCheck1) { - setDrawableBounds(checkDrawable, layoutWidth - AndroidUtilities.dpf(22.5f) - checkDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - checkDrawable.getIntrinsicHeight()); + if (isBroadcast) { + if (drawCheck1 || drawCheck2) { + if (!media) { + setDrawableBounds(broadcastDrawable, layoutWidth - AndroidUtilities.dpf(20.5f) - broadcastDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.0f) - broadcastDrawable.getIntrinsicHeight()); + broadcastDrawable.draw(canvas); } else { - setDrawableBounds(checkDrawable, layoutWidth - AndroidUtilities.dpf(18.5f) - checkDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - checkDrawable.getIntrinsicHeight()); + setDrawableBounds(broadcastMediaDrawable, layoutWidth - AndroidUtilities.dpf(24.0f) - broadcastMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - broadcastMediaDrawable.getIntrinsicHeight()); + broadcastMediaDrawable.draw(canvas); } - checkDrawable.draw(canvas); - } else { - if (drawCheck1) { - setDrawableBounds(checkMediaDrawable, layoutWidth - AndroidUtilities.dpf(26.0f) - checkMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - checkMediaDrawable.getIntrinsicHeight()); - } else { - setDrawableBounds(checkMediaDrawable, layoutWidth - AndroidUtilities.dpf(22.0f) - checkMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - checkMediaDrawable.getIntrinsicHeight()); - } - checkMediaDrawable.draw(canvas); } - } - if (drawCheck1) { - if (!media) { - setDrawableBounds(halfCheckDrawable, layoutWidth - AndroidUtilities.dp(18) - halfCheckDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - halfCheckDrawable.getIntrinsicHeight()); - halfCheckDrawable.draw(canvas); - } else { - setDrawableBounds(halfCheckMediaDrawable, layoutWidth - AndroidUtilities.dpf(20.5f) - halfCheckMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - halfCheckMediaDrawable.getIntrinsicHeight()); - halfCheckMediaDrawable.draw(canvas); + } else { + if (drawCheck2) { + if (!media) { + if (drawCheck1) { + setDrawableBounds(checkDrawable, layoutWidth - AndroidUtilities.dpf(22.5f) - checkDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - checkDrawable.getIntrinsicHeight()); + } else { + setDrawableBounds(checkDrawable, layoutWidth - AndroidUtilities.dpf(18.5f) - checkDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - checkDrawable.getIntrinsicHeight()); + } + checkDrawable.draw(canvas); + } else { + if (drawCheck1) { + setDrawableBounds(checkMediaDrawable, layoutWidth - AndroidUtilities.dpf(26.0f) - checkMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - checkMediaDrawable.getIntrinsicHeight()); + } else { + setDrawableBounds(checkMediaDrawable, layoutWidth - AndroidUtilities.dpf(22.0f) - checkMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - checkMediaDrawable.getIntrinsicHeight()); + } + checkMediaDrawable.draw(canvas); + } + } + if (drawCheck1) { + if (!media) { + setDrawableBounds(halfCheckDrawable, layoutWidth - AndroidUtilities.dp(18) - halfCheckDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - halfCheckDrawable.getIntrinsicHeight()); + halfCheckDrawable.draw(canvas); + } else { + setDrawableBounds(halfCheckMediaDrawable, layoutWidth - AndroidUtilities.dpf(20.5f) - halfCheckMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - halfCheckMediaDrawable.getIntrinsicHeight()); + halfCheckMediaDrawable.draw(canvas); + } } } if (drawError) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 7c8158722..d706ee32c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -2161,6 +2161,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not MessageObject newMsgObj = (MessageObject)args[2]; if (newMsgObj != null) { obj.messageOwner.media = newMsgObj.messageOwner.media; + obj.generateThumbs(true, 1); } messagesDict.remove(msgId); messagesDict.put(newMsgId, obj); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java index 1dd411aad..e4179b324 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java @@ -143,7 +143,8 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen membersSectionRow = rowCount++; rowCount += info.participants.size(); membersEndRow = rowCount; - if (info.participants.size() < 200) { + int maxCount = chat_id > 0 ? MessagesController.getInstance().maxGroupCount : MessagesController.getInstance().maxBroadcastCount; + if (info.participants.size() < maxCount) { addMemberRow = rowCount++; } else { addMemberRow = -1; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java index 93b6d220a..91d74a232 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java @@ -91,6 +91,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen private EditText userSelectEditText; private boolean ignoreChange = false; private boolean isBroadcast = false; + private int maxCount = 200; private HashMap selectedContacts = new HashMap(); private ArrayList allSpans = new ArrayList(); @@ -113,6 +114,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen public GroupCreateActivity(Bundle args) { super(args); isBroadcast = args.getBoolean("broadcast", false); + maxCount = !isBroadcast ? MessagesController.getInstance().maxGroupCount : MessagesController.getInstance().maxBroadcastCount; } @Override @@ -141,7 +143,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen } else { actionBarLayer.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup)); } - actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), 200)); + actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount)); actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() { @Override @@ -216,7 +218,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen selectedContacts.remove(sp.uid); } } - actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), 200)); + actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount)); listView.invalidateViews(); } else { search = true; @@ -274,7 +276,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen userSelectEditText.setSelection(text.length()); ignoreChange = false; } else { - if (selectedContacts.size() == 200) { + if (selectedContacts.size() == maxCount) { return; } ignoreChange = true; @@ -282,7 +284,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen span.uid = user.id; ignoreChange = false; } - actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), 200)); + actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount)); if (searching || searchWas) { searching = false; searchWas = false; diff --git a/TMessagesProj/src/main/res/drawable-hdpi/broadcast3.png b/TMessagesProj/src/main/res/drawable-hdpi/broadcast3.png new file mode 100644 index 000000000..d29697597 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/broadcast3.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/broadcast4.png b/TMessagesProj/src/main/res/drawable-hdpi/broadcast4.png new file mode 100644 index 000000000..ed908d804 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/broadcast4.png differ diff --git a/TMessagesProj/src/main/res/drawable-ldpi/broadcast3.png b/TMessagesProj/src/main/res/drawable-ldpi/broadcast3.png new file mode 100644 index 000000000..532a1f098 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-ldpi/broadcast3.png differ diff --git a/TMessagesProj/src/main/res/drawable-ldpi/broadcast4.png b/TMessagesProj/src/main/res/drawable-ldpi/broadcast4.png new file mode 100644 index 000000000..09916a977 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-ldpi/broadcast4.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/broadcast3.png b/TMessagesProj/src/main/res/drawable-mdpi/broadcast3.png new file mode 100644 index 000000000..fb81e5ebf Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/broadcast3.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/broadcast4.png b/TMessagesProj/src/main/res/drawable-mdpi/broadcast4.png new file mode 100644 index 000000000..dda48af2b Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/broadcast4.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/broadcast3.png b/TMessagesProj/src/main/res/drawable-xhdpi/broadcast3.png new file mode 100644 index 000000000..c95c69020 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/broadcast3.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/broadcast4.png b/TMessagesProj/src/main/res/drawable-xhdpi/broadcast4.png new file mode 100644 index 000000000..727ee6f41 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/broadcast4.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/broadcast3.png b/TMessagesProj/src/main/res/drawable-xxhdpi/broadcast3.png new file mode 100644 index 000000000..f89697b73 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/broadcast3.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/broadcast4.png b/TMessagesProj/src/main/res/drawable-xxhdpi/broadcast4.png new file mode 100644 index 000000000..9a1b9b2ab Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/broadcast4.png differ