From d7deedfa33ddfa51c72a5634d1f07ad2d7ad58a4 Mon Sep 17 00:00:00 2001 From: Arseny271 Date: Thu, 15 Jan 2026 19:17:15 +0400 Subject: [PATCH] update to 12.3.1 (6385) --- .../messenger/SendMessagesHelper.java | 5 +- .../ui/ActionBar/ActionBarLayout.java | 33 +++++-- .../telegram/ui/Cells/DialogsHintCell.java | 10 ++- .../java/org/telegram/ui/DialogsActivity.java | 2 +- .../java/org/telegram/ui/LaunchActivity.java | 86 +++++++++++++++---- gradle.properties | 4 +- 6 files changed, 106 insertions(+), 34 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java index bad34004d..e3336b150 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java @@ -4044,10 +4044,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe webPage = null; } } - HashSet diceEmojies = new HashSet<>(); - diceEmojies.add("\uD83C\uDFB2"); - diceEmojies.add("\uD83C\uDFAF"); - if (canSendStickers && message.length() < 30 && webPage == null && (entities == null || entities.isEmpty()) && diceEmojies.contains(message.replace("\ufe0f", "")) && encryptedChat == null && scheduleDate == 0) { + if (canSendStickers && message.length() < 30 && webPage == null && (entities == null || entities.isEmpty()) && getMessagesController().diceEmojies.contains(message.replace("\ufe0f", "")) && encryptedChat == null && scheduleDate == 0) { final TLRPC.TL_messageMediaDice mediaDice = new TLRPC.TL_messageMediaDice(); mediaDice.emoticon = message; mediaDice.value = -1; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java index c004247b9..326e755f8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java @@ -1407,6 +1407,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F return false; } + private boolean predictiveInput; private boolean predictiveBackInProgress; private boolean predictiveBackHasProgress; private float predictiveBackY; @@ -1414,14 +1415,20 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F public void onBackStarted(float touchX, float touchY) { if (animationInProgress) { if (backAnimator != null) { - backAnimator.end(); + if (!backAnimatorIsBack) { + backAnimator.cancel(); + } else { + backAnimator.end(); + } backAnimator = null; } else { return; } if (animationInProgress) return; } - if (predictiveBackInProgress) return; + if (predictiveBackInProgress || predictiveInput) { + return; + } if (transitionAnimationPreviewMode || startedTracking || checkTransitionAnimation() || fragmentsStack.size() <= 1) { return; } @@ -1440,6 +1447,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F } predictiveBackHasProgress = false; predictiveBackInProgress = true; + predictiveInput = true; predictiveBackLeft = touchX < AndroidUtilities.displaySize.x / 2f; predictiveBackY = touchY; prepareForMoving(); @@ -1450,7 +1458,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F } public void onBackProgress(float t) { - if (!predictiveBackInProgress) return; + if (!predictiveInput) return; final float dx = dp(56) * t; predictiveBackHasProgress = t > 0; containerView.setTranslationX(dx); @@ -1458,15 +1466,17 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F } public void onBackCancelled() { - if (!predictiveBackInProgress) return; + if (!predictiveInput) return; + predictiveInput = false; animateBackEndAnimation(true); } public void onBackInvoked() { - if (!predictiveBackInProgress) { + if (!predictiveInput) { onBackPressed(); return; } + predictiveInput = false; animateBackEndAnimation(false); } @@ -1474,6 +1484,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F return predictiveBackInProgress && predictiveBackHasProgress; } + private boolean backAnimatorIsBack; private AnimatorSet backAnimator; private void animateBackEndAnimation(boolean backAnimation) { final BaseFragment currentFragment = !fragmentsStack.isEmpty() ? fragmentsStack.get(fragmentsStack.size() - 1) : null; @@ -1524,14 +1535,26 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F } animatorSet.addListener(new AnimatorListenerAdapter() { + private boolean cancelled; + @Override + public void onAnimationCancel(Animator animation) { + cancelled = true; + predictiveBackInProgress = false; + containerView.setAlpha(1.0f); + onSlideAnimationEnd(true); + backAnimator = null; + } @Override public void onAnimationEnd(Animator animator) { + if (cancelled) return; predictiveBackInProgress = false; containerView.setAlpha(1.0f); onSlideAnimationEnd(backAnimation); + backAnimator = null; } }); backAnimator = animatorSet; + backAnimatorIsBack = backAnimation; animatorSet.start(); animationInProgress = true; layoutToIgnore = containerViewBack; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogsHintCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogsHintCell.java index f4a08fca1..20da8baef 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogsHintCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogsHintCell.java @@ -69,12 +69,14 @@ public class DialogsHintCell extends BlurredFrameLayout { titleView.setEllipsize(TextUtils.TruncateAt.END); titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); titleView.setTypeface(AndroidUtilities.bold()); - titleView.setSingleLine(); + titleView.setMaxLines(5); + contentView.addView(titleView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP)); messageView = new LinkSpanDrawable.LinksTextView(context); messageView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); messageView.setEllipsize(TextUtils.TruncateAt.END); + messageView.setMaxLines(5); contentView.addView(messageView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, Gravity.TOP)); NotificationCenter.getGlobalInstance().listenGlobal(this, NotificationCenter.emojiLoaded, args -> { @@ -90,11 +92,11 @@ public class DialogsHintCell extends BlurredFrameLayout { parentView.setOrientation(LinearLayout.HORIZONTAL); if (LocaleController.isRTL) { parentView.addView(contentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 7, 0, 7, 0)); - parentView.addView(avatarsImageView, LayoutHelper.createFrame(0, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 2, 0, 8, 0)); + parentView.addView(avatarsImageView, LayoutHelper.createFrame(0, 36, Gravity.CENTER_VERTICAL, 2, 0, 8, 0)); parentView.addView(imageView, LayoutHelper.createFrame(36, 36, Gravity.CENTER_VERTICAL | Gravity.RIGHT, 2, 1, 0, 0)); } else { parentView.addView(imageView, LayoutHelper.createFrame(36, 36, Gravity.CENTER_VERTICAL | Gravity.LEFT, 0, 1, 2, 0)); - parentView.addView(avatarsImageView, LayoutHelper.createFrame(0, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 0, 0, 2, 0)); + parentView.addView(avatarsImageView, LayoutHelper.createFrame(0, 36, Gravity.CENTER_VERTICAL, 0, 0, 2, 0)); parentView.addView(contentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 7, 0, 7, 0)); } addView(parentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); @@ -215,7 +217,7 @@ public class DialogsHintCell extends BlurredFrameLayout { MeasureSpec.makeMeasureSpec(width - getPaddingLeft() - getPaddingRight(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.y, MeasureSpec.AT_MOST) ); - this.height = contentView.getMeasuredHeight() + getPaddingTop() + getPaddingBottom() + 1; + this.height = parentView.getMeasuredHeight() + getPaddingTop() + getPaddingBottom() + 1; super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java index e879f468e..a0cf0ae3c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java @@ -6175,7 +6175,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. Theme.key_windowBackgroundWhiteValueText, AndroidUtilities.REPLACING_TAG_TYPE_LINKBOLD, null - ), null, false), LocaleController.formatString("BoostingPremiumChristmasSubTitle", R.string.BoostingPremiumChristmasSubTitle)); + ), null, false), LocaleController.formatString(R.string.BoostingPremiumChristmasSubTitle)); dialogsHintCell.setOnCloseListener(v -> { MessagesController.getInstance(currentAccount).removeSuggestion(0, "PREMIUM_CHRISTMAS"); ChangeBounds transition = new ChangeBounds(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index 8fc34898d..4fdc6c846 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -51,6 +51,7 @@ import android.text.TextPaint; import android.text.TextUtils; import android.text.style.ClickableSpan; import android.util.Base64; +import android.util.Log; import android.util.SparseIntArray; import android.view.ActionMode; import android.view.Gravity; @@ -72,6 +73,7 @@ import android.widget.RelativeLayout; import android.widget.Toast; import android.window.BackEvent; import android.window.OnBackAnimationCallback; +import android.window.OnBackInvokedCallback; import android.window.OnBackInvokedDispatcher; import androidx.annotation.NonNull; @@ -1042,11 +1044,15 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati RestrictedLanguagesSelectActivity.checkRestrictedLanguages(false); if (Build.VERSION.SDK_INT >= 34) { - getOnBackInvokedDispatcher().registerOnBackInvokedCallback( - OnBackInvokedDispatcher.PRIORITY_DEFAULT, - new OnBackAnimationCallback() { + if (onBackAnimationCallback == null) { + onBackAnimationCallback = new OnBackAnimationCallback() { + private boolean started = false; + private boolean invoked = false; + @Override public void onBackInvoked() { + invoked = true; + if (AndroidUtilities.isTablet()) { onBackPressed(); return; @@ -1062,6 +1068,12 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati @Override public void onBackStarted(@NonNull BackEvent backEvent) { + started = true; + invoked = false; + predictiveBackStarted = false; + } + + private void onBackStartedInternal(BackEvent backEvent) { if (AndroidUtilities.isTablet()) return; if (!onBackPressed(false)) return; if (actionBarLayout != null) { @@ -1069,8 +1081,21 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati } } + private static final float LAZY_START = 0.015f; + private boolean predictiveBackStarted; + private boolean predictiveBackInvoked; + @Override public void onBackProgressed(@NonNull BackEvent backEvent) { + if (started && invoked) return; + + final float progress = backEvent.getProgress(); + if (!predictiveBackStarted && progress > LAZY_START) { + predictiveBackStarted = true; + onBackStartedInternal(backEvent); + } + + final float fixedProgress = Math.max(0, progress - LAZY_START) / (1 - LAZY_START); if (AndroidUtilities.isTablet()) return; if (actionBarLayout != null) { actionBarLayout.onBackProgress(backEvent.getProgress()); @@ -1079,33 +1104,49 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati @Override public void onBackCancelled() { + started = false; + invoked = false; + if (AndroidUtilities.isTablet()) return; if (actionBarLayout != null) { actionBarLayout.onBackCancelled(); } } - } - ); - } else if (Build.VERSION.SDK_INT >= 33) { + }; + } getOnBackInvokedDispatcher().registerOnBackInvokedCallback( OnBackInvokedDispatcher.PRIORITY_DEFAULT, - () -> { - if (AndroidUtilities.isTablet()) { - onBackPressed(); - return; + (OnBackAnimationCallback) onBackAnimationCallback + ); + } else if (Build.VERSION.SDK_INT >= 33) { + if (onBackInvokedCallback == null) { + onBackInvokedCallback = new OnBackInvokedCallback() { + @Override + public void onBackInvoked() { + if (AndroidUtilities.isTablet()) { + onBackPressed(); + return; + } + if (!onBackPressed(true)) + return; + if (actionBarLayout != null) { + actionBarLayout.onBackInvoked(); + } else { + onBackPressed(); + } } - if (!onBackPressed(true)) - return; - if (actionBarLayout != null) { - actionBarLayout.onBackInvoked(); - } else { - onBackPressed(); - } - } + }; + } + getOnBackInvokedDispatcher().registerOnBackInvokedCallback( + OnBackInvokedDispatcher.PRIORITY_DEFAULT, + (OnBackInvokedCallback) onBackInvokedCallback ); } } + private Object onBackAnimationCallback; + private Object onBackInvokedCallback; + private void showAttachMenuBot(TLRPC.TL_attachMenuBot attachMenuBot, String startApp, boolean sidemenu) { drawerLayoutContainer.closeDrawer(); BaseFragment lastFragment = getLastFragment(); @@ -7166,6 +7207,15 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati } catch (Exception e) { FileLog.e(e); } + if (Build.VERSION.SDK_INT >= 34) { + if (onBackAnimationCallback instanceof OnBackAnimationCallback) { + getOnBackInvokedDispatcher().unregisterOnBackInvokedCallback((OnBackAnimationCallback) onBackAnimationCallback); + } + } else if (Build.VERSION.SDK_INT >= 33) { + if (onBackAnimationCallback instanceof OnBackInvokedCallback) { + getOnBackInvokedDispatcher().unregisterOnBackInvokedCallback((OnBackInvokedCallback) onBackInvokedCallback); + } + } clearFragments(); super.onDestroy(); onFinish(); diff --git a/gradle.properties b/gradle.properties index 188d457f3..6bb315db1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,8 +13,8 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true #Sat Mar 12 05:53:50 MSK 2016 -APP_VERSION_CODE=6377 -APP_VERSION_NAME=12.3.0 +APP_VERSION_CODE=6385 +APP_VERSION_NAME=12.3.1 APP_PACKAGE=org.telegram.messenger IS_PRIVATE=false RELEASE_KEY_PASSWORD=android