From 5a47056c7b1cb0b7d095ca6e7d1a288c01f8f160 Mon Sep 17 00:00:00 2001 From: DrKLO Date: Sun, 1 Nov 2020 00:13:37 +0300 Subject: [PATCH] Update to 7.2.1 (2139) --- TMessagesProj/build.gradle | 2 +- .../org/telegram/messenger/BuildVars.java | 2 +- .../messenger/DownloadController.java | 2 ++ .../org/telegram/messenger/ImageLoader.java | 8 +++-- .../telegram/messenger/LocaleController.java | 17 +++++++++- .../org/telegram/messenger/MessageObject.java | 11 +++--- .../messenger/MessagesController.java | 26 +++++++------- .../telegram/messenger/MessagesStorage.java | 15 +++----- .../messenger/NotificationCenter.java | 2 +- .../messenger/SendMessagesHelper.java | 8 +++-- .../telegram/ui/ActionBar/BaseFragment.java | 6 ++++ .../telegram/ui/Cells/ChatMessageCell.java | 14 ++++---- .../telegram/ui/ChannelAdminLogActivity.java | 4 +-- .../java/org/telegram/ui/ChatActivity.java | 29 +++++++++------- .../org/telegram/ui/ChatUsersActivity.java | 4 +-- .../ui/Components/ChatActivityEnterView.java | 29 ++++++++-------- .../ui/Components/FragmentContextView.java | 10 +++--- .../ui/Components/voip/VoIPPiPView.java | 9 +++-- .../org/telegram/ui/GroupCreateActivity.java | 1 - .../java/org/telegram/ui/LaunchActivity.java | 2 +- .../org/telegram/ui/ThemePreviewActivity.java | 2 +- .../java/org/telegram/ui/VoIPFragment.java | 34 ++++++++++--------- 22 files changed, 132 insertions(+), 105 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index a531acaa9..e1456360c 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -285,7 +285,7 @@ android { } } - defaultConfig.versionCode = 2137 + defaultConfig.versionCode = 2139 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 199b05b06..b00071996 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -18,7 +18,7 @@ public class BuildVars { public static boolean LOGS_ENABLED = false; public static boolean USE_CLOUD_STRINGS = true; public static boolean CHECK_UPDATES = true; - public static int BUILD_VERSION = 2137; + public static int BUILD_VERSION = 2139; public static String BUILD_VERSION_STRING = "7.2.0"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java b/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java index 5581ccc11..5d93ec660 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java @@ -1048,6 +1048,8 @@ public class DownloadController extends BaseController implements NotificationCe MessageObject messageObject = (MessageObject) delayedMessage.extraHashMap.get(fileName + "_i"); if (messageObject != null && messageObject.isVideo()) { getMessagesController().sendTyping(dialogId, topMessageId, 5, 0); + } else if (messageObject != null && messageObject.getDocument() != null) { + getMessagesController().sendTyping(dialogId, topMessageId, 3, 0); } else { getMessagesController().sendTyping(dialogId, topMessageId, 4, 0); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java index 84c93ff88..03ad700a0 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java @@ -403,9 +403,11 @@ public class ImageLoader { @Override protected void onPostExecute(final String result) { if (result != null) { - cacheImage.httpTask = new HttpImageTask(cacheImage, 0, result); - httpTasks.add(cacheImage.httpTask); - runHttpTasks(false); + imageLoadQueue.postRunnable(() -> { + cacheImage.httpTask = new HttpImageTask(cacheImage, 0, result); + httpTasks.add(cacheImage.httpTask); + runHttpTasks(false); + }); } else if (canRetry) { artworkLoadError(cacheImage.url); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java index 649c31e4e..443519e59 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java @@ -233,9 +233,10 @@ public class LocaleController { "nl", "nn", "no", "sv", "af", "bg", "bn", "ca", "eu", "fur", "fy", "gu", "ha", "is", "ku", "lb", "ml", "mr", "nah", "ne", "om", "or", "pa", "pap", "ps", "so", "sq", "sw", "ta", "te", "tk", "ur", "zu", "mn", "gsw", "chr", "rm", "pt", "an", "ast"}, new PluralRules_One()); - addRules(new String[]{"cs", "sk", "sr", "hr", "bs"}, new PluralRules_Czech()); + addRules(new String[]{"cs", "sk"}, new PluralRules_Czech()); addRules(new String[]{"ff", "fr", "kab"}, new PluralRules_French()); addRules(new String[]{"ru", "uk", "be", "sh"}, new PluralRules_Balkan()); + addRules(new String[]{"sr", "hr", "bs"}, new PluralRules_Serbian()); addRules(new String[]{"lv"}, new PluralRules_Latvian()); addRules(new String[]{"lt"}, new PluralRules_Lithuanian()); addRules(new String[]{"pl"}, new PluralRules_Polish()); @@ -2810,6 +2811,20 @@ public class LocaleController { } } + public static class PluralRules_Serbian extends PluralRules { + public int quantityForNumber(int count) { + int rem100 = count % 100; + int rem10 = count % 10; + if (rem10 == 1 && rem100 != 11) { + return QUANTITY_ONE; + } else if (rem10 >= 2 && rem10 <= 4 && !(rem100 >= 12 && rem100 <= 14)) { + return QUANTITY_FEW; + } else { + return QUANTITY_OTHER; + } + } + } + public static class PluralRules_Arabic extends PluralRules { public int quantityForNumber(int count) { int rem100 = count % 100; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java index a7448260e..4bf027608 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java @@ -4081,7 +4081,7 @@ public class MessageObject { lastLineWidth = linesMaxWidth; } - linesMaxWidthWithLeft = lastLineWidthWithLeft = (int) Math.ceil(lastLine + lastLeft); + linesMaxWidthWithLeft = lastLineWidthWithLeft = (int) Math.ceil(linesMaxWidth + Math.max(0, lastLeft)); if (currentBlockLinesCount > 1) { boolean hasNonRTL = false; @@ -4094,10 +4094,6 @@ public class MessageObject { lineWidth = 0; } - if (lineWidth > maxWidth + 20) { - lineWidth = maxWidth; - } - try { lineLeft = block.textLayout.getLineLeft(n); } catch (Exception e) { @@ -4105,6 +4101,11 @@ public class MessageObject { lineLeft = 0; } + if (lineWidth > maxWidth + 20) { + lineWidth = maxWidth; + lineLeft = 0; + } + if (lineLeft > 0) { textXOffset = Math.min(textXOffset, lineLeft); block.directionFlags |= 1; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index a19dcf017..26523462d 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -4253,7 +4253,7 @@ public class MessagesController extends BaseController implements NotificationCe } public void deleteDialog(final long did, final int onlyHistory, boolean revoke) { - deleteDialog(did, true, onlyHistory, 0, revoke, null, 0); + deleteDialog(did, 1, onlyHistory, 0, revoke, null, 0); } public void setDialogsInTransaction(boolean transaction) { @@ -4263,11 +4263,16 @@ public class MessagesController extends BaseController implements NotificationCe } } - protected void deleteDialog(final long did, final boolean first, final int onlyHistory, final int max_id, boolean revoke, TLRPC.InputPeer peer, final long taskId) { + protected void deleteDialog(long did, int first, int onlyHistory, int max_id, boolean revoke, TLRPC.InputPeer peer, long taskId) { if (onlyHistory == 2) { getMessagesStorage().deleteDialog(did, onlyHistory); return; } + if (first == 1 && max_id == 0) { + TLRPC.InputPeer peerFinal = peer; + getMessagesStorage().getDialogMaxMessageId(did, (param) -> deleteDialog(did, 2, onlyHistory, Math.max(0, param), revoke, peerFinal, taskId)); + return; + } if (onlyHistory == 0 || onlyHistory == 3) { getMediaDataController().uninstallShortcut(did); } @@ -4275,15 +4280,8 @@ public class MessagesController extends BaseController implements NotificationCe int high_id = (int) (did >> 32); int max_id_delete = max_id; - if (first) { + if (first != 0) { boolean isPromoDialog = false; - boolean emptyMax = max_id_delete == 0; - if (emptyMax) { - int max = getMessagesStorage().getDialogMaxMessageId(did); - if (max > 0) { - max_id_delete = Math.max(max, max_id_delete); - } - } getMessagesStorage().deleteDialog(did, onlyHistory); TLRPC.Dialog dialog = dialogs_dict.get(did); if (onlyHistory == 0 || onlyHistory == 3) { @@ -4293,7 +4291,7 @@ public class MessagesController extends BaseController implements NotificationCe getMediaDataController().cleanDraft(did, 0, false); } if (dialog != null) { - if (emptyMax) { + if (first == 2) { max_id_delete = Math.max(0, dialog.top_message); max_id_delete = Math.max(max_id_delete, dialog.read_inbox_max_id); max_id_delete = Math.max(max_id_delete, dialog.read_outbox_max_id); @@ -4373,7 +4371,7 @@ public class MessagesController extends BaseController implements NotificationCe } } } - if (emptyMax) { + if (first == 2) { Integer max = dialogs_read_inbox_max.get(did); if (max != null) { max_id_delete = Math.max(max, max_id_delete); @@ -4420,7 +4418,7 @@ public class MessagesController extends BaseController implements NotificationCe data = new NativeByteBuffer(4 + 8 + 4 + 4 + 4 + 4 + peer.getObjectSize()); data.writeInt32(13); data.writeInt64(did); - data.writeBool(first); + data.writeBool(first != 0); data.writeInt32(onlyHistory); data.writeInt32(max_id_delete); data.writeBool(revoke); @@ -4468,7 +4466,7 @@ public class MessagesController extends BaseController implements NotificationCe if (error == null) { TLRPC.TL_messages_affectedHistory res = (TLRPC.TL_messages_affectedHistory) response; if (res.offset > 0) { - deleteDialog(did, false, onlyHistory, max_id_delete_final, revoke, peerFinal, 0); + deleteDialog(did, 0, onlyHistory, max_id_delete_final, revoke, peerFinal, 0); } processNewDifferenceParams(-1, res.pts, -1, res.pts_count); getMessagesStorage().onDeleteQueryComplete(did); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java index 3fc8f1222..f3f83758a 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java @@ -1224,7 +1224,7 @@ public class MessagesStorage extends BaseController { final int maxIdDelete = data.readInt32(false); final boolean revoke = data.readBool(false); TLRPC.InputPeer inputPeer = TLRPC.InputPeer.TLdeserialize(data, data.readInt32(false), false); - AndroidUtilities.runOnUIThread(() -> getMessagesController().deleteDialog(did, first, onlyHistory, maxIdDelete, revoke, inputPeer, taskId)); + AndroidUtilities.runOnUIThread(() -> getMessagesController().deleteDialog(did, first ? 1 : 0, onlyHistory, maxIdDelete, revoke, inputPeer, taskId)); break; } case 15: { @@ -10863,11 +10863,10 @@ public class MessagesStorage extends BaseController { }); } - public int getDialogMaxMessageId(final long dialog_id) { - final CountDownLatch countDownLatch = new CountDownLatch(1); - final Integer[] max = new Integer[]{0}; + public void getDialogMaxMessageId(final long dialog_id, IntCallback callback) { storageQueue.postRunnable(() -> { SQLiteCursor cursor = null; + int[] max = new int[1]; try { cursor = database.queryFinalized("SELECT MAX(mid) FROM messages WHERE uid = " + dialog_id); if (cursor.next()) { @@ -10880,14 +10879,8 @@ public class MessagesStorage extends BaseController { cursor.dispose(); } } - countDownLatch.countDown(); + AndroidUtilities.runOnUIThread(() -> callback.run(max[0])); }); - try { - countDownLatch.await(); - } catch (Exception e) { - FileLog.e(e); - } - return max[0]; } public int getDialogReadMax(final boolean outbox, final long dialog_id) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java index 27568aeb1..605a45a60 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java @@ -276,7 +276,7 @@ public class NotificationCenter { public int setAnimationInProgress(int oldIndex, int[] allowedNotifications, boolean stopHeavyOperations) { onAnimationFinish(oldIndex); if (heavyOperationsCounter.isEmpty() && stopHeavyOperations) { - NotificationCenter.getGlobalInstance().postNotificationName(stopAllHeavyOperations, 512); + getGlobalInstance().postNotificationName(stopAllHeavyOperations, 512); } animationInProgressCount++; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java index 6a65e75e7..7f2282227 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java @@ -878,7 +878,9 @@ public class SendMessagesHelper extends BaseController implements NotificationCe message.messageObjects.remove(index); message.messages.remove(index); message.originalPaths.remove(index); - message.parentObjects.remove(index); + if (!message.parentObjects.isEmpty()) { + message.parentObjects.remove(index); + } if (message.sendRequest != null) { TLRPC.TL_messages_sendMultiMedia request = (TLRPC.TL_messages_sendMultiMedia) message.sendRequest; request.multi_media.remove(index); @@ -5465,7 +5467,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe docType[0] = 0; } } - if (groupId != null) { + if (!isEncrypted && groupId != null) { if (docType != null && prevType != null && prevType != docType[0]) { finishGroup(accountInstance, groupId[0], scheduleDate); groupId[0] = Utilities.random.nextLong(); @@ -5525,7 +5527,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe enryptedLayer = AndroidUtilities.getPeerLayerVersion(encryptedChat.layer); } } - if ((!isEncrypted || enryptedLayer >= 73) && count > 1 && mediaCount % 10 == 0) { + if (!isEncrypted && count > 1 && mediaCount % 10 == 0) { groupId = Utilities.random.nextLong(); mediaCount = 0; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java index dec14abd3..7156a9b5f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java @@ -271,6 +271,12 @@ public class BaseFragment { return false; } + protected void resumeDelayedFragmentAnimation() { + if (parentLayout != null) { + parentLayout.resumeDelayedFragmentAnimation(); + } + } + public void onResume() { isPaused = false; } 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 3de588c6c..264d36633 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -3414,7 +3414,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate try { int width = (int) Math.ceil(Theme.chat_replyNamePaint.measureText(site_name) + 1); siteNameLayout = new StaticLayout(site_name, Theme.chat_replyNamePaint, Math.min(width, linkPreviewMaxWidth), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); - siteNameRtl = siteNameLayout.getLineLeft(0) != 0; + siteNameRtl = Math.max(siteNameLayout.getLineLeft(0), 0) != 0; int height = siteNameLayout.getLineBottom(siteNameLayout.getLineCount() - 1); linkPreviewHeight += height; totalHeight += height; @@ -3448,7 +3448,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate totalHeight += height; boolean checkForRtl = true; for (int a = 0; a < titleLayout.getLineCount(); a++) { - int lineLeft = (int) titleLayout.getLineLeft(a); + int lineLeft = (int) Math.max(0, titleLayout.getLineLeft(a)); if (lineLeft != 0) { titleIsRTL = true; } @@ -3497,7 +3497,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate int height = authorLayout.getLineBottom(authorLayout.getLineCount() - 1); linkPreviewHeight += height; totalHeight += height; - int lineLeft = (int) authorLayout.getLineLeft(0); + int lineLeft = (int) Math.max(authorLayout.getLineLeft(0), 0); authorX = -lineLeft; int width; if (lineLeft != 0) { @@ -3536,7 +3536,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate boolean hasRTL = false; for (int a = 0; a < descriptionLayout.getLineCount(); a++) { int lineLeft = (int) Math.ceil(descriptionLayout.getLineLeft(a)); - if (lineLeft != 0) { + if (lineLeft > 0) { hasRTL = true; if (descriptionX == 0) { descriptionX = -lineLeft; @@ -3554,7 +3554,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } int width; - if (lineLeft != 0) { + if (lineLeft > 0) { width = textWidth - lineLeft; } else { if (hasRTL) { @@ -4240,7 +4240,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate boolean titleRtl = false; if (titleLayout != null) { for (int a = 0, N = titleLayout.getLineCount(); a < N; a++) { - if (titleLayout.getLineLeft(a) != 0) { + if (titleLayout.getLineLeft(a) > 0) { titleRtl = true; break; } @@ -12691,7 +12691,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } public float getNonAnimationTranslationX(boolean update) { - if (!currentMessageObject.isOutOwner()) { + if (currentMessageObject != null && !currentMessageObject.isOutOwner()) { if (update && (checkBoxVisible || checkBoxAnimationInProgress)) { Interpolator interpolator = checkBoxVisible ? CubicBezierInterpolator.EASE_OUT : CubicBezierInterpolator.EASE_IN; checkBoxTranslation = (int) Math.ceil(interpolator.getInterpolation(checkBoxAnimationProgress) * AndroidUtilities.dp(35)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java index 289623915..4f9105bfb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java @@ -1715,7 +1715,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio @Override public void onTransitionAnimationStart(boolean isOpen, boolean backward) { if (isOpen) { - allowAnimationIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(allowAnimationIndex, new int[]{NotificationCenter.chatInfoDidLoad, NotificationCenter.dialogsNeedReload, + allowAnimationIndex = getNotificationCenter().setAnimationInProgress(allowAnimationIndex, new int[]{NotificationCenter.chatInfoDidLoad, NotificationCenter.dialogsNeedReload, NotificationCenter.closeChats, NotificationCenter.messagesDidLoad, NotificationCenter.botKeyboardDidLoad/*, NotificationCenter.botInfoDidLoad*/}); openAnimationEnded = false; } @@ -1724,7 +1724,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio @Override public void onTransitionAnimationEnd(boolean isOpen, boolean backward) { if (isOpen) { - NotificationCenter.getInstance(currentAccount).onAnimationFinish(allowAnimationIndex); + getNotificationCenter().onAnimationFinish(allowAnimationIndex); openAnimationEnded = true; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index ea45fb6e1..eca004c57 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -490,6 +490,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private boolean openAnimationEnded; private boolean fragmentOpened; + private boolean fragmentBeginToShow; private long openAnimationStartTime; private boolean scrollToTopOnResume; @@ -634,6 +635,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private long activityResumeTime; private int transitionAnimationIndex; + private int scrollAnimationIndex; private final static int[] allowedNotificationsDuringChatListAnimations = new int[]{ NotificationCenter.messagesRead, NotificationCenter.threadMessagesRead, @@ -1486,6 +1488,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (chatAttachAlert != null) { chatAttachAlert.dismissInternal(); } + getNotificationCenter().onAnimationFinish(transitionAnimationIndex); + getNotificationCenter().onAnimationFinish(scrollAnimationIndex); hideUndoViews(); if (chatInviteRunnable != null) { AndroidUtilities.cancelRunOnUIThread(chatInviteRunnable); @@ -4020,13 +4024,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (MessagesController.getGlobalMainSettings().getBoolean("view_animations", true)) { chatListItemAniamtor = new ChatListItemAnimator(this, chatListView) { - int index = -1; Runnable finishRunnable; @Override public void onAnimationStart() { - if (index == -1) { - index = getNotificationCenter().setAnimationInProgress(index, allowedNotificationsDuringChatListAnimations, false); + if (scrollAnimationIndex == -1) { + scrollAnimationIndex = getNotificationCenter().setAnimationInProgress(scrollAnimationIndex, allowedNotificationsDuringChatListAnimations, false); } if (finishRunnable != null) { AndroidUtilities.cancelRunOnUIThread(finishRunnable); @@ -4048,9 +4051,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not scrollToMessageId(nextScrollToMessageId, nextScrollFromMessageId, nextScrollSelect, nextScrollLoadIndex, nextScrollForce); nextScrollToMessageId = 0; } - if (index != -1) { - getNotificationCenter().onAnimationFinish(index); - index = -1; + if (scrollAnimationIndex != -1) { + getNotificationCenter().onAnimationFinish(scrollAnimationIndex); + scrollAnimationIndex = -1; } if (BuildVars.LOGS_ENABLED) { FileLog.d("chatItemAnimator enable notifications"); @@ -4066,9 +4069,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not AndroidUtilities.cancelRunOnUIThread(finishRunnable); } AndroidUtilities.runOnUIThread(finishRunnable = () -> { - if (index != -1) { - getNotificationCenter().onAnimationFinish(index); - index = -1; + if (scrollAnimationIndex != -1) { + getNotificationCenter().onAnimationFinish(scrollAnimationIndex); + scrollAnimationIndex = -1; } if (BuildVars.LOGS_ENABLED) { FileLog.d("chatItemAnimator enable notifications"); @@ -11158,11 +11161,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } else { doNotRemoveLoadIndex = false; } - if (!doNotRemoveLoadIndex && !openAnimationEnded) { + if (!doNotRemoveLoadIndex && !fragmentBeginToShow && !paused) { int[] alowedNotifications = new int[]{NotificationCenter.chatInfoDidLoad, NotificationCenter.dialogsNeedReload, NotificationCenter.scheduledMessagesUpdated, NotificationCenter.closeChats, NotificationCenter.botKeyboardDidLoad, NotificationCenter.userInfoDidLoad, NotificationCenter.pinnedInfoDidLoad, NotificationCenter.needDeleteDialog/*, NotificationCenter.botInfoDidLoad*/}; if (transitionAnimationIndex == 0) { transitionAnimationIndex = getNotificationCenter().setAnimationInProgress(transitionAnimationIndex, alowedNotifications); + AndroidUtilities.runOnUIThread(() -> getNotificationCenter().onAnimationFinish(transitionAnimationIndex), 800); } else { getNotificationCenter().updateAllowedNotifications(transitionAnimationIndex, alowedNotifications); } @@ -11371,9 +11375,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not firstLoading = false; AndroidUtilities.runOnUIThread(() -> { getNotificationCenter().runDelayedNotifications(); - if (parentLayout != null) { - parentLayout.resumeDelayedFragmentAnimation(); - } + resumeDelayedFragmentAnimation(); }); } @@ -14945,6 +14947,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not public void onTransitionAnimationStart(boolean isOpen, boolean backward) { int[] alowedNotifications = null; if (isOpen) { + fragmentBeginToShow = true; if (transitionAnimationIndex == 0) { alowedNotifications = new int[]{ NotificationCenter.dialogsNeedReload, NotificationCenter.closeChats, diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java index ab21ff369..b9a8402db 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java @@ -1890,9 +1890,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente req.offset = offset; req.limit = count; int reqId = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (parentLayout != null) { - parentLayout.resumeDelayedFragmentAnimation(); - } + resumeDelayedFragmentAnimation(); if (error == null) { TLRPC.TL_channels_channelParticipants res = (TLRPC.TL_channels_channelParticipants) response; if (type == TYPE_ADMIN) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java index 6b2746381..7b9506118 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -3367,13 +3367,13 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (currentTopViewAnimation != null && currentTopViewAnimation.equals(animation)) { currentTopViewAnimation = null; } - NotificationCenter.getGlobalInstance().onAnimationFinish(notificationsIndex); + NotificationCenter.getInstance(currentAccount).onAnimationFinish(notificationsIndex); } }); currentTopViewAnimation.setDuration(250); currentTopViewAnimation.setInterpolator(CubicBezierInterpolator.DEFAULT); currentTopViewAnimation.start(); - notificationsIndex = NotificationCenter.getGlobalInstance().setAnimationInProgress(notificationsIndex, null); + notificationsIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(notificationsIndex, null); } else { topViewEnterProgress = 1f; topView.setTranslationY(0); @@ -3673,6 +3673,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe public void setDialogId(long id, int account) { dialog_id = id; if (currentAccount != account) { + NotificationCenter.getInstance(currentAccount).onAnimationFinish(notificationsIndex); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.recordStarted); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.recordStartError); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.recordStopped); @@ -6622,12 +6623,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (delegate != null) { delegate.bottomPanelTranslationYChanged(0); } - NotificationCenter.getGlobalInstance().onAnimationFinish(notificationsIndex); + NotificationCenter.getInstance(currentAccount).onAnimationFinish(notificationsIndex); requestLayout(); } }); panelAnimation.start(); - notificationsIndex = NotificationCenter.getGlobalInstance().setAnimationInProgress(notificationsIndex, null); + notificationsIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(notificationsIndex, null); requestLayout(); } } @@ -6665,11 +6666,11 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (delegate != null) { delegate.bottomPanelTranslationYChanged(0); } - NotificationCenter.getInstance(UserConfig.selectedAccount).onAnimationFinish(notificationsIndex); + NotificationCenter.getInstance(currentAccount).onAnimationFinish(notificationsIndex); requestLayout(); } }); - notificationsIndex = NotificationCenter.getInstance(UserConfig.selectedAccount).setAnimationInProgress(notificationsIndex, null); + notificationsIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(notificationsIndex, null); panelAnimation.start(); requestLayout(); } else { @@ -6709,14 +6710,14 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe panelAnimation = null; botKeyboardView.setTranslationY(0); botKeyboardView.setVisibility(GONE); - NotificationCenter.getInstance(UserConfig.selectedAccount).onAnimationFinish(notificationsIndex); + NotificationCenter.getInstance(currentAccount).onAnimationFinish(notificationsIndex); if (delegate != null) { delegate.bottomPanelTranslationYChanged(0); } requestLayout(); } }); - notificationsIndex = NotificationCenter.getInstance(UserConfig.selectedAccount).setAnimationInProgress(notificationsIndex, null); + notificationsIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(notificationsIndex, null); panelAnimation.start(); requestLayout(); } else { @@ -6998,11 +6999,11 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe delegate.bottomPanelTranslationYChanged(0); } requestLayout(); - NotificationCenter.getGlobalInstance().onAnimationFinish(notificationsIndex); + NotificationCenter.getInstance(currentAccount).onAnimationFinish(notificationsIndex); } }); panelAnimation.start(); - notificationsIndex = NotificationCenter.getGlobalInstance().setAnimationInProgress(notificationsIndex, null); + notificationsIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(notificationsIndex, null); requestLayout(); } } @@ -7383,12 +7384,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe public void onAnimationEnd(Animator animation) { stickersExpansionAnim = null; emojiView.setLayerType(LAYER_TYPE_NONE, null); - NotificationCenter.getGlobalInstance().onAnimationFinish(notificationsIndex); + NotificationCenter.getInstance(currentAccount).onAnimationFinish(notificationsIndex); } }); stickersExpansionAnim = anims; emojiView.setLayerType(LAYER_TYPE_HARDWARE, null); - notificationsIndex = NotificationCenter.getGlobalInstance().setAnimationInProgress(notificationsIndex, null); + notificationsIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(notificationsIndex, null); stickersExpansionProgress = 0f; sizeNotifierLayout.invalidate(); anims.start(); @@ -7431,14 +7432,14 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (keyboardVisible && isPopupShowing()) { showPopup(0, currentPopupContentType); } - NotificationCenter.getGlobalInstance().onAnimationFinish(notificationsIndex); + NotificationCenter.getInstance(currentAccount).onAnimationFinish(notificationsIndex); } }); stickersExpansionProgress = 1f; sizeNotifierLayout.invalidate(); stickersExpansionAnim = anims; emojiView.setLayerType(LAYER_TYPE_HARDWARE, null); - notificationsIndex = NotificationCenter.getGlobalInstance().setAnimationInProgress(notificationsIndex, null); + notificationsIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(notificationsIndex, null); anims.start(); } else { stickersExpansionProgress = 0; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java index adccb9888..2181d6421 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java @@ -79,6 +79,8 @@ public class FragmentContextView extends FrameLayout implements NotificationCent private boolean isMusic; private boolean supportsCalls = true; + private int account = UserConfig.selectedAccount; + private boolean isLocation; private FragmentContextViewDelegate delegate; @@ -715,7 +717,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - NotificationCenter.getInstance(UserConfig.selectedAccount).onAnimationFinish(animationIndex); + NotificationCenter.getInstance(account).onAnimationFinish(animationIndex); if (animatorSet != null && animatorSet.equals(animation)) { setVisibility(GONE); if (delegate != null) { @@ -726,7 +728,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent } }); animatorSet.start(); - animationIndex = NotificationCenter.getInstance(UserConfig.selectedAccount).setAnimationInProgress(animationIndex, null); + animationIndex = NotificationCenter.getInstance(account).setAnimationInProgress(animationIndex, null); } } } else { @@ -765,7 +767,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - NotificationCenter.getInstance(UserConfig.selectedAccount).onAnimationFinish(animationIndex); + NotificationCenter.getInstance(account).onAnimationFinish(animationIndex); if (animatorSet != null && animatorSet.equals(animation)) { if (delegate != null) { delegate.onAnimation(false, true); @@ -775,7 +777,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent } }); animatorSet.start(); - animationIndex = NotificationCenter.getInstance(UserConfig.selectedAccount).setAnimationInProgress(animationIndex, null); + animationIndex = NotificationCenter.getInstance(account).setAnimationInProgress(animationIndex, null); } visible = true; setVisibility(VISIBLE); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/VoIPPiPView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/VoIPPiPView.java index d04c2f028..7baceb7bb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/VoIPPiPView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/VoIPPiPView.java @@ -102,6 +102,8 @@ public class VoIPPiPView implements VoIPBaseService.StateListener, NotificationC long startTime; int animationIndex = -1; + private int currentAccount; + Runnable collapseRunnable = new Runnable() { @Override public void run() { @@ -134,7 +136,7 @@ public class VoIPPiPView implements VoIPBaseService.StateListener, NotificationC } }; - public static void show(Activity activity, int parentWidth, int parentHeight, int animationType) { + public static void show(Activity activity, int account, int parentWidth, int parentHeight, int animationType) { if (instance != null || VideoCameraCapturer.eglBase == null) { return; } @@ -142,6 +144,7 @@ public class VoIPPiPView implements VoIPBaseService.StateListener, NotificationC instance = new VoIPPiPView(activity, parentWidth, parentHeight, false); WindowManager wm = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE); + instance.currentAccount = account; instance.windowManager = wm; instance.windowLayoutParams = windowLayoutParams; SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("voippipconfig", Context.MODE_PRIVATE); @@ -334,7 +337,7 @@ public class VoIPPiPView implements VoIPBaseService.StateListener, NotificationC enlargeIcon.setOnClickListener((v) -> { if (context instanceof LaunchActivity && !ApplicationLoader.mainInterfacePaused) { - VoIPFragment.show((Activity) context); + VoIPFragment.show((Activity) context, currentAccount); } else if (context instanceof LaunchActivity) { Intent intent = new Intent(context, LaunchActivity.class); intent.setAction("voip"); @@ -588,7 +591,7 @@ public class VoIPPiPView implements VoIPBaseService.StateListener, NotificationC if (event.getAction() == MotionEvent.ACTION_UP && !moving && System.currentTimeMillis() - startTime < 150) { Context context = getContext(); if (context instanceof LaunchActivity && !ApplicationLoader.mainInterfacePaused) { - VoIPFragment.show((Activity) context); + VoIPFragment.show((Activity) context, currentAccount); } else if (context instanceof LaunchActivity) { Intent intent = new Intent(context, LaunchActivity.class); intent.setAction("voip"); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java index cbd4addab..f24f69ff5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java @@ -239,7 +239,6 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen public void onAnimationEnd(Animator animation) { NotificationCenter.getInstance(currentAccount).onAnimationFinish(animationIndex); requestLayout(); - super.onAnimationEnd(animation); } }); animationIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(animationIndex, null); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index c582c3ce1..9307066aa 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -2236,7 +2236,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa } if (isVoipIntent) { - VoIPFragment.show(this); + VoIPFragment.show(this, intentAccount[0]); } intent.setAction(null); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java index 2c6168ad4..13beb9e6a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java @@ -1448,7 +1448,7 @@ public class ThemePreviewActivity extends BaseFragment implements DownloadContro public int getDefaultColor(int num) { if (colorType == 3 && applyingTheme.firstAccentIsDefault && num == 0) { Theme.ThemeAccent accent = applyingTheme.themeAccentsMap.get(Theme.DEFALT_THEME_ACCENT_ID); - return accent.myMessagesAccentColor; + return accent != null ? accent.myMessagesAccentColor : 0; } return 0; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java index e5285e724..2d19ad84b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java @@ -99,6 +99,8 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification private final static int STATE_FULLSCREEN = 1; private final static int STATE_FLOATING = 2; + private int currentAccount; + Activity activity; TLRPC.User currentUser; @@ -205,12 +207,11 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification private boolean screenWasWakeup; private boolean isVideoCall; - public static void show(Activity activity) { - show(activity, false); + public static void show(Activity activity, int account) { + show(activity, false, account); } - - public static void show(Activity activity, boolean overlay) { + public static void show(Activity activity, boolean overlay, int account) { if (instance != null && instance.windowView.getParent() == null) { if (instance != null) { instance.callingUserTextureView.renderer.release(); @@ -229,6 +230,7 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification } VoIPFragment fragment = new VoIPFragment(); fragment.activity = activity; + fragment.currentAccount = account; instance = fragment; VoIPWindowView windowView = new VoIPWindowView(activity, !transitionFromPip) { @Override @@ -333,7 +335,7 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification h -= instance.lastInsets.getSystemWindowInsetBottom(); } if (instance.canSwitchToPip) { - VoIPPiPView.show(instance.activity, instance.windowView.getMeasuredWidth(), h, VoIPPiPView.ANIMATION_ENTER_TYPE_SCALE); + VoIPPiPView.show(instance.activity, instance.currentAccount, instance.windowView.getMeasuredWidth(), h, VoIPPiPView.ANIMATION_ENTER_TYPE_SCALE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH && instance.lastInsets != null) { VoIPPiPView.topInset = instance.lastInsets.getSystemWindowInsetTop(); VoIPPiPView.bottomInset = instance.lastInsets.getSystemWindowInsetBottom(); @@ -379,13 +381,13 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification } public VoIPFragment() { - currentUser = MessagesController.getInstance(UserConfig.selectedAccount).getUser(UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId()); + currentUser = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId()); callingUser = VoIPService.getSharedInstance().getUser(); VoIPService.getSharedInstance().registerStateListener(this); isOutgoing = VoIPService.getSharedInstance().isOutgoing(); previousState = -1; currentState = VoIPService.getSharedInstance().getCallState(); - NotificationCenter.getInstance(UserConfig.selectedAccount).addObserver(this, NotificationCenter.voipServiceCreated); + NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.voipServiceCreated); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiDidLoad); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.closeInCallActivity); } @@ -395,7 +397,7 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification if (service != null) { service.unregisterStateListener(this); } - NotificationCenter.getInstance(UserConfig.selectedAccount).removeObserver(this, NotificationCenter.voipServiceCreated); + NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.voipServiceCreated); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiDidLoad); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.closeInCallActivity); } @@ -732,7 +734,7 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification intent.putExtra("start_incall_activity", false); intent.putExtra("video_call", isVideoCall); intent.putExtra("can_video_call", isVideoCall); - intent.putExtra("account", UserConfig.selectedAccount); + intent.putExtra("account", currentAccount); try { activity.startService(intent); } catch (Throwable e) { @@ -863,7 +865,7 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH && instance.lastInsets != null) { h -= instance.lastInsets.getSystemWindowInsetBottom(); } - VoIPPiPView.show(instance.activity, instance.windowView.getMeasuredWidth(), h, VoIPPiPView.ANIMATION_ENTER_TYPE_TRANSITION); + VoIPPiPView.show(instance.activity, instance.currentAccount, instance.windowView.getMeasuredWidth(), h, VoIPPiPView.ANIMATION_ENTER_TYPE_TRANSITION); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH && instance.lastInsets != null) { VoIPPiPView.topInset = instance.lastInsets.getSystemWindowInsetTop(); VoIPPiPView.bottomInset = instance.lastInsets.getSystemWindowInsetBottom(); @@ -883,13 +885,13 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification VoIPPiPView.switchingToPip = true; switchingToPip = true; Animator animator = createPiPTransition(false); - animationIndex = NotificationCenter.getInstance(UserConfig.selectedAccount).setAnimationInProgress(animationIndex, null); + animationIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(animationIndex, null); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { VoIPPiPView.getInstance().windowView.setAlpha(1f); AndroidUtilities.runOnUIThread(() -> { - NotificationCenter.getInstance(UserConfig.selectedAccount).onAnimationFinish(animationIndex); + NotificationCenter.getInstance(currentAccount).onAnimationFinish(animationIndex); VoIPPiPView.getInstance().onTransitionEnd(); currentUserCameraFloatingLayout.setCornerRadius(-1f); callingUserTextureView.renderer.release(); @@ -920,7 +922,7 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification switchingToPip = true; VoIPPiPView.switchingToPip = true; VoIPPiPView.prepareForTransition(); - animationIndex = NotificationCenter.getInstance(UserConfig.selectedAccount).setAnimationInProgress(animationIndex, null); + animationIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(animationIndex, null); AndroidUtilities.runOnUIThread(() -> { windowView.setAlpha(1f); Animator animator = createPiPTransition(true); @@ -953,7 +955,7 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - NotificationCenter.getInstance(UserConfig.selectedAccount).onAnimationFinish(animationIndex); + NotificationCenter.getInstance(currentAccount).onAnimationFinish(animationIndex); currentUserCameraFloatingLayout.setCornerRadius(-1f); switchingToPip = false; currentUserCameraFloatingLayout.switchingToPip = false; @@ -1252,7 +1254,7 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification intent.putExtra("start_incall_activity", false); intent.putExtra("video_call", false); intent.putExtra("can_video_call", false); - intent.putExtra("account", UserConfig.selectedAccount); + intent.putExtra("account", currentAccount); try { activity.startService(intent); } catch (Throwable e) { @@ -2052,7 +2054,7 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH && instance.lastInsets != null) { h -= instance.lastInsets.getSystemWindowInsetBottom(); } - VoIPPiPView.show(instance.activity, instance.windowView.getMeasuredWidth(), h, VoIPPiPView.ANIMATION_ENTER_TYPE_SCALE); + VoIPPiPView.show(instance.activity, instance.currentAccount, instance.windowView.getMeasuredWidth(), h, VoIPPiPView.ANIMATION_ENTER_TYPE_SCALE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH && instance.lastInsets != null) { VoIPPiPView.topInset = instance.lastInsets.getSystemWindowInsetTop(); VoIPPiPView.bottomInset = instance.lastInsets.getSystemWindowInsetBottom();