diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java index 02a82db0..50d44a7e 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java @@ -10,6 +10,7 @@ import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.Typeface; import android.net.http.AndroidHttpClient; import android.os.AsyncTask; import android.os.Build; @@ -241,7 +242,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh Feed feed = m_adapter.getItem(info.position); if (feed != null) - menu.setHeaderTitle(feed.title); + menu.setHeaderTitle(feed.display_title != null ? feed.display_title : feed.title); if (!feed.is_cat) { menu.findItem(R.id.browse_feeds).setVisible(false); @@ -380,7 +381,11 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh Feed feed = (Feed)list.getItemAtPosition(position); if (feed.is_cat) { - m_activity.onCatSelected(new FeedCategory(feed.id, feed.title, feed.unread)); + if (feed.always_display_as_feed) { + m_activity.onCatSelected(new FeedCategory(feed.id, feed.title, feed.unread), true); + } else { + m_activity.onCatSelected(new FeedCategory(feed.id, feed.title, feed.unread)); + } } else { m_activity.onFeedSelected(feed); } @@ -533,12 +538,25 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh m_feeds.clear(); + int catUnread = 0; + for (Feed f : feeds) - if (f.id > -10 || m_catId != -4) // skip labels for flat feedlist for now - m_feeds.add(f); + if (f.id > -10 || m_catId != -4) { // skip labels for flat feedlist for now + m_feeds.add(f); + catUnread += f.unread; + } sortFeeds(); + if (m_enableParentBtn && m_activeCategory != null && m_activeCategory.id >= 0) { + Feed feed = new Feed(m_activeCategory.id, m_activeCategory.title, true); + feed.unread = catUnread; + feed.always_display_as_feed = true; + feed.display_title = getString(R.string.feed_all_articles); + + m_feeds.add(0, feed); + } + /*if (m_feeds.size() == 0) setLoadingStatus(R.string.no_feeds_to_display, false); else */ @@ -623,7 +641,14 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh TextView tt = (TextView) v.findViewById(R.id.title); if (tt != null) { - tt.setText(feed.title); + tt.setText(feed.display_title != null ? feed.display_title : feed.title); + + if (feed.always_display_as_feed) { + tt.setTypeface(null, Typeface.BOLD); + } else { + tt.setTypeface(null, Typeface.NORMAL); + } + } TextView tu = (TextView) v.findViewById(R.id.unread_counter); @@ -636,8 +661,10 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh ImageView icon = (ImageView)v.findViewById(R.id.icon); if (icon != null) { - - if (m_enableFeedIcons) { + + if (feed.is_cat && feed.always_display_as_feed) { + icon.setImageResource(R.drawable.ic_published_special); + } else if (m_enableFeedIcons) { try { File storage = m_activity.getExternalCacheDir(); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Feed.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Feed.java index 6cf4a1b1..57a237ec 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Feed.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Feed.java @@ -13,6 +13,8 @@ public class Feed implements Comparable, Parcelable { public int last_updated; public int order_id; public boolean is_cat; + public boolean always_display_as_feed; + public String display_title; public Feed(int id, String title, boolean is_cat) { this.id = id; @@ -62,6 +64,8 @@ public class Feed implements Comparable, Parcelable { out.writeInt(last_updated); out.writeInt(is_cat ? 1 : 0); out.writeInt(order_id); + out.writeInt(always_display_as_feed ? 1 : 0); + out.writeString(display_title); } public void readFromParcel(Parcel in) { @@ -74,6 +78,8 @@ public class Feed implements Comparable, Parcelable { last_updated = in.readInt(); is_cat = in.readInt() == 1; order_id = in.readInt(); + always_display_as_feed = in.readInt() == 1; + display_title = in.readString(); } @SuppressWarnings("rawtypes") diff --git a/org.fox.ttrss/src/main/res/values/strings.xml b/org.fox.ttrss/src/main/res/values/strings.xml index 75ad090e..07b1613e 100644 --- a/org.fox.ttrss/src/main/res/values/strings.xml +++ b/org.fox.ttrss/src/main/res/values/strings.xml @@ -249,5 +249,6 @@ Title Sort articles Fresh articles + All articles