diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 197aefc67..57676e034 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -283,7 +283,7 @@ android { } } - defaultConfig.versionCode = 1849 + defaultConfig.versionCode = 1850 applicationVariants.all { variant -> variant.outputs.all { output -> diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index 5e6698cbc..b1299c949 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -19,7 +19,7 @@ public class BuildVars { public static boolean USE_CLOUD_STRINGS = true; public static boolean CHECK_UPDATES = true; public static boolean TON_WALLET_STANDALONE = false; - public static int BUILD_VERSION = 1849; + public static int BUILD_VERSION = 1850; public static String BUILD_VERSION_STRING = "5.14.0"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java index ac96bc04f..d675de278 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java @@ -1789,25 +1789,43 @@ public class MessageObject { return; } if ((results.flags & 2) != 0) { - byte[] chosen = null; - boolean correct = false; + ArrayList chosen = null; + byte[] correct = null; if (results.min && media.results.results != null) { for (int b = 0, N2 = media.results.results.size(); b < N2; b++) { TLRPC.TL_pollAnswerVoters answerVoters = media.results.results.get(b); if (answerVoters.chosen) { - chosen = answerVoters.option; - correct = answerVoters.correct; - break; + if (chosen == null) { + chosen = new ArrayList<>(); + } + chosen.add(answerVoters.option); + } + if (answerVoters.correct) { + correct = answerVoters.option; } } } media.results.results = results.results; - if (chosen != null) { + if (chosen != null || correct != null) { for (int b = 0, N2 = media.results.results.size(); b < N2; b++) { TLRPC.TL_pollAnswerVoters answerVoters = media.results.results.get(b); - if (Arrays.equals(answerVoters.option, chosen)) { - answerVoters.chosen = true; - answerVoters.correct = correct; + if (chosen != null) { + for (int a = 0, N = chosen.size(); a < N; a++) { + if (Arrays.equals(answerVoters.option, chosen.get(a))) { + answerVoters.chosen = true; + chosen.remove(a); + break; + } + } + if (chosen.isEmpty()) { + chosen = null; + } + } + if (correct != null && Arrays.equals(answerVoters.option, correct)) { + answerVoters.correct = true; + correct = null; + } + if (chosen == null && correct == null) { break; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java index 3ea1506fa..70a232e83 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -2304,6 +2304,11 @@ public class Theme { public static final String key_chat_attachPermissionText = "chat_attachPermissionText"; public static final String key_chat_attachEmptyImage = "chat_attachEmptyImage"; + public static final String key_chat_inPollCorrectAnswer = "chat_inPollCorrectAnswer"; + public static final String key_chat_outPollCorrectAnswer = "chat_outPollCorrectAnswer"; + public static final String key_chat_inPollWrongAnswer = "chat_inPollWrongAnswer"; + public static final String key_chat_outPollWrongAnswer = "chat_outPollWrongAnswer"; + public static final String key_chat_attachGalleryBackground = "chat_attachGalleryBackground"; public static final String key_chat_attachGalleryIcon = "chat_attachGalleryIcon"; public static final String key_chat_attachAudioBackground = "chat_attachAudioBackground"; @@ -2993,6 +2998,10 @@ public class Theme { defaultColors.put(key_chat_attachPollBackground, 0xfff2c04b); defaultColors.put(key_chat_attachPollIcon, 0xffffffff); + defaultColors.put(key_chat_inPollCorrectAnswer, 0xff60c255); + defaultColors.put(key_chat_outPollCorrectAnswer, 0xff60c255); + defaultColors.put(key_chat_inPollWrongAnswer, 0xffeb6060); + defaultColors.put(key_chat_outPollWrongAnswer, 0xffeb6060); defaultColors.put(key_chat_status, 0xffd5e8f7); defaultColors.put(key_chat_inGreenCall, 0xff00c853); @@ -3503,6 +3512,10 @@ public class Theme { fallbackKeys.put(key_chat_outTextSelectionHighlight, key_chat_textSelectBackground); fallbackKeys.put(key_chat_inTextSelectionHighlight, key_chat_textSelectBackground); fallbackKeys.put(key_chat_TextSelectionCursor, key_chat_messagePanelCursor); + fallbackKeys.put(key_chat_inPollCorrectAnswer, key_chat_attachLocationBackground); + fallbackKeys.put(key_chat_outPollCorrectAnswer, key_chat_attachLocationBackground); + fallbackKeys.put(key_chat_inPollWrongAnswer, key_chat_attachAudioBackground); + fallbackKeys.put(key_chat_outPollWrongAnswer, key_chat_attachAudioBackground); themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_background)); themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_nameInMessage)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java index e4b326bb2..819c0164a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -1836,7 +1836,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate return textSelectionHelper.onTouchEvent(event); } else { event.offsetLocation(this.getLeft() - cell.getLeft(), this.getTop() - cell.getTop()); - return textSelectionHelper.onTouchEvent(event); + boolean result = textSelectionHelper.onTouchEvent(event); + event.offsetLocation(-(this.getLeft() - cell.getLeft()), -(this.getTop() - cell.getTop())); + return result; } } } @@ -9566,9 +9568,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (pollVoted || pollClosed || animatePollAnswerAlpha) { if (lastPoll.quiz && pollVoted && button.chosen && !currentBackgroundDrawable.hasGradient()) { if (button.correct) { - Theme.chat_docBackPaint.setColor(Theme.getColor(Theme.key_chat_attachLocationBackground)); + Theme.chat_docBackPaint.setColor(Theme.getColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outPollCorrectAnswer : Theme.key_chat_inPollCorrectAnswer)); } else { - Theme.chat_docBackPaint.setColor(Theme.getColor(Theme.key_chat_attachAudioBackground)); + Theme.chat_docBackPaint.setColor(Theme.getColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outPollWrongAnswer : Theme.key_chat_inPollWrongAnswer)); } } else { Theme.chat_docBackPaint.setColor(Theme.getColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outAudioSeekbarFill : Theme.key_chat_inAudioSeekbarFill)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 18a76f0ff..d81fa1d7c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -16821,6 +16821,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[0]}, null, Theme.key_chat_inLocationIcon), new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outLocationBackground), new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[1]}, null, Theme.key_chat_outLocationIcon), + new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPollCorrectAnswer), + new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPollCorrectAnswer), + new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPollWrongAnswer), + new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPollWrongAnswer), new ThemeDescription(messagesSearchListView, 0, new Class[]{DialogCell.class}, null, new Drawable[]{Theme.avatar_savedDrawable}, null, Theme.key_avatar_text), new ThemeDescription(messagesSearchListView, 0, new Class[]{DialogCell.class}, Theme.dialogs_countPaint, null, null, Theme.key_chats_unreadCounter),