aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-05-08 22:31:05 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-05-08 22:31:05 +0000
commitb0fad500b940840f41210833fbc9b98eeb5ff6ad (patch)
treef1280addb39d0a582fdfc03d9ad37b41850f6424 /app/src/main/java
parente773ec69296b8861bd9d514e18bbe6713707fb90 (diff)
downloadinfinity-for-reddit-b0fad500b940840f41210833fbc9b98eeb5ff6ad.tar
infinity-for-reddit-b0fad500b940840f41210833fbc9b98eeb5ff6ad.tar.gz
infinity-for-reddit-b0fad500b940840f41210833fbc9b98eeb5ff6ad.tar.bz2
infinity-for-reddit-b0fad500b940840f41210833fbc9b98eeb5ff6ad.tar.lz
infinity-for-reddit-b0fad500b940840f41210833fbc9b98eeb5ff6ad.tar.xz
infinity-for-reddit-b0fad500b940840f41210833fbc9b98eeb5ff6ad.tar.zst
infinity-for-reddit-b0fad500b940840f41210833fbc9b98eeb5ff6ad.zip
Migrate from PlayerView to StyledPlayerView in ExoPlayer.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java39
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java20
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java20
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java36
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragmentBindingAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragmentBindingAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ExoPlayable.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ExoPlayerViewHelper.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/Playable.java14
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/PlayableImpl.java10
12 files changed, 88 insertions, 80 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 b996bfb5..c90c7cb3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
@@ -56,7 +56,7 @@ 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.PlayerView;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.ui.TrackSelectionDialogBuilder;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
@@ -459,24 +459,27 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
}
});
} else {
- PlayerView videoPlayerView = findViewById(R.id.player_view_view_video_activity);
+ StyledPlayerView videoPlayerView = findViewById(R.id.player_view_view_video_activity);
videoPlayerView.setPlayer(player);
- videoPlayerView.setControllerVisibilityListener(visibility -> {
- switch (visibility) {
- case View.GONE:
- getWindow().getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_FULLSCREEN
- | View.SYSTEM_UI_FLAG_IMMERSIVE);
- break;
- case View.VISIBLE:
- getWindow().getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ videoPlayerView.setControllerVisibilityListener(new StyledPlayerView.ControllerVisibilityListener() {
+ @Override
+ public void onVisibilityChanged(int visibility) {
+ switch (visibility) {
+ case View.GONE:
+ getWindow().getDecorView().setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_IMMERSIVE);
+ break;
+ case View.VISIBLE:
+ getWindow().getDecorView().setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ }
}
});
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
index 0486751e..2c7644ca 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
@@ -47,7 +47,7 @@ import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Tracks;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.DefaultTimeBar;
-import com.google.android.exoplayer2.ui.PlayerView;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.ui.TimeBar;
import com.google.android.material.button.MaterialButton;
import com.google.common.collect.ImmutableList;
@@ -3111,7 +3111,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
AspectRatioFrameLayout aspectRatioFrameLayout;
GifImageView previewImageView;
ImageView errorLoadingVideoImageView;
- PlayerView videoPlayer;
+ StyledPlayerView videoPlayer;
ImageView muteButton;
ImageView fullscreenButton;
ImageView pauseButton;
@@ -3143,7 +3143,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
AspectRatioFrameLayout aspectRatioFrameLayout,
GifImageView previewImageView,
ImageView errorLoadingVideoImageView,
- PlayerView videoPlayer,
+ StyledPlayerView videoPlayer,
ImageView muteButton,
ImageView fullscreenButton,
ImageView pauseButton,
@@ -3283,7 +3283,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
previewImageView.setOnClickListener(view -> fullscreenButton.performClick());
videoPlayer.setOnClickListener(view -> {
- if (mEasierToWatchInFullScreen && videoPlayer.isControllerVisible()) {
+ if (mEasierToWatchInFullScreen && videoPlayer.isControllerFullyVisible()) {
fullscreenButton.performClick();
}
});
@@ -4753,7 +4753,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
AspectRatioFrameLayout aspectRatioFrameLayout;
GifImageView previewImageView;
ImageView errorLoadingRedgifsImageView;
- PlayerView videoPlayer;
+ StyledPlayerView videoPlayer;
ImageView muteButton;
ImageView fullscreenButton;
ImageView pauseButton;
@@ -4787,7 +4787,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
AspectRatioFrameLayout aspectRatioFrameLayout,
GifImageView previewImageView,
ImageView errorLoadingRedgifsImageView,
- PlayerView videoPlayer,
+ StyledPlayerView videoPlayer,
ImageView muteButton,
ImageView fullscreenButton,
ImageView pauseButton,
@@ -4929,7 +4929,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
previewImageView.setOnClickListener(view -> fullscreenButton.performClick());
videoPlayer.setOnClickListener(view -> {
- if (mEasierToWatchInFullScreen && videoPlayer.isControllerVisible()) {
+ if (mEasierToWatchInFullScreen && videoPlayer.isControllerFullyVisible()) {
fullscreenButton.performClick();
}
});
@@ -5770,7 +5770,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
AspectRatioFrameLayout aspectRatioFrameLayout;
GifImageView previewImageView;
ImageView errorLoadingRedgifsImageView;
- PlayerView videoPlayer;
+ StyledPlayerView videoPlayer;
ImageView muteButton;
ImageView fullscreenButton;
ImageView pauseButton;
@@ -5795,7 +5795,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
AspectRatioFrameLayout aspectRatioFrameLayout,
GifImageView previewImageView,
ImageView errorLoadingRedgifsImageView,
- PlayerView videoPlayer,
+ StyledPlayerView videoPlayer,
ImageView muteButton,
ImageView fullscreenButton,
ImageView pauseButton,
@@ -5925,7 +5925,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
previewImageView.setOnClickListener(view -> fullscreenButton.performClick());
videoPlayer.setOnClickListener(view -> {
- if (mEasierToWatchInFullScreen && videoPlayer.isControllerVisible()) {
+ if (mEasierToWatchInFullScreen && videoPlayer.isControllerFullyVisible()) {
fullscreenButton.performClick();
}
});
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 90696fcd..54da4052 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
@@ -42,7 +42,7 @@ import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Tracks;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.DefaultTimeBar;
-import com.google.android.exoplayer2.ui.PlayerView;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.ui.TimeBar;
import com.google.android.material.button.MaterialButton;
import com.google.common.collect.ImmutableList;
@@ -1592,7 +1592,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
class PostDetailBaseVideoAutoplayViewHolder extends PostDetailBaseViewHolder implements ToroPlayer {
public Call<String> fetchRedgifsOrStreamableVideoCall;
AspectRatioFrameLayout aspectRatioFrameLayout;
- PlayerView playerView;
+ StyledPlayerView playerView;
GifImageView previewImageView;
ImageView mErrorLoadingRedgifsImageView;
ImageView muteButton;
@@ -1624,7 +1624,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
CustomTextView flairTextView,
TextView upvoteRatioTextView,
AspectRatioFrameLayout aspectRatioFrameLayout,
- PlayerView playerView,
+ StyledPlayerView playerView,
GifImageView previewImageView,
ImageView errorLoadingRedgifsImageView,
ImageView muteButton,
@@ -1758,7 +1758,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
previewImageView.setOnClickListener(view -> fullscreenButton.performClick());
playerView.setOnClickListener(view -> {
- if (mEasierToWatchInFullScreen && playerView.isControllerVisible()) {
+ if (mEasierToWatchInFullScreen && playerView.isControllerFullyVisible()) {
fullscreenButton.performClick();
}
});
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 286bdff1..9297c6ee 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -47,7 +47,7 @@ import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Tracks;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.DefaultTimeBar;
-import com.google.android.exoplayer2.ui.PlayerView;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.ui.TimeBar;
import com.google.android.material.button.MaterialButton;
import com.google.common.collect.ImmutableList;
@@ -3273,7 +3273,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
AspectRatioFrameLayout aspectRatioFrameLayout;
GifImageView previewImageView;
ImageView errorLoadingRedgifsImageView;
- PlayerView videoPlayer;
+ StyledPlayerView videoPlayer;
ImageView muteButton;
ImageView fullscreenButton;
ImageView pauseButton;
@@ -3305,7 +3305,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
AspectRatioFrameLayout aspectRatioFrameLayout,
GifImageView previewImageView,
ImageView errorLoadingRedgifsImageView,
- PlayerView videoPlayer,
+ StyledPlayerView videoPlayer,
ImageView muteButton,
ImageView fullscreenButton,
ImageView pauseButton,
@@ -3446,7 +3446,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
previewImageView.setOnClickListener(view -> fullscreenButton.performClick());
videoPlayer.setOnClickListener(view -> {
- if (mEasierToWatchInFullScreen && videoPlayer.isControllerVisible()) {
+ if (mEasierToWatchInFullScreen && videoPlayer.isControllerFullyVisible()) {
fullscreenButton.performClick();
}
});
@@ -4984,7 +4984,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
AspectRatioFrameLayout aspectRatioFrameLayout;
GifImageView previewImageView;
ImageView errorLoadingRedgifsImageView;
- PlayerView videoPlayer;
+ StyledPlayerView videoPlayer;
ImageView muteButton;
ImageView fullscreenButton;
ImageView pauseButton;
@@ -5017,7 +5017,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
AspectRatioFrameLayout aspectRatioFrameLayout,
GifImageView previewImageView,
ImageView errorLoadingRedgifsImageView,
- PlayerView videoPlayer,
+ StyledPlayerView videoPlayer,
ImageView muteButton,
ImageView fullscreenButton,
ImageView pauseButton,
@@ -5160,7 +5160,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
previewImageView.setOnClickListener(view -> fullscreenButton.performClick());
videoPlayer.setOnClickListener(view -> {
- if (mEasierToWatchInFullScreen && videoPlayer.isControllerVisible()) {
+ if (mEasierToWatchInFullScreen && videoPlayer.isControllerFullyVisible()) {
fullscreenButton.performClick();
}
});
@@ -6033,7 +6033,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
AspectRatioFrameLayout aspectRatioFrameLayout;
GifImageView previewImageView;
ImageView errorLoadingRedgifsImageView;
- PlayerView videoPlayer;
+ StyledPlayerView videoPlayer;
ImageView muteButton;
ImageView fullscreenButton;
ImageView pauseButton;
@@ -6058,7 +6058,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
AspectRatioFrameLayout aspectRatioFrameLayout,
GifImageView previewImageView,
ImageView errorLoadingRedgifsImageView,
- PlayerView videoPlayer,
+ StyledPlayerView videoPlayer,
ImageView muteButton,
ImageView fullscreenButton,
ImageView pauseButton,
@@ -6192,7 +6192,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
previewImageView.setOnClickListener(view -> fullscreenButton.performClick());
videoPlayer.setOnClickListener(view -> {
- if (mEasierToWatchInFullScreen && videoPlayer.isControllerVisible()) {
+ if (mEasierToWatchInFullScreen && videoPlayer.isControllerFullyVisible()) {
fullscreenButton.performClick();
}
});
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 ea805b36..43532966 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
@@ -30,6 +30,7 @@ import com.google.android.exoplayer2.Tracks;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelector;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
@@ -113,22 +114,25 @@ public class ViewImgurVideoFragment extends Fragment {
}
}
- binding.getRoot().setControllerVisibilityListener(visibility -> {
- switch (visibility) {
- case View.GONE:
- activity.getWindow().getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_FULLSCREEN
- | View.SYSTEM_UI_FLAG_IMMERSIVE);
- break;
- case View.VISIBLE:
- activity.getWindow().getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ binding.getRoot().setControllerVisibilityListener(new StyledPlayerView.ControllerVisibilityListener() {
+ @Override
+ public void onVisibilityChanged(int visibility) {
+ switch (visibility) {
+ case View.GONE:
+ activity.getWindow().getDecorView().setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_IMMERSIVE);
+ break;
+ case View.VISIBLE:
+ activity.getWindow().getDecorView().setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ }
}
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragmentBindingAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragmentBindingAdapter.java
index f1050db9..3d69ca2f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragmentBindingAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragmentBindingAdapter.java
@@ -2,7 +2,7 @@ package ml.docilealligator.infinityforreddit.fragments;
import android.widget.TextView;
-import com.google.android.exoplayer2.ui.PlayerView;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.material.bottomappbar.BottomAppBar;
import com.google.android.material.button.MaterialButton;
@@ -28,7 +28,7 @@ class ViewImgurVideoFragmentBindingAdapter {
playbackSpeedButton = binding.getRoot().findViewById(R.id.playback_speed_image_view_exo_playback_control_view);
}
- PlayerView getRoot() {
+ StyledPlayerView getRoot() {
return binding.getRoot();
}
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 39969c6e..fd7358d7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
@@ -30,6 +30,7 @@ import com.google.android.exoplayer2.Tracks;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelector;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
@@ -118,7 +119,7 @@ public class ViewRedditGalleryVideoFragment extends Fragment {
}
}
- binding.getPlayerView().setControllerVisibilityListener(visibility -> {
+ binding.getPlayerView().setControllerVisibilityListener((StyledPlayerView.ControllerVisibilityListener) visibility -> {
switch (visibility) {
case View.GONE:
activity.getWindow().getDecorView().setSystemUiVisibility(
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragmentBindingAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragmentBindingAdapter.java
index d86a5ef2..e00b6ff2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragmentBindingAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragmentBindingAdapter.java
@@ -4,7 +4,7 @@ import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;
-import com.google.android.exoplayer2.ui.PlayerView;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.material.bottomappbar.BottomAppBar;
import com.google.android.material.button.MaterialButton;
@@ -35,7 +35,7 @@ class ViewRedditGalleryVideoFragmentBindingAdapter {
return binding.getRoot();
}
- PlayerView getPlayerView() {
+ StyledPlayerView getPlayerView() {
return binding.playerViewViewRedditGalleryVideoFragment;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ExoPlayable.java b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ExoPlayable.java
index 9690d014..33410904 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ExoPlayable.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ExoPlayable.java
@@ -35,7 +35,7 @@ import com.google.android.exoplayer2.source.BehindLiveWindowException;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo;
import com.google.android.exoplayer2.trackselection.TrackSelector;
-import com.google.android.exoplayer2.ui.PlayerView;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.common.collect.ImmutableList;
import ml.docilealligator.infinityforreddit.R;
@@ -85,7 +85,7 @@ public class ExoPlayable extends PlayableImpl {
}
@Override
- public void setPlayerView(@Nullable PlayerView playerView) {
+ public void setPlayerView(@Nullable StyledPlayerView playerView) {
// This will also clear these flags
if (playerView != this.playerView) {
this.lastSeenTrackGroupArray = null;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ExoPlayerViewHelper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ExoPlayerViewHelper.java
index 3ee611a7..81b2dbbf 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ExoPlayerViewHelper.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ExoPlayerViewHelper.java
@@ -25,7 +25,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.ExoPlayer;
-import com.google.android.exoplayer2.ui.PlayerView;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import ml.docilealligator.infinityforreddit.videoautoplay.annotations.RemoveIn;
import ml.docilealligator.infinityforreddit.videoautoplay.helper.ToroPlayerHelper;
@@ -77,7 +77,7 @@ public class ExoPlayerViewHelper extends ToroPlayerHelper {
public ExoPlayerViewHelper(@NonNull ToroPlayer player, @NonNull ExoPlayable playable) {
super(player);
//noinspection ConstantConditions
- if (player.getPlayerView() == null || !(player.getPlayerView() instanceof PlayerView)) {
+ if (player.getPlayerView() == null || !(player.getPlayerView() instanceof StyledPlayerView)) {
throw new IllegalArgumentException("Require non-null PlayerView");
}
@@ -92,7 +92,7 @@ public class ExoPlayerViewHelper extends ToroPlayerHelper {
playable.addErrorListener(super.getErrorListeners());
playable.addOnVolumeChangeListener(super.getVolumeChangeListeners());
playable.prepare(!lazyPrepare);
- playable.setPlayerView((PlayerView) player.getPlayerView());
+ playable.setPlayerView((StyledPlayerView) player.getPlayerView());
}
@Override public void release() {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/Playable.java b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/Playable.java
index d6583fc5..4c879e57 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/Playable.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/Playable.java
@@ -32,7 +32,7 @@ import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.text.Cue;
import com.google.android.exoplayer2.text.CueGroup;
import com.google.android.exoplayer2.text.TextOutput;
-import com.google.android.exoplayer2.ui.PlayerView;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.video.VideoSize;
import java.util.List;
@@ -43,7 +43,7 @@ import ml.docilealligator.infinityforreddit.videoautoplay.media.PlaybackInfo;
import ml.docilealligator.infinityforreddit.videoautoplay.media.VolumeInfo;
/**
- * Define an interface to control a playback, specific for {@link SimpleExoPlayer} and {@link PlayerView}.
+ * Define an interface to control a playback, specific for {@link SimpleExoPlayer} and {@link StyledPlayerView}.
* <p>
* This interface is designed to be reused across Config change. Implementation must not hold any
* strong reference to Activity, and if it supports any kind of that, make sure to implicitly clean
@@ -63,7 +63,7 @@ public interface Playable {
* - If there is non-trivial PlaybackInfo, update it to the SimpleExoPlayer.
* - If client request to prepare MediaSource, then prepare it.
* <p>
- * This method must be called before {@link #setPlayerView(PlayerView)}.
+ * This method must be called before {@link #setPlayerView(com.google.android.exoplayer2.ui.StyledPlayerView)}.
*
* @param prepareSource if {@code true}, also prepare the MediaSource when preparing the Player,
* if {@code false} just do nothing for the MediaSource.
@@ -71,7 +71,7 @@ public interface Playable {
void prepare(boolean prepareSource);
/**
- * Set the {@link PlayerView} for this Playable. It is expected that a playback doesn't require a
+ * Set the {@link StyledPlayerView} for this Playable. It is expected that a playback doesn't require a
* UI, so this setup is optional. But it must be called after the SimpleExoPlayer is prepared,
* that is after {@link #prepare(boolean)} and before {@link #release()}.
* <p>
@@ -80,15 +80,15 @@ public interface Playable {
*
* @param playerView the PlayerView to set to the SimpleExoPlayer.
*/
- void setPlayerView(@Nullable PlayerView playerView);
+ void setPlayerView(@Nullable StyledPlayerView playerView);
/**
- * Get current {@link PlayerView} of this Playable.
+ * Get current {@link StyledPlayerView} of this Playable.
*
* @return current PlayerView instance of this Playable.
*/
@Nullable
- PlayerView getPlayerView();
+ StyledPlayerView getPlayerView();
/**
* Start the playback. If the {@link MediaSource} is not prepared, then also prepare it.
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/PlayableImpl.java b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/PlayableImpl.java
index a3f762e9..f9f26962 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/PlayableImpl.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/PlayableImpl.java
@@ -31,7 +31,7 @@ import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.source.MediaSource;
-import com.google.android.exoplayer2.ui.PlayerView;
+import com.google.android.exoplayer2.ui.StyledPlayerView;
import ml.docilealligator.infinityforreddit.videoautoplay.media.PlaybackInfo;
import ml.docilealligator.infinityforreddit.videoautoplay.media.VolumeInfo;
@@ -61,7 +61,7 @@ class PlayableImpl implements Playable {
protected ToroExoPlayer player; // on-demand, cached
protected MediaSource mediaSource; // on-demand, since we do not reuse MediaSource now.
- protected PlayerView playerView; // on-demand, not always required.
+ protected StyledPlayerView playerView; // on-demand, not always required.
private boolean sourcePrepared = false;
private boolean listenerApplied = false;
@@ -83,13 +83,13 @@ class PlayableImpl implements Playable {
@CallSuper
@Override
- public void setPlayerView(@Nullable PlayerView playerView) {
+ public void setPlayerView(@Nullable StyledPlayerView playerView) {
if (this.playerView == playerView) return;
if (playerView == null) {
this.playerView.setPlayer(null);
} else {
if (this.player != null) {
- PlayerView.switchTargetView(this.player.getPlayer(), this.playerView, playerView);
+ StyledPlayerView.switchTargetView(this.player.getPlayer(), this.playerView, playerView);
}
}
@@ -97,7 +97,7 @@ class PlayableImpl implements Playable {
}
@Override
- public final PlayerView getPlayerView() {
+ public final StyledPlayerView getPlayerView() {
return this.playerView;
}