From e887996053ea6c76724b2880903059feb62da5eb Mon Sep 17 00:00:00 2001 From: Wagubi Brian Date: Mon, 1 Jul 2019 10:36:57 +0300 Subject: [PATCH] Extend play/pause functionality to Image Cover --- .../java/de/danoeh/antennapod/fragment/CoverFragment.java | 8 ++++++++ app/src/main/res/layout/cover_fragment.xml | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) 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 7fd61d3ad..db9dd9530 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -44,6 +44,7 @@ public class CoverFragment extends Fragment { txtvPodcastTitle = root.findViewById(R.id.txtvPodcastTitle); txtvEpisodeTitle = root.findViewById(R.id.txtvEpisodeTitle); imgvCover = root.findViewById(R.id.imgvCover); + imgvCover.setOnClickListener(v -> onPlayPause()); return root; } @@ -114,4 +115,11 @@ public class CoverFragment extends Fragment { disposable.dispose(); } } + + void onPlayPause() { + if (controller == null) { + return; + } + controller.playPause(); + } } diff --git a/app/src/main/res/layout/cover_fragment.xml b/app/src/main/res/layout/cover_fragment.xml index fec7be26c..8e0ec3679 100644 --- a/app/src/main/res/layout/cover_fragment.xml +++ b/app/src/main/res/layout/cover_fragment.xml @@ -26,7 +26,8 @@ android:contentDescription="@string/cover_label" android:scaleType="fitCenter" android:transitionName="coverTransition" - tools:src="@android:drawable/sym_def_app_icon" /> + tools:src="@android:drawable/sym_def_app_icon" + android:foreground="?attr/selectableItemBackground" />