Improved Feedlist
This commit is contained in:
parent
0634ae4d78
commit
fb2f19459a
|
@ -1,38 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgvFeedimage"
|
||||
android:layout_width="60dip"
|
||||
android:layout_height="60dip"
|
||||
android:layout_width="55dip"
|
||||
android:layout_height="55dip"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginBottom="1dip"
|
||||
android:layout_marginLeft="1dip"
|
||||
android:layout_marginRight="4dip"
|
||||
android:cropToPadding="true" />
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_toRightOf="@id/imgvFeedimage" >
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toRightOf="@id/imgvFeedimage"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvFeedname"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvNewEpisodes"
|
||||
android:layout_width="fill_parent"
|
||||
android:id="@+id/txtvNumEpisodes"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
android:textColor="@color/gray" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvLastUpdate"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/gray"
|
||||
android:textStyle="italic"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvNewEps"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="yellow">#FFFF00</color>
|
||||
<color name="fuchsia">#FF00FF</color>
|
||||
<color name="red">#FF0000</color>
|
||||
<color name="silver">#C0C0C0</color>
|
||||
<color name="gray">#808080</color>
|
||||
<color name="olive">#808000</color>
|
||||
<color name="purple">#800080</color>
|
||||
<color name="maroon">#800000</color>
|
||||
<color name="aqua">#00FFFF</color>
|
||||
<color name="lime">#00FF00</color>
|
||||
<color name="teal">#008080</color>
|
||||
<color name="green">#008000</color>
|
||||
<color name="blue">#0000FF</color>
|
||||
<color name="navy">#000080</color>
|
||||
<color name="black">#000000</color>
|
||||
|
||||
</resources>
|
|
@ -40,33 +40,32 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
|
|||
convertView = inflater.inflate(R.layout.feedlist_item, null);
|
||||
holder.title = (TextView) convertView
|
||||
.findViewById(R.id.txtvFeedname);
|
||||
holder.newEpisodes = (TextView) convertView.findViewById(R.id.txtvNewEpisodes);
|
||||
|
||||
holder.newEpisodes = (TextView) convertView.findViewById(R.id.txtvNewEps);
|
||||
holder.image = (ImageView) convertView
|
||||
.findViewById(R.id.imgvFeedimage);
|
||||
holder.lastUpdate = (TextView) convertView
|
||||
.findViewById(R.id.txtvLastUpdate);
|
||||
holder.numberOfEpisodes = (TextView) convertView.findViewById(R.id.txtvNumEpisodes);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
holder.title.setText(feed.getTitle());
|
||||
holder.lastUpdate.setText(DateUtils.formatSameDayTime(feed
|
||||
holder.lastUpdate.setText("Last Update: " + DateUtils.formatSameDayTime(feed
|
||||
.getLastUpdate().getTime(), System.currentTimeMillis(),
|
||||
DateFormat.SHORT, DateFormat.SHORT));
|
||||
holder.numberOfEpisodes.setText(feed.getItems().size() + " Episodes");
|
||||
|
||||
int newItems = feed.getNumOfNewItems();
|
||||
if (newItems > 0) {
|
||||
holder.newEpisodes.setTextColor(Color.parseColor("red"));
|
||||
if (newItems == 1) {
|
||||
holder.newEpisodes.setText(newItems + " new Episode");
|
||||
} else {
|
||||
holder.newEpisodes.setText(newItems + " new Episodes");
|
||||
}
|
||||
holder.newEpisodes.setText(Integer.toString(newItems));
|
||||
holder.newEpisodes.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.newEpisodes.setTextColor(Color.parseColor("gray"));
|
||||
holder.newEpisodes.setText("No new episodes");
|
||||
holder.newEpisodes.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (feed.getImage() != null) {
|
||||
holder.image.setImageBitmap(feed.getImage().getImageBitmap()); // TODO
|
||||
// select
|
||||
|
@ -84,6 +83,7 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
|
|||
static class Holder {
|
||||
TextView title;
|
||||
TextView lastUpdate;
|
||||
TextView numberOfEpisodes;
|
||||
TextView newEpisodes;
|
||||
ImageView image;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue