From bbd212ff2c4e7e77eb1332eeab440dfe13a3d40d Mon Sep 17 00:00:00 2001 From: Docile-Alligator Date: Sun, 10 Apr 2022 09:40:16 +0800 Subject: [PATCH] Click autoplaying videos to open them in fullscreen. --- .../adapters/PostDetailRecyclerViewAdapter.java | 8 ++++++-- .../adapters/PostRecyclerViewAdapter.java | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index ba59a7fd..fca4fd35 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -1722,8 +1722,12 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter fullscreenButton.performClick()); - playerView.setOnLongClickListener(view -> fullscreenButton.performClick()); + previewImageView.setOnClickListener(view -> fullscreenButton.performClick()); + playerView.setOnClickListener(view -> { + if (playerView.isControllerVisible()) { + fullscreenButton.performClick(); + } + }); } void bindVideoUri(Uri videoUri) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index 065dbf81..450f37bf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -2694,7 +2694,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter fetchGfycatOrStreamableVideoCall; - //public FetchGfycatOrRedgifsVideoLinks fetchGfycatOrRedgifsVideoLinks; PostVideoAutoplayViewHolder(View itemView) { super(itemView); @@ -2787,7 +2786,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter fullscreenButton.performClick()); + previewImageView.setOnClickListener(view -> fullscreenButton.performClick()); + + videoPlayer.setOnClickListener(view -> { + if (videoPlayer.isControllerVisible()) { + fullscreenButton.performClick(); + } + }); } void bindVideoUri(Uri videoUri) { @@ -4096,7 +4101,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter fullscreenButton.performClick()); + previewImageView.setOnClickListener(view -> fullscreenButton.performClick()); + + videoPlayer.setOnClickListener(view -> { + if (videoPlayer.isControllerVisible()) { + fullscreenButton.performClick(); + } + }); } void bindVideoUri(Uri videoUri) {