From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: alina sireneva <alina@tei.su>
Date: Tue, 12 May 2026 19:57:59 +0200
Subject: reduce motion in profile

---
 .../ui/Components/ProfileActionsView.java     |  4 +++
 .../ui/Components/SharedMediaLayout.java      |  3 ++
 .../java/org/telegram/ui/Gifts/GiftSheet.java |  4 +++
 .../java/org/telegram/ui/ProfileActivity.java | 28 +++++++++++--------
 .../telegram/ui/Stars/ProfileGiftsView.java   |  8 ++++--
 .../ui/Stories/ProfileStoriesView.java        |  5 ++--
 6 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ProfileActionsView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ProfileActionsView.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ProfileActionsView.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ProfileActionsView.java
@@ -291,6 +291,10 @@ public class ProfileActionsView extends View {
 
         float fraction = Utilities.clamp01(height / targetHeight);
         float alphaFraction1 = Utilities.clamp01((fraction - 0.2f) / 0.8f);
+        if (desu.inugram.helpers.profile.ProfileHelper.reduceMotion()) {
+            fraction = 1f;
+            alphaFraction1 = 1f;
+        }
         if (alphaFraction1 <= 0f) {
             return;
         }
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java
@@ -6904,6 +6904,9 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
         if (!delegate.isFragmentOpened()) {
             animated = false;
         }
+        if (desu.inugram.helpers.profile.ProfileHelper.reduceMotion()) {
+            animated = false;
+        }
         boolean hasRecommendations = false;
         boolean hasSavedDialogs = false;
         boolean hasSavedMessages = savedMessagesContainer != null && sharedMediaPreloader != null && sharedMediaPreloader.hasSavedMessages;
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Gifts/GiftSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Gifts/GiftSheet.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Gifts/GiftSheet.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Gifts/GiftSheet.java
@@ -1100,6 +1100,10 @@ public class GiftSheet extends BottomSheetWithRecyclerListView implements Notifi
 
             imageView = new BackupImageView(context);
             imageView.getImageReceiver().setAutoRepeat(0);
+            if (desu.inugram.helpers.profile.ProfileHelper.reduceMotion()) {
+                imageView.getImageReceiver().setAllowStartLottieAnimation(false);
+                imageView.getImageReceiver().setAllowStartAnimation(false);
+            }
             card.addView(imageView, imageViewLayoutParams = LayoutHelper.createFrame(80, 80, Gravity.CENTER, 0, 12, 0, 12));
 
             lockView = new PremiumLockIconView(context, PremiumLockIconView.TYPE_GIFT_LOCK, resourcesProvider);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
@@ -1375,7 +1375,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
                         canvas.clipRect(0, 0, getMeasuredWidth(), y1);
                         float atop = actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0;
                         float maxExpand = getHeaderOnlyExtraHeight() + atop + (actionBar.getHeight() - atop) / 2f;
-                        StarGiftPatterns.drawProfileAnimatedPattern(canvas, emoji, getMeasuredWidth(), maxExpand, calculateHeaderExtraDiff(), avatarContainer, 1.0f);
+                        final boolean inuReduceMotionPattern = ProfileHelper.reduceMotion() && isFragmentOpened;
+                        StarGiftPatterns.drawProfileAnimatedPattern(canvas, emoji, getMeasuredWidth(), maxExpand, inuReduceMotionPattern ? 1f : calculateHeaderExtraDiff(), avatarContainer, inuReduceMotionPattern && !openAnimationInProgress ? Math.max(0f, calculateHeaderExtraDiff()) : 1f);
                         canvas.restore();
                     }
                 }
@@ -4270,7 +4271,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
                 updateBottomButtonY();
             }
         };
-        listView.setItemAnimator(defaultItemAnimator);
+        listView.setItemAnimator(ProfileHelper.reduceMotion() ? null : defaultItemAnimator);
         defaultItemAnimator.setMoveDelay(0);
         defaultItemAnimator.setMoveDuration(320);
         defaultItemAnimator.setRemoveDuration(320);
@@ -6020,8 +6021,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
             avatarGooey.setGooeyEnabled(false);
         } else {
             avatarGooey.setPullProgress(pullUpProgress);
-            avatarGooey.setBlurIntensity(Math.min((MathUtils.clamp(pullUpProgress, 0.2f, 0.7f) - 0.2f) / 0.5f, 0.75f));
-            avatarGooey.setGooeyEnabled(pullUpProgress > 0 && pullUpProgress < 1);
+            avatarGooey.setBlurIntensity(ProfileHelper.reduceMotion() ? 0f : Math.min((MathUtils.clamp(pullUpProgress, 0.2f, 0.7f) - 0.2f) / 0.5f, 0.75f));
+            avatarGooey.setGooeyEnabled(!ProfileHelper.reduceMotion() && pullUpProgress > 0 && pullUpProgress < 1);
         }
         if (storyView != null && playProfileAnimation != 2) {
             storyView.setAlpha(pullUpProgress > 0 ? lerp(1.0f, 0.0f, ilerp(pullUpProgress, 0, 0.5f)) : 1.0f);
@@ -8425,7 +8426,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
                         + ActionBar.getCurrentActionBarHeight()
                         - dp(21)
                         + actionBar.getTranslationY();
-                avatarY = lerp(endY, startY, diff);
+                avatarY = ProfileHelper.reduceMotion() ? startY - Math.max(0f, headerExtraHeight - extraHeight) : lerp(endY, startY, diff);
             } else {
                 avatarY = endNameY;
             }
@@ -8707,6 +8708,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
                     avatarScale = lerp(intoSize, 96, diff) / 100f;
                     pullUpProgress = 1.0f - diff;
                 }
+                if (ProfileHelper.reduceMotion() && !openAnimationInProgress) {
+                    avatarScale = 96f / 100f;
+                    pullUpProgress = 0.0f;
+                }
 
                 if (actionsView != null) {
                     if (openAnimationInProgress) {
@@ -8720,7 +8725,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
                     storyView.invalidate();
                 }
                 if (giftsView != null) {
-                    giftsView.setCollapseProgress(diff, openAnimationInProgress);
+                    giftsView.setCollapseProgress(ProfileHelper.reduceMotion() ? 1f : diff, openAnimationInProgress);
                 }
                 final float nameScale = 1.0f + 0.12f * diff;
                 if (expandAnimator == null || !expandAnimator.isRunning()) {
@@ -8803,6 +8808,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
         if (diff >= 1f) {
             avatarImage.setAlpha(1f);
         }
+        ProfileHelper.applyReduceMotionAlpha(openAnimationInProgress, diff, avatarContainer, giftsView, storyView);
     }
 
     private void updateExtraViews(float newTop) {
@@ -8813,7 +8819,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
             overlaysView.requestLayout();
         }
         if (topView != null) {
-            topView.backgroundGradientMatrix.setTranslate(0f, avatarY - topView.backgroundGradientY);
+            topView.backgroundGradientMatrix.setTranslate(0f, ProfileHelper.reduceMotion() && openAnimationInProgress ? 0f : avatarY - topView.backgroundGradientY);
             if (topView.backgroundGradient != null) {
                 topView.backgroundGradient.setLocalMatrix(topView.backgroundGradientMatrix);
             }
@@ -11226,7 +11232,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
             return;
         }
         final int newTop = ActionBar.getCurrentActionBarHeight() + (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0);
-        actionsView.isOpeningLayout = openAnimationInProgress;
+        actionsView.isOpeningLayout = openAnimationInProgress || ProfileHelper.reduceMotion();
 
         if (openAnimationInProgress && playProfileAnimation == 2 && avatarContainer != null) {
             float vh = avatarContainer.getHeight() * avatarContainer.getScaleY();
@@ -11514,11 +11520,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
                     if (/*!getMessagesController().premiumFeaturesBlocked() && */user != null && !MessagesController.isSupportUser(user) && DialogObject.getEmojiStatusDocumentId(user.emoji_status) != 0) {
                         rightIconIsStatus = true;
                         rightIconIsPremium = false;
-                        nameTextView[a].setRightDrawable(getEmojiStatusDrawable(user.emoji_status, true, true, a));
+                        nameTextView[a].setRightDrawable(getEmojiStatusDrawable(user.emoji_status, true, !ProfileHelper.reduceMotion(), a));
                     } else if (getMessagesController().isPremiumUser(user)) {
                         rightIconIsStatus = false;
                         rightIconIsPremium = true;
-                        nameTextView[a].setRightDrawable(getEmojiStatusDrawable(null, true, true, a));
+                        nameTextView[a].setRightDrawable(getEmojiStatusDrawable(null, true, !ProfileHelper.reduceMotion(), a));
                     } else {
                         nameTextView[a].setRightDrawable(null);
                     }
@@ -16643,7 +16649,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
         if (collectibleHint != null) {
             collectibleHint.hide();
         }
-        if (status != null && !TextUtils.isEmpty(status.slug)) {
+        if (status != null && !TextUtils.isEmpty(status.slug) && !ProfileHelper.reduceMotion()) {
             collectibleHintVisible = null;
             collectibleHint = new HintView2(getContext(), HintView2.DIRECTION_BOTTOM);
             collectibleHintBackgroundColor = Theme.blendOver(status.center_color | 0xFF000000, Theme.multAlpha(status.pattern_color | 0xFF000000, .5f));
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stars/ProfileGiftsView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stars/ProfileGiftsView.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Stars/ProfileGiftsView.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Stars/ProfileGiftsView.java
@@ -20,6 +20,8 @@ import android.view.animation.LinearInterpolator;
 
 import androidx.annotation.NonNull;
 
+import desu.inugram.helpers.profile.ProfileHelper;
+
 import org.telegram.messenger.AndroidUtilities;
 import org.telegram.messenger.MessagesController;
 import org.telegram.messenger.NotificationCenter;
@@ -323,7 +325,7 @@ public class ProfileGiftsView extends View implements NotificationCenter.Notific
                 } else {
                     g.emojiDrawable = AnimatedEmojiDrawable.make(currentAccount, AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, g.documentId);
                 }
-                g.animatedFloat = new AnimatedFloat(this, 0, 320, null);
+                g.animatedFloat = new AnimatedFloat(this, 0, ProfileHelper.reduceMotion() ? 160 : 320, null);
                 g.animatedFloat.force(0.0f);
                 if (isAttachedToWindow()) {
                     g.emojiDrawable.addView(this);
@@ -402,7 +404,7 @@ public class ProfileGiftsView extends View implements NotificationCenter.Notific
         for (int i = 0; i < gifts.size(); ++i) {
             final Gift gift = gifts.get(i);
             final float enter = gift.animatedFloat.set(1.0f);
-            float scale = lerp(0.5f, 1.0f, enter);
+            float scale = ProfileHelper.reduceMotion() ? 1f : lerp(0.5f, 1.0f, enter);
             final float alpha = enter * (1.0f - expandProgress) * (1.0f - actionBarProgress) * (closedAlpha);
 
             float gx, gy;
@@ -442,7 +444,7 @@ public class ProfileGiftsView extends View implements NotificationCenter.Notific
             }
 
             final float collapseProgressWithEnter;
-            if (isOpening || enter >= 1f) {
+            if (ProfileHelper.reduceMotion() || isOpening || enter >= 1f) {
                 collapseProgressWithEnter = collapseProgress;
             } else {
                 collapseProgressWithEnter = Math.min(enter, collapseProgress);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/ProfileStoriesView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/ProfileStoriesView.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/ProfileStoriesView.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/ProfileStoriesView.java
@@ -460,6 +460,7 @@ public class ProfileStoriesView extends View implements NotificationCenter.Notif
     }
 
     public void animateNewStory() {
+        if (desu.inugram.helpers.profile.ProfileHelper.reduceMotion()) return;
         if (newStoryBounce != null) {
             newStoryBounce.cancel();
         }
@@ -598,8 +599,8 @@ public class ProfileStoriesView extends View implements NotificationCenter.Notif
         }
         if (progressToUploading < 1f) {
             segmentsAlpha = clamp(1f - expandProgress / 0.2f, 1, 0) * (1f - progressToUploading);
-            final float segmentsCount = segmentsCountAnimated.set(count);
-            final float segmentsUnreadCount = segmentsUnreadCountAnimated.set(unreadCount);
+            final float segmentsCount = segmentsCountAnimated.set(count, desu.inugram.helpers.profile.ProfileHelper.reduceMotion());
+            final float segmentsUnreadCount = segmentsUnreadCountAnimated.set(unreadCount, desu.inugram.helpers.profile.ProfileHelper.reduceMotion());
 
             if (isFailed) {
                 rect2.set(rect1);
