From ba2a219168721680cd6e5e553a35a7cbf2614e22 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 6 Jul 2020 22:14:58 +0800 Subject: Show a preview image before autoplaying video is loaded. --- .../infinityforreddit/Adapter/PostRecyclerViewAdapter.java | 14 +++++++++++++- .../main/res/layout/item_post_detail_video_autoplay.xml | 7 +++++++ app/src/main/res/layout/item_post_video_type_autoplay.xml | 9 ++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java index 0537e0e8..7bc347b6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java @@ -522,6 +522,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter cues) { } + + @Override + public void onRenderedFirstFrame() { + mGlide.clear(previewImageView); + previewImageView.setVisibility(View.GONE); + } }); } helper.initialize(container, playbackInfo); @@ -2054,7 +2066,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter= 0.85; + return ToroUtil.visibleAreaOffset(this, itemView.getParent()) >= 0.75; } @Override diff --git a/app/src/main/res/layout/item_post_detail_video_autoplay.xml b/app/src/main/res/layout/item_post_detail_video_autoplay.xml index 6ee5736a..b8b75860 100644 --- a/app/src/main/res/layout/item_post_detail_video_autoplay.xml +++ b/app/src/main/res/layout/item_post_detail_video_autoplay.xml @@ -202,6 +202,13 @@ android:background="#000000" app:resize_mode="fixed_width"> + + + app:controller_layout_id="@layout/exo_autoplay_playback_control_view" /> + + -- cgit v1.2.3