From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: alina sireneva <alina@tei.su>
Date: Wed, 29 Apr 2026 17:59:48 +0300
Subject: option to disable scrim blur throughout the app

---
 .../telegram/messenger/AndroidUtilities.java  |  7 +++++++
 .../ui/Components/BlurBehindDrawable.java     | 15 +++++++++++++++
 .../telegram/ui/Components/ScrimOptions.java  | 10 +++++++++-
 .../org/telegram/ui/ContentPreviewViewer.java |  4 ++--
 .../java/org/telegram/ui/DialogsActivity.java | 10 ++++++++++
 .../org/telegram/ui/MessageSendPreview.java   | 19 +++++++++++++++----
 .../java/org/telegram/ui/TopicsFragment.java  | 12 ++++++++++++
 7 files changed, 70 insertions(+), 7 deletions(-)

diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
@@ -6087,6 +6087,13 @@ public class AndroidUtilities {
             return;
         }
 
+        if (desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue()) {
+            Bitmap stub = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_8888);
+            stub.eraseColor(0x60000000);
+            onBitmapDone.run(stub);
+            return;
+        }
+
         List<View> views = allGlobalViews();
 
         if (views == null) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/BlurBehindDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/BlurBehindDrawable.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/BlurBehindDrawable.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/BlurBehindDrawable.java
@@ -73,6 +73,21 @@ public class BlurBehindDrawable {
         if (parentView == null || parentView.getMeasuredHeight() == 0 && parentView.getMeasuredWidth() == 0) {
             return;
         }
+        if (desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue()) {
+            if (animateAlpha) {
+                if (show && blurAlpha != 1f) {
+                    blurAlpha = Math.min(1f, blurAlpha + 0.09f);
+                    parentView.invalidate();
+                } else if (!show && blurAlpha != 0f) {
+                    blurAlpha = Math.max(0f, blurAlpha - 0.09f);
+                    parentView.invalidate();
+                }
+            }
+            float a = animateAlpha ? blurAlpha : 1f;
+            errorBlackoutPaint.setAlpha((int) (0x60 * a));
+            canvas.drawPaint(errorBlackoutPaint);
+            return;
+        }
         if (type == 1 && !wasDraw && !animateAlpha) {
             generateBlurredBitmaps();
             invalidate = false;
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrimOptions.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrimOptions.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrimOptions.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrimOptions.java
@@ -347,6 +347,14 @@ public class ScrimOptions extends Dialog {
     }
 
     public static void makeGlobalBlurBitmaps(Utilities.Callback2<Bitmap, Bitmap> bitmaps) {
+        if (desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue()) {
+            Bitmap stubBg = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_8888);
+            stubBg.eraseColor(0x60000000);
+            Bitmap stubOptions = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_8888);
+            stubOptions.eraseColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground) | 0xFF000000);
+            bitmaps.run(stubBg, stubOptions);
+            return;
+        }
         AndroidUtilities.makeGlobalBlurBitmap(bitmap -> {
             final ColorMatrix colorMatrixBg = new ColorMatrix();
             AndroidUtilities.adjustSaturationColorMatrix(colorMatrixBg, Theme.isCurrentThemeDark() ? .04f : +.25f);
@@ -366,7 +374,7 @@ public class ScrimOptions extends Dialog {
     }
 
     public static void makeGlobalBlurBitmaps(View cutToContainer, Utilities.Callback2<Bitmap, Bitmap> bitmaps) {
-        if (cutToContainer == null) {
+        if (cutToContainer == null || desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue()) {
             makeGlobalBlurBitmaps(bitmaps);
             return;
         }
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java
@@ -2056,7 +2056,7 @@ public class ContentPreviewViewer {
                 containerView.invalidate();
             }
 
-            if (blurProgress != 0 && blurrBitmap != null) {
+            if (blurProgress != 0 && blurrBitmap != null && !desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue()) {
                 paint.setAlpha((int) (blurProgress * 255));
                 if (paint.getAlpha() != 255) {
                     canvas.drawColor(Theme.multAlpha(Theme.getColor(Theme.key_windowBackgroundGray, resourcesProvider), blurProgress));
@@ -2065,7 +2065,7 @@ public class ContentPreviewViewer {
             }
         }
 
-        backgroundDrawable.setAlpha((int) (180 * showProgress));
+        backgroundDrawable.setAlpha((int) ((desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue() ? 255 : 180) * showProgress));
         backgroundDrawable.setBounds(0, 0, containerView.getWidth(), containerView.getHeight());
         backgroundDrawable.draw(canvas);
 
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java
@@ -9040,6 +9040,16 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
         if (blurredView == null) {
             return;
         }
+        if (desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue()) {
+            blurredView.setBackgroundColor(0x60000000);
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                blurredView.setForeground(null);
+            }
+            blurredView.setAlpha(0.0f);
+            blurredView.setVisibility(View.VISIBLE);
+            checkUi_mainTabsVisible();
+            return;
+        }
         int w = (int) (fragmentView.getMeasuredWidth() / 9.0f);
         int h = (int) (fragmentView.getMeasuredHeight() / 9.0f);
         Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MessageSendPreview.java b/TMessagesProj/src/main/java/org/telegram/ui/MessageSendPreview.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/MessageSendPreview.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/MessageSendPreview.java
@@ -161,7 +161,7 @@ public class MessageSendPreview extends Dialog implements NotificationCenter.Not
             @Override
             protected void dispatchDraw(@NonNull Canvas canvas) {
                 if (activityVisibilityController != null) {
-                    activityVisibilityController.setHidden(openProgress == 1 && blurBitmapPaint != null);
+                    activityVisibilityController.setHidden(openProgress == 1 && blurBitmapPaint != null && !desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue());
                 }
 
                 if (openProgress > 0 && blurBitmapPaint != null) {
@@ -1166,7 +1166,9 @@ public class MessageSendPreview extends Dialog implements NotificationCenter.Not
                 WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS |
                 WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION |
                 WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
-        params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
+        if (!desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue()) {
+            params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
+        }
         params.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
         window.setAttributes(params);
 
@@ -1694,6 +1696,15 @@ public class MessageSendPreview extends Dialog implements NotificationCenter.Not
         if (dismissing) return;
         dismissing = true;
 
+        if (desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue()) {
+            if (editText != null) {
+                editText.setAlpha(1f);
+            }
+            if (anchorSendButton != null && !sent) {
+                anchorSendButton.setAlpha(1f);
+            }
+        }
+
         SpoilerEffect2.pause(SpoilerEffect2.TYPE_DEFAULT, false);
         if (spoilerEffect2 != null) {
             spoilerEffect2.detach(windowView);
@@ -1776,13 +1787,13 @@ public class MessageSendPreview extends Dialog implements NotificationCenter.Not
                     closing = false;
                 }
                 if (editText != null) {
-                    editText.setAlpha(1f);
+                    editText.setAlpha(open && desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue() ? 0f : 1f);
                 }
                 if (destCell != null) {
                     destCell.setVisibility(View.VISIBLE);
                 }
                 if (anchorSendButton != null && !sent) {
-                    anchorSendButton.setAlpha(1f);
+                    anchorSendButton.setAlpha(open && desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue() ? 0f : 1f);
                 }
                 if (!open && sendButton != null) {
                     sendButton.setAlpha(0f);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TopicsFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/TopicsFragment.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/TopicsFragment.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/TopicsFragment.java
@@ -4033,6 +4033,18 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
         if (blurredView == null || parentLayout == null) {
             return;
         }
+        if (desu.inugram.InuConfig.DISABLE_SCRIM_BLUR.getValue()) {
+            blurredView.setBackgroundColor(0x60000000);
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                blurredView.setForeground(null);
+            }
+            blurredView.setAlpha(0.0f);
+            if (blurredView.getParent() != null) {
+                ((ViewGroup) blurredView.getParent()).removeView(blurredView);
+            }
+            parentLayout.getOverlayContainerView().addView(blurredView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
+            return;
+        }
         int w = (int) (fragmentView.getMeasuredWidth() / 6.0f);
         int h = (int) (fragmentView.getMeasuredHeight() / 6.0f);
         Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
