Merge pull request #1539 from recalculated/external-player
Redesign ExternalPlayerFragment
This commit is contained in:
commit
ce29d9f669
|
@ -9,6 +9,7 @@ import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
|
@ -30,9 +31,10 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
|
|
||||||
private ViewGroup fragmentLayout;
|
private ViewGroup fragmentLayout;
|
||||||
private ImageView imgvCover;
|
private ImageView imgvCover;
|
||||||
private ViewGroup layoutInfo;
|
|
||||||
private TextView txtvTitle;
|
private TextView txtvTitle;
|
||||||
private ImageButton butPlay;
|
private ImageButton butPlay;
|
||||||
|
private TextView mFeedName;
|
||||||
|
private ProgressBar mProgressBar;
|
||||||
|
|
||||||
private PlaybackController controller;
|
private PlaybackController controller;
|
||||||
|
|
||||||
|
@ -47,11 +49,12 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
container, false);
|
container, false);
|
||||||
fragmentLayout = (ViewGroup) root.findViewById(R.id.fragmentLayout);
|
fragmentLayout = (ViewGroup) root.findViewById(R.id.fragmentLayout);
|
||||||
imgvCover = (ImageView) root.findViewById(R.id.imgvCover);
|
imgvCover = (ImageView) root.findViewById(R.id.imgvCover);
|
||||||
layoutInfo = (ViewGroup) root.findViewById(R.id.layoutInfo);
|
|
||||||
txtvTitle = (TextView) root.findViewById(R.id.txtvTitle);
|
txtvTitle = (TextView) root.findViewById(R.id.txtvTitle);
|
||||||
butPlay = (ImageButton) root.findViewById(R.id.butPlay);
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -82,6 +85,7 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPositionObserverUpdate() {
|
public void onPositionObserverUpdate() {
|
||||||
|
ExternalPlayerFragment.this.onPositionObserverUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -159,6 +163,8 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
controller.init();
|
controller.init();
|
||||||
|
mProgressBar.setProgress((int)
|
||||||
|
((double) controller.getPosition() / controller.getDuration() * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -199,6 +205,9 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
Playable media = controller.getMedia();
|
Playable media = controller.getMedia();
|
||||||
if (media != null) {
|
if (media != null) {
|
||||||
txtvTitle.setText(media.getEpisodeTitle());
|
txtvTitle.setText(media.getEpisodeTitle());
|
||||||
|
mFeedName.setText(media.getFeedTitle());
|
||||||
|
mProgressBar.setProgress((int)
|
||||||
|
((double) controller.getPosition() / controller.getDuration() * 100));
|
||||||
|
|
||||||
Glide.with(getActivity())
|
Glide.with(getActivity())
|
||||||
.load(media.getImageUri())
|
.load(media.getImageUri())
|
||||||
|
@ -234,4 +243,9 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
public PlaybackController getPlaybackControllerTestingOnly() {
|
public PlaybackController getPlaybackControllerTestingOnly() {
|
||||||
return controller;
|
return controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onPositionObserverUpdate() {
|
||||||
|
mProgressBar.setProgress((int)
|
||||||
|
((double) controller.getPosition() / controller.getDuration() * 100));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,69 +1,89 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/fragmentLayout"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/fragmentLayout"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:orientation="vertical"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone"
|
android:orientation="vertical"
|
||||||
android:background="?attr/colorPrimary"
|
android:visibility="gone">
|
||||||
tools:visibility="visible"
|
|
||||||
tools:background="@android:color/darker_gray">
|
|
||||||
|
|
||||||
<View
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="2dp"
|
android:layout_height="@dimen/external_player_height">
|
||||||
android:background="@color/holo_blue_light"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/imgvCover"
|
||||||
android:layout_height="wrap_content">
|
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
|
<ProgressBar
|
||||||
android:id="@+id/layoutInfo"
|
android:id="@+id/episodeProgress"
|
||||||
android:layout_width="0dp"
|
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"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtvTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_alignParentBottom="true"
|
||||||
android:background="?attr/selectableItemBackground">
|
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"/>
|
||||||
|
|
||||||
<ImageView
|
<TextView
|
||||||
android:id="@+id/imgvCover"
|
android:id="@+id/txtvAuthor"
|
||||||
android:contentDescription="@string/cover_label"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="@dimen/external_player_height"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="@dimen/external_player_height"
|
android:layout_below="@id/episodeProgress"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_marginTop="26dp"
|
||||||
android:padding="4dp"
|
android:layout_toRightOf="@id/imgvCover"
|
||||||
android:adjustViewBounds="true"
|
android:layout_toEndOf="@id/imgvCover"
|
||||||
android:cropToPadding="true"
|
android:layout_marginLeft="16dp"
|
||||||
android:scaleType="fitXY"
|
android:layout_marginStart="16dp"
|
||||||
tools:src="@drawable/ic_stat_antenna_default"
|
android:layout_toLeftOf="@id/butPlay"
|
||||||
tools:background="@android:color/holo_green_dark" />
|
android:layout_toStartOf="@id/butPlay"
|
||||||
|
style="@style/TextAppearance.AppCompat.Body1"
|
||||||
<TextView
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:id="@+id/txtvTitle"
|
android:ellipsize="end"
|
||||||
android:layout_width="match_parent"
|
android:maxLines="1"
|
||||||
android:layout_height="wrap_content"
|
tools:text="Episode author that is too long and will cause the text to wrap"/>
|
||||||
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>
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/butPlay"
|
android:id="@+id/butPlay"
|
||||||
android:contentDescription="@string/pause_label"
|
android:layout_width="52dp"
|
||||||
android:layout_width="@dimen/external_player_height"
|
android:layout_height="52dp"
|
||||||
android:layout_height="@dimen/external_player_height"
|
android:layout_alignParentRight="true"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:layout_alignParentEnd="true"
|
||||||
tools:src="@drawable/ic_play_arrow_white_36dp"
|
android:layout_below="@id/episodeProgress"
|
||||||
tools:background="@android:color/holo_green_dark"/>
|
android:layout_centerVertical="true"
|
||||||
</LinearLayout>
|
android:contentDescription="@string/pause_label"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
tools:src="@drawable/ic_play_arrow_white_36dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -41,6 +41,7 @@
|
||||||
<attr name="ic_lock_open" format="reference"/>
|
<attr name="ic_lock_open" format="reference"/>
|
||||||
<attr name="ic_lock_closed" format="reference"/>
|
<attr name="ic_lock_closed" format="reference"/>
|
||||||
<attr name="ic_filter" format="reference"/>
|
<attr name="ic_filter" format="reference"/>
|
||||||
|
<attr name="progressBarTheme" format="reference"/>
|
||||||
|
|
||||||
<!-- Used in itemdescription -->
|
<!-- Used in itemdescription -->
|
||||||
<attr name="non_transparent_background" format="reference"/>
|
<attr name="non_transparent_background" format="reference"/>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<dimen name="widget_margin">8dp</dimen>
|
<dimen name="widget_margin">8dp</dimen>
|
||||||
<dimen name="thumbnail_length">70dp</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="enc_icons_size">20dp</dimen>
|
||||||
<dimen name="text_size_micro">12sp</dimen>
|
<dimen name="text_size_micro">12sp</dimen>
|
||||||
<dimen name="text_size_small">14sp</dimen>
|
<dimen name="text_size_small">14sp</dimen>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<style name="Theme.AntennaPod.Light" parent="Theme.AppCompat.Light">
|
<style name="Theme.AntennaPod.Light" parent="Theme.AppCompat.Light">
|
||||||
<item name="colorPrimary">@color/primary_light</item>
|
<item name="colorPrimary">@color/primary_light</item>
|
||||||
<item name="colorAccent">@color/holo_blue_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="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
||||||
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Light</item>
|
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Light</item>
|
||||||
<item name="attr/action_bar_icon_color">@color/grey600</item>
|
<item name="attr/action_bar_icon_color">@color/grey600</item>
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
<style name="Theme.AntennaPod.Dark" parent="Theme.AppCompat">
|
<style name="Theme.AntennaPod.Dark" parent="Theme.AppCompat">
|
||||||
<item name="colorAccent">@color/holo_blue_dark</item>
|
<item name="colorAccent">@color/holo_blue_dark</item>
|
||||||
<item name="buttonStyle">@style/Widget.AntennaPod.Button</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="alertDialogTheme">@style/AntennaPod.Dialog.Dark</item>
|
||||||
<item name="attr/action_bar_icon_color">@color/white</item>
|
<item name="attr/action_bar_icon_color">@color/white</item>
|
||||||
<item name="attr/action_about">@drawable/ic_info_white_24dp</item>g
|
<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">
|
<style name="Theme.AntennaPod.Light.NoTitle" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
|
<item name="progressBarTheme">@style/ProgressBarLight</item>
|
||||||
<item name="colorPrimary">@color/primary_light</item>
|
<item name="colorPrimary">@color/primary_light</item>
|
||||||
<item name="colorAccent">@color/holo_blue_light</item>
|
<item name="colorAccent">@color/holo_blue_light</item>
|
||||||
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
||||||
|
@ -151,6 +154,7 @@
|
||||||
<style name="Theme.AntennaPod.Dark.NoTitle" parent="Theme.AppCompat.NoActionBar">
|
<style name="Theme.AntennaPod.Dark.NoTitle" parent="Theme.AppCompat.NoActionBar">
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
|
<item name="progressBarTheme">@style/ProgressBarDark</item>
|
||||||
<item name="colorAccent">@color/holo_blue_dark</item>
|
<item name="colorAccent">@color/holo_blue_dark</item>
|
||||||
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
||||||
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Dark</item>
|
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Dark</item>
|
||||||
|
@ -253,4 +257,14 @@
|
||||||
|
|
||||||
</style>
|
</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>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue