From ed9e38da5b3b6ca80a7cb719a000d310d07497b0 Mon Sep 17 00:00:00 2001 From: DrKLO Date: Fri, 24 Apr 2020 12:28:11 +0300 Subject: [PATCH] Update to 6.1.0 (1940) --- TMessagesProj/build.gradle | 2 +- .../org/telegram/messenger/AndroidUtilities.java | 9 +++++++++ .../java/org/telegram/messenger/BuildVars.java | 2 +- .../java/org/telegram/ui/CacheControlActivity.java | 11 ++--------- .../main/java/org/telegram/ui/ChatActivity.java | 3 +++ .../Components/ChatAttachAlertLocationLayout.java | 1 + .../java/org/telegram/ui/LocationActivity.java | 1 + .../main/java/org/telegram/ui/ProfileActivity.java | 14 +++++++++----- 8 files changed, 27 insertions(+), 16 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index b5228641e..e8108bff7 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -286,7 +286,7 @@ android { } } - defaultConfig.versionCode = 1938 + defaultConfig.versionCode = 1940 def tgVoipDexFileName = "libtgvoip.dex" def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"] diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java index 6bb836ab0..61d841c57 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java @@ -2894,6 +2894,15 @@ public class AndroidUtilities { return null; } + public static void fixGoogleMapsBug() { //https://issuetracker.google.com/issues/154855417#comment301 + SharedPreferences googleBug = ApplicationLoader.applicationContext.getSharedPreferences("google_bug_154855417", Context.MODE_PRIVATE); + if (!googleBug.contains("fixed")) { + File corruptedZoomTables = new File(ApplicationLoader.getFilesDirFixed(), "ZoomTables.data"); + corruptedZoomTables.delete(); + googleBug.edit().putBoolean("fixed", true).apply(); + } + } + public static CharSequence concat(CharSequence... text) { if (text.length == 0) { return ""; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index 7684efa99..f17892ee2 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -19,7 +19,7 @@ public class BuildVars { public static boolean USE_CLOUD_STRINGS = true; public static boolean CHECK_UPDATES = true; public static boolean TON_WALLET_STANDALONE = false; - public static int BUILD_VERSION = 1938; + public static int BUILD_VERSION = 1940; public static String BUILD_VERSION_STRING = "6.1.0"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java index 8b340b6e9..1d886d596 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java @@ -396,6 +396,7 @@ public class CacheControlActivity extends BaseFragment { return false; } }; + bottomSheet.setAllowNestedScroll(true); bottomSheet.setApplyBottomPadding(false); LinearLayout linearLayout = new LinearLayout(getParentActivity()); bottomSheetView = linearLayout; @@ -488,15 +489,7 @@ public class CacheControlActivity extends BaseFragment { cleanupFolders(); }); linearLayout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50)); - NestedScrollView scrollView = new NestedScrollView(context) { - @Override - public boolean onTouchEvent(MotionEvent ev) { - if (getMeasuredHeight() == linearLayout.getMeasuredHeight()) { - return false; - } - return super.onTouchEvent(ev); - } - }; + NestedScrollView scrollView = new NestedScrollView(context); scrollView.setVerticalScrollBarEnabled(false); scrollView.addView(linearLayout); bottomSheet.setCustomView(scrollView); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index f6bfaf4ec..778edc4fa 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -15732,6 +15732,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } progressDialog[0] = null; if (response instanceof TLRPC.TL_payments_bankCardData) { + if (getParentActivity() == null) { + return; + } TLRPC.TL_payments_bankCardData data = (TLRPC.TL_payments_bankCardData) response; BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity()); ArrayList arrayList = new ArrayList<>(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertLocationLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertLocationLayout.java index b14955eba..796138d3f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertLocationLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertLocationLayout.java @@ -370,6 +370,7 @@ public class ChatAttachAlertLocationLayout extends ChatAttachAlert.AttachAlertLa public ChatAttachAlertLocationLayout(ChatAttachAlert alert, Context context) { super(alert, context); + AndroidUtilities.fixGoogleMapsBug(); ChatActivity chatActivity = (ChatActivity) parentAlert.baseFragment; dialogId = chatActivity.getDialogId(); if (chatActivity.getCurrentEncryptedChat() == null && !chatActivity.isInScheduleMode() && !UserObject.isUserSelf(chatActivity.getCurrentUser())) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java index 88ec5c9c5..e23b512e6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java @@ -400,6 +400,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter public LocationActivity(int type) { super(); locationType = type; + AndroidUtilities.fixGoogleMapsBug(); } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index 663cb7346..fed663a10 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -1453,7 +1453,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. int height = MeasureSpec.getSize(heightMeasureSpec); boolean changed = false; if (lastMeasuredContentWidth != getMeasuredWidth() || lastMeasuredContentHeight != getMeasuredHeight()) { - changed = lastMeasuredContentWidth != 0; + changed = lastMeasuredContentWidth != 0 && lastMeasuredContentWidth != getMeasuredWidth(); listContentHeight = 0; int count = listAdapter.getItemCount(); lastMeasuredContentWidth = getMeasuredWidth(); @@ -1462,12 +1462,13 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. int hs = MeasureSpec.makeMeasureSpec(listView.getMeasuredHeight(), MeasureSpec.UNSPECIFIED); positionToOffset.clear(); for (int i = 0; i < count; i++) { - RecyclerView.ViewHolder holder = listAdapter.createViewHolder(null, listAdapter.getItemViewType(i)); - listAdapter.onBindViewHolder(holder, i); + int type = listAdapter.getItemViewType(i); positionToOffset.put(i, listContentHeight); - if (holder.itemView instanceof SharedMediaLayout) { + if (type == 13) { listContentHeight += listView.getMeasuredHeight(); } else { + RecyclerView.ViewHolder holder = listAdapter.createViewHolder(null, type); + listAdapter.onBindViewHolder(holder, i); holder.itemView.measure(ws, hs); listContentHeight += holder.itemView.getMeasuredHeight(); } @@ -1548,7 +1549,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. top = view.getTop(); } boolean layout = false; - if (!changed && pos != RecyclerView.NO_POSITION) { + if (actionBar.isSearchFieldVisible()) { + layoutManager.scrollToPositionWithOffset(sharedMediaRow, -paddingTop); + layout = true; + } else if (!changed && pos != RecyclerView.NO_POSITION) { layoutManager.scrollToPositionWithOffset(pos, top - paddingTop); layout = true; }