diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-06-22 17:27:21 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-06-22 17:27:21 +0200 |
commit | fb2f19459a439159b097e8def9739cb12d79f7c1 (patch) | |
tree | 4172d33536d216a353fb63fbca7f0528cd5c117a | |
parent | 0634ae4d781e9f91005032fb7905a3f4564932f1 (diff) | |
download | AntennaPod-fb2f19459a439159b097e8def9739cb12d79f7c1.zip |
Improved Feedlist
-rw-r--r-- | res/layout/feedlist_item.xml | 46 | ||||
-rw-r--r-- | res/values/colors.xml | 21 | ||||
-rw-r--r-- | src/de/podfetcher/adapter/FeedlistAdapter.java | 20 |
3 files changed, 63 insertions, 24 deletions
diff --git a/res/layout/feedlist_item.xml b/res/layout/feedlist_item.xml index b448b75f9..ff9cef63b 100644 --- a/res/layout/feedlist_item.xml +++ b/res/layout/feedlist_item.xml @@ -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>
\ No newline at end of file diff --git a/res/values/colors.xml b/res/values/colors.xml new file mode 100644 index 000000000..61a13a358 --- /dev/null +++ b/res/values/colors.xml @@ -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>
\ No newline at end of file diff --git a/src/de/podfetcher/adapter/FeedlistAdapter.java b/src/de/podfetcher/adapter/FeedlistAdapter.java index e10c7bff0..8f9860ce1 100644 --- a/src/de/podfetcher/adapter/FeedlistAdapter.java +++ b/src/de/podfetcher/adapter/FeedlistAdapter.java @@ -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; } |