summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java13
-rw-r--r--app/src/main/res/layout/feeditem_fragment.xml95
2 files changed, 60 insertions, 48 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
index 3bdc0e49f..375356c2c 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
@@ -39,6 +39,7 @@ import de.danoeh.antennapod.adapter.actionbutton.StreamActionButton;
import de.danoeh.antennapod.adapter.actionbutton.VisitWebsiteActionButton;
import de.danoeh.antennapod.core.event.DownloadEvent;
import de.danoeh.antennapod.core.event.DownloaderUpdate;
+import de.danoeh.antennapod.core.service.download.DownloadRequest;
import de.danoeh.antennapod.core.service.download.DownloadService;
import de.danoeh.antennapod.event.FeedItemEvent;
import de.danoeh.antennapod.event.PlayerStatusEvent;
@@ -54,6 +55,7 @@ import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.util.DateFormatter;
import de.danoeh.antennapod.core.util.FeedItemUtil;
+import de.danoeh.antennapod.ui.common.CircularProgressBar;
import de.danoeh.antennapod.ui.common.ThemeUtils;
import de.danoeh.antennapod.core.util.playback.PlaybackController;
import de.danoeh.antennapod.core.util.playback.Timeline;
@@ -106,7 +108,7 @@ public class ItemFragment extends Fragment {
private TextView txtvDuration;
private TextView txtvPublished;
private ImageView imgvCover;
- private ProgressBar progbarDownload;
+ private CircularProgressBar progbarDownload;
private ProgressBar progbarLoading;
private TextView butAction1Text;
private TextView butAction2Text;
@@ -158,7 +160,7 @@ public class ItemFragment extends Fragment {
imgvCover = layout.findViewById(R.id.imgvCover);
imgvCover.setOnClickListener(v -> openPodcast());
- progbarDownload = layout.findViewById(R.id.progbarDownload);
+ progbarDownload = layout.findViewById(R.id.circularProgressBar);
progbarLoading = layout.findViewById(R.id.progbarLoading);
butAction1 = layout.findViewById(R.id.butAction1);
butAction2 = layout.findViewById(R.id.butAction2);
@@ -311,10 +313,11 @@ public class ItemFragment extends Fragment {
progbarDownload.setVisibility(View.GONE);
if (item.hasMedia() && downloaderList != null) {
for (Downloader downloader : downloaderList) {
- if (downloader.getDownloadRequest().getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA
- && downloader.getDownloadRequest().getFeedfileId() == item.getMedia().getId()) {
+ DownloadRequest request = downloader.getDownloadRequest();
+ if (request.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA
+ && request.getFeedfileId() == item.getMedia().getId()) {
progbarDownload.setVisibility(View.VISIBLE);
- progbarDownload.setProgress(downloader.getDownloadRequest().getProgressPercent());
+ progbarDownload.setPercentage(0.01f * Math.max(1, request.getProgressPercent()), request);
}
}
}
diff --git a/app/src/main/res/layout/feeditem_fragment.xml b/app/src/main/res/layout/feeditem_fragment.xml
index f070b4fd0..0e5ace85f 100644
--- a/app/src/main/res/layout/feeditem_fragment.xml
+++ b/app/src/main/res/layout/feeditem_fragment.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout 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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/content_root"
@@ -32,20 +33,19 @@
<LinearLayout
android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="16dp"
- android:layout_marginStart="16dp"
- android:layout_height="wrap_content">
+ android:layout_marginStart="16dp">
<TextView
android:id="@+id/txtvPodcast"
- style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foreground="?attr/selectableItemBackground"
android:importantForAccessibility="no"
- tools:text="Podcast title"
- tools:background="@android:color/holo_green_dark" />
+ style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
+ tools:text="Podcast title" />
<TextView
android:id="@+id/txtvTitle"
@@ -55,8 +55,7 @@
android:textColor="?android:attr/textColorPrimary"
android:ellipsize="end"
android:maxLines="5"
- tools:text="@sample/episodes.json/data/title"
- tools:background="@android:color/holo_green_dark" />
+ tools:text="@sample/episodes.json/data/title" />
<LinearLayout
android:layout_width="match_parent"
@@ -64,15 +63,13 @@
<TextView
android:id="@+id/txtvDuration"
- style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- tools:text="@sample/episodes.json/data/duration"
- tools:background="@android:color/holo_green_dark" />
+ style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
+ tools:text="@sample/episodes.json/data/duration" />
<TextView
android:id="@+id/separatorIcons"
- style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
@@ -81,48 +78,41 @@
android:layout_marginEnd="4dp"
android:importantForAccessibility="no"
android:text="ยท"
- tools:background="@android:color/holo_blue_light" />
+ style="@style/AntennaPod.TextView.ListItemSecondaryTitle" />
<TextView
android:id="@+id/txtvPublished"
- style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- tools:text="Jan 23"
- tools:background="@android:color/holo_green_dark" />
+ style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
+ tools:text="Jan 23" />
+
</LinearLayout>
+
</LinearLayout>
- </LinearLayout>
- <ProgressBar
- android:id="@+id/progbarDownload"
- style="?android:attr/progressBarStyleHorizontal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:visibility="gone" />
+ </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
- tools:background="@android:color/holo_blue_bright"
android:baselineAligned="false">
<LinearLayout
+ android:id="@+id/butAction1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:id="@+id/butAction1"
android:orientation="horizontal"
android:background="?android:attr/selectableItemBackground"
android:gravity="center">
<ImageView
+ android:id="@+id/butAction1Icon"
android:layout_width="24dp"
android:layout_height="24dp"
- android:id="@+id/butAction1Icon"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
@@ -130,41 +120,58 @@
tools:src="@drawable/ic_settings" />
<TextView
- android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:id="@+id/butAction1Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:textColor="?android:attr/textColorPrimary"
tools:text="Button 1" />
+
</LinearLayout>
<LinearLayout
+ android:id="@+id/butAction2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:id="@+id/butAction2"
android:orientation="horizontal"
android:background="?android:attr/selectableItemBackground"
android:gravity="center">
- <ImageView
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:id="@+id/butAction2Icon"
- android:layout_marginRight="8dp"
- android:layout_marginEnd="8dp"
- android:layout_marginTop="12dp"
- android:layout_marginBottom="12dp"
- tools:src="@drawable/ic_settings" />
+ <FrameLayout
+ android:layout_width="40dp"
+ android:layout_height="40dp"
+ android:layout_marginTop="4dp"
+ android:layout_marginBottom="4dp"
+ android:layout_gravity="bottom|end">
+
+ <de.danoeh.antennapod.ui.common.CircularProgressBar
+ android:id="@+id/circularProgressBar"
+ android:layout_width="36dp"
+ android:layout_height="36dp"
+ android:layout_gravity="center"
+ android:visibility="gone"
+ app:foregroundColor="?android:attr/textColorPrimary" />
+
+ <ImageView
+ android:id="@+id/butAction2Icon"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_gravity="center"
+ tools:src="@drawable/ic_settings" />
+
+ </FrameLayout>
<TextView
- android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:id="@+id/butAction2Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:textColor="?android:attr/textColorPrimary"
tools:text="Button 2" />
+
</LinearLayout>
+
</LinearLayout>
<TextView
@@ -174,19 +181,19 @@
android:visibility="gone"
android:textAlignment="center"
android:background="?android:attr/dividerVertical"
- android:text="@string/no_media_label"/>
+ android:text="@string/no_media_label" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
- android:background="?android:attr/dividerVertical"/>
+ android:background="?android:attr/dividerVertical" />
</LinearLayout>
<de.danoeh.antennapod.view.NestedScrollableHost
- android:layout_below="@id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:layout_below="@id/header"
app:preferVertical="3">
<de.danoeh.antennapod.view.ShownotesWebView
@@ -207,5 +214,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminate="true" />
+
</FrameLayout>
-</RelativeLayout> \ No newline at end of file
+
+</RelativeLayout>