From 019970d5fefd19cf6860de039634762542e9b49b Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Thu, 9 May 2024 18:06:54 -0400 Subject: Fix controller animation issues in StyledPlayerView in ExoPlayer. --- .../infinityforreddit/activities/ViewVideoActivity.java | 5 +++-- app/src/main/res/layout/activity_post_video.xml | 4 +++- app/src/main/res/layout/activity_view_video.xml | 4 +++- app/src/main/res/layout/exo_playback_control_view.xml | 8 ++++---- app/src/main/res/layout/fragment_view_imgur_video.xml | 4 +++- app/src/main/res/layout/fragment_view_reddit_gallery_video.xml | 4 +++- app/src/main/res/layout/item_post_card_2_video_autoplay.xml | 4 +++- .../layout/item_post_card_2_video_autoplay_legacy_controller.xml | 4 +++- app/src/main/res/layout/item_post_card_3_video_type_autoplay.xml | 4 +++- .../item_post_card_3_video_type_autoplay_legacy_controller.xml | 4 +++- app/src/main/res/layout/item_post_detail_video_autoplay.xml | 4 +++- .../layout/item_post_detail_video_autoplay_legacy_controller.xml | 4 +++- app/src/main/res/layout/item_post_video_type_autoplay.xml | 4 +++- .../layout/item_post_video_type_autoplay_legacy_controller.xml | 4 +++- 14 files changed, 43 insertions(+), 18 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 54eecf43..0600191a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java @@ -57,6 +57,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.StyledPlayerControlView; import com.google.android.exoplayer2.ui.StyledPlayerView; import com.google.android.exoplayer2.ui.TrackSelectionDialogBuilder; import com.google.android.exoplayer2.upstream.DataSource; @@ -464,9 +465,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 StyledPlayerView.ControllerVisibilityListener() { + videoPlayerView.setControllerVisibilityListener(new StyledPlayerControlView.VisibilityListener() { @Override - public void onVisibilityChanged(int visibility) { + public void onVisibilityChange(int visibility) { switch (visibility) { case View.GONE: getWindow().getDecorView().setSystemUiVisibility( diff --git a/app/src/main/res/layout/activity_post_video.xml b/app/src/main/res/layout/activity_post_video.xml index 5b0b6f46..3dcde6b8 100644 --- a/app/src/main/res/layout/activity_post_video.xml +++ b/app/src/main/res/layout/activity_post_video.xml @@ -271,7 +271,9 @@ android:layout_width="match_parent" android:layout_height="400dp" android:visibility="gone" - app:controller_layout_id="@layout/exo_playback_control_view" /> + android:animateLayoutChanges="true" + app:controller_layout_id="@layout/exo_playback_control_view" + app:animation_enabled="false" /> diff --git a/app/src/main/res/layout/activity_view_video.xml b/app/src/main/res/layout/activity_view_video.xml index 786cd9ae..10af052b 100644 --- a/app/src/main/res/layout/activity_view_video.xml +++ b/app/src/main/res/layout/activity_view_video.xml @@ -25,7 +25,9 @@ android:id="@+id/player_view_view_video_activity" android:layout_width="match_parent" android:layout_height="match_parent" - app:controller_layout_id="@layout/exo_playback_control_view"/> + android:animateLayoutChanges="true" + app:controller_layout_id="@layout/exo_playback_control_view" + app:animation_enabled="false" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_view_reddit_gallery_video.xml b/app/src/main/res/layout/fragment_view_reddit_gallery_video.xml index 5f11afb2..d2650ff3 100644 --- a/app/src/main/res/layout/fragment_view_reddit_gallery_video.xml +++ b/app/src/main/res/layout/fragment_view_reddit_gallery_video.xml @@ -10,6 +10,8 @@ android:id="@+id/player_view_view_reddit_gallery_video_fragment" android:layout_width="match_parent" android:layout_height="match_parent" - app:controller_layout_id="@layout/exo_playback_control_view"/> + android:animateLayoutChanges="true" + app:controller_layout_id="@layout/exo_playback_control_view" + app:animation_enabled="false" /> \ No newline at end of file diff --git a/app/src/main/res/layout/item_post_card_2_video_autoplay.xml b/app/src/main/res/layout/item_post_card_2_video_autoplay.xml index acfbbd72..6a279d0c 100644 --- a/app/src/main/res/layout/item_post_card_2_video_autoplay.xml +++ b/app/src/main/res/layout/item_post_card_2_video_autoplay.xml @@ -30,9 +30,11 @@ android:id="@+id/player_view_item_post_card_2_video_autoplay" android:layout_width="match_parent" android:layout_height="match_parent" + android:animateLayoutChanges="true" app:show_timeout="1500" app:auto_show="false" - app:controller_layout_id="@layout/exo_autoplay_playback_control_view" /> + app:controller_layout_id="@layout/exo_autoplay_playback_control_view" + app:animation_enabled="false" /> + app:controller_layout_id="@layout/exo_autoplay_playback_control_view_legacy" + app:animation_enabled="false" /> + app:controller_layout_id="@layout/exo_autoplay_playback_control_view" + app:animation_enabled="false" /> + app:controller_layout_id="@layout/exo_autoplay_playback_control_view_legacy" + app:animation_enabled="false" /> + app:controller_layout_id="@layout/exo_autoplay_playback_control_view" + app:animation_enabled="false" /> + app:controller_layout_id="@layout/exo_autoplay_playback_control_view_legacy" + app:animation_enabled="false" /> + app:controller_layout_id="@layout/exo_autoplay_playback_control_view" + app:animation_enabled="false" /> + app:controller_layout_id="@layout/exo_autoplay_playback_control_view_legacy" + app:animation_enabled="false" />