From 3f6842f27ac8bd406647c58c0cc640779b1bb15e Mon Sep 17 00:00:00 2001
From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>
Date: Thu, 9 May 2024 18:59:31 -0400
Subject: Fix play button not shown in ViewVideoActivity when pinch to zoom
video is enabled.
---
.../infinityforreddit/activities/ViewVideoActivity.java | 7 +++----
.../activities/ViewVideoActivityBindingAdapter.java | 2 +-
.../infinityforreddit/fragments/ViewImgurVideoFragment.java | 2 +-
.../fragments/ViewRedditGalleryVideoFragment.java | 2 +-
app/src/main/res/layout/activity_view_video_zoomable.xml | 3 +--
app/src/main/res/layout/exo_playback_control_view.xml | 6 +++---
6 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
index 0600191a..fc9562e0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
@@ -57,7 +57,6 @@ import com.google.android.exoplayer2.source.hls.HlsMediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelectionOverride;
import com.google.android.exoplayer2.ui.PlayerControlView;
-import com.google.android.exoplayer2.ui.StyledPlayerControlView;
import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.ui.TrackSelectionDialogBuilder;
import com.google.android.exoplayer2.upstream.DataSource;
@@ -465,9 +464,9 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
} else {
StyledPlayerView videoPlayerView = findViewById(R.id.player_view_view_video_activity);
videoPlayerView.setPlayer(player);
- videoPlayerView.setControllerVisibilityListener(new StyledPlayerControlView.VisibilityListener() {
+ videoPlayerView.setControllerVisibilityListener(new StyledPlayerView.ControllerVisibilityListener() {
@Override
- public void onVisibilityChange(int visibility) {
+ public void onVisibilityChanged(int visibility) {
switch (visibility) {
case View.GONE:
getWindow().getDecorView().setSystemUiVisibility(
@@ -488,7 +487,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
});
}
- MaterialButton playPauseButton = findViewById(R.id.exo_play);
+ MaterialButton playPauseButton = findViewById(R.id.exo_play_pause);
Drawable playDrawable = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_play_arrow_24dp, null);
Drawable pauseDrawable = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_pause_24dp, null);
playPauseButton.setOnClickListener(view -> {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivityBindingAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivityBindingAdapter.java
index f37fcb7b..e28c8a19 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivityBindingAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivityBindingAdapter.java
@@ -64,7 +64,7 @@ public class ViewVideoActivityBindingAdapter {
}
public MaterialButton getMuteButton() {
- return binding.getRoot().findViewById(R.id.mute_exo_playback_control_view);
+ return getRoot().findViewById(R.id.mute_exo_playback_control_view);
}
public MaterialButton getHdButton() {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
index 961c30b0..c52ab690 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
@@ -289,7 +289,7 @@ public class ViewImgurVideoFragment extends Fragment {
binding.getMuteButton().setIconResource(R.drawable.ic_unmute_24dp);
}
- MaterialButton playPauseButton = binding.getRoot().findViewById(R.id.exo_play);
+ MaterialButton playPauseButton = binding.getRoot().findViewById(R.id.exo_play_pause);
Drawable playDrawable = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_play_arrow_24dp, null);
Drawable pauseDrawable = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_pause_24dp, null);
playPauseButton.setOnClickListener(view -> {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
index 0430b848..f597068a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
@@ -290,7 +290,7 @@ public class ViewRedditGalleryVideoFragment extends Fragment {
binding.getMuteButton().setImageResource(R.drawable.ic_unmute_24dp);
}
- MaterialButton playPauseButton = binding.getRoot().findViewById(R.id.exo_play);
+ MaterialButton playPauseButton = binding.getRoot().findViewById(R.id.exo_play_pause);
Drawable playDrawable = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_play_arrow_24dp, null);
Drawable pauseDrawable = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_pause_24dp, null);
playPauseButton.setOnClickListener(view -> {
diff --git a/app/src/main/res/layout/activity_view_video_zoomable.xml b/app/src/main/res/layout/activity_view_video_zoomable.xml
index ea2ff8eb..c561ed82 100644
--- a/app/src/main/res/layout/activity_view_video_zoomable.xml
+++ b/app/src/main/res/layout/activity_view_video_zoomable.xml
@@ -34,8 +34,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
- app:controller_layout_id="@layout/exo_playback_control_view"
- app:show_timeout="1500" />
+ app:controller_layout_id="@layout/exo_playback_control_view" />