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 @@ - + - + android:layout_height="@dimen/external_player_height"> - + - + + + 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"/> - - - - + - + 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"/> - \ No newline at end of file + + + 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 @@ + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + 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 @@ + 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 @@ 8dp 70dp - 70dp + 56dp 20dp 12sp 14sp 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 @@ + + + +