diff options
author | Tom Hennen <TomHennen@users.noreply.github.com> | 2016-01-28 17:26:14 -0500 |
---|---|---|
committer | Tom Hennen <TomHennen@users.noreply.github.com> | 2016-01-28 17:26:14 -0500 |
commit | 65c335a707fcef542c79be89e6c2daa619b596fa (patch) | |
tree | ed5542e71817929ad5a9969f32f00e21949744d2 /app/src/main | |
parent | b1aec69b2c0b2770e7d4839a2f08e60e59bfb5b9 (diff) | |
parent | c0adf5f4d44110416890ce9e990ba24f8234d50d (diff) | |
download | AntennaPod-65c335a707fcef542c79be89e6c2daa619b596fa.zip |
Merge pull request #1622 from mfietz/issue/821-subscription-pubdates
Subscription view: Show publication dates and look better
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java | 16 | ||||
-rw-r--r-- | app/src/main/res/layout/itemdescription_listitem.xml | 49 |
2 files changed, 49 insertions, 16 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java index 9011c8b02..5b205e91f 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java @@ -6,11 +6,13 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.core.feed.FeedItem; import java.util.List; +import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.util.DateUtils; + /** * List adapter for showing a list of FeedItems with their title and description. */ @@ -33,6 +35,7 @@ public class FeedItemlistDescriptionAdapter extends ArrayAdapter<FeedItem> { .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.itemdescription_listitem, parent, false); holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); + holder.pubDate = (TextView) convertView.findViewById(R.id.txtvPubDate); holder.description = (TextView) convertView.findViewById(R.id.txtvDescription); convertView.setTag(holder); @@ -41,15 +44,20 @@ public class FeedItemlistDescriptionAdapter extends ArrayAdapter<FeedItem> { } holder.title.setText(item.getTitle()); + holder.pubDate.setText(DateUtils.formatAbbrev(getContext(), item.getPubDate())); if (item.getDescription() != null) { - holder.description.setText(item.getDescription()); + String description = item.getDescription() + .replaceAll("\n", " ") + .replaceAll("\\s+", " ") + .trim(); + holder.description.setText(description); } - return convertView; } static class Holder { TextView title; + TextView pubDate; TextView description; } } diff --git a/app/src/main/res/layout/itemdescription_listitem.xml b/app/src/main/res/layout/itemdescription_listitem.xml index ca8f974bf..51bc9a5eb 100644 --- a/app/src/main/res/layout/itemdescription_listitem.xml +++ b/app/src/main/res/layout/itemdescription_listitem.xml @@ -1,30 +1,55 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:paddingBottom="8dp" tools:background="@android:color/holo_orange_light"> <TextView + android:id="@+id/txtvPubDate" + style="@android:style/TextAppearance.Small" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_alignParentTop="true" + android:layout_marginLeft="8dp" + android:textSize="14sp" + android:textColor="?android:textColorSecondary" + android:ellipsize="end" + android:lines="1" + tools:text="22 Jan 2016" + tools:background="@android:color/holo_green_dark" /> + + <TextView android:id="@+id/txtvTitle" - style="@style/AntennaPod.TextView.ListItemPrimaryTitle" - android:layout_width="match_parent" + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_margin="16dp" + android:layout_alignParentLeft="true" + android:layout_alignParentTop="true" + android:layout_toLeftOf="@id/txtvPubDate" + android:textSize="16sp" + android:textColor="?android:attr/textColorPrimary" + android:ellipsize="end" + android:maxLines="2" tools:text="Feed item title" tools:background="@android:color/holo_green_dark" /> <TextView android:id="@+id/txtvDescription" - style="@style/AntennaPod.TextView.ListItemSecondaryTitle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="16dp" - android:layout_marginLeft="16dp" - android:layout_marginRight="16dp" - android:lines="3" + android:layout_below="@id/txtvTitle" + android:textSize="14sp" + android:textColor="?android:attr/textColorSecondary" + android:ellipsize="end" + android:maxLines="3" tools:text="Feed item description" tools:background="@android:color/holo_green_dark" /> -</LinearLayout> + +</RelativeLayout> |