summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java20
-rw-r--r--app/src/main/res/layout/external_player_fragment.xml136
-rw-r--r--core/src/main/res/drawable/progress_bar_horizontal_dark.xml15
-rw-r--r--core/src/main/res/drawable/progress_bar_horizontal_light.xml15
-rw-r--r--core/src/main/res/values/attrs.xml1
-rw-r--r--core/src/main/res/values/dimens.xml2
-rw-r--r--core/src/main/res/values/styles.xml14
7 files changed, 141 insertions, 62 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java
index 7b02b4f18..888684313 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java
@@ -9,6 +9,7 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
+import android.widget.ProgressBar;
import android.widget.TextView;
import com.bumptech.glide.Glide;
@@ -30,9 +31,10 @@ public class ExternalPlayerFragment extends Fragment {
private ViewGroup fragmentLayout;
private ImageView imgvCover;
- private ViewGroup layoutInfo;
private TextView txtvTitle;
private ImageButton butPlay;
+ private TextView mFeedName;
+ private ProgressBar mProgressBar;
private PlaybackController controller;
@@ -47,11 +49,12 @@ public class ExternalPlayerFragment extends Fragment {
container, false);
fragmentLayout = (ViewGroup) root.findViewById(R.id.fragmentLayout);
imgvCover = (ImageView) root.findViewById(R.id.imgvCover);
- layoutInfo = (ViewGroup) root.findViewById(R.id.layoutInfo);
txtvTitle = (TextView) root.findViewById(R.id.txtvTitle);
butPlay = (ImageButton) root.findViewById(R.id.butPlay);
+ mFeedName = (TextView) root.findViewById(R.id.txtvAuthor);
+ mProgressBar = (ProgressBar) root.findViewById(R.id.episodeProgress);
- layoutInfo.setOnClickListener(new OnClickListener() {
+ fragmentLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -82,6 +85,7 @@ public class ExternalPlayerFragment extends Fragment {
@Override
public void onPositionObserverUpdate() {
+ ExternalPlayerFragment.this.onPositionObserverUpdate();
}
@Override
@@ -159,6 +163,8 @@ public class ExternalPlayerFragment extends Fragment {
public void onResume() {
super.onResume();
controller.init();
+ mProgressBar.setProgress((int)
+ ((double) controller.getPosition() / controller.getDuration() * 100));
}
@Override
@@ -199,6 +205,9 @@ public class ExternalPlayerFragment extends Fragment {
Playable media = controller.getMedia();
if (media != null) {
txtvTitle.setText(media.getEpisodeTitle());
+ mFeedName.setText(media.getFeedTitle());
+ mProgressBar.setProgress((int)
+ ((double) controller.getPosition() / controller.getDuration() * 100));
Glide.with(getActivity())
.load(media.getImageUri())
@@ -234,4 +243,9 @@ public class ExternalPlayerFragment extends Fragment {
public PlaybackController getPlaybackControllerTestingOnly() {
return controller;
}
+
+ public void onPositionObserverUpdate() {
+ mProgressBar.setProgress((int)
+ ((double) controller.getPosition() / controller.getDuration() * 100));
+ }
}
diff --git a/app/src/main/res/layout/external_player_fragment.xml b/app/src/main/res/layout/external_player_fragment.xml
index ef83baa17..b928b6233 100644
--- a/app/src/main/res/layout/external_player_fragment.xml
+++ b/app/src/main/res/layout/external_player_fragment.xml
@@ -1,69 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/fragmentLayout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:visibility="gone"
- android:background="?attr/colorPrimary"
- tools:visibility="visible"
- tools:background="@android:color/darker_gray">
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/fragmentLayout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:visibility="gone">
- <View
+ <RelativeLayout
android:layout_width="match_parent"
- android:layout_height="2dp"
- android:background="@color/holo_blue_light"/>
+ android:layout_height="@dimen/external_player_height">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ <ImageView
+ android:id="@+id/imgvCover"
+ android:contentDescription="@string/cover_label"
+ android:layout_width="@dimen/external_player_height"
+ android:layout_height="@dimen/external_player_height"
+ android:adjustViewBounds="true"
+ android:cropToPadding="true"
+ android:scaleType="fitXY"
+ tools:src="@drawable/ic_drag_vertical_white_48dp"
+ tools:background="@android:color/holo_green_dark"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"/>
- <RelativeLayout
- android:id="@+id/layoutInfo"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:background="?attr/selectableItemBackground">
+ <ProgressBar
+ android:id="@+id/episodeProgress"
+ android:layout_width="match_parent"
+ android:layout_height="4dp"
+ android:layout_toRightOf="@id/imgvCover"
+ android:layout_toEndOf="@id/imgvCover"
+ android:layout_alignParentTop="true"
+ style="?attr/progressBarTheme"
+ android:indeterminate="false"
+ tools:progress="100"/>
- <ImageView
- android:id="@+id/imgvCover"
- android:contentDescription="@string/cover_label"
- android:layout_width="@dimen/external_player_height"
- android:layout_height="@dimen/external_player_height"
- android:layout_alignParentLeft="true"
- android:padding="4dp"
- android:adjustViewBounds="true"
- android:cropToPadding="true"
- android:scaleType="fitXY"
- tools:src="@drawable/ic_stat_antenna_default"
- tools:background="@android:color/holo_green_dark" />
+ <TextView
+ android:id="@+id/txtvTitle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_marginBottom="26dp"
+ android:layout_toRightOf="@id/imgvCover"
+ android:layout_toEndOf="@id/imgvCover"
+ android:layout_marginLeft="16dp"
+ android:layout_marginStart="16dp"
+ android:layout_toLeftOf="@id/butPlay"
+ android:layout_toStartOf="@id/butPlay"
+ style="@style/Base.TextAppearance.AppCompat.Body1"
+ android:ellipsize="end"
+ android:maxLines="1"
+ tools:text="Episode title that is too long and will cause the text to wrap"/>
- <TextView
- android:id="@+id/txtvTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_marginLeft="8dp"
- android:layout_marginRight="8dp"
- android:layout_marginTop="8dp"
- android:layout_toRightOf="@id/imgvCover"
- android:ellipsize="end"
- android:maxLines="2"
- android:textSize="18sp"
- android:fontFamily="sans-serif-light"
- tools:text="Playback item title"
- tools:background="@android:color/holo_green_dark"/>
- </RelativeLayout>
+ <TextView
+ android:id="@+id/txtvAuthor"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/episodeProgress"
+ android:layout_marginTop="26dp"
+ android:layout_toRightOf="@id/imgvCover"
+ android:layout_toEndOf="@id/imgvCover"
+ android:layout_marginLeft="16dp"
+ android:layout_marginStart="16dp"
+ android:layout_toLeftOf="@id/butPlay"
+ android:layout_toStartOf="@id/butPlay"
+ style="@style/TextAppearance.AppCompat.Body1"
+ android:textColor="?android:attr/textColorSecondary"
+ android:ellipsize="end"
+ android:maxLines="1"
+ tools:text="Episode author that is too long and will cause the text to wrap"/>
<ImageButton
android:id="@+id/butPlay"
- android:contentDescription="@string/pause_label"
- android:layout_width="@dimen/external_player_height"
- android:layout_height="@dimen/external_player_height"
- android:background="?attr/selectableItemBackground"
- tools:src="@drawable/ic_play_arrow_white_36dp"
- tools:background="@android:color/holo_green_dark"/>
- </LinearLayout>
+ android:layout_width="52dp"
+ android:layout_height="52dp"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
+ android:layout_below="@id/episodeProgress"
+ android:layout_centerVertical="true"
+ android:contentDescription="@string/pause_label"
+ android:background="?attr/selectableItemBackground"
+ tools:src="@drawable/ic_play_arrow_white_36dp"/>
+
+ </RelativeLayout>
-</LinearLayout> \ No newline at end of file
+</LinearLayout>
diff --git a/core/src/main/res/drawable/progress_bar_horizontal_dark.xml b/core/src/main/res/drawable/progress_bar_horizontal_dark.xml
new file mode 100644
index 000000000..73ad5b37c
--- /dev/null
+++ b/core/src/main/res/drawable/progress_bar_horizontal_dark.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@android:id/background">
+ <shape>
+ <solid android:color="#33FFFFFF"/>
+ </shape>
+ </item>
+ <item android:id="@android:id/progress">
+ <clip>
+ <shape>
+ <solid android:color="@color/holo_blue_dark"/>
+ </shape>
+ </clip>
+ </item>
+</layer-list>
diff --git a/core/src/main/res/drawable/progress_bar_horizontal_light.xml b/core/src/main/res/drawable/progress_bar_horizontal_light.xml
new file mode 100644
index 000000000..a1a7129e9
--- /dev/null
+++ b/core/src/main/res/drawable/progress_bar_horizontal_light.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@android:id/background">
+ <shape>
+ <solid android:color="#33212121"/>
+ </shape>
+ </item>
+ <item android:id="@android:id/progress">
+ <clip>
+ <shape>
+ <solid android:color="@color/holo_blue_light"/>
+ </shape>
+ </clip>
+ </item>
+</layer-list>
diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml
index de641f518..4e444c990 100644
--- a/core/src/main/res/values/attrs.xml
+++ b/core/src/main/res/values/attrs.xml
@@ -41,6 +41,7 @@
<attr name="ic_lock_open" format="reference"/>
<attr name="ic_lock_closed" format="reference"/>
<attr name="ic_filter" format="reference"/>
+ <attr name="progressBarTheme" format="reference"/>
<!-- Used in itemdescription -->
<attr name="non_transparent_background" format="reference"/>
diff --git a/core/src/main/res/values/dimens.xml b/core/src/main/res/values/dimens.xml
index c46537b3e..aa57e3051 100644
--- a/core/src/main/res/values/dimens.xml
+++ b/core/src/main/res/values/dimens.xml
@@ -3,7 +3,7 @@
<dimen name="widget_margin">8dp</dimen>
<dimen name="thumbnail_length">70dp</dimen>
- <dimen name="external_player_height">70dp</dimen>
+ <dimen name="external_player_height">56dp</dimen>
<dimen name="enc_icons_size">20dp</dimen>
<dimen name="text_size_micro">12sp</dimen>
<dimen name="text_size_small">14sp</dimen>
diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml
index b9ee70dbf..1f73fbba2 100644
--- a/core/src/main/res/values/styles.xml
+++ b/core/src/main/res/values/styles.xml
@@ -4,6 +4,7 @@
<style name="Theme.AntennaPod.Light" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/primary_light</item>
<item name="colorAccent">@color/holo_blue_light</item>
+ <item name="progressBarTheme">@style/ProgressBarLight</item>
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Light</item>
<item name="attr/action_bar_icon_color">@color/grey600</item>
@@ -53,6 +54,7 @@
<style name="Theme.AntennaPod.Dark" parent="Theme.AppCompat">
<item name="colorAccent">@color/holo_blue_dark</item>
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
+ <item name="progressBarTheme">@style/ProgressBarDark</item>
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Dark</item>
<item name="attr/action_bar_icon_color">@color/white</item>
<item name="attr/action_about">@drawable/ic_info_white_24dp</item>g
@@ -101,6 +103,7 @@
<style name="Theme.AntennaPod.Light.NoTitle" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
+ <item name="progressBarTheme">@style/ProgressBarLight</item>
<item name="colorPrimary">@color/primary_light</item>
<item name="colorAccent">@color/holo_blue_light</item>
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
@@ -151,6 +154,7 @@
<style name="Theme.AntennaPod.Dark.NoTitle" parent="Theme.AppCompat.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
+ <item name="progressBarTheme">@style/ProgressBarDark</item>
<item name="colorAccent">@color/holo_blue_dark</item>
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Dark</item>
@@ -253,4 +257,14 @@
</style>
+ <style name="ProgressBarLight">
+ <item name="android:indeterminateOnly">false</item>
+ <item name="android:progressDrawable">@drawable/progress_bar_horizontal_light</item>
+ </style>
+
+ <style name="ProgressBarDark">
+ <item name="android:indeterminateOnly">false</item>
+ <item name="android:progressDrawable">@drawable/progress_bar_horizontal_dark</item>
+ </style>
+
</resources>