Merge pull request #3856 from ByteHamster/player-screen-update

Player screen design update
This commit is contained in:
H. Lehmann 2020-02-13 20:42:56 +01:00 committed by GitHub
commit 09927c060c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 145 additions and 131 deletions

View File

@ -211,12 +211,6 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
findViewById(R.id.shadow).setVisibility(View.GONE);
AppBarLayout appBarLayout = findViewById(R.id.appBar);
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics());
appBarLayout.setElevation(px);
}
drawerLayout = findViewById(R.id.drawer_layout);
navList = findViewById(R.id.nav_list);
navDrawer = findViewById(R.id.nav_layout);

View File

@ -11,6 +11,8 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.FitCenter;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.feed.Chapter;
@ -121,7 +123,8 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
.apply(new RequestOptions()
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
.dontAnimate()
.fitCenter())
.transforms(new FitCenter(), new RoundedCorners((int)
(4 * getContext().getResources().getDisplayMetrics().density))))
.into(holder.image);
}
} else {

View File

@ -12,6 +12,8 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.FitCenter;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.request.RequestOptions;
import de.danoeh.antennapod.R;
@ -81,6 +83,7 @@ public class CoverFragment extends Fragment {
private void displayMediaInfo(@NonNull Playable media) {
txtvPodcastTitle.setText(media.getFeedTitle());
txtvEpisodeTitle.setText(media.getEpisodeTitle());
displayedChapterIndex = -2; // Force refresh
displayCoverImage(media.getPosition());
}
@ -133,7 +136,8 @@ public class CoverFragment extends Fragment {
.apply(new RequestOptions()
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
.dontAnimate()
.fitCenter());
.transforms(new FitCenter(),
new RoundedCorners((int) (16 * getResources().getDisplayMetrics().density))));
if (chapter == -1 || TextUtils.isEmpty(media.getChapters().get(chapter).getImageUrl())) {
cover.into(imgvCover);
} else {
@ -142,7 +146,8 @@ public class CoverFragment extends Fragment {
.apply(new RequestOptions()
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
.dontAnimate()
.fitCenter())
.transforms(new FitCenter(),
new RoundedCorners((int) (16 * getResources().getDisplayMetrics().density))))
.thumbnail(cover)
.error(cover)
.into(imgvCover);

View File

@ -1,13 +1,16 @@
package de.danoeh.antennapod.view;
import android.content.Context;
import android.content.res.TypedArray;
import androidx.appcompat.widget.AppCompatImageView;
import android.util.AttributeSet;
import de.danoeh.antennapod.core.R;
/**
* From http://stackoverflow.com/a/19449488/6839
*/
public class SquareImageView extends AppCompatImageView {
private boolean useMinimum = false;
public SquareImageView(Context context) {
super(context);
@ -15,19 +18,29 @@ public class SquareImageView extends AppCompatImageView {
public SquareImageView(Context context, AttributeSet attrs) {
super(context, attrs);
loadAttrs(context, attrs);
}
public SquareImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
loadAttrs(context, attrs);
}
private void loadAttrs(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, new int[]{R.styleable.SquareImageView_useMinimum});
useMinimum = a.getBoolean(0, false);
a.recycle();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = getMeasuredWidth();
//noinspection SuspiciousNameCombination
setMeasuredDimension(width, width);
int size = getMeasuredWidth();
if (useMinimum) {
size = Math.min(getMeasuredWidth(), getMeasuredHeight());
}
setMeasuredDimension(size, size);
}
}

View File

@ -1,44 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:squareImageView="http://schemas.android.com/apk/de.danoeh.antennapod"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
android:padding="8dp"
android:gravity="center">
<de.danoeh.antennapod.view.SquareImageView
android:id="@+id/imgvCover"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:contentDescription="@string/cover_label"
android:scaleType="fitCenter"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:transitionName="coverTransition"
tools:src="@android:drawable/sym_def_app_icon"
android:foreground="?attr/selectableItemBackgroundBorderless"
squareImageView:useMinimum="true" />
<TextView
android:id="@+id/txtvPodcastTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:layout_marginTop="16dp"
android:textColor="?android:attr/textColorSecondary"
android:textIsSelectable="true"
tools:text="Podcast" />
<ImageView
android:id="@+id/imgvCover"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:contentDescription="@string/cover_label"
android:scaleType="fitCenter"
android:transitionName="coverTransition"
tools:src="@android:drawable/sym_def_app_icon"
android:foreground="?attr/selectableItemBackground" />
<TextView
android:id="@+id/txtvEpisodeTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:textColor="?android:attr/textColorPrimary"
android:textIsSelectable="true"
android:layout_marginBottom="8dp"
tools:text="Episode" />
</LinearLayout>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.drawerlayout.widget.DrawerLayout 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/drawer_layout"
@ -33,71 +32,72 @@
android:layout_marginTop="-12dp"
android:paddingBottom="4dp"
android:layout_gravity="center"
android:background="@android:color/transparent"/>
android:background="@android:color/transparent" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_above="@id/playtime_layout"
android:layout_below="@id/appBar"
android:foreground="?android:windowContentOverlay"
tools:background="@android:color/holo_orange_light"
android:layout_marginBottom="12dp" />
<SeekBar
android:id="@+id/sbPosition"
android:layout_width="match_parent"
android:layout_height="24dp"
android:max="500"
tools:progress="100"
android:layout_above="@id/playtime_layout"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layoutDirection="ltr"
tools:background="@android:color/holo_green_dark" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/playtime_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:layout_alignParentBottom="true"
android:background="?attr/overlay_drawable"
android:layoutDirection="ltr"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_marginBottom="4dp">
<TextView
android:id="@+id/txtvPosition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/scrubber_vertical_padding"
android:paddingBottom="@dimen/scrubber_vertical_padding">
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"
tools:background="@android:color/holo_green_dark" />
<TextView
android:id="@+id/txtvPosition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"
tools:background="@android:color/holo_green_dark"/>
<TextView
android:id="@+id/txtvLength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"
tools:background="@android:color/holo_green_dark"/>
<SeekBar
android:id="@+id/sbPosition"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:layout_toLeftOf="@id/txtvLength"
android:layout_toStartOf="@id/txtvLength"
android:layout_toRightOf="@id/txtvPosition"
android:layout_toEndOf="@id/txtvPosition"
android:max="500"
tools:background="@android:color/holo_green_dark"/>
android:id="@+id/txtvLength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"
tools:background="@android:color/holo_green_dark" />
</RelativeLayout>
@ -105,26 +105,36 @@
android:id="@+id/player_control"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="8dp"
android:background="?attr/overlay_background"
android:layout_marginBottom="24dp"
tools:background="@android:color/holo_purple">
<ImageButton
android:id="@+id/butPlay"
android:layout_width="@dimen/audioplayer_playercontrols_length"
android:layout_height="@dimen/audioplayer_playercontrols_length"
android:layout_width="@dimen/audioplayer_playercontrols_length_big"
android:layout_height="@dimen/audioplayer_playercontrols_length_big"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:padding="8dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/pause_label"
app:srcCompat="?attr/av_play"
android:scaleType="fitCenter"
tools:srcCompat="@drawable/ic_av_play_white_24dp"
tools:background="@android:color/holo_green_dark" />
<de.danoeh.antennapod.view.CircularProgressBar
android:layout_width="@dimen/audioplayer_playercontrols_length_big"
android:layout_height="@dimen/audioplayer_playercontrols_length_big"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:layout_centerHorizontal="true"
android:background="?attr/selectableItemBackground"
android:contentDescription="@string/pause_label"
app:srcCompat="?attr/av_play"
android:scaleType="fitCenter"
tools:src="@drawable/ic_av_play_white_24dp"
tools:background="@android:color/holo_green_dark" />
android:layout_centerVertical="true" />
<ImageButton
android:id="@+id/butRev"
@ -132,13 +142,14 @@
android:layout_height="@dimen/audioplayer_playercontrols_length"
android:layout_toLeftOf="@id/butPlay"
android:layout_toStartOf="@id/butPlay"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:background="?attr/selectableItemBackground"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/rewind_label"
app:srcCompat="?attr/av_rewind"
android:scaleType="fitCenter"
tools:src="@drawable/ic_av_fast_rewind_white_48dp"
tools:srcCompat="@drawable/ic_av_fast_rewind_white_48dp"
tools:background="@android:color/holo_blue_dark" />
<TextView
@ -150,12 +161,11 @@
android:layout_alignStart="@id/butRev"
android:layout_alignRight="@id/butRev"
android:layout_alignEnd="@id/butRev"
android:layout_marginTop="-8dp"
android:gravity="center"
android:text="30"
android:textSize="12sp"
android:textColor="?android:attr/textColorSecondary"
android:clickable="false"/>
android:clickable="false" />
<ImageButton
android:id="@+id/butPlaybackSpeed"
@ -163,11 +173,12 @@
android:layout_height="@dimen/audioplayer_playercontrols_length"
android:layout_toLeftOf="@id/butRev"
android:layout_toStartOf="@id/butRev"
android:background="?attr/selectableItemBackground"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/set_playback_speed_label"
app:srcCompat="?attr/av_speed"
android:scaleType="fitCenter"
tools:src="@drawable/ic_playback_speed_white_48dp"
tools:srcCompat="@drawable/ic_playback_speed_white_48dp"
tools:visibility="gone"
tools:background="@android:color/holo_green_dark" />
@ -180,12 +191,11 @@
android:layout_alignStart="@id/butPlaybackSpeed"
android:layout_alignRight="@id/butPlaybackSpeed"
android:layout_alignEnd="@id/butPlaybackSpeed"
android:layout_marginTop="-8dp"
android:gravity="center"
android:text="1.00"
android:textSize="12sp"
android:textColor="?android:attr/textColorSecondary"
android:clickable="false"/>
android:clickable="false" />
<ImageButton
android:id="@+id/butCastDisconnect"
@ -193,7 +203,8 @@
android:layout_height="@dimen/audioplayer_playercontrols_length"
android:layout_toLeftOf="@id/butRev"
android:layout_toStartOf="@id/butRev"
android:background="?attr/selectableItemBackground"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/cast_disconnect_label"
android:src="?attr/ic_cast_disconnect"
android:scaleType="fitCenter"
@ -208,13 +219,14 @@
android:layout_height="@dimen/audioplayer_playercontrols_length"
android:layout_toRightOf="@id/butPlay"
android:layout_toEndOf="@id/butPlay"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:background="?attr/selectableItemBackground"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/fast_forward_label"
app:srcCompat="?attr/av_fast_forward"
android:scaleType="fitCenter"
tools:src="@drawable/ic_av_fast_forward_white_48dp"
tools:srcCompat="@drawable/ic_av_fast_forward_white_48dp"
tools:background="@android:color/holo_blue_dark" />
<TextView
@ -226,12 +238,11 @@
android:layout_alignStart="@id/butFF"
android:layout_alignRight="@id/butFF"
android:layout_alignEnd="@id/butFF"
android:layout_marginTop="-8dp"
android:gravity="center"
android:text="30"
android:textSize="12sp"
android:textColor="?android:attr/textColorSecondary"
android:clickable="false"/>
android:clickable="false" />
<ImageButton
android:id="@+id/butSkip"
@ -239,33 +250,17 @@
android:layout_height="@dimen/audioplayer_playercontrols_length"
android:layout_toRightOf="@id/butFF"
android:layout_toEndOf="@id/butFF"
android:background="?attr/selectableItemBackground"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
app:srcCompat="?attr/av_skip"
android:contentDescription="@string/skip_episode_label"
tools:src="@drawable/ic_av_skip_white_48dp"
tools:srcCompat="@drawable/ic_av_skip_white_48dp"
tools:background="@android:color/holo_green_dark" />
</RelativeLayout>
</LinearLayout>
<androidx.viewpager.widget.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_above="@id/playtime_layout"
android:layout_below="@id/appBar"
android:foreground="?android:windowContentOverlay"
tools:background="@android:color/holo_orange_light" />
<View
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_below="@id/appBar"
android:background="@drawable/shadow" />
</RelativeLayout>
<include layout="@layout/nav_list" />

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="scrubber_vertical_padding">12dp</dimen>
</resources>

View File

@ -74,4 +74,8 @@
<attr name="about_screen_card_border" format="color"/>
<attr name="about_screen_font_color" format="color"/>
<attr name="batch_edit_fab_icon" format="reference"/>
<declare-styleable name="SquareImageView">
<attr name="useMinimum" format="boolean" />
</declare-styleable>
</resources>

View File

@ -31,12 +31,11 @@
<dimen name="listitem_icon_rightpadding">16dp</dimen>
<dimen name="audioplayer_playercontrols_length">48dp</dimen>
<dimen name="audioplayer_playercontrols_length_big">64dp</dimen>
<dimen name="media_router_controller_playback_control_vertical_padding">16dp</dimen>
<dimen name="media_router_controller_playback_control_horizontal_spacing">12dp</dimen>
<dimen name="media_router_controller_playback_control_start_padding">24dp</dimen>
<dimen name="media_router_controller_bottom_margin">8dp</dimen>
<dimen name="scrubber_vertical_padding">0dp</dimen>
</resources>