Show number of "in progress" episodes for each feed
This commit is contained in:
parent
528cda20d3
commit
d32f49b274
|
@ -3,7 +3,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingTop="4dp" >
|
||||
|
||||
<ImageView
|
||||
|
@ -18,19 +18,61 @@
|
|||
android:cropToPadding="true"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvNewEps"
|
||||
<LinearLayout
|
||||
android:id="@+id/lEpisodeCounts"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold" />
|
||||
android:orientation="vertical" >
|
||||
|
||||
<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
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toLeftOf="@id/txtvNewEps"
|
||||
android:layout_toLeftOf="@id/lEpisodeCounts"
|
||||
android:layout_toRightOf="@id/imgvFeedimage"
|
||||
android:orientation="vertical" >
|
||||
|
||||
|
|
|
@ -47,6 +47,12 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
|
|||
|
||||
holder.newEpisodes = (TextView) convertView
|
||||
.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
|
||||
.findViewById(R.id.imgvFeedimage);
|
||||
holder.lastUpdate = (TextView) convertView
|
||||
|
@ -79,16 +85,25 @@ 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();
|
||||
|
||||
int inProgressItems = feed.getNumOfStartedItems();
|
||||
|
||||
if (newItems > 0) {
|
||||
holder.newEpisodes.setText(Integer.toString(newItems));
|
||||
holder.newEpisodes.setVisibility(View.VISIBLE);
|
||||
holder.newEpisodesLabel.setVisibility(View.VISIBLE);
|
||||
} 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());
|
||||
|
||||
imageLoader.loadThumbnailBitmap(
|
||||
|
@ -105,7 +120,10 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
|
|||
TextView lastUpdate;
|
||||
TextView numberOfEpisodes;
|
||||
TextView newEpisodes;
|
||||
TextView inProgressEpisodes;
|
||||
ImageView image;
|
||||
View newEpisodesLabel;
|
||||
View inProgressEpisodesLabel;
|
||||
}
|
||||
|
||||
public int getSelectedItemIndex() {
|
||||
|
|
Loading…
Reference in New Issue