From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: alina sireneva <alina@tei.su>
Date: Mon, 20 Apr 2026 17:00:53 +0300
Subject: tweaks for the dialogs list fab

---
 .../java/org/telegram/ui/DialogsActivity.java | 42 ++++++++++++-------
 1 file changed, 28 insertions(+), 14 deletions(-)

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
@@ -279,6 +279,7 @@ import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
 
 import desu.inugram.InuHooks;
+import desu.inugram.helpers.dialogs.DialogsFabHelper;
 import desu.inugram.helpers.dialogs.FolderHelper;
 import desu.inugram.helpers.dialogs.MainTabsHelper;
 import me.vkryl.android.animator.BoolAnimator;
@@ -4558,7 +4559,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
                                 } else {
                                     goingDown = firstVisiblePosition > prevPosition;
                                 }
-                                if (changed && scrollUpdated && (goingDown || scrollingManually)) {
+                                if (changed && scrollUpdated && (goingDown || scrollingManually) && DialogsFabHelper.hideOnScroll()) {
                                     hideFloatingButton(goingDown);
                                 }
                                 prevPosition = firstVisiblePosition;
@@ -4749,14 +4750,21 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
         });
         searchTabsAndFiltersLayout.addView(filtersView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP));
 
+        additionFloatingButtonOffset = DialogsFabHelper.floatingButtonOffset(hasMainTabs);
+
         floatingButtonStories = new FragmentFloatingButton(context, resourceProvider, true);
-        floatingButtonStories.setContentDescription(getString(R.string.StoryPrivacyButtonPost));
-        floatingButtonStories.setImageResource(R.drawable.outline_fab_story_24);
-        floatingButtonStories.setOnClickListener(v -> openStoriesRecorder());
-        contentView.addView(floatingButtonStories, FragmentFloatingButton.createSubButtonLayoutParams());
+        DialogsFabHelper.Action inu_secondaryAction = DialogsFabHelper.secondaryAction();
+        floatingButtonStories.setContentDescription(inu_secondaryAction.label());
+        floatingButtonStories.setImageResource(inu_secondaryAction.getIconRes());
+        floatingButtonStories.setOnClickListener(v -> DialogsFabHelper.perform(this, inu_secondaryAction));
+        FrameLayout.LayoutParams inu_secondaryFabParams = FragmentFloatingButton.createSubButtonLayoutParams();
+        DialogsFabHelper.applySide(inu_secondaryFabParams);
+        contentView.addView(floatingButtonStories, inu_secondaryFabParams);
 
         floatingButton3 = new FragmentFloatingButton(context, resourceProvider);
-        contentView.addView(floatingButton3, FragmentFloatingButton.createDefaultLayoutParams());
+        FrameLayout.LayoutParams inu_mainFabParams = FragmentFloatingButton.createDefaultLayoutParams();
+        DialogsFabHelper.applySide(inu_mainFabParams);
+        contentView.addView(floatingButton3, inu_mainFabParams);
         floatingButton3.setOnClickListener(v -> {
             if (parentLayout != null && parentLayout.isInPreviewMode()) {
                 finishPreviewFragment();
@@ -4776,7 +4784,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
                     AccountFrozenAlert.show(currentAccount);
                     return;
                 }
-                openWriteContacts();
+                DialogsFabHelper.perform(this, DialogsFabHelper.mainAction());
             }
         });
 
@@ -8871,12 +8879,15 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
 
     private void updateFloatingButtonVisibility(boolean animated) {
         final boolean isVisible = !(onlySelect && initialDialogsType != 10 || folderId != 0 || communityId != 0 || inPreviewMode || (searching && !onlySelect) || floatingButtonHidden);
+        final boolean inu_configurable = initialDialogsType == DIALOGS_TYPE_DEFAULT && !onlySelect;
+        final boolean inu_mainVisible = !inu_configurable || DialogsFabHelper.mainAction() != DialogsFabHelper.Action.NONE;
+        final boolean inu_secondaryVisible = !inu_configurable || DialogsFabHelper.secondaryAction() != DialogsFabHelper.Action.NONE;
 
         if (floatingButton3 != null) {
-            floatingButton3.setButtonVisible(isVisible, animated);
+            floatingButton3.setButtonVisible(isVisible && inu_mainVisible, animated);
         }
         if (floatingButtonStories != null) {
-            floatingButtonStories.setButtonVisible(isVisible, animated);
+            floatingButtonStories.setButtonVisible(isVisible && inu_secondaryVisible, animated);
         }
     }
 
@@ -8915,8 +8926,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
             floatingButton3.setImageResource(R.drawable.floating_check);
             floatingButton3.setContentDescription(LocaleController.getString(R.string.Done));
         } else {
-            floatingButton3.setImageResource(R.drawable.filled_fab_compose_32);
-            floatingButton3.setContentDescription(LocaleController.getString(R.string.NewMessageTitle));
+            DialogsFabHelper.Action inu_main = DialogsFabHelper.mainAction();
+            floatingButton3.setImageResource(inu_main.getIconRes() != 0 ? inu_main.getIconRes() : R.drawable.filled_fab_compose_32);
+            floatingButton3.setContentDescription(inu_main.label());
         }
     }
 
@@ -13530,13 +13542,13 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
         }, 0);
     }
 
-    private void openWriteContacts() {
+    public void openWriteContacts() {
         Bundle args = new Bundle();
         args.putBoolean("destroyAfterSelect", true);
         presentFragment(new ContactsActivity(args));
     }
 
-    private void openStoriesRecorder() {
+    public void openStoriesRecorder() {
         if (!storiesEnabled) {
             if (storyPremiumHint != null) {
                 if (storyPremiumHint.shown()) {
@@ -13757,10 +13769,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
             });
         });
         io.addGap();
-        io.add(R.drawable.outline_groups_24, getString(R.string.NewGroup), () -> {
+        final boolean inu_needNewMessage = !DialogsFabHelper.hasNewMessage();
+        io.addIf(!inu_needNewMessage, R.drawable.outline_groups_24, getString(R.string.NewGroup), () -> {
             Bundle args = new Bundle();
             presentFragment(new GroupCreateActivity(args));
         });
+        io.addIf(inu_needNewMessage, R.drawable.menu_topic_add, getString(R.string.NewMessageTitle), this::openWriteContacts);
         io.add(R.drawable.outline_saved_24, getString(R.string.SavedMessages), () -> {
             Bundle args = new Bundle();
             args.putLong("user_id", UserConfig.getInstance(currentAccount).getClientUserId());
