diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2015-05-22 23:31:05 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2015-05-22 23:31:05 +0200 |
commit | dc010d01d5274bbe4f7e7de42d2d64d9ec1160ce (patch) | |
tree | 0946074a95801f0614a5fba2a5376ba35b4fcb73 | |
parent | 53627e51aa054c69978bbb315c7e88def9105c15 (diff) | |
parent | f28853b00dec8875c967ef89ecef9602049a67e7 (diff) | |
download | AntennaPod-dc010d01d5274bbe4f7e7de42d2d64d9ec1160ce.zip |
Merge pull request #825 from TomHennen/fix_822_with_play_progress
Download and playback progress now displayed in All/New Episodes
-rw-r--r-- | app/src/main/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/adapter/AllEpisodesListAdapter.java | 32 | ||||
-rw-r--r-- | app/src/main/res/layout/new_episodes_listitem.xml | 14 |
3 files changed, 23 insertions, 25 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 97f8bbdad..9b73fd013 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.danoeh.antennapod" - android:versionCode="51" + android:versionCode="52" android:versionName="1.2"> <uses-permission android:name="android.permission.INTERNET"/> diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/AllEpisodesListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/AllEpisodesListAdapter.java index ea0c96be9..d96326053 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/AllEpisodesListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/AllEpisodesListAdapter.java @@ -80,8 +80,8 @@ public class AllEpisodesListAdapter extends BaseAdapter { .findViewById(R.id.butSecondaryAction); holder.queueStatus = (ImageView) convertView .findViewById(R.id.imgvInPlaylist); - holder.downloadProgress = (ProgressBar) convertView - .findViewById(R.id.pbar_download_progress); + holder.progress = (ProgressBar) convertView + .findViewById(R.id.pbar_progress); holder.imageView = (ImageView) convertView.findViewById(R.id.imgvImage); holder.txtvDuration = (TextView) convertView.findViewById(R.id.txtvDuration); convertView.setTag(holder); @@ -109,24 +109,24 @@ public class AllEpisodesListAdapter extends BaseAdapter { holder.txtvDuration.setText(""); } + FeedItem.State state = item.getState(); if (isDownloadingMedia) { - holder.downloadProgress.setVisibility(View.VISIBLE); - holder.txtvDuration.setVisibility(View.GONE); - holder.pubDate.setVisibility(View.GONE); + holder.progress.setVisibility(View.VISIBLE); + // item is being downloaded + holder.progress.setProgress(itemAccess.getItemDownloadProgressPercent(item)); + } else if (state == FeedItem.State.PLAYING + || state == FeedItem.State.IN_PROGRESS) { + if (media.getDuration() > 0) { + int progress = (int) (100.0 * media.getPosition() / media.getDuration()); + holder.progress.setProgress(progress); + holder.progress.setVisibility(View.VISIBLE); + } } else { - holder.txtvDuration.setVisibility(View.VISIBLE); - holder.pubDate.setVisibility(View.VISIBLE); - holder.downloadProgress.setVisibility(View.GONE); + holder.progress.setVisibility(View.GONE); } - if (!media.isDownloaded()) { - if (isDownloadingMedia) { - // item is being downloaded - holder.downloadProgress.setProgress(itemAccess.getItemDownloadProgressPercent(item)); - } - } } else { - holder.downloadProgress.setVisibility(View.GONE); + holder.progress.setVisibility(View.GONE); holder.txtvDuration.setVisibility(View.GONE); } @@ -164,7 +164,7 @@ public class AllEpisodesListAdapter extends BaseAdapter { View statusUnread; ImageView queueStatus; ImageView imageView; - ProgressBar downloadProgress; + ProgressBar progress; TextView txtvDuration; ImageButton butSecondary; } diff --git a/app/src/main/res/layout/new_episodes_listitem.xml b/app/src/main/res/layout/new_episodes_listitem.xml index b738cf836..ff1318fc8 100644 --- a/app/src/main/res/layout/new_episodes_listitem.xml +++ b/app/src/main/res/layout/new_episodes_listitem.xml @@ -43,7 +43,7 @@ <TextView android:id="@+id/txtvTitle" style="@style/AntennaPod.TextView.ListItemPrimaryTitle" - android:layout_width="0dp" + android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" @@ -55,10 +55,10 @@ android:id="@+id/bottom_bar" android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_below="@id/txtvTitle" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" - android:layout_marginTop="16dp" tools:background="@android:color/holo_red_light" > <TextView @@ -93,14 +93,12 @@ tools:background="@android:color/holo_green_dark" /> <ProgressBar - android:id="@+id/pbar_download_progress" + android:id="@+id/pbar_progress" style="?android:attr/progressBarStyleHorizontal" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginLeft="8dp" - android:layout_marginRight="8dp" - android:layout_toLeftOf="@id/txtvPublished" - android:layout_toRightOf="@id/txtvDuration" + android:layout_below="@id/txtvDuration" + android:layout_marginTop="-2dp" android:max="100" /> </RelativeLayout> |