Merge pull request #1626 from mfietz/replace_prestissimo_with_sonic

Switch Prestissimo users to Sonic
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 9011c8b..5b205e9 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.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 @@
                     .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 @@
         }
 
         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/java/de/danoeh/antennapod/fragment/ChaptersFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java
index ce1d753..96abdd8 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java
@@ -68,7 +68,7 @@
         this.media = media;
         adapter.setMedia(media);
         adapter.notifyDataSetChanged();
-        if(media.getChapters() == null) {
+        if(media == null || media.getChapters() == null || media.getChapters().size() == 0) {
             setEmptyText(getString(R.string.no_items_label));
         } else {
             setEmptyText(null);
diff --git a/app/src/main/res/layout/itemdescription_listitem.xml b/app/src/main/res/layout/itemdescription_listitem.xml
index ca8f974..51bc9a5 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/txtvTitle"
-        style="@style/AntennaPod.TextView.ListItemPrimaryTitle"
-        android:layout_width="match_parent"
+        android:id="@+id/txtvPubDate"
+        style="@android:style/TextAppearance.Small"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_margin="16dp"
+        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"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        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>