From 4f4fd516d9b33f7f2d3bd25be3526c74009c42f6 Mon Sep 17 00:00:00 2001 From: Aman Jain Date: Fri, 12 Dec 2025 03:15:45 +0530 Subject: [PATCH] Move 'Untagged' chip to end and center selected tag in subscription view (#8141) --- .../subscriptions/SubscriptionFragment.java | 19 +++++++++++++++++++ .../subscriptions/SubscriptionTagAdapter.java | 12 ++++++++++++ .../antennapod/storage/database/DBReader.java | 6 +++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java index 2b927a5b8..a859a0074 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java @@ -416,6 +416,25 @@ public class SubscriptionFragment extends Fragment } } tagsRecycler.setVisibility(shouldShowTags ? View.VISIBLE : View.GONE); + // Scroll to center the selected tag + tagsRecycler.post(() -> { + int selectedPosition = tagAdapter.getSelectedTagPosition(); + if (selectedPosition < 0) { + return; + } + LinearLayoutManager layoutManager = + (LinearLayoutManager) tagsRecycler.getLayoutManager(); + // Calculate offset to center the selected chip + View selectedView = layoutManager.findViewByPosition(selectedPosition); + if (selectedView != null) { + int recyclerWidth = tagsRecycler.getWidth(); + int chipWidth = selectedView.getWidth(); + int offset = (recyclerWidth - chipWidth) / 2; + layoutManager.scrollToPositionWithOffset(selectedPosition, offset); + } else { + tagsRecycler.scrollToPosition(selectedPosition); + } + }); } }, error -> { Log.e(TAG, Log.getStackTraceString(error)); diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionTagAdapter.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionTagAdapter.java index 660f04406..b75a30ed2 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionTagAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionTagAdapter.java @@ -45,6 +45,18 @@ public class SubscriptionTagAdapter extends RecyclerView.Adapter tagsSorted = new ArrayList<>(tags.values()); Collections.sort(tagsSorted, (o1, o2) -> o1.getTitle().compareToIgnoreCase(o2.getTitle())); - if (!untaggedTag.getFeeds().isEmpty()) { - tagsSorted.add(0, untaggedTag); - } // Root tag here means "all feeds", this is different from the nav drawer. NavDrawerData.TagItem rootTag = new NavDrawerData.TagItem(FeedPreferences.TAG_ROOT); for (Feed feed : feeds) { rootTag.addFeed(feed, 0); } tagsSorted.add(0, rootTag); + if (!untaggedTag.getFeeds().isEmpty()) { + tagsSorted.add(untaggedTag); + } return tagsSorted; }