Show number of "in progress" episodes for each feed

This commit is contained in:
Michael Kaiser 2012-10-23 15:05:42 +02:00
parent 528cda20d3
commit d32f49b274
2 changed files with 72 additions and 12 deletions

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:paddingRight="16dp" android:paddingRight="8dp"
android:paddingTop="4dp" > android:paddingTop="4dp" >
<ImageView <ImageView
@ -18,19 +18,61 @@
android:cropToPadding="true" android:cropToPadding="true"
android:scaleType="fitXY" /> android:scaleType="fitXY" />
<TextView <LinearLayout
android:id="@+id/txtvNewEps" android:id="@+id/lEpisodeCounts"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="fill_parent"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:textSize="20dp" android:orientation="vertical" >
android:textStyle="bold" />
<LinearLayout
android:id="@+id/lNewStatusLabel"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="1" >
<TextView
android:id="@+id/txtvNewEps"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginRight="4dip"
android:textSize="20dp"
android:textStyle="bold" />
<View
android:layout_width="5dip"
android:layout_height="match_parent"
android:background="@color/status_unread"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:id="@+id/lProgressStatusLabel"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="1" >
<TextView
android:id="@+id/txtvProgressEps"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginRight="4dip"
android:textSize="20dp"
android:textStyle="bold" />
<View
android:layout_width="5dip"
android:layout_height="match_parent"
android:background="@color/status_progress"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_toLeftOf="@id/txtvNewEps" android:layout_toLeftOf="@id/lEpisodeCounts"
android:layout_toRightOf="@id/imgvFeedimage" android:layout_toRightOf="@id/imgvFeedimage"
android:orientation="vertical" > android:orientation="vertical" >

View File

@ -47,6 +47,12 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
holder.newEpisodes = (TextView) convertView holder.newEpisodes = (TextView) convertView
.findViewById(R.id.txtvNewEps); .findViewById(R.id.txtvNewEps);
holder.inProgressEpisodes = (TextView) convertView
.findViewById(R.id.txtvProgressEps);
holder.newEpisodesLabel = (View) convertView
.findViewById(R.id.lNewStatusLabel);
holder.inProgressEpisodesLabel = (View) convertView
.findViewById(R.id.lProgressStatusLabel);
holder.image = (ImageView) convertView holder.image = (ImageView) convertView
.findViewById(R.id.imgvFeedimage); .findViewById(R.id.imgvFeedimage);
holder.lastUpdate = (TextView) convertView holder.lastUpdate = (TextView) convertView
@ -81,14 +87,23 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
.getString(R.string.episodes_suffix)); .getString(R.string.episodes_suffix));
int newItems = feed.getNumOfNewItems(); int newItems = feed.getNumOfNewItems();
int startedItems = feed.getNumOfStartedItems(); int inProgressItems = 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.newEpisodesLabel.setVisibility(View.VISIBLE);
} else { } else {
holder.newEpisodes.setVisibility(View.INVISIBLE); holder.newEpisodesLabel.setVisibility(View.INVISIBLE);
} }
if (inProgressItems > 0) {
holder.inProgressEpisodes
.setText(Integer.toString(inProgressItems));
holder.inProgressEpisodesLabel.setVisibility(View.VISIBLE);
} else {
holder.inProgressEpisodesLabel.setVisibility(View.INVISIBLE);
}
holder.image.setTag(feed.getImage()); holder.image.setTag(feed.getImage());
imageLoader.loadThumbnailBitmap( imageLoader.loadThumbnailBitmap(
@ -105,7 +120,10 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
TextView lastUpdate; TextView lastUpdate;
TextView numberOfEpisodes; TextView numberOfEpisodes;
TextView newEpisodes; TextView newEpisodes;
TextView inProgressEpisodes;
ImageView image; ImageView image;
View newEpisodesLabel;
View inProgressEpisodesLabel;
} }
public int getSelectedItemIndex() { public int getSelectedItemIndex() {