From 99f5637dda59bc405734342d3e2448701d63f2d3 Mon Sep 17 00:00:00 2001 From: DrKLO Date: Fri, 2 Oct 2020 14:25:02 +0300 Subject: [PATCH] Update to 7.1.1 (2096) --- TMessagesProj/build.gradle | 2 +- .../org/telegram/messenger/BuildVars.java | 2 +- .../org/telegram/messenger/ImageReceiver.java | 12 ++- .../messenger/MessagesController.java | 2 +- .../ui/ActionBar/ActionBarMenuItem.java | 4 +- .../java/org/telegram/ui/ActionBar/Theme.java | 6 +- .../ui/Adapters/DialogsSearchAdapter.java | 69 ++++++++---- .../telegram/ui/Cells/ChatMessageCell.java | 41 +++++-- .../telegram/ui/Cells/SharedAudioCell.java | 2 +- .../org/telegram/ui/Cells/SharedLinkCell.java | 8 +- .../java/org/telegram/ui/ChatActivity.java | 28 ++--- .../ui/Components/ChatActivityEnterView.java | 4 +- .../ChatAttachAlertAudioLayout.java | 1 + .../ChatAttachAlertPhotoLayout.java | 14 +-- .../PhotoViewerCaptionEnterView.java | 10 +- .../ui/Components/SearchViewPager.java | 101 +++++++++++++++++- .../java/org/telegram/ui/DialogsActivity.java | 36 ++++++- .../java/org/telegram/ui/LaunchActivity.java | 12 +-- .../java/org/telegram/ui/PhotoViewer.java | 34 +++--- .../java/org/telegram/ui/ProfileActivity.java | 3 + 20 files changed, 283 insertions(+), 108 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 7c096f099..4202effc1 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -284,7 +284,7 @@ android { } } - defaultConfig.versionCode = 2094 + defaultConfig.versionCode = 2096 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 1a55fcf4d..880b6344d 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 = 2094; + public static int BUILD_VERSION = 2096; public static String BUILD_VERSION_STRING = "7.1.0"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java b/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java index 06abf13ea..1e3849abb 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java @@ -853,12 +853,16 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg bitmapH = bitmapDrawable.getIntrinsicHeight(); } } else { + Bitmap bitmap = bitmapDrawable.getBitmap(); + if (bitmap != null && bitmap.isRecycled()) { + return; + } if (orientation % 360 == 90 || orientation % 360 == 270) { - bitmapW = bitmapDrawable.getBitmap().getHeight(); - bitmapH = bitmapDrawable.getBitmap().getWidth(); + bitmapW = bitmap.getHeight(); + bitmapH = bitmap.getWidth(); } else { - bitmapW = bitmapDrawable.getBitmap().getWidth(); - bitmapH = bitmapDrawable.getBitmap().getHeight(); + bitmapW = bitmap.getWidth(); + bitmapH = bitmap.getHeight(); } } float realImageW = imageW - sideClip * 2; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index 2dc03ee48..21db67783 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -4562,7 +4562,7 @@ public class MessagesController extends BaseController implements NotificationCe if ((messageViews.flags & 2) != 0) { if (forwards == null) { forwards = new SparseIntArray(); - channelViews.put(key, forwards); + channelForwards.put(key, forwards); } forwards.put(req.id.get(a1), messageViews.forwards); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java index 6f5736665..3efd8f4d8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java @@ -910,7 +910,7 @@ public class ActionBarMenuItem extends FrameLayout { ignoreRequestLayout = true; measureChildWithMargins(searchFilterLayout, widthMeasureSpec, width, heightMeasureSpec, 0); int filterWidth = searchFilterLayout.getVisibility() == View.VISIBLE ? searchFilterLayout.getMeasuredWidth() : 0; - measureChildWithMargins(searchField, widthMeasureSpec, width + filterWidth, heightMeasureSpec, 0); + measureChildWithMargins(searchField, MeasureSpec.makeMeasureSpec(minWidth - AndroidUtilities.dp(6), MeasureSpec.UNSPECIFIED), width + filterWidth, heightMeasureSpec, 0); ignoreRequestLayout = false; setMeasuredDimension(Math.max(filterWidth + searchField.getMeasuredWidth(), minWidth), MeasureSpec.getSize(heightMeasureSpec)); } @@ -1109,7 +1109,7 @@ public class ActionBarMenuItem extends FrameLayout { searchContainer.addView(searchFilterLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 32, Gravity.CENTER_VERTICAL, 0, 0, 48, 0)); } else { searchContainer.addView(searchFilterLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 32, Gravity.CENTER_VERTICAL, 0, 0, 48, 0)); - searchContainer.addView(searchField, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.CENTER_VERTICAL, 0, 0, 0, 0)); + searchContainer.addView(searchField, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.CENTER_VERTICAL, 0, 0, wrapInScrollView ? 0 : 48, 0)); searchContainer.addView(searchFieldCaption, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.CENTER_VERTICAL | Gravity.RIGHT, 0, 5.5f, 48, 0)); } searchFilterLayout.setClipChildren(false); 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 540c0b8a3..969e81f57 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -7428,7 +7428,7 @@ public class Theme { color = defaultColors.get(key); } } - if (color != null && (key_windowBackgroundWhite.equals(key) || key_windowBackgroundGray.equals(key))) { + if (color != null && (key_windowBackgroundWhite.equals(key) || key_windowBackgroundGray.equals(key) || key_actionBarDefault.equals(key) || key_actionBarDefaultArchived.equals(key))) { color |= 0xff000000; } return color; @@ -7520,14 +7520,14 @@ public class Theme { return getDefaultColor(key); } } - if (key_windowBackgroundWhite.equals(key) || key_windowBackgroundGray.equals(key)) { + if (key_windowBackgroundWhite.equals(key) || key_windowBackgroundGray.equals(key) || key_actionBarDefault.equals(key) || key_actionBarDefaultArchived.equals(key)) { color |= 0xff000000; } return color; } public static void setColor(String key, int color, boolean useDefault) { - if (key.equals(key_chat_wallpaper) || key.equals(key_chat_wallpaper_gradient_to) || key.equals(key_windowBackgroundWhite) || key.equals(key_windowBackgroundGray)) { + if (key.equals(key_chat_wallpaper) || key.equals(key_chat_wallpaper_gradient_to) || key.equals(key_windowBackgroundWhite) || key.equals(key_windowBackgroundGray) || key.equals(key_actionBarDefault) || key.equals(key_actionBarDefaultArchived)) { color = 0xff000000 | color; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsSearchAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsSearchAdapter.java index 07a83dcaf..c5516f9f1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsSearchAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsSearchAdapter.java @@ -56,6 +56,8 @@ import java.util.concurrent.ConcurrentHashMap; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.google.android.exoplayer2.util.Log; + public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { private Context mContext; @@ -93,6 +95,10 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { private FilteredSearchView.Delegate filtersDelegate; private int folderId; + public boolean isSearching() { + return waitingResponseCount > 0; + } + public static class DialogSearchResult { public TLObject object; public int date; @@ -106,10 +112,11 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { } public interface DialogsSearchAdapterDelegate { - void searchStateChanged(boolean searching); + void searchStateChanged(boolean searching, boolean animated); void didPressedOnSubDialog(long did); void needRemoveHint(int did); void needClearList(); + void runResultsEnterAnimation(); } private class CategoryAdapterRecycler extends RecyclerListView.SelectionAdapter { @@ -171,6 +178,8 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { searchAdapterHelper.setDelegate(new SearchAdapterHelper.SearchAdapterHelperDelegate() { @Override public void onDataSetChanged(int searchId) { + waitingResponseCount--; + Log.d("kek", "data set change " + waitingResponseCount); lastGlobalSearchId = searchId; if (lastLocalSearchId != searchId) { searchResult.clear(); @@ -179,10 +188,13 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { searchResultMessages.clear(); } searchWas = true; - if (!searchAdapterHelper.isSearchInProgress() && delegate != null && reqId == 0) { - delegate.searchStateChanged(false); + if (delegate != null) { + delegate.searchStateChanged(waitingResponseCount > 0, true); } notifyDataSetChanged(); + if (delegate != null) { + delegate.runResultsEnterAnimation(); + } } @Override @@ -191,7 +203,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { searchResultHashtags.add(arrayList.get(a).hashtag); } if (delegate != null) { - delegate.searchStateChanged(false); + delegate.searchStateChanged(false, false); } notifyDataSetChanged(); } @@ -275,9 +287,6 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { } lastMessagesSearchString = query; final int currentReqId = ++lastReqId; - /*if (delegate != null) { - delegate.searchStateChanged(true); - }*/ reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { final ArrayList messageObjects = new ArrayList<>(); if (error == null) { @@ -291,6 +300,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { } AndroidUtilities.runOnUIThread(() -> { if (currentReqId == lastReqId && (searchId <= 0 || searchId == lastSearchId)) { + waitingResponseCount--; if (error == null) { currentMessagesQuery = query; TLRPC.messages_Messages res = (TLRPC.messages_Messages) response; @@ -330,12 +340,13 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { } } notifyDataSetChanged(); + if (delegate != null && req.offset_id == 0) { + delegate.searchStateChanged(waitingResponseCount > 0, true); + delegate.runResultsEnterAnimation(); + } } } reqId = 0; - if (!searchAdapterHelper.isSearchInProgress() && delegate != null) { - delegate.searchStateChanged(false); - } }); }, ConnectionsManager.RequestFlagFailOnServerErrors); } @@ -555,6 +566,8 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { private void updateSearchResults(final ArrayList result, final ArrayList names, final ArrayList encUsers, final int searchId) { AndroidUtilities.runOnUIThread(() -> { + waitingResponseCount--; + Log.d("kek", "update local search " + waitingResponseCount); if (searchId != lastSearchId) { return; } @@ -585,11 +598,8 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { searchAdapterHelper.mergeResults(searchResult); notifyDataSetChanged(); if (delegate != null) { - if (getItemCount() == 0 && (searchRunnable2 != null || searchAdapterHelper.isSearchInProgress())) { - delegate.searchStateChanged(true); - } else { - delegate.searchStateChanged(false); - } + delegate.searchStateChanged(waitingResponseCount > 0, true); + delegate.runResultsEnterAnimation(); } }); } @@ -604,6 +614,8 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { notifyDataSetChanged(); } + int waitingResponseCount; + public void searchDialogs(String text) { if (text != null && text.equals(lastSearchText)) { return; @@ -634,6 +646,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { } searchWas = false; lastSearchId = 0; + waitingResponseCount = 0; searchMessagesInternal(null, 0); notifyDataSetChanged(); localTipDates.clear(); @@ -650,22 +663,23 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { for (int a = 0; a < hashtags.size(); a++) { searchResultHashtags.add(hashtags.get(a).hashtag); } + waitingResponseCount = 0; + notifyDataSetChanged(); if (delegate != null) { - delegate.searchStateChanged(false); + delegate.searchStateChanged(false, false); } - } else { - /*if (delegate != null) { - delegate.searchStateChanged(true); - }*/ } } else { searchResultHashtags.clear(); } - notifyDataSetChanged(); + final int searchId = ++lastSearchId; + waitingResponseCount = 3; + notifyDataSetChanged(); if (needMessagesSearch != 2 && delegate != null) { - delegate.searchStateChanged(true); + delegate.searchStateChanged(true, false); } + Utilities.searchQueue.postRunnable(searchRunnable = () -> { searchRunnable = null; searchDialogsInternal(query, searchId); @@ -676,8 +690,14 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { } if (needMessagesSearch != 2) { searchAdapterHelper.queryServerSearch(query, true, dialogsType != 4, true, dialogsType != 4, dialogsType == 2, 0, dialogsType == 0, 0, searchId); + } else { + waitingResponseCount--; + } + if (needMessagesSearch == 0) { + waitingResponseCount--; + } else { + searchMessagesInternal(text, searchId); } - searchMessagesInternal(text, searchId); }); }, 300); } @@ -685,6 +705,9 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { @Override public int getItemCount() { + if (waitingResponseCount == 3) { + return 0; + } if (isRecentSearchDisplayed()) { return (!recentSearchObjects.isEmpty() ? recentSearchObjects.size() + 1 : 0) + (!MediaDataController.getInstance(currentAccount).hints.isEmpty() ? 1 : 0); } 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 efae5ef47..7ababd1de 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -2864,6 +2864,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate canStreamVideo = false; animatingNoSound = 0; drawSideButton = !isRepliesChat && checkNeedDrawShareButton(messageObject) ? 1 : 0; + if (drawSideButton == 1 && messageObject.messageOwner.fwd_from != null && !messageObject.isOutOwner() && messageObject.messageOwner.fwd_from.saved_from_peer != null && messageObject.getDialogId() == UserConfig.getInstance(currentAccount).getClientUserId()) { + drawSideButton = 2; + } replyNameLayout = null; adminLayout = null; checkOnlyButtonPressed = false; @@ -4401,7 +4404,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } else { drawForwardedName = messageObject.messageOwner.fwd_from != null && !messageObject.isAnyKindOfSticker(); if (!messageObject.isAnyKindOfSticker() && messageObject.type != MessageObject.TYPE_ROUND_VIDEO) { - drawName = messageObject.isFromGroup() && messageObject.isMegagroup(); + drawName = messageObject.isFromGroup() && messageObject.isMegagroup() && (currentPosition == null || (currentPosition.flags & MessageObject.POSITION_FLAG_TOP) != 0); } mediaBackground = isMedia = messageObject.type != 9; drawImageButton = true; @@ -8725,8 +8728,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate private boolean checkNeedDrawShareButton(MessageObject messageObject) { if ((currentPosition != null && !currentPosition.last) || currentMessageObject.deleted) { return false; - } else if (messageObject.messageOwner.fwd_from != null && !messageObject.isOutOwner() && messageObject.messageOwner.fwd_from.saved_from_peer != null && messageObject.getDialogId() == UserConfig.getInstance(currentAccount).getClientUserId()) { - drawSideButton = 2; } return messageObject.needDrawShareButton(); } @@ -10048,10 +10049,32 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate Theme.chat_adminPaint.setColor(color); canvas.save(); float ax; - if (!mediaBackground && currentMessageObject.isOutOwner()) { - ax = backgroundDrawableLeft + backgroundDrawableRight - AndroidUtilities.dp(17) - adminLayout.getLineWidth(0); + if (currentMessagesGroup != null) { + int dWidth = getGroupPhotosWidth(); + int firstLineWidth = 0; + for (int a = 0; a < currentMessagesGroup.posArray.size(); a++) { + MessageObject.GroupedMessagePosition position = currentMessagesGroup.posArray.get(a); + if (position.minY == 0) { + firstLineWidth += Math.ceil((position.pw + position.leftSpanOffset) / 1000.0f * dWidth); + } else { + break; + } + } + if (!mediaBackground && currentMessageObject.isOutOwner()) { + ax = backgroundDrawableLeft + firstLineWidth - AndroidUtilities.dp(17) - adminLayout.getLineWidth(0); + } else { + ax = backgroundDrawableLeft + firstLineWidth - AndroidUtilities.dp(11) - adminLayout.getLineWidth(0); + } + ax -= getExtraTextX() + AndroidUtilities.dp(8); + if (!currentMessageObject.isOutOwner()) { + ax -= AndroidUtilities.dp(48); + } } else { - ax = backgroundDrawableLeft + backgroundDrawableRight - AndroidUtilities.dp(11) - adminLayout.getLineWidth(0); + if (!mediaBackground && currentMessageObject.isOutOwner()) { + ax = backgroundDrawableLeft + backgroundDrawableRight - AndroidUtilities.dp(17) - adminLayout.getLineWidth(0); + } else { + ax = backgroundDrawableLeft + backgroundDrawableRight - AndroidUtilities.dp(11) - adminLayout.getLineWidth(0); + } } canvas.translate(ax, nameY + AndroidUtilities.dp(0.5f)); if (transitionParams.animateSign) { @@ -12372,7 +12395,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } } else if (virtualViewId == COMMENT) { if (delegate != null) { - delegate.didPressCommentButton(ChatMessageCell.this); + if (isRepliesChat) { + delegate.didPressSideButton(ChatMessageCell.this); + } else { + delegate.didPressCommentButton(ChatMessageCell.this); + } } } } else if (action == AccessibilityNodeInfo.ACTION_LONG_CLICK) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java index c1b54c55f..4a3ad9f04 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java @@ -410,7 +410,7 @@ public class SharedAudioCell extends FrameLayout implements DownloadController.F if (titleLayout != null) { canvas.save(); - canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline), titleY); + canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline) + (LocaleController.isRTL && dateLayout != null ? dateLayout.getWidth() + AndroidUtilities.dp(4) : 0), titleY); titleLayout.draw(canvas); canvas.restore(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java index b5a6c3d61..3bc4c7539 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java @@ -309,7 +309,7 @@ public class SharedLinkCell extends FrameLayout { titleFinal = titleH; } - titleLayout = ChatMessageCell.generateStaticLayout(titleFinal, titleTextPaint, maxWidth - dateWidth, maxWidth - dateWidth, 0, 3); + titleLayout = ChatMessageCell.generateStaticLayout(titleFinal, titleTextPaint, maxWidth - dateWidth - AndroidUtilities.dp(4), maxWidth - dateWidth - AndroidUtilities.dp(4), 0, 3); if (titleLayout.getLineCount() > 0) { descriptionY = titleY + titleLayout.getLineBottom(titleLayout.getLineCount() - 1) + AndroidUtilities.dp(4); } @@ -565,7 +565,11 @@ public class SharedLinkCell extends FrameLayout { } if (titleLayout != null) { canvas.save(); - canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline), titleY); + float x = AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline); + if (LocaleController.isRTL) { + x += dateLayout == null ? 0 : (dateLayout.getWidth() + AndroidUtilities.dp(4)); + } + canvas.translate(x, titleY); titleLayout.draw(canvas); canvas.restore(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 5da65e8d4..be9414391 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -2508,23 +2508,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not continue; } if (child == chatListView) { - /*globalIgnoreLayout = true; - int additionalPadding = inputFieldHeight - AndroidUtilities.dp(51); - if (pinnedMessageView != null && pinnedMessageView.getTag() == null || topChatPanelView != null && topChatPanelView.getTag() == null) { - chatListView.setPadding(0, AndroidUtilities.dp(52) + additionalPadding, 0, AndroidUtilities.dp(3)); - } else { - chatListView.setPadding(0, AndroidUtilities.dp(4) + additionalPadding, 0, AndroidUtilities.dp(3)); - } - globalIgnoreLayout = false;*/ -// if (chatActivityEnterView.getAlpha() != 1.0f) { -// chatListView.setTranslationY(inputFieldHeight - AndroidUtilities.dp(51)); -// } chatListViewClipTop = inPreviewMode ? 0 : (inputFieldHeight - AndroidUtilities.dp(51)); int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY); int h = heightSize - listViewTopHeight - (inPreviewMode && Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); -// if (!chatActivityEnterView.pannelAniamationInProgress()) { -// h -= chatEmojiViewPadding; -// } if (keyboardSize > AndroidUtilities.dp(20) && getLayoutParams().height < 0) { h += keyboardSize; } @@ -2727,9 +2713,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (keyboardSize > AndroidUtilities.dp(20) && getLayoutParams().height < 0) { childTop -= keyboardSize; } -// if (!chatActivityEnterView.pannelAniamationInProgress()) { -// childTop += chatEmojiViewPadding; -// } } else if (child == progressView) { if (chatActivityEnterView.isTopViewVisible()) { childTop -= AndroidUtilities.dp(48); @@ -14567,6 +14550,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } else { pinnedMessageEnterOffset = 0; invalidateChatListViewTopPadding(); + if (firstLoading) { + updateChatListViewTopPadding(); + } pinnedMessageView.setVisibility(View.VISIBLE); } } @@ -14974,8 +14960,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } if (actionBar != null) { actionBar.setBackButtonDrawable(!value ? new BackDrawable(false) : null); - headerItem.setAlpha(!value ? 1.0f : 0.0f); - attachItem.setAlpha(!value ? 1.0f : 0.0f); + if (headerItem != null) { + headerItem.setAlpha(!value ? 1.0f : 0.0f); + } + if (attachItem != null) { + attachItem.setAlpha(!value ? 1.0f : 0.0f); + } } if (chatListView != null) { 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 0dd6e2039..2377d7548 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -6565,9 +6565,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe keyboardHeightLand = MessagesController.getGlobalEmojiSettings().getInt("kbd_height_land3", AndroidUtilities.dp(200)); } int currentHeight = AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y ? keyboardHeightLand : keyboardHeight; - if (!samePannelWasVisible && !anotherPanelWasVisible) { + /*if (!samePannelWasVisible && !anotherPanelWasVisible) { currentHeight = 0; - } else if (contentType == 1) { + } else */if (contentType == 1) { currentHeight = Math.min(botKeyboardView.getKeyboardHeight(), currentHeight); } if (botKeyboardView != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertAudioLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertAudioLayout.java index f11c12bdc..56df56382 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertAudioLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertAudioLayout.java @@ -529,6 +529,7 @@ public class ChatAttachAlertAudioLayout extends ChatAttachAlert.AttachAlertLayou message.out = true; message.id = id; message.peer_id = new TLRPC.TL_peerUser(); + message.from_id = new TLRPC.TL_peerUser(); message.peer_id.user_id = message.from_id.user_id = UserConfig.getInstance(parentAlert.currentAccount).getClientUserId(); message.date = (int) (System.currentTimeMillis() / 1000); message.message = ""; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java index be7faad55..51c6fa6f1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java @@ -2500,12 +2500,14 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou if (cameraIcon != null) { cameraIcon.setVisibility(VISIBLE); } - int count = gridView.getChildCount(); - for (int a = 0; a < count; a++) { - View child = gridView.getChildAt(a); - if (child instanceof PhotoAttachCameraCell) { - child.setVisibility(View.INVISIBLE); - break; + if (cameraView != null) { + int count = gridView.getChildCount(); + for (int a = 0; a < count; a++) { + View child = gridView.getChildAt(a); + if (child instanceof PhotoAttachCameraCell) { + child.setVisibility(View.INVISIBLE); + break; + } } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java index d14d8c911..19081c1ab 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java @@ -16,7 +16,6 @@ import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; -import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; @@ -382,6 +381,9 @@ public class PhotoViewerCaptionEnterView extends FrameLayout implements Notifica public void updateColors() { Theme.setDrawableColor(drawable, Theme.getColor(Theme.key_dialogFloatingButton)); Theme.setDrawableColor(checkDrawable, Theme.getColor(Theme.key_dialogFloatingIcon)); + if (emojiView != null) { + emojiView.updateColors(); + } } public boolean hideActionMode() { @@ -522,11 +524,7 @@ public class PhotoViewerCaptionEnterView extends FrameLayout implements Notifica Emoji.replaceEmoji(builder, messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); } messageEditText.setText(builder); - if (start + text.length() <= messageEditText.length()) { - messageEditText.setSelection(start + text.length()); - } else { - messageEditText.setSelection(messageEditText.length()); - } + messageEditText.setSelection(Math.min(start + text.length(), messageEditText.length())); } catch (Exception e) { FileLog.e(e); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java index c7c47403d..86d432587 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java @@ -2,9 +2,16 @@ package org.telegram.ui.Components; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; +import android.animation.AnimatorSet; +import android.animation.ObjectAnimator; +import android.animation.ValueAnimator; import android.content.Context; +import android.graphics.Canvas; import android.os.Bundle; +import android.util.SparseArray; +import android.util.SparseIntArray; import android.view.View; +import android.view.ViewTreeObserver; import android.widget.FrameLayout; import androidx.recyclerview.widget.LinearLayoutManager; @@ -40,7 +47,9 @@ import org.telegram.ui.ViewPagerFixed; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; +import java.util.Set; public class SearchViewPager extends ViewPagerFixed implements FilteredSearchView.UiCallback { @@ -80,6 +89,8 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie private final int folderId; + ArrayList currentAnimators = new ArrayList<>(); + public SearchViewPager(Context context, BaseFragment fragment, int type, int initialDialogsType, int folderId, ChatPreviewDelegate chatPreviewDelegate) { super(context); this.folderId = folderId; @@ -96,14 +107,30 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie } }; - searchListView = new RecyclerListView(context); + searchListView = new RecyclerListView(context) { + @Override + protected void dispatchDraw(Canvas canvas) { + int n = getChildCount(); + loop: for (int i = 0; i < n; i++) { + View v = getChildAt(i); + int position = searchlayoutManager.getPosition(v); + for (int k = 0; k < currentAnimators.size(); k++) { + if (currentAnimators.get(k).setup(v, position)) { + continue loop; + } + } + v.setAlpha(1f); + } + super.dispatchDraw(canvas); + } + }; searchListView.setPivotY(0); searchListView.setAdapter(dialogsSearchAdapter); searchListView.setVerticalScrollBarEnabled(true); searchListView.setInstantClick(true); searchListView.setVerticalScrollbarPosition(LocaleController.isRTL ? RecyclerListView.SCROLLBAR_POSITION_LEFT : RecyclerListView.SCROLLBAR_POSITION_RIGHT); searchListView.setLayoutManager(searchlayoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); - + searchListView.setAnimateEmptyView(true, 0); searchListView.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { @@ -226,6 +253,8 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie dialogsSearchAdapter.setFiltersDelegate(filteredSearchViewDelegate, false); noMediaFiltersSearchView.animate().setListener(null).cancel(); noMediaFiltersSearchView.setDelegate(null, false); + emptyView.showProgress(!dialogsSearchAdapter.isSearching(), false); + emptyView.showProgress(dialogsSearchAdapter.isSearching(), false); if (reset) { noMediaFiltersSearchView.setVisibility(View.GONE); } else { @@ -629,6 +658,74 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie } } + public void runResultsEnterAnimation() { + Set hasSet = new HashSet<>(); + int n = searchListView.getChildCount(); + for (int i = 0; i < n; i++) { + hasSet.add(searchlayoutManager.getPosition(searchListView.getChildAt(i))); + } + searchListView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { + @Override + public boolean onPreDraw() { + searchListView.getViewTreeObserver().removeOnPreDrawListener(this); + int n = searchListView.getChildCount(); + for (int i = 0; i < n; i++) { + View child = searchListView.getChildAt(i); + int position = searchlayoutManager.getPosition(child); + if (!hasSet.contains(position)) { + SearchResultsEnterAnimator animator = new SearchResultsEnterAnimator(); + child.setAlpha(0); + int s = Math.min(searchListView.getMeasuredHeight(), Math.max(0, child.getTop())); + int delay = (int) ((s / (float) searchListView.getMeasuredHeight()) * 100); + animator.position = position; + animator.valueAnimator.setStartDelay(delay); + animator.valueAnimator.setDuration(200); + animator.valueAnimator.start(); + } + } + return true; + } + }); + } + + public void cancelEnterAnimation() { + for (int i = 0; i < currentAnimators.size(); i++) { + SearchResultsEnterAnimator animator = currentAnimators.get(i); + animator.valueAnimator.cancel(); + currentAnimators.remove(animator); + i--; + } + } + + + private class SearchResultsEnterAnimator { + final ValueAnimator valueAnimator; + float progress; + int position; + + private SearchResultsEnterAnimator() { + valueAnimator = ValueAnimator.ofFloat(0, 1f); + valueAnimator.addUpdateListener(valueAnimator -> { + progress = (float) valueAnimator.getAnimatedValue(); + searchListView.invalidate(); + }); + valueAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + currentAnimators.remove(SearchResultsEnterAnimator.this); + } + }); + currentAnimators.add(this); + } + + public boolean setup(View view, int position) { + if (this.position == position) { + view.setAlpha(progress); + return true; + } + return false; + } + } public interface ChatPreviewDelegate { void startChatPreview(DialogCell cell); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java index 7b61c6bab..65a1d73cf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java @@ -2608,14 +2608,20 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. searchViewPager.dialogsSearchAdapter.setDelegate(new DialogsSearchAdapter.DialogsSearchAdapterDelegate() { @Override - public void searchStateChanged(boolean search) { + public void searchStateChanged(boolean search, boolean animated) { + if (searchViewPager.emptyView.getVisibility() == View.VISIBLE) { + animated = true; + } if (searching && searchWas && searchViewPager.emptyView != null) { if (search || searchViewPager.dialogsSearchAdapter.getItemCount() != 0) { - searchViewPager.emptyView.showProgress(true); + searchViewPager.emptyView.showProgress(true, animated); } else { - searchViewPager.emptyView.showProgress(false); + searchViewPager.emptyView.showProgress(false, animated); } } + if (search && searchViewPager.dialogsSearchAdapter.getItemCount() == 0) { + searchViewPager.cancelEnterAnimation(); + } } @Override @@ -2702,6 +2708,13 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); } } + + @Override + public void runResultsEnterAnimation() { + if (searchViewPager != null) { + searchViewPager.runResultsEnterAnimation(); + } + } }); searchViewPager.searchListView.setOnItemClickListener((view, position) -> onItemClick(view, position, searchViewPager.dialogsSearchAdapter)); @@ -3753,7 +3766,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. } searchWasFullyShowed = true; AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid); - fragmentView.requestLayout(); searchItem.setVisibility(View.GONE); } else { whiteActionBar = false; @@ -3769,9 +3781,11 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. hideFloatingButton(false); } searchWasFullyShowed = false; - fragmentView.requestLayout(); searchItem.getSearchContainer().setAlpha(1f); + } + if (fragmentView != null) { + fragmentView.requestLayout(); } viewPages[0].listView.setVerticalScrollBarEnabled(true); @@ -5931,6 +5945,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. if (doneItem != null) { doneItem.setIconColor(Theme.getColor(Theme.key_actionBarDefaultIcon)); } + if (commentView != null) { + commentView.updateColors(); + } if (filtersView != null) { filtersView.updateColors(); @@ -6304,6 +6321,15 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_button)); arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_buttonActive)); + if (commentView != null) { + arrayList.add(new ThemeDescription(commentView, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground)); + arrayList.add(new ThemeDescription(commentView, 0, null, null, new Drawable[]{Theme.chat_composeShadowDrawable}, null, Theme.key_chat_messagePanelShadow)); + arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"messageEditText"}, null, null, null, Theme.key_chat_messagePanelText)); + arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_CURSORCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"messageEditText"}, null, null, null, Theme.key_chat_messagePanelCursor)); + arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_HINTTEXTCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"messageEditText"}, null, null, null, Theme.key_chat_messagePanelHint)); + arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"sendButton"}, null, null, null, Theme.key_chat_messagePanelSend)); + } + arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarTipBackground)); arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_player_time)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index 8126560fd..c1e2a05a9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -2250,7 +2250,6 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa FileLog.e(e); } } - //TODO error try { progressDialog.dismiss(); } catch (Exception e) { @@ -3163,6 +3162,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa }); mainFragmentsStack.get(mainFragmentsStack.size() - 1).showDialog(alert); } else { + String captionToSend = null; for (int i = 0; i < dids.size(); i++) { final long did = dids.get(i); int lower_part = (int) did; @@ -3177,14 +3177,13 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa } } else { if (videoPath != null) { - String caption = null; if (sendingText != null && sendingText.length() <= 1024) { - caption = sendingText; + captionToSend = sendingText; sendingText = null; } ArrayList arrayList = new ArrayList<>(); arrayList.add(videoPath); - SendMessagesHelper.prepareSendingDocuments(accountInstance, arrayList, arrayList, null, caption, null, did, null, null, null, null, true, 0); + SendMessagesHelper.prepareSendingDocuments(accountInstance, arrayList, arrayList, null, captionToSend, null, did, null, null, null, null, true, 0); } } if (photoPathsArray != null) { @@ -3195,12 +3194,11 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa SendMessagesHelper.prepareSendingMedia(accountInstance, photoPathsArray, did, null, null, null, false, false, null, true, 0); } if (documentsPathsArray != null || documentsUrisArray != null) { - String caption = null; if (sendingText != null && sendingText.length() <= 1024 && ((documentsPathsArray != null ? documentsPathsArray.size() : 0) + (documentsUrisArray != null ? documentsUrisArray.size() : 0)) == 1) { - caption = sendingText; + captionToSend = sendingText; sendingText = null; } - SendMessagesHelper.prepareSendingDocuments(accountInstance, documentsPathsArray, documentsOriginalPathsArray, documentsUrisArray, caption, documentsMimeType, did, null, null, null, null, true, 0); + SendMessagesHelper.prepareSendingDocuments(accountInstance, documentsPathsArray, documentsOriginalPathsArray, documentsUrisArray, captionToSend, documentsMimeType, did, null, null, null, null, true, 0); } if (sendingText != null) { SendMessagesHelper.prepareSendingText(accountInstance, sendingText, did, true, 0); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index b3b981468..b98a35eae 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -6935,7 +6935,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } File f = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), SharedConfig.getLastLocalId() + "_temp.jpg"); mergeImages(entry.thumbPath = f.getAbsolutePath(), null, croppedPaintBitmap, croppedBitmap, thumbSize, true); - croppedPaintBitmap.recycle(); + if (croppedPaintBitmap != null) { + croppedPaintBitmap.recycle(); + } paintBitmap.recycle(); } else { if (!isCurrentVideo) { @@ -9621,21 +9623,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat editState.mediaEntities = searchImage.mediaEntities; editState.cropState = searchImage.cropState; } - if (editState.cropState != null) { - previousHasTransform = true; - previousCropPx = editState.cropState.cropPx; - previousCropPy = editState.cropState.cropPy; - previousCropScale = editState.cropState.cropScale; - previousCropRotation = editState.cropState.cropRotate; - previousCropOrientation = editState.cropState.transformRotation; - previousCropPw = editState.cropState.cropPw; - previousCropPh = editState.cropState.cropPh; - previousCropMirrored = editState.cropState.mirrored; - cropTransform.setViewTransform(previousHasTransform, previousCropPx, previousCropPy, previousCropRotation, previousCropOrientation, previousCropScale, 1.0f, 1.0f, previousCropPw, previousCropPh, 0, 0, previousCropMirrored); - } else { - previousHasTransform = false; - cropTransform.setViewTransform(false, previousCropPx, previousCropPy, previousCropRotation, previousCropOrientation, previousCropScale, 1.0f, 1.0f, previousCropPw, previousCropPh, 0, 0, previousCropMirrored); - } if (object instanceof MediaController.MediaEditState) { MediaController.MediaEditState state = (MediaController.MediaEditState) object; if (hasAnimatedMediaEntities()) { @@ -9647,6 +9634,21 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } } } + if (editState.cropState != null) { + previousHasTransform = true; + previousCropPx = editState.cropState.cropPx; + previousCropPy = editState.cropState.cropPy; + previousCropScale = editState.cropState.cropScale; + previousCropRotation = editState.cropState.cropRotate; + previousCropOrientation = editState.cropState.transformRotation; + previousCropPw = editState.cropState.cropPw; + previousCropPh = editState.cropState.cropPh; + previousCropMirrored = editState.cropState.mirrored; + cropTransform.setViewTransform(previousHasTransform, previousCropPx, previousCropPy, previousCropRotation, previousCropOrientation, previousCropScale, 1.0f, 1.0f, previousCropPw, previousCropPh, 0, 0, previousCropMirrored); + } else { + previousHasTransform = false; + cropTransform.setViewTransform(false, previousCropPx, previousCropPy, previousCropRotation, previousCropOrientation, previousCropScale, 1.0f, 1.0f, previousCropPw, previousCropPh, 0, 0, previousCropMirrored); + } } else if (pageBlocksAdapter != null) { if (currentIndex < 0 || currentIndex >= pageBlocksAdapter.getItemsCount()) { closePhoto(false, false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index cede4ae7c..c7acef15e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -4862,6 +4862,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } } else if (chat_id != 0) { if (chatInfo != null && (!TextUtils.isEmpty(chatInfo.about) || chatInfo.location instanceof TLRPC.TL_channelLocation) || !TextUtils.isEmpty(currentChat.username)) { + if (LocaleController.isRTL && ChatObject.isChannel(currentChat) && !currentChat.megagroup && chatInfo.linked_chat_id != 0) { + emptyRow = rowCount++; + } infoHeaderRow = rowCount++; if (chatInfo != null) { if (!TextUtils.isEmpty(chatInfo.about)) {