From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: alina sireneva <alina@tei.su>
Date: Fri, 10 Apr 2026 06:58:12 +0300
Subject: dialog folders display mode customizations

---
 .../messenger/MessagesController.java         |   1 +
 .../telegram/messenger/MessagesStorage.java   |  26 +++++
 .../ui/Components/FilterTabsView.java         | 100 ++++++++++++------
 .../java/org/telegram/ui/DialogsActivity.java |  17 ++-
 .../org/telegram/ui/FilterCreateActivity.java |   4 +
 5 files changed, 114 insertions(+), 34 deletions(-)

diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
@@ -1286,6 +1286,7 @@ public class MessagesController extends BaseController implements NotificationCe
         public ArrayList<TLRPC.Dialog> dialogsForward = new ArrayList<>();
         public int color;
         public boolean title_noanimate;
+        public String inu_emoticon;
 
         public ArrayList<TL_chatlists.TL_exportedChatlistInvite> invites = null;
 
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java
@@ -72,6 +72,7 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Consumer;
+import desu.inugram.helpers.dialogs.FolderHelper;
 
 import me.vkryl.core.BitwiseUtils;
 
@@ -2678,6 +2679,8 @@ public class MessagesStorage extends BaseController {
                     return 0;
                 });
 
+                FolderHelper.loadMeta(MessagesStorage.this, currentAccount, dialogFilters);
+
                 if (updateCounters) {
                     calcUnreadCounters(true);
                 }
@@ -2772,6 +2775,9 @@ public class MessagesStorage extends BaseController {
             while (cursor.next()) {
                 int folderId = cursor.intValue(1);
                 long did = cursor.longValue(0);
+                if (FolderHelper.shouldExcludeFromCounter(currentAccount, did)) {
+                    continue;
+                }
                 int unread;
                 int mentions = 0;
                 if (isForum(did, FORUM_TYPE_CHAT | FORUM_TYPE_BOT | FORUM_TYPE_DIRECT)) {
@@ -2818,6 +2824,11 @@ public class MessagesStorage extends BaseController {
                 getUsersInternal(usersToLoad, users, true);
                 for (int a = 0, N = users.size(); a < N; a++) {
                     TLRPC.User user = users.get(a);
+                    if (FolderHelper.shouldExcludeFromCounter(currentAccount, user.id, user)) {
+                        dialogsWithUnread.remove(user.id);
+                        dialogsWithMentions.remove(user.id);
+                        continue;
+                    }
                     boolean muted = getMessagesController().isDialogMuted(user.id, 0);
                     int idx1 = dialogsByFolders.get(user.id);
                     int idx2 = muted ? 1 : 0;
@@ -3329,6 +3340,10 @@ public class MessagesStorage extends BaseController {
                             changed = true;
                             filter.title_noanimate= newFilter.title_noanimate;
                         }
+                        if (!TextUtils.equals(filter.inu_emoticon, newFilter.emoticon)) {
+                            changed = true;
+                            filter.inu_emoticon = newFilter.emoticon;
+                        }
                         final int color = (newFilter.flags & 134217728) != 0 ? newFilter.color : -1;
                         if (filter.color != color) {
                             filter.color = color;
@@ -3470,6 +3485,7 @@ public class MessagesStorage extends BaseController {
                         filter.name = newFilter.title.text;
                         filter.entities = newFilter.title.entities;
                         filter.title_noanimate = newFilter.title_noanimate;
+                        filter.inu_emoticon = newFilter.emoticon;
                         filter.color = (newFilter.flags & 134217728) != 0 ? newFilter.color : -1;
                         filter.pendingUnreadCount = -1;
                         for (int c = 0; c < 2; c++) {
@@ -3589,6 +3605,7 @@ public class MessagesStorage extends BaseController {
             saveDialogFilterInternal(filtersToSave.get(a), false, true);
             anythingChanged = true;
         }
+        FolderHelper.saveMeta(MessagesStorage.this, dialogFilters);
         boolean orderChanged = false;
         for (int a = 0, N = dialogFilters.size(); a < N; a++) {
             MessagesController.DialogFilter filter = dialogFilters.get(a);
@@ -6061,6 +6078,9 @@ public class MessagesStorage extends BaseController {
                     continue;
                 }
                 long did = array.keyAt(a);
+                if (FolderHelper.shouldExcludeFromCounter(currentAccount, did)) {
+                    continue;
+                }
                 if (read) {
                     if (b == 0) {
                         dialogsWithUnread.remove(did);
@@ -6124,6 +6144,11 @@ public class MessagesStorage extends BaseController {
             getUsersInternal(usersToLoad, users);
             for (int a = 0, N = users.size(); a < N; a++) {
                 TLRPC.User user = users.get(a);
+                if (FolderHelper.shouldExcludeFromCounter(currentAccount, user.id, user)) {
+                    dialogsWithUnread.remove(user.id);
+                    dialogsWithMentions.remove(user.id);
+                    continue;
+                }
                 boolean muted = getMessagesController().isDialogMuted(user.id, 0);
                 Integer folderId = dialogsByFolders.get(user.id);
                 int idx1 = folderId == null || folderId < 0 || folderId > 1 ? 0 : folderId;
@@ -17405,6 +17430,7 @@ public class MessagesStorage extends BaseController {
     }
 
     public void resetAllUnreadCounters(boolean muted) {
+        if (muted && FolderHelper.isMuteFilteringActive()) muted = false;
         for (int a = 0, N = dialogFilters.size(); a < N; a++) {
             MessagesController.DialogFilter filter = dialogFilters.get(a);
             if (muted) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java
@@ -34,11 +34,9 @@ import android.text.SpannableStringBuilder;
 import android.text.StaticLayout;
 import android.text.TextPaint;
 import android.text.TextUtils;
-import android.util.Log;
 import android.util.Property;
 import android.util.SparseIntArray;
 import android.view.HapticFeedbackConstants;
-import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.accessibility.AccessibilityNodeInfo;
@@ -67,10 +65,9 @@ import org.telegram.tgnet.ConnectionsManager;
 import org.telegram.tgnet.TLRPC;
 import org.telegram.ui.ActionBar.Theme;
 import org.telegram.ui.Components.blur3.drawable.BlurredBackgroundDrawable;
-import org.telegram.ui.Stories.recorder.HintView2;
 
 import java.util.ArrayList;
-import java.util.Map;
+import desu.inugram.helpers.dialogs.FolderHelper;
 
 @SuppressLint("ViewConstructor")
 public class FilterTabsView extends FrameLayout {
@@ -124,6 +121,7 @@ public class FilterTabsView extends FrameLayout {
         public boolean isDefault;
         public boolean isLocked;
         public boolean noanimate;
+        public int inu_iconResId;
 
         public Tab(int i, CharSequence title, boolean noanimate) {
             this.id = i;
@@ -132,7 +130,7 @@ public class FilterTabsView extends FrameLayout {
         }
 
         public int getWidth(boolean store) {
-            int width = titleWidth = (int) Math.ceil(HintView2.measureCorrectly(title, textPaint));
+            int width = titleWidth = FolderHelper.getContentWidth(title, textPaint);
             int c;
             if (store) {
                 c = delegate.getTabCounter(id);
@@ -151,9 +149,15 @@ public class FilterTabsView extends FrameLayout {
                 String counterText = String.format("%d", c);
                 int counterWidth = (int) Math.ceil(textCounterPaint.measureText(counterText));
                 int countWidth = Math.max(dp(TAB_COUNTER_HEIGHT - 10), counterWidth) + dp(10);
-                counterResultWidth = countWidth + dp(-2);
+                if (FolderHelper.isTitleOnly()) {
+                    counterResultWidth = countWidth + dp(-2);
+                } else if (FolderHelper.isIconsOnly()) {
+                    counterResultWidth = countWidth;
+                } else {
+                    counterResultWidth = countWidth + dp(6);
+                }
             } else {
-                counterResultWidth = !isDefault && isEditing ? dp(TAB_COUNTER_HEIGHT - 5) : 0;
+                counterResultWidth = !isDefault && isEditing ? dp(TAB_COUNTER_HEIGHT - 5) + (FolderHelper.isIconsOnly() ? dp(6) : 0) : 0;
             }
             width += counterResultWidth;
 
@@ -173,8 +177,8 @@ public class FilterTabsView extends FrameLayout {
         }
     }
 
-    private static final float TAB_PADDING_WIDTH = 24;
-    private static final float TAB_INTERNAL_PADDING = 12.5f;
+    public static final float TAB_PADDING_WIDTH = 24;
+    public static final float TAB_INTERNAL_PADDING = 12.5f;
     private static final float TAB_COUNTER_HEIGHT = 17.333f;
 
     public class TabView extends View {
@@ -191,6 +195,7 @@ public class FilterTabsView extends FrameLayout {
         private AnimatedEmojiSpan.EmojiGroupedSpans textLayoutEmojis;
         private StaticLayout textLayout;
         private int textOffsetX;
+        private Drawable inu_iconDrawable;
 
         public boolean animateChange;
         public float changeProgress;
@@ -243,6 +248,7 @@ public class FilterTabsView extends FrameLayout {
             currentTab = tab;
             currentPosition = position;
             setContentDescription(tab.title);
+            inu_iconDrawable = FolderHelper.needIcons() ? getContext().getResources().getDrawable(tab.inu_iconResId).mutate() : null;
             requestLayout();
 
             if (currentNoanimate != (currentTab != null && currentTab.noanimate)) {
@@ -289,7 +295,7 @@ public class FilterTabsView extends FrameLayout {
 
         @Override
         protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-            int w = currentTab.getWidth(false) + dp(TAB_PADDING_WIDTH) + additionalTabWidth;
+            int w = currentTab.getWidth(false) + dp(FolderHelper.getTabPadding()) + additionalTabWidth;
             setMeasuredDimension(w, MeasureSpec.getSize(heightMeasureSpec));
         }
 
@@ -386,7 +392,14 @@ public class FilterTabsView extends FrameLayout {
             }
 
             tabCounterVisible = (countWidth != 0 && !animateCounterRemove) ? (counterText != null ? 1.0f : editingStartAnimationProgress) : 0;
-            tabWidth = currentTab.titleWidth + ((countWidth != 0 && !animateCounterRemove) ? countWidth + dp(-2 * (counterText != null ? 1.0f : editingStartAnimationProgress)) : 0);
+            tabWidth = currentTab.titleWidth;
+            if (FolderHelper.isTitleOnly()) {
+                tabWidth += (countWidth != 0 && !animateCounterRemove) ? countWidth + dp(-2 * (counterText != null ? 1.0f : editingStartAnimationProgress)) : 0;
+            } else if (FolderHelper.isIconsOnly()) {
+                tabWidth += (countWidth != 0 && !animateCounterRemove) ? countWidth : 0;
+            } else {
+                tabWidth += (countWidth != 0 && !animateCounterRemove) ? countWidth + dp(6 * (counterText != null ? 1.0f : editingStartAnimationProgress)) : 0;
+            }
             float textX = (getMeasuredWidth() - tabWidth) / 2f;
             if (animateTextX) {
                 textX = textX * changeProgress + animateFromTextX * (1f - changeProgress);
@@ -401,12 +414,16 @@ public class FilterTabsView extends FrameLayout {
             }
 
 
+            FolderHelper.drawTabIcon(canvas, inu_iconDrawable, emojiColorFilter, textX, getMeasuredWidth(), getMeasuredHeight());
+
             float titleOffsetX = 0;
+            if (!FolderHelper.isIconsOnly()) {
+            float inu_extraTextX = FolderHelper.getTextXOffset();
             if (animateTextChange) {
                 titleOffsetX = titleXOffset * (animateTextChangeOut ? changeProgress : 1f - changeProgress);
                 if (titleAnimateStableLayout != null) {
                     canvas.save();
-                    canvas.translate(textX + textOffsetX + titleOffsetX, (getMeasuredHeight() - textHeight) / 2f + 1);
+                    canvas.translate(textX + textOffsetX + titleOffsetX + inu_extraTextX, (getMeasuredHeight() - textHeight) / 2f + 1);
                     titleAnimateStableLayout.draw(canvas);
                     AnimatedEmojiSpan.drawAnimatedEmojis(canvas, titleAnimateStableLayout, titleAnimateStableLayoutEmojis, 0, null, computeVerticalScrollOffset() - dp(6), computeVerticalScrollOffset() + computeVerticalScrollExtent(), 0, 1.0f, emojiColorFilter);
                     canvas.restore();
@@ -415,7 +432,7 @@ public class FilterTabsView extends FrameLayout {
                     canvas.save();
                     int alpha = textPaint.getAlpha();
                     textPaint.setAlpha((int) (alpha * (animateTextChangeOut ? 1f - changeProgress : changeProgress)));
-                    canvas.translate(textX + textOffsetX + titleOffsetX, (getMeasuredHeight() - textHeight) / 2f + 1);
+                    canvas.translate(textX + textOffsetX + titleOffsetX + inu_extraTextX, (getMeasuredHeight() - textHeight) / 2f + 1);
                     titleAnimateInLayout.draw(canvas);
                     AnimatedEmojiSpan.drawAnimatedEmojis(canvas, titleAnimateInLayout, titleAnimateInLayoutEmojis, 0, null, computeVerticalScrollOffset() - dp(6), computeVerticalScrollOffset() + computeVerticalScrollExtent(), 0, (animateTextChangeOut ? 1f - changeProgress : changeProgress), emojiColorFilter);
                     canvas.restore();
@@ -425,7 +442,7 @@ public class FilterTabsView extends FrameLayout {
                     canvas.save();
                     int alpha = textPaint.getAlpha();
                     textPaint.setAlpha((int) (alpha * (animateTextChangeOut ? changeProgress : 1f - changeProgress)));
-                    canvas.translate(textX + textOffsetX + titleOffsetX, (getMeasuredHeight() - textHeight) / 2f + 1);
+                    canvas.translate(textX + textOffsetX + titleOffsetX + inu_extraTextX, (getMeasuredHeight() - textHeight) / 2f + 1);
                     titleAnimateOutLayout.draw(canvas);
                     AnimatedEmojiSpan.drawAnimatedEmojis(canvas, titleAnimateOutLayout, titleAnimateOutLayoutEmojis, 0, null, computeVerticalScrollOffset() - dp(6), computeVerticalScrollOffset() + computeVerticalScrollExtent(), 0, (animateTextChangeOut ? changeProgress : 1f - changeProgress), emojiColorFilter);
                     canvas.restore();
@@ -434,12 +451,13 @@ public class FilterTabsView extends FrameLayout {
             } else {
                 if (textLayout != null) {
                     canvas.save();
-                    canvas.translate(textX + textOffsetX, (getMeasuredHeight() - textHeight) / 2f + 1);
+                    canvas.translate(textX + textOffsetX + inu_extraTextX, (getMeasuredHeight() - textHeight) / 2f + 1);
                     textLayout.draw(canvas);
                     AnimatedEmojiSpan.drawAnimatedEmojis(canvas, textLayout, textLayoutEmojis, 0, null, computeVerticalScrollOffset() - dp(6), computeVerticalScrollOffset() + computeVerticalScrollExtent(), 0, 1.0f, emojiColorFilter);
                     canvas.restore();
                 }
             }
+            } // !inu_iconsOnly
 
             if (animateCounterEnter || counterText != null || showRemove && (isEditing || editingStartAnimationProgress != 0)) {
                 if (aBackgroundColorKey < 0) {
@@ -466,10 +484,11 @@ public class FilterTabsView extends FrameLayout {
                 if (animateTextChange) {
                     titleWidth = animateFromTitleWidth * (1f - changeProgress) + currentTab.titleWidth * changeProgress;
                 }
+                int extra = dp(FolderHelper.isIconsOnly() ? 0 : 6);
                 if (animateTextChange && titleAnimateOutLayout == null) {
-                    x = textX - titleXOffset + titleOffsetX + titleWidth + dp(5);
+                    x = textX - titleXOffset + titleOffsetX + titleWidth + extra;
                 } else {
-                    x = textX + titleWidth + dp(5);
+                    x = textX + titleWidth + extra;
                 }
                 int countTop = (getMeasuredHeight() - dp(TAB_COUNTER_HEIGHT)) / 2;
 
@@ -655,7 +674,14 @@ public class FilterTabsView extends FrameLayout {
             } else {
                 countWidth = 0;
             }
-            int tabWidth = currentTab.titleWidth + (countWidth != 0 ? countWidth + dp(6 * (counterText != null ? 1.0f : editingStartAnimationProgress)) : 0);
+            int tabWidth = currentTab.titleWidth;
+            if (FolderHelper.isTitleOnly()) {
+                tabWidth += countWidth != 0 ? countWidth + dp(6 * (counterText != null ? 1.0f : editingStartAnimationProgress)) : 0;
+            } else if (FolderHelper.isIconsOnly()) {
+                tabWidth += countWidth != 0 ? countWidth : 0;
+            } else {
+                tabWidth += countWidth != 0 ? countWidth + dp(6 * (counterText != null ? 1.0f : editingStartAnimationProgress)) : 0;
+            }
             int textX = (getMeasuredWidth() - tabWidth) / 2;
 
             if (textX != lastTextX) {
@@ -949,6 +975,7 @@ public class FilterTabsView extends FrameLayout {
             }
         };
         listView.setClipChildren(false);
+        listView.setOverScrollMode(OVER_SCROLL_NEVER);
         itemAnimator = new DefaultItemAnimator() {
 
             @Override
@@ -1098,7 +1125,7 @@ public class FilterTabsView extends FrameLayout {
         });
         ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new TouchHelperCallback());
         itemTouchHelper.attachToRecyclerView(listView);
-        listViewPaddingH = Math.max(0, dp(23.5f - TAB_PADDING_WIDTH / 2f));
+        listViewPaddingH = Math.max(0, dp(11f + FolderHelper.getTabInternalPadding() - FolderHelper.getTabPadding() / 2f));
         listView.setPadding(listViewPaddingH, 0, listViewPaddingH, 0);
         listView.setClipToPadding(false);
         listView.setDrawSelectorBehind(true);
@@ -1260,6 +1287,10 @@ public class FilterTabsView extends FrameLayout {
     }
 
     public void addTab(int id, int stableId, String text, ArrayList<TLRPC.MessageEntity> entities, boolean noanimate, boolean isDefault, boolean isLocked) {
+        inu_addTab(id, stableId, text, entities, noanimate, isDefault, isLocked, null);
+    }
+
+    public void inu_addTab(int id, int stableId, String text, ArrayList<TLRPC.MessageEntity> entities, boolean noanimate, boolean isDefault, boolean isLocked, String emoticon) {
         int position = tabs.size();
         if (position == 0 && selectedTabId == -1) {
             selectedTabId = id;
@@ -1274,7 +1305,8 @@ public class FilterTabsView extends FrameLayout {
         Tab tab = new Tab(id, text(text, entities), noanimate);
         tab.isDefault = isDefault;
         tab.isLocked = isLocked;
-        allTabsWidth += tab.getWidth(true) + dp(TAB_PADDING_WIDTH);
+        tab.inu_iconResId = FolderHelper.getTabIcon(emoticon);
+        allTabsWidth += tab.getWidth(true) + dp(FolderHelper.getTabPadding());
         tabs.add(tab);
     }
 
@@ -1293,7 +1325,7 @@ public class FilterTabsView extends FrameLayout {
         Tab tab = new Tab(id, text, noanimate);
         tab.isDefault = isDefault;
         tab.isLocked = isLocked;
-        allTabsWidth += tab.getWidth(true) + dp(TAB_PADDING_WIDTH);
+        allTabsWidth += tab.getWidth(true) + dp(FolderHelper.getTabPadding());
         tabs.add(tab);
     }
 
@@ -1382,7 +1414,7 @@ public class FilterTabsView extends FrameLayout {
             positionToWidth.put(a, tabWidth);
             positionToCount.put(a, tabs.get(a).counter);
             positionToX.put(a, xOffset + additionalTabWidth / 2);
-            xOffset += tabWidth + dp(TAB_PADDING_WIDTH) + additionalTabWidth;
+            xOffset += tabWidth + dp(FolderHelper.getTabPadding()) + additionalTabWidth;
         }
     }
 
@@ -1472,10 +1504,10 @@ public class FilterTabsView extends FrameLayout {
                     float prevH = positionToCount.get(idx1) != 0 ? 1 : 0;
                     float newH = positionToCount.get(idx2) != 0 ? 1 : 0;
                     if (additionalTabWidth != 0) {
-                        indicatorX = lerp(prevX, newX, animatingIndicatorProgress) + dp(TAB_PADDING_WIDTH / 2f);
+                        indicatorX = lerp(prevX, newX, animatingIndicatorProgress) + dp(FolderHelper.getTabPadding() / 2f);
                     } else {
                         int x = positionToX.get(position);
-                        indicatorX = lerp(prevX, newX, animatingIndicatorProgress) - (x - holder.itemView.getLeft()) + dp(TAB_PADDING_WIDTH / 2f);
+                        indicatorX = lerp(prevX, newX, animatingIndicatorProgress) - (x - holder.itemView.getLeft()) + dp(FolderHelper.getTabPadding() / 2f);
                     }
                     indicatorWidth = lerp(prevW, newW, animatingIndicatorProgress);
                     counterVisible = lerp(prevH, newH, animatingIndicatorProgress);
@@ -1507,7 +1539,7 @@ public class FilterTabsView extends FrameLayout {
             final float add = additionalTabWidth / 2f;
 
             final int y = height / 2 - dp(14);
-            selectorDrawable.setBounds((int) (indicatorX - dp(TAB_INTERNAL_PADDING) - add), y, (int) (indicatorX + indicatorWidth + dp(TAB_INTERNAL_PADDING) + add), y + dp(28));
+            selectorDrawable.setBounds((int) (indicatorX - dp(FolderHelper.getTabInternalPadding()) - add), y, (int) (indicatorX + indicatorWidth + dp(FolderHelper.getTabInternalPadding()) + add), y + dp(28));
             selectorDrawable.setAlpha(31);
             selectorDrawable.draw(canvas);
             canvas.restore();
@@ -1544,12 +1576,15 @@ public class FilterTabsView extends FrameLayout {
         if (!tabs.isEmpty()) {
             final int width = MeasureSpec.getSize(widthMeasureSpec) - listViewPaddingH * 2;
             Tab firstTab = findDefaultTab();
+            int trueTabsWidth;
             if (firstTab != null) {
                 firstTab.setTitle(LocaleController.getString(R.string.FilterAllChats), null, false);
                 int tabWidth = firstTab.getWidth(false);
                 firstTab.setTitle(allTabsWidth > width ? LocaleController.getString(R.string.FilterAllChatsShort) : LocaleController.getString(R.string.FilterAllChats), null, false);
-                int trueTabsWidth = allTabsWidth - tabWidth;
-                trueTabsWidth += firstTab.getWidth(false);
+                trueTabsWidth = allTabsWidth - tabWidth + firstTab.getWidth(false);
+            } else {
+                trueTabsWidth = allTabsWidth;
+            }
                 int prevWidth = additionalTabWidth;
                 additionalTabWidth = trueTabsWidth < width ? (width - trueTabsWidth) / tabs.size() : 0;
                 if (prevWidth != additionalTabWidth) {
@@ -1562,7 +1597,6 @@ public class FilterTabsView extends FrameLayout {
                 }
                 updateTabsWidths();
                 invalidated = false;
-            }
         }
         super.onMeasure(widthMeasureSpec, heightMeasureSpec);
     }
@@ -1716,9 +1750,10 @@ public class FilterTabsView extends FrameLayout {
                 invalidated = true;
                 requestLayout();
                 allTabsWidth = 0;
-                findDefaultTab().setTitle(LocaleController.getString(R.string.FilterAllChats), null, false);
+                Tab defTab = findDefaultTab();
+                if (defTab != null) defTab.setTitle(LocaleController.getString(R.string.FilterAllChats), null, false);
                 for (int b = 0; b < N; b++) {
-                    allTabsWidth += tabs.get(b).getWidth(true) + dp(TAB_PADDING_WIDTH);
+                    allTabsWidth += tabs.get(b).getWidth(true) + dp(FolderHelper.getTabPadding());
                 }
                 break;
             }
@@ -1747,9 +1782,10 @@ public class FilterTabsView extends FrameLayout {
             listView.setItemAnimator(itemAnimator);
             adapter.notifyDataSetChanged();
             allTabsWidth = 0;
-            findDefaultTab().setTitle(LocaleController.getString(R.string.FilterAllChats), null, false);
+            Tab defTab = findDefaultTab();
+            if (defTab != null) defTab.setTitle(LocaleController.getString(R.string.FilterAllChats), null, false);
             for (int b = 0, N = tabs.size(); b < N; b++) {
-                allTabsWidth += tabs.get(b).getWidth(true) + dp(TAB_PADDING_WIDTH);
+                allTabsWidth += tabs.get(b).getWidth(true) + dp(FolderHelper.getTabPadding());
             }
         }
     }
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.FolderHelper;
 import desu.inugram.helpers.dialogs.MainTabsHelper;
 import me.vkryl.android.animator.BoolAnimator;
 import me.vkryl.android.animator.FactorAnimator;
@@ -3683,6 +3684,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
                     if (initialDialogsType == DIALOGS_TYPE_FORWARD) {
                         return 0;
                     }
+                    if (desu.inugram.InuConfig.FOLDERS_UNREAD_COUNTER_MODE.getValue() == desu.inugram.InuConfig.FoldersUnreadCounterModeItem.HIDE) {
+                        return 0;
+                    }
                     if (tabId == filterTabsView.getDefaultTabId()) {
                         return getMessagesStorage().getMainUnreadCount();
                     }
@@ -6886,12 +6890,15 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
                     selectWithStableId = true;
                 }
                 filterTabsView.removeTabs();
+                boolean skipDefault = FolderHelper.shouldSkipDefaultTab(filters.size());
                 for (int a = 0, N = filters.size(); a < N; a++) {
                     if (filters.get(a).isDefault()) {
-                        filterTabsView.addTab(a, 0, LocaleController.getString(R.string.FilterAllChats), null, false, true, filters.get(a).locked);
+                        if (skipDefault) continue;
+                        filterTabsView.inu_addTab(a, 0, LocaleController.getString(R.string.FilterAllChats), null, false, true, filters.get(a).locked, "\uD83D\uDCAC");
                     } else {
                         final MessagesController.DialogFilter filter = filters.get(a);
-                        filterTabsView.addTab(a, filter.localId, filter.name, filter.entities, filter.title_noanimate, false, filters.get(a).locked);
+                        android.util.Pair<String, String> info = FolderHelper.getTabInfo(filter);
+                        filterTabsView.inu_addTab(a, filter.localId, info.first, filter.entities, filter.title_noanimate, false, filters.get(a).locked, info.second);
                     }
                 }
                 if (stableId >= 0) {
@@ -6914,9 +6921,15 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
                     if (viewPages[a].selectedType >= filters.size()) {
                         viewPages[a].selectedType = filters.size() - 1;
                     }
+                    int snapped = FolderHelper.snapOffDefault(filters, viewPages[a].selectedType);
+                    if (snapped != viewPages[a].selectedType) {
+                        viewPages[a].selectedType = snapped;
+                        if (a == 0) updateCurrentTab = true;
+                    }
                     viewPages[a].listView.setScrollingTouchSlop(RecyclerView.TOUCH_SLOP_PAGING);
                 }
                 filterTabsView.finishAddingTabs(animatedUpdateItems);
+                FolderHelper.refreshSelectedTab(filterTabsView, viewPages[0].selectedType, filters.size());
                 if (updateCurrentTab) {
                     switchToCurrentSelectedMode(false);
                 }
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java
@@ -1148,6 +1148,10 @@ public class FilterCreateActivity extends BaseFragment {
             req.filter.flags |= 134217728;
             req.filter.color = newFilterColor;
         }
+        if (filter.inu_emoticon != null && !filter.inu_emoticon.isEmpty()) {
+            req.filter.flags |= 1 << 25;
+            req.filter.emoticon = filter.inu_emoticon;
+        }
         MessagesController messagesController = fragment.getMessagesController();
         ArrayList<Long> pinArray = new ArrayList<>();
         if (newPinned.size() != 0) {
