summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrecalculated <recalculated@users.noreply.github.com>2016-01-07 19:05:41 -0600
committerrecalculated <recalculated@users.noreply.github.com>2016-01-07 19:05:41 -0600
commit0d54bd18a74839a6b6c6ba47524903629bb4ffb4 (patch)
tree92e20002d50c88ea5841794d0702e7ade6ac4cca
parent8a4624cb921438e447623cb795c41e8cbefac7e4 (diff)
downloadAntennaPod-0d54bd18a74839a6b6c6ba47524903629bb4ffb4.zip
Redesign ExternalPlayerFragment
-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-v21/progress_bar_horizontal.xml10
-rw-r--r--core/src/main/res/drawable/progress_bar_horizontal.xml10
-rw-r--r--core/src/main/res/values/dimens.xml2
-rw-r--r--core/src/main/res/values/styles.xml5
6 files changed, 118 insertions, 65 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..c1dccc658 100644
--- a/app/src/main/res/layout/external_player_fragment.xml
+++ b/app/src/main/res/layout/external_player_fragment.xml
@@ -1,69 +1,83 @@
<?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">
+<RelativeLayout
+ 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="@dimen/external_player_height"
+ android:visibility="gone"
+ tools:visibility="visible">
- <View
- android:layout_width="match_parent"
- android:layout_height="2dp"
- android:background="@color/holo_blue_light"/>
+ <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"/>
- <LinearLayout
+ <ProgressBar
+ android:id="@+id/episodeProgress"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <RelativeLayout
- android:id="@+id/layoutInfo"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:background="?attr/selectableItemBackground">
+ android:layout_height="4dp"
+ android:layout_toRightOf="@id/imgvCover"
+ android:layout_toEndOf="@id/imgvCover"
+ android:layout_alignParentTop="true"
+ style="@style/ProgressBarStyle"
+ 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>
+ <ImageButton
+ android:id="@+id/butPlay"
+ 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"/>
-</LinearLayout> \ No newline at end of file
+</RelativeLayout>
diff --git a/core/src/main/res/drawable-v21/progress_bar_horizontal.xml b/core/src/main/res/drawable-v21/progress_bar_horizontal.xml
new file mode 100644
index 000000000..2c0c18182
--- /dev/null
+++ b/core/src/main/res/drawable-v21/progress_bar_horizontal.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@android:id/progress">
+ <clip>
+ <shape>
+ <solid android:color="?attr/colorAccent"/>
+ </shape>
+ </clip>
+ </item>
+</layer-list>
diff --git a/core/src/main/res/drawable/progress_bar_horizontal.xml b/core/src/main/res/drawable/progress_bar_horizontal.xml
new file mode 100644
index 000000000..f96a1c3e0
--- /dev/null
+++ b/core/src/main/res/drawable/progress_bar_horizontal.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <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/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..b006f31b9 100644
--- a/core/src/main/res/values/styles.xml
+++ b/core/src/main/res/values/styles.xml
@@ -253,4 +253,9 @@
</style>
+ <style name="ProgressBarStyle">
+ <item name="android:indeterminateOnly">false</item>
+ <item name="android:progressDrawable">@drawable/progress_bar_horizontal</item>
+ </style>
+
</resources>