From 3480f19272fbe7679172dc51473e19fcf184501c Mon Sep 17 00:00:00 2001 From: DrKLO Date: Sat, 30 Jan 2021 22:47:24 +0300 Subject: [PATCH] Update to 7.4.2 (2227) --- TMessagesProj/build.gradle | 2 +- .../widget/DefaultItemAnimator.java | 1 + .../org/telegram/messenger/BuildVars.java | 2 +- .../messenger/MessagesController.java | 15 ++++--- .../messenger/SendMessagesHelper.java | 4 +- .../messenger/ShortcutWidgetService.java | 1 + .../video/MediaCodecVideoConvertor.java | 24 ++++++----- .../org/telegram/ui/ActionBar/ActionBar.java | 15 +++++-- .../org/telegram/ui/ChatUsersActivity.java | 23 +++++++---- .../telegram/ui/Components/AlertsCreator.java | 14 ++++--- .../ui/Components/FilterTabsView.java | 32 +++++++++++---- .../org/telegram/ui/ContentPreviewViewer.java | 4 +- .../java/org/telegram/ui/DialogsActivity.java | 40 ++++++------------- .../java/org/telegram/ui/LaunchActivity.java | 3 ++ .../java/org/telegram/ui/PhotoViewer.java | 38 +++++++++++++++++- .../ui/PopupNotificationActivity.java | 1 + 16 files changed, 145 insertions(+), 74 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 2bc0a3c9a..e9927a512 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -290,7 +290,7 @@ android { } } - defaultConfig.versionCode = 2226 + defaultConfig.versionCode = 2227 applicationVariants.all { variant -> variant.outputs.all { output -> diff --git a/TMessagesProj/src/main/java/androidx/recyclerview/widget/DefaultItemAnimator.java b/TMessagesProj/src/main/java/androidx/recyclerview/widget/DefaultItemAnimator.java index e94957035..81ac82422 100644 --- a/TMessagesProj/src/main/java/androidx/recyclerview/widget/DefaultItemAnimator.java +++ b/TMessagesProj/src/main/java/androidx/recyclerview/widget/DefaultItemAnimator.java @@ -209,6 +209,7 @@ public class DefaultItemAnimator extends SimpleItemAnimator { return true; } + public void setDelayAnimations(boolean value) { delayAnimations = value; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index e7f385f3f..b7ae154f1 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 = 2226; + public static int BUILD_VERSION = 2227; public static String BUILD_VERSION_STRING = "7.4.0"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index 7caabec4e..18272b533 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -475,6 +475,9 @@ public class MessagesController extends BaseController implements NotificationCe } public boolean includesDialog(AccountInstance accountInstance, int lowerId, TLRPC.Dialog d) { + if (neverShow.contains(lowerId)) { + return false; + } if (alwaysShow.contains(lowerId)) { return true; } @@ -485,8 +488,7 @@ public class MessagesController extends BaseController implements NotificationCe ContactsController contactsController = accountInstance.getContactsController(); boolean skip = false; if ((flags & DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && messagesController.isDialogMuted(d.id) && d.unread_mentions_count == 0 || - (flags & DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0 && d.unread_count == 0 && !d.unread_mark && d.unread_mentions_count == 0 || - neverShow.contains(lowerId)) { + (flags & DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0 && d.unread_count == 0 && !d.unread_mark && d.unread_mentions_count == 0) { return false; } if (lowerId > 0) { @@ -2915,7 +2917,7 @@ public class MessagesController extends BaseController implements NotificationCe value = 0; } dialogs_read_outbox_max.put(dialog.id, Math.max(dialog.read_outbox_max_id, value)); - if (value == 0) { + if (dialog.read_outbox_max_id > value) { if (dialog.peer.channel_id != 0) { TLRPC.TL_updateReadChannelOutbox update = new TLRPC.TL_updateReadChannelOutbox(); update.channel_id = dialog.peer.channel_id; @@ -3042,7 +3044,7 @@ public class MessagesController extends BaseController implements NotificationCe } dialogs_read_inbox_max.put(dialog_id, Math.max(res.full_chat.read_inbox_max_id, value)); - if (value == 0) { + if (res.full_chat.read_inbox_max_id > value) { ArrayList arrayList = new ArrayList<>(); TLRPC.TL_updateReadChannelInbox update = new TLRPC.TL_updateReadChannelInbox(); update.channel_id = chat_id; @@ -3056,7 +3058,7 @@ public class MessagesController extends BaseController implements NotificationCe value = getMessagesStorage().getDialogReadMax(true, dialog_id); } dialogs_read_outbox_max.put(dialog_id, Math.max(res.full_chat.read_outbox_max_id, value)); - if (value == 0) { + if (res.full_chat.read_outbox_max_id > value) { ArrayList arrayList = new ArrayList<>(); TLRPC.TL_updateReadChannelOutbox update = new TLRPC.TL_updateReadChannelOutbox(); update.channel_id = chat_id; @@ -11812,6 +11814,9 @@ public class MessagesController extends BaseController implements NotificationCe dialogs_read_inbox_max.put(dialog_id, Math.max(value, update.max_id)); } else if (baseUpdate instanceof TLRPC.TL_updateReadChannelOutbox) { TLRPC.TL_updateReadChannelOutbox update = (TLRPC.TL_updateReadChannelOutbox) baseUpdate; + if (BuildVars.LOGS_ENABLED) { + FileLog.d(baseUpdate + " channelId = " + update.channel_id); + } long message_id = update.max_id; message_id |= ((long) update.channel_id) << 32; long dialog_id = -update.channel_id; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java index 75e88c164..e20a73b39 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java @@ -140,7 +140,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe } }); } - }); + }, ConnectionsManager.RequestFlagFailOnServerErrors); } public long getUploadedCount() { @@ -237,7 +237,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe } }); } - }); + }, ConnectionsManager.RequestFlagFailOnServerErrors); } private void startImport() { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ShortcutWidgetService.java b/TMessagesProj/src/main/java/org/telegram/messenger/ShortcutWidgetService.java index 53c780316..0841a7930 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ShortcutWidgetService.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ShortcutWidgetService.java @@ -51,6 +51,7 @@ class ShortcutRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactor public ShortcutRemoteViewsFactory(Context context, Intent intent) { mContext = context; + Theme.createDialogsResources(context); appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); SharedPreferences preferences = context.getSharedPreferences("shortcut_widget", Activity.MODE_PRIVATE); int accountId = preferences.getInt("account" + appWidgetId, -1); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java b/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java index ac47f61e4..d6c3c4a70 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java @@ -424,7 +424,7 @@ public class MediaCodecVideoConvertor { FileLog.e(e); //s20 ultra exception } if (maxBufferSize <= 0) { - maxBufferSize = 16 * 1024; + maxBufferSize = 64 * 1024; } audioBuffer = ByteBuffer.allocateDirect(maxBufferSize); @@ -487,10 +487,12 @@ public class MediaCodecVideoConvertor { } } } else if (copyAudioBuffer && audioIndex != -1 && index == audioIndex) { - long size = extractor.getSampleSize(); - if (size > maxBufferSize) { - maxBufferSize = (int) (size + 1024); - audioBuffer = ByteBuffer.allocateDirect(maxBufferSize); + if (Build.VERSION.SDK_INT >= 28) { + long size = extractor.getSampleSize(); + if (size > maxBufferSize) { + maxBufferSize = (int) (size + 1024); + audioBuffer = ByteBuffer.allocateDirect(maxBufferSize); + } } info.size = extractor.readSampleData(audioBuffer, 0); if (Build.VERSION.SDK_INT < 21) { @@ -834,7 +836,7 @@ public class MediaCodecVideoConvertor { } } if (maxBufferSize <= 0) { - maxBufferSize = 16 * 1024; + maxBufferSize = 64 * 1024; } ByteBuffer buffer = ByteBuffer.allocateDirect(maxBufferSize); if (audioTrackIndex >= 0 || videoTrackIndex >= 0) { @@ -844,10 +846,12 @@ public class MediaCodecVideoConvertor { checkConversionCanceled(); boolean eof = false; int muxerTrackIndex; - long size = extractor.getSampleSize(); - if (size > maxBufferSize) { - maxBufferSize = (int) (size + 1024); - buffer = ByteBuffer.allocateDirect(maxBufferSize); + if (Build.VERSION.SDK_INT >= 28) { + long size = extractor.getSampleSize(); + if (size > maxBufferSize) { + maxBufferSize = (int) (size + 1024); + buffer = ByteBuffer.allocateDirect(maxBufferSize); + } } info.size = extractor.readSampleData(buffer, 0); int index = extractor.getSampleTrackIndex(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java index d09823e51..8ae6340f6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java @@ -447,10 +447,15 @@ public class ActionBar extends FrameLayout { actionMode = null; } actionModeTag = tag; - actionMode = new ActionBarMenu(getContext(), this); + actionMode = new ActionBarMenu(getContext(), this) { + @Override + public void setBackgroundColor(int color) { + super.setBackgroundColor(actionModeColor = color); + } + }; actionMode.isActionMode = true; actionMode.setClickable(true); - actionMode.setBackgroundColor(actionModeColor = Theme.getColor(Theme.key_actionBarActionModeDefault)); + actionMode.setBackgroundColor(Theme.getColor(Theme.key_actionBarActionModeDefault)); addView(actionMode, indexOfChild(backButtonImageView)); actionMode.setPadding(0, occupyStatusBar ? AndroidUtilities.statusBarHeight : 0, 0, 0); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) actionMode.getLayoutParams(); @@ -680,10 +685,14 @@ public class ActionBar extends FrameLayout { public void setActionModeColor(int color) { if (actionMode != null) { - actionMode.setBackgroundColor(actionModeColor = color); + actionMode.setBackgroundColor(color); } } + public void setActionModeOverrideColor(int color) { + actionModeColor = color; + } + @Override public void setBackgroundColor(int color) { super.setBackgroundColor(actionBarColor = color); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java index 6d7232398..b217ddc27 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java @@ -905,14 +905,23 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente getMessagesController().putUser(user, false); if (map.get(user.id) == null) { - TLRPC.ChatParticipant participant = new TLRPC.TL_chatParticipant(); - participant.inviter_id = getUserConfig().getClientUserId(); - participant.user_id = user.id; - participant.date = getConnectionsManager().getCurrentTime(); + if (ChatObject.isChannel(currentChat)) { + TLRPC.TL_channelParticipant channelParticipant1 = new TLRPC.TL_channelParticipant(); + channelParticipant1.inviter_id = getUserConfig().getClientUserId(); + channelParticipant1.user_id = user.id; + channelParticipant1.date = getConnectionsManager().getCurrentTime(); + array.add(k, channelParticipant1); + k++; + map.put(user.id, channelParticipant1); + } else { + TLRPC.ChatParticipant participant = new TLRPC.TL_chatParticipant(); + participant.user_id = user.id; + participant.inviter_id = getUserConfig().getClientUserId(); + array.add(k, participant); + k++; + map.put(user.id, participant); + } - array.add(k, participant); - k++; - map.put(user.id, participant); } } if (array == participants) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java index 5ddf53958..65c859311 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java @@ -140,6 +140,8 @@ public class AlertsCreator { showSimpleAlert(fragment, LocaleController.getString("ImportErrorTitle", R.string.ImportErrorTitle), LocaleController.getString("ImportErrorFileLang", R.string.ImportErrorFileLang)); } else if (error.text.contains("IMPORT_UPLOAD_FAILED")) { showSimpleAlert(fragment, LocaleController.getString("ImportErrorTitle", R.string.ImportErrorTitle), LocaleController.getString("ImportFailedToUpload", R.string.ImportFailedToUpload)); + } else if (error.text.startsWith("FLOOD_WAIT")) { + showFloodWaitAlert(error.text, fragment); } else { showSimpleAlert(fragment, LocaleController.getString("ImportErrorTitle", R.string.ImportErrorTitle), LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text); } @@ -171,7 +173,7 @@ public class AlertsCreator { } return null; } else if (fragment != null) { - AlertsCreator.showAddUserAlert(error.text, fragment, args != null && args.length > 0 ? (Boolean) args[0] : false, request); + showAddUserAlert(error.text, fragment, args != null && args.length > 0 ? (Boolean) args[0] : false, request); } else { if (error.text.equals("PEER_FLOOD")) { NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.needShowAlert, 1); @@ -182,18 +184,18 @@ public class AlertsCreator { fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_CREATE)); return null; } else if (error.text.startsWith("FLOOD_WAIT")) { - AlertsCreator.showFloodWaitAlert(error.text, fragment); + showFloodWaitAlert(error.text, fragment); } else { - AlertsCreator.showAddUserAlert(error.text, fragment, false, request); + showAddUserAlert(error.text, fragment, false, request); } } else if (request instanceof TLRPC.TL_channels_createChannel) { if (error.text.equals("CHANNELS_TOO_MUCH")) { fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_CREATE)); return null; } else if (error.text.startsWith("FLOOD_WAIT")) { - AlertsCreator.showFloodWaitAlert(error.text, fragment); + showFloodWaitAlert(error.text, fragment); } else { - AlertsCreator.showAddUserAlert(error.text, fragment, false, request); + showAddUserAlert(error.text, fragment, false, request); } } else if (request instanceof TLRPC.TL_messages_editMessage) { if (!error.text.equals("MESSAGE_NOT_MODIFIED")) { @@ -484,7 +486,7 @@ public class AlertsCreator { } } if (few) { - AlertsCreator.createSimpleAlert(context, chat.title, LocaleController.getString("SlowmodeSendError", R.string.SlowmodeSendError)).show(); + createSimpleAlert(context, chat.title, LocaleController.getString("SlowmodeSendError", R.string.SlowmodeSendError)).show(); return true; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java index 679c8a081..b0dfb1eb0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java @@ -580,6 +580,17 @@ public class FilterTabsView extends FrameLayout { info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK); } } + + public void clearTransitionParams() { + animateChange = false; + animateTabCounter = false; + animateCounterChange = false; + animateTextChange = false; + animateTextX = false; + animateTabWidth = false; + changeAnimator = null; + invalidate(); + } } private TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); @@ -814,14 +825,7 @@ public class FilterTabsView extends FrameLayout { valueAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - tabView.animateChange = false; - tabView.animateTabCounter = false; - tabView.animateCounterChange = false; - tabView.animateTextChange = false; - tabView.animateTextX = false; - tabView.animateTabWidth = false; - tabView.changeAnimator = null; - tabView.invalidate(); + tabView.clearTransitionParams(); } }); tabView.changeAnimator = valueAnimator; @@ -835,6 +839,18 @@ public class FilterTabsView extends FrameLayout { public void onMoveFinished(RecyclerView.ViewHolder item) { super.onMoveFinished(item); item.itemView.setTranslationX(0); + if (item.itemView instanceof TabView) { + ((TabView) item.itemView).clearTransitionParams(); + } + } + + @Override + public void endAnimation(RecyclerView.ViewHolder item) { + super.endAnimation(item); + item.itemView.setTranslationX(0); + if (item.itemView instanceof TabView) { + ((TabView) item.itemView).clearTransitionParams(); + } } }; itemAnimator.setDelayAnimations(false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java index 1025898d6..8dd6ac9ee 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java @@ -463,7 +463,7 @@ public class ContentPreviewViewer { clearsInputField = stickerCell.isClearsInputField(); } else if (currentPreviewCell instanceof ContextLinkCell) { ContextLinkCell contextLinkCell = (ContextLinkCell) currentPreviewCell; - open(contextLinkCell.getDocument(), delegate != null ? delegate.getQuery(true) : null, contextLinkCell.getBotInlineResult(), contentType, false, contextLinkCell.getInlineBot()); + open(contextLinkCell.getDocument(), delegate != null ? delegate.getQuery(true) : null, contextLinkCell.getBotInlineResult(), contentType, false, contextLinkCell.getBotInlineResult() != null ? contextLinkCell.getInlineBot() : contextLinkCell.getParentObject()); if (contentType != CONTENT_TYPE_GIF) { contextLinkCell.setScaled(true); } @@ -560,7 +560,7 @@ public class ContentPreviewViewer { clearsInputField = stickerCell.isClearsInputField(); } else if (currentPreviewCell instanceof ContextLinkCell) { ContextLinkCell contextLinkCell = (ContextLinkCell) currentPreviewCell; - open(contextLinkCell.getDocument(), delegate != null ? delegate.getQuery(true) : null, contextLinkCell.getBotInlineResult(), contentTypeFinal, false, contextLinkCell.getInlineBot()); + open(contextLinkCell.getDocument(), delegate != null ? delegate.getQuery(true) : null, contextLinkCell.getBotInlineResult(), contentTypeFinal, false, contextLinkCell.getBotInlineResult() != null ? contextLinkCell.getInlineBot() : contextLinkCell.getParentObject()); if (contentTypeFinal != CONTENT_TYPE_GIF) { contextLinkCell.setScaled(true); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java index a9c532697..6c1f90651 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java @@ -1115,20 +1115,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. public void addView(View child, int index, ViewGroup.LayoutParams params) { super.addView(child, index, params); child.setTranslationY(viewOffset); - int position = getChildAdapterPosition(child); - Float alpha = listAlphaItems.get(position); - if (alpha != null) { - child.setAlpha(alpha); - } else { - child.setAlpha(1f); - } } @Override public void removeView(View view) { super.removeView(view); view.setTranslationY(0); - view.setAlpha(1f); } @Override @@ -1150,6 +1142,16 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. @Override protected void dispatchDraw(Canvas canvas) { + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + int position = getChildAdapterPosition(child); + Float alpha = listAlphaItems.get(position, null); + if (alpha == null) { + child.setAlpha(1f); + } else { + child.setAlpha(alpha); + } + } super.dispatchDraw(canvas); if (slidingView != null && pacmanAnimation != null) { pacmanAnimation.draw(canvas, slidingView.getTop() + slidingView.getMeasuredHeight() / 2); @@ -5411,6 +5413,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. updateAnimated = true; } else { createActionMode(); + actionBar.setActionModeOverrideColor(Theme.getColor(Theme.key_windowBackgroundWhite)); actionBar.showActionMode(); resetScroll(); if (menuDrawable != null) { @@ -5939,7 +5942,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. listView.getViewTreeObserver().removeOnPreDrawListener(this); int n = listView.getChildCount(); AnimatorSet animatorSet = new AnimatorSet(); - boolean animated = false; for (int i = 0; i < n; i++) { View child = listView.getChildAt(i); int position = listView.getChildAdapterPosition(child); @@ -5952,29 +5954,13 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. a.addUpdateListener(valueAnimator -> { Float alpha = (Float) valueAnimator.getAnimatedValue(); listAlphaItems.put(position, alpha); - if (listView.getChildAdapterPosition(child) == position) { - child.setAlpha(alpha); - } else { - RecyclerView.ViewHolder vh = listView.findViewHolderForAdapterPosition(position); - if (vh != null) { - vh.itemView.setAlpha(1f); - } - } + listView.invalidate(); }); a.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { listAlphaItems.remove(position); - if (listAlphaItems.size() == 0) { - for (int i = 0; i < listView.getChildCount(); i++) { - listView.getChildAt(i).setAlpha(1f); - } - } else { - RecyclerView.ViewHolder vh = listView.findViewHolderForAdapterPosition(position); - if (vh != null) { - vh.itemView.setAlpha(1f); - } - } + listView.invalidate(); } }); a.setStartDelay(delay); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index 83a46bd03..910f06533 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -3887,6 +3887,9 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa @Override protected void onResume() { super.onResume(); + if (Theme.selectedAutoNightType == Theme.AUTO_NIGHT_TYPE_SYSTEM) { + Theme.checkAutoNightThemeConditions(); + } //FileLog.d("UI resume time = " + (SystemClock.elapsedRealtime() - ApplicationLoader.startTime)); NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, 4096); MediaController.getInstance().setFeedbackView(actionBarLayout, true); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index 1ca0175c9..8aeaf438c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -1910,6 +1910,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat groupedPhotosHeight = 0; } + if (videoPlayerControlFrameLayout != null) { + videoPlayerControlFrameLayout.parentWidth = widthSize; + videoPlayerControlFrameLayout.parentHeight = heightSize; + } + widthSize -= (getPaddingRight() + getPaddingLeft()); heightSize -= getPaddingBottom(); @@ -2208,6 +2213,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat private float progress = 1f; private boolean seekBarTransitionEnabled; private boolean translationYAnimationEnabled = true; + private boolean ignoreLayout; + private int parentWidth; + private int parentHeight; public VideoPlayerControlFrameLayout(@NonNull Context context) { super(context); @@ -2227,11 +2235,20 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat return true; } + @Override + public void requestLayout() { + if (ignoreLayout) { + return; + } + super.requestLayout(); + } + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int extraWidth; + ignoreLayout = true; FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) videoPlayerTime.getLayoutParams(); - if (containerView.getMeasuredWidth() > containerView.getMeasuredHeight()) { + if (parentWidth > parentHeight) { if (exitFullscreenButton.getVisibility() != VISIBLE) { exitFullscreenButton.setVisibility(VISIBLE); } @@ -2244,6 +2261,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat extraWidth = 0; layoutParams.rightMargin = AndroidUtilities.dp(12); } + ignoreLayout = false; super.onMeasure(widthMeasureSpec, heightMeasureSpec); long duration; if (videoPlayer != null) { @@ -6885,7 +6903,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat break; } } - if (containerView.getMeasuredHeight() > containerView.getMeasuredWidth() && !(videoTextureView instanceof VideoEditTextureView) && w > h) { + if (AndroidUtilities.displaySize.y > AndroidUtilities.displaySize.x && !(videoTextureView instanceof VideoEditTextureView) && w > h) { if (fullscreenButton[b].getVisibility() != View.VISIBLE) { fullscreenButton[b].setVisibility(View.VISIBLE); } @@ -6898,6 +6916,22 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat fullscreenButton[b].setVisibility(View.INVISIBLE); } } + + float currentTranslationX; + if (imageMoveAnimation != null) { + currentTranslationX = translationX + (animateToX - translationX) * animationValue; + } else { + currentTranslationX = translationX; + } + float offsetX; + if (b == 1) { + offsetX = 0; + } else if (b == 2) { + offsetX = -AndroidUtilities.displaySize.x - AndroidUtilities.dp(15) + (currentTranslationX - maxX); + } else { + offsetX = currentTranslationX < minX ? (currentTranslationX - minX) : 0; + } + fullscreenButton[b].setTranslationX(offsetX + AndroidUtilities.displaySize.x - AndroidUtilities.dp(48)); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PopupNotificationActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PopupNotificationActivity.java index 7c80c1592..e28aebc67 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PopupNotificationActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PopupNotificationActivity.java @@ -158,6 +158,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + Theme.createDialogsResources(this); Theme.createChatResources(this, false); AndroidUtilities.fillStatusBarHeight(this);