From 528cda20d36ff2b4a521a385cf5b8913ee05bf92 Mon Sep 17 00:00:00 2001 From: Michael Kaiser Date: Tue, 23 Oct 2012 14:56:10 +0200 Subject: [PATCH] Indicate "unread"/"in progress" state of individual feed items --- res/layout/feeditemlist_item.xml | 180 ++++++++++-------- res/values/colors.xml | 2 + .../adapter/FeedItemlistAdapter.java | 13 +- .../antennapod/adapter/FeedlistAdapter.java | 3 + 4 files changed, 114 insertions(+), 84 deletions(-) diff --git a/res/layout/feeditemlist_item.xml b/res/layout/feeditemlist_item.xml index 37dbbcc17..1378540da 100644 --- a/res/layout/feeditemlist_item.xml +++ b/res/layout/feeditemlist_item.xml @@ -1,89 +1,103 @@ - + android:paddingLeft="4dp" > - - - - - - - - - - - - - - - - - + android:background="@color/status_unread" + android:visibility="invisible" /> - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/values/colors.xml b/res/values/colors.xml index e7463852f..e87f90420 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -23,5 +23,7 @@ #DDDDDD #669900 #CC0000 + #99CC00 + #FFBB33 \ No newline at end of file diff --git a/src/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java b/src/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java index f4a131db8..5cbe3075f 100644 --- a/src/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java +++ b/src/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java @@ -71,6 +71,8 @@ public class FeedItemlistAdapter extends ArrayAdapter { holder.feedtitle = (TextView) convertView .findViewById(R.id.txtvFeedname); } + holder.statusLabel = (View) convertView + .findViewById(R.id.vStatusLabel); convertView.setTag(holder); } else { @@ -90,10 +92,18 @@ public class FeedItemlistAdapter extends ArrayAdapter { holder.feedtitle.setVisibility(View.VISIBLE); holder.feedtitle.setText(item.getFeed().getTitle()); } - if (!item.isRead()) { + + if (item.isInProgress()) { holder.title.setTypeface(Typeface.DEFAULT_BOLD); + holder.statusLabel.setBackgroundColor(convertView.getResources().getColor(R.color.status_progress)); + holder.statusLabel.setVisibility(View.VISIBLE); + } else if (!item.isRead()) { + holder.title.setTypeface(Typeface.DEFAULT_BOLD); + holder.statusLabel.setBackgroundColor(convertView.getResources().getColor(R.color.status_unread)); + holder.statusLabel.setVisibility(View.VISIBLE); } else { holder.title.setTypeface(Typeface.DEFAULT); + holder.statusLabel.setVisibility(View.INVISIBLE); } holder.published.setText(convertView.getResources().getString( @@ -169,6 +179,7 @@ public class FeedItemlistAdapter extends ArrayAdapter { ImageView type; ImageView downloading; ImageButton butAction; + View statusLabel; } public int getSelectedItemIndex() { diff --git a/src/de/danoeh/antennapod/adapter/FeedlistAdapter.java b/src/de/danoeh/antennapod/adapter/FeedlistAdapter.java index 93aa2443e..8e41b2270 100644 --- a/src/de/danoeh/antennapod/adapter/FeedlistAdapter.java +++ b/src/de/danoeh/antennapod/adapter/FeedlistAdapter.java @@ -79,7 +79,10 @@ public class FeedlistAdapter extends ArrayAdapter { holder.numberOfEpisodes.setText(feed.getNumOfItems() + convertView.getResources() .getString(R.string.episodes_suffix)); + int newItems = feed.getNumOfNewItems(); + int startedItems = feed.getNumOfStartedItems(); + if (newItems > 0) { holder.newEpisodes.setText(Integer.toString(newItems)); holder.newEpisodes.setVisibility(View.VISIBLE);