diff options
author | Andrew Dolgov <[email protected]> | 2014-11-07 00:43:50 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2014-11-07 00:43:50 +0300 |
commit | ef5ca11c43ad588303f191e0b86a50e617f73734 (patch) | |
tree | 42f0d649ef42fe6eb9f57d3e50e2767e2c424db7 /org.fox.ttrss/src/main | |
parent | e83a2ae7d0c0cf7d6c0f27e6ed3af5cd4817a35f (diff) |
add all articles special entry to category lists
Diffstat (limited to 'org.fox.ttrss/src/main')
-rw-r--r-- | org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java | 41 | ||||
-rw-r--r-- | org.fox.ttrss/src/main/java/org/fox/ttrss/types/Feed.java | 6 | ||||
-rw-r--r-- | org.fox.ttrss/src/main/res/values/strings.xml | 1 |
3 files changed, 41 insertions, 7 deletions
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<Feed>, 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<Feed>, 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<Feed>, 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 @@ <string name="headlines_sort_title">Title</string> <string name="headlines_sort_articles_title">Sort articles</string> <string name="fresh_articles">Fresh articles</string> + <string name="feed_all_articles">All articles</string> </resources> |