From ac61881e3a01f87ed65f699c46911f5c1be41d87 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 12 Nov 2014 22:26:27 +0300 Subject: [PATCH] keep Special category always visible in root cat view to provide easier access to starred and other meta feeds --- .../org/fox/ttrss/FeedCategoriesFragment.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java index d3cffe21..4f793f5b 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java @@ -340,19 +340,32 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe m_cats.clear(); int apiLevel = m_activity.getApiLevel(); - + + boolean specialCatFound = false; + // virtual cats implemented in getCategories since api level 1 if (apiLevel == 0) { m_cats.add(new FeedCategory(-1, "Special", 0)); m_cats.add(new FeedCategory(-2, "Labels", 0)); m_cats.add(new FeedCategory(0, "Uncategorized", 0)); + + specialCatFound = true; } - for (FeedCategory c : cats) - m_cats.add(c); + for (FeedCategory c : cats) { + if (c.id == -1) { + specialCatFound = true; + } + + m_cats.add(c); + } sortCats(); - + + if (!specialCatFound) { + m_cats.add(0, new FeedCategory(-1, "Special", 0)); + } + /* if (m_cats.size() == 0) setLoadingStatus(R.string.no_feeds_to_display, false); else */