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,89 +1,103 @@
<?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_height="match_parent"
android:paddingLeft="8dp" >
android:paddingLeft="4dp" >
<TextView
android:id="@+id/txtvItemname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@+id/butAction"
android:textSize="16dp" />
<TextView
android:id="@+id/txtvFeedname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvItemname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:visibility="gone" />
<TextView
android:id="@+id/txtvPublished"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvFeedname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:textColor="@color/gray" />
<ImageView
android:id="@+id/imgvType"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvInPlaylist" />
<ImageView
android:id="@id/imgvInPlaylist"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloaded"
android:src="@drawable/stat_playlist"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloaded"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloading"
android:src="@drawable/av_download"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloading"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@id/butAction"
android:src="@drawable/navigation_refresh"
android:visibility="visible" />
<TextView
android:id="@+id/txtvLenSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/txtvPublished"
android:maxLines="2" />
<ImageButton
android:id="@id/butAction"
android:layout_width="wrap_content"
<View
android:id="@+id/vStatusLabel"
android:layout_width="5dip"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/borderless_button"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:padding="8dp"
android:scaleType="fitXY"
android:src="@drawable/navigation_expand" />
android:background="@color/status_unread"
android:visibility="invisible" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="4dp" >
<TextView
android:id="@+id/txtvItemname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@+id/butAction"
android:textSize="16dp" />
<TextView
android:id="@+id/txtvFeedname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvItemname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:visibility="gone" />
<TextView
android:id="@+id/txtvPublished"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvFeedname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:textColor="@color/gray" />
<ImageView
android:id="@+id/imgvType"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvInPlaylist" />
<ImageView
android:id="@id/imgvInPlaylist"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloaded"
android:src="@drawable/stat_playlist"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloaded"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloading"
android:src="@drawable/av_download"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloading"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@id/butAction"
android:src="@drawable/navigation_refresh"
android:visibility="visible" />
<TextView
android:id="@+id/txtvLenSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/txtvPublished"
android:maxLines="2" />
<ImageButton
android:id="@id/butAction"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/borderless_button"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:padding="8dp"
android:scaleType="center"
android:src="@drawable/navigation_expand" />
</RelativeLayout>
</LinearLayout>

View File

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

View File

@ -71,6 +71,8 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
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<FeedItem> {
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<FeedItem> {
ImageView type;
ImageView downloading;
ImageButton butAction;
View statusLabel;
}
public int getSelectedItemIndex() {

View File

@ -79,7 +79,10 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
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);