From 31d7592964e52c7220e28f0ed6dc2286c56de1c6 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Wed, 13 Oct 2021 21:00:24 +0800 Subject: [PATCH] Legacy autoplay video controller UI. --- app/build.gradle | 1 + .../PostDetailRecyclerViewAdapter.java | 7 +- .../adapters/PostRecyclerViewAdapter.java | 9 +- .../utils/SharedPreferencesUtils.java | 1 + ..._autoplay_playback_control_view_legacy.xml | 90 +++++ .../item_post_card_2_video_autoplay.xml | 2 +- ...ard_2_video_autoplay_legacy_controller.xml | 308 +++++++++++++++++ .../item_post_detail_video_autoplay.xml | 2 +- ...etail_video_autoplay_legacy_controller.xml | 325 ++++++++++++++++++ .../layout/item_post_video_type_autoplay.xml | 2 +- ..._video_type_autoplay_legacy_controller.xml | 320 +++++++++++++++++ app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/video_preferences.xml | 6 + 13 files changed, 1065 insertions(+), 9 deletions(-) create mode 100644 app/src/main/res/layout/exo_autoplay_playback_control_view_legacy.xml create mode 100644 app/src/main/res/layout/item_post_card_2_video_autoplay_legacy_controller.xml create mode 100644 app/src/main/res/layout/item_post_detail_video_autoplay_legacy_controller.xml create mode 100644 app/src/main/res/layout/item_post_video_type_autoplay_legacy_controller.xml diff --git a/app/build.gradle b/app/build.gradle index 4661aea2..9049696f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -51,6 +51,7 @@ dependencies { implementation 'androidx.browser:browser:1.3.0' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' def lifecycleVersion = "2.3.1" implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-livedata:$lifecycleVersion" 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 4c3ee7e3..93386ec5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -44,9 +44,7 @@ import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.target.Target; -import com.google.android.exoplayer2.metadata.Metadata; import com.google.android.exoplayer2.source.TrackGroupArray; -import com.google.android.exoplayer2.text.Cue; import com.google.android.exoplayer2.trackselection.TrackSelectionArray; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import com.google.android.exoplayer2.ui.PlayerView; @@ -55,7 +53,6 @@ import com.libRG.CustomTextView; import org.commonmark.ext.gfm.tables.TableBlock; import java.util.ArrayList; -import java.util.List; import java.util.Locale; import java.util.concurrent.Executor; import java.util.regex.Matcher; @@ -167,6 +164,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter + + + + + + + + + + + + + + + + + + + + + + + \ 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 8cb3ef10..1846c3df 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 @@ -29,7 +29,7 @@ android:id="@+id/player_view_item_post_card_2_video_autoplay" android:layout_width="match_parent" android:layout_height="match_parent" - app:show_timeout="1000" + app:show_timeout="1500" app:controller_layout_id="@layout/exo_autoplay_playback_control_view" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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 78396e50..6e6f77b2 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 @@ -213,7 +213,7 @@ android:id="@+id/player_view_item_post_detail_video_autoplay" android:layout_width="match_parent" android:layout_height="match_parent" - app:show_timeout="1000" + app:show_timeout="1500" app:controller_layout_id="@layout/exo_autoplay_playback_control_view" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_post_video_type_autoplay.xml b/app/src/main/res/layout/item_post_video_type_autoplay.xml index 0d83ca9f..33bdf97f 100644 --- a/app/src/main/res/layout/item_post_video_type_autoplay.xml +++ b/app/src/main/res/layout/item_post_video_type_autoplay.xml @@ -206,7 +206,7 @@ android:id="@+id/player_view_item_post_video_type_autoplay" android:layout_width="match_parent" android:layout_height="match_parent" - app:show_timeout="1000" + app:show_timeout="1500" app:controller_layout_id="@layout/exo_autoplay_playback_control_view" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7b4121f5..0f7e8f98 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -612,6 +612,7 @@ External Browser Custom Tab Internal Browser + Legacy Video Controller UI Cannot get the link diff --git a/app/src/main/res/xml/video_preferences.xml b/app/src/main/res/xml/video_preferences.xml index d3653e3c..3095c477 100644 --- a/app/src/main/res/xml/video_preferences.xml +++ b/app/src/main/res/xml/video_preferences.xml @@ -55,6 +55,12 @@ app:title="@string/settings_video_autoplay_title" app:useSimpleSummaryProvider="true" /> + +