Indicate "unread"/"in progress" state of individual feed items

This commit is contained in:
Michael Kaiser 2012-10-23 14:56:10 +02:00
parent 27fe652551
commit 528cda20d3
4 changed files with 114 additions and 84 deletions

View File

@ -1,8 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingLeft="8dp" > android:paddingLeft="4dp" >
<View
android:id="@+id/vStatusLabel"
android:layout_width="5dip"
android:layout_height="match_parent"
android:background="@color/status_unread"
android:visibility="invisible" />
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="4dp" >
<TextView <TextView
android:id="@+id/txtvItemname" android:id="@+id/txtvItemname"
@ -83,7 +96,8 @@
android:focusable="false" android:focusable="false"
android:focusableInTouchMode="false" android:focusableInTouchMode="false"
android:padding="8dp" android:padding="8dp"
android:scaleType="fitXY" android:scaleType="center"
android:src="@drawable/navigation_expand" /> android:src="@drawable/navigation_expand" />
</RelativeLayout> </RelativeLayout>
</LinearLayout>

View File

@ -23,5 +23,7 @@
<color name="actionbar_gray">#DDDDDD</color> <color name="actionbar_gray">#DDDDDD</color>
<color name="download_success_green">#669900</color> <color name="download_success_green">#669900</color>
<color name="download_failed_red">#CC0000</color> <color name="download_failed_red">#CC0000</color>
<color name="status_unread">#99CC00</color>
<color name="status_progress">#FFBB33</color>
</resources> </resources>

View File

@ -71,6 +71,8 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
holder.feedtitle = (TextView) convertView holder.feedtitle = (TextView) convertView
.findViewById(R.id.txtvFeedname); .findViewById(R.id.txtvFeedname);
} }
holder.statusLabel = (View) convertView
.findViewById(R.id.vStatusLabel);
convertView.setTag(holder); convertView.setTag(holder);
} else { } else {
@ -90,10 +92,18 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
holder.feedtitle.setVisibility(View.VISIBLE); holder.feedtitle.setVisibility(View.VISIBLE);
holder.feedtitle.setText(item.getFeed().getTitle()); holder.feedtitle.setText(item.getFeed().getTitle());
} }
if (!item.isRead()) {
if (item.isInProgress()) {
holder.title.setTypeface(Typeface.DEFAULT_BOLD); 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 { } else {
holder.title.setTypeface(Typeface.DEFAULT); holder.title.setTypeface(Typeface.DEFAULT);
holder.statusLabel.setVisibility(View.INVISIBLE);
} }
holder.published.setText(convertView.getResources().getString( holder.published.setText(convertView.getResources().getString(
@ -169,6 +179,7 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
ImageView type; ImageView type;
ImageView downloading; ImageView downloading;
ImageButton butAction; ImageButton butAction;
View statusLabel;
} }
public int getSelectedItemIndex() { public int getSelectedItemIndex() {

View File

@ -79,7 +79,10 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
holder.numberOfEpisodes.setText(feed.getNumOfItems() holder.numberOfEpisodes.setText(feed.getNumOfItems()
+ convertView.getResources() + convertView.getResources()
.getString(R.string.episodes_suffix)); .getString(R.string.episodes_suffix));
int newItems = feed.getNumOfNewItems(); int newItems = feed.getNumOfNewItems();
int startedItems = feed.getNumOfStartedItems();
if (newItems > 0) { if (newItems > 0) {
holder.newEpisodes.setText(Integer.toString(newItems)); holder.newEpisodes.setText(Integer.toString(newItems));
holder.newEpisodes.setVisibility(View.VISIBLE); holder.newEpisodes.setVisibility(View.VISIBLE);