From 0485102797c5e58af967e6b99f58fe6ea5149e44 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Wed, 12 Feb 2020 13:25:05 +0100 Subject: [PATCH 1/5] Updated player screen appearance --- .../activity/MediaplayerInfoActivity.java | 6 - .../antennapod/fragment/CoverFragment.java | 5 +- .../antennapod/view/SquareImageView.java | 5 +- app/src/main/res/layout/cover_fragment.xml | 30 ++-- .../res/layout/mediaplayerinfo_activity.xml | 131 ++++++++---------- core/src/main/res/values-h768dp/dimens.xml | 4 - core/src/main/res/values/dimens.xml | 2 - 7 files changed, 78 insertions(+), 105 deletions(-) delete mode 100644 core/src/main/res/values-h768dp/dimens.xml diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java index 75819425c..85996c7e4 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java @@ -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); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java index 5467d71a8..79e88679e 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -12,6 +12,8 @@ import android.widget.TextView; 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.glide.ApGlideSettings; @@ -75,7 +77,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)))) .into(imgvCover); } diff --git a/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java b/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java index f82309c4a..439f80b97 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java +++ b/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java @@ -25,9 +25,8 @@ public class SquareImageView extends AppCompatImageView { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); - int width = getMeasuredWidth(); - //noinspection SuspiciousNameCombination - setMeasuredDimension(width, width); + int size = Math.min(getMeasuredWidth(), getMeasuredHeight()); + setMeasuredDimension(size, size); } } \ No newline at end of file diff --git a/app/src/main/res/layout/cover_fragment.xml b/app/src/main/res/layout/cover_fragment.xml index 8e0ec3679..f73562245 100644 --- a/app/src/main/res/layout/cover_fragment.xml +++ b/app/src/main/res/layout/cover_fragment.xml @@ -4,36 +4,38 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - android:padding="8dp"> + android:padding="8dp" + android:gravity="center"> + + - - - + android:background="@android:color/transparent" /> + + + + - + + + 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" /> - - - - + 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" /> @@ -105,9 +105,7 @@ 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="16dp" tools:background="@android:color/holo_purple"> + android:clickable="false" /> + android:clickable="false" /> + android:clickable="false" /> - - - - diff --git a/core/src/main/res/values-h768dp/dimens.xml b/core/src/main/res/values-h768dp/dimens.xml deleted file mode 100644 index fd744e422..000000000 --- a/core/src/main/res/values-h768dp/dimens.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - 12dp - \ No newline at end of file diff --git a/core/src/main/res/values/dimens.xml b/core/src/main/res/values/dimens.xml index 34cbe1b72..ee2c57ac4 100644 --- a/core/src/main/res/values/dimens.xml +++ b/core/src/main/res/values/dimens.xml @@ -37,6 +37,4 @@ 24dp 8dp - 0dp - From fe632a4f9f5dd5aa9ed8e54f42aa1496ce08f480 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Wed, 12 Feb 2020 13:38:18 +0100 Subject: [PATCH 2/5] Fixed other square images --- .../danoeh/antennapod/view/SquareImageView.java | 17 ++++++++++++++++- app/src/main/res/layout/cover_fragment.xml | 4 +++- .../res/layout/mediaplayerinfo_activity.xml | 12 ++++++------ core/src/main/res/values/attrs.xml | 4 ++++ 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java b/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java index 439f80b97..6c9a12f43 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java +++ b/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java @@ -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,17 +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.getTheme().obtainStyledAttributes(attrs, + new int[]{R.styleable.SquareImageView_useMinimum}, 0, 0); + useMinimum = a.getBoolean(0, false); + a.recycle(); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); - int size = Math.min(getMeasuredWidth(), getMeasuredHeight()); + int size = getMeasuredWidth(); + if (useMinimum) { + size = Math.min(getMeasuredWidth(), getMeasuredHeight()); + } setMeasuredDimension(size, size); } diff --git a/app/src/main/res/layout/cover_fragment.xml b/app/src/main/res/layout/cover_fragment.xml index f73562245..c5fedd07a 100644 --- a/app/src/main/res/layout/cover_fragment.xml +++ b/app/src/main/res/layout/cover_fragment.xml @@ -3,6 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + xmlns:squareImageView="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:padding="8dp" android:gravity="center"> @@ -18,7 +19,8 @@ android:layout_marginRight="32dp" android:transitionName="coverTransition" tools:src="@android:drawable/sym_def_app_icon" - android:foreground="?attr/selectableItemBackgroundBorderless"/> + android:foreground="?attr/selectableItemBackgroundBorderless" + squareImageView:useMinimum="true" /> + + + + From b64769ab632f8a2a295e9484203e5b1bd2eee098 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Thu, 13 Feb 2020 12:46:21 +0100 Subject: [PATCH 3/5] Rounded chapter images --- .../de/danoeh/antennapod/adapter/ChaptersListAdapter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java index cb74bb169..1171acaa5 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java @@ -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 { .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 { From 3c6fd072e346da1f6649025c96aa29548c043ba4 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Thu, 13 Feb 2020 13:43:13 +0100 Subject: [PATCH 4/5] Added border to play button --- .../res/layout/mediaplayerinfo_activity.xml | 56 ++++++++++++------- core/src/main/res/values/dimens.xml | 1 + 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/app/src/main/res/layout/mediaplayerinfo_activity.xml b/app/src/main/res/layout/mediaplayerinfo_activity.xml index 08d29c8e1..1d48d1708 100644 --- a/app/src/main/res/layout/mediaplayerinfo_activity.xml +++ b/app/src/main/res/layout/mediaplayerinfo_activity.xml @@ -71,7 +71,7 @@ android:layout_height="wrap_content" android:paddingLeft="8dp" android:paddingRight="8dp" - android:layout_marginBottom="16dp"> + android:layout_marginBottom="4dp"> + + + android:layout_centerVertical="true" /> @@ -178,7 +191,6 @@ 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" @@ -191,6 +203,7 @@ android:layout_height="@dimen/audioplayer_playercontrols_length" android:layout_toLeftOf="@id/butRev" android:layout_toStartOf="@id/butRev" + android:layout_centerVertical="true" android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@string/cast_disconnect_label" android:src="?attr/ic_cast_disconnect" @@ -206,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: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" /> diff --git a/core/src/main/res/values/dimens.xml b/core/src/main/res/values/dimens.xml index ee2c57ac4..bef2d311c 100644 --- a/core/src/main/res/values/dimens.xml +++ b/core/src/main/res/values/dimens.xml @@ -31,6 +31,7 @@ 16dp 48dp + 64dp 16dp 12dp From 5de0cc138c91a46dc4d48a3f6b261775fb811734 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Thu, 13 Feb 2020 20:26:45 +0100 Subject: [PATCH 5/5] Little fixes --- .../main/java/de/danoeh/antennapod/fragment/CoverFragment.java | 1 + .../main/java/de/danoeh/antennapod/view/SquareImageView.java | 3 +-- app/src/main/res/layout/cover_fragment.xml | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java index fc540e223..cc1868321 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -83,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()); } diff --git a/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java b/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java index 6c9a12f43..dcf1edbe7 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java +++ b/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java @@ -27,8 +27,7 @@ public class SquareImageView extends AppCompatImageView { } private void loadAttrs(Context context, AttributeSet attrs) { - TypedArray a = context.getTheme().obtainStyledAttributes(attrs, - new int[]{R.styleable.SquareImageView_useMinimum}, 0, 0); + TypedArray a = context.obtainStyledAttributes(attrs, new int[]{R.styleable.SquareImageView_useMinimum}); useMinimum = a.getBoolean(0, false); a.recycle(); } diff --git a/app/src/main/res/layout/cover_fragment.xml b/app/src/main/res/layout/cover_fragment.xml index c5fedd07a..4292344fd 100644 --- a/app/src/main/res/layout/cover_fragment.xml +++ b/app/src/main/res/layout/cover_fragment.xml @@ -1,9 +1,9 @@ @@ -43,6 +43,7 @@ android:maxLines="2" android:textColor="?android:attr/textColorPrimary" android:textIsSelectable="true" + android:layout_marginBottom="8dp" tools:text="Episode" />