From c1862f334ef76b009b4423cbb92cf47d11f7431d Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Wed, 11 Aug 2021 23:44:43 +0800 Subject: Disable video autoplay when separating post and comments in post detail page is enabled. --- .../adapters/PostDetailRecyclerViewAdapter.java | 7 +++++-- .../fragments/ViewPostDetailFragment.java | 23 ++++++++++++---------- app/src/main/res/values/strings.xml | 5 +++-- .../res/xml-sw600dp/post_details_preferences.xml | 6 ++++-- app/src/main/res/xml/post_details_preferences.xml | 3 ++- 5 files changed, 27 insertions(+), 17 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 2fa784eb..b75bce36 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -166,6 +166,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition))); mCommentsAdapter = new CommentsRecyclerViewAdapter(activity, @@ -1176,8 +1179,8 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic mPostAdapter = new PostDetailRecyclerViewAdapter(activity, ViewPostDetailFragment.this, mExecutor, mCustomThemeWrapper, mRetrofit, mOauthRetrofit, mGfycatRetrofit, mRedgifsRetrofit, - mRedditDataRoomDatabase, mGlide, mWindowWidth, mAccessToken, - mAccountName, mPost, mLocale, mSharedPreferences, + mRedditDataRoomDatabase, mGlide, mWindowWidth, mSeparatePostAndComments, + mAccessToken, mAccountName, mPost, mLocale, mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostDetailsSharedPreferences, mExoCreator, post1 -> EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition))); @@ -1725,7 +1728,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic } mSmoothScroller.setTargetPosition(mCommentsRecyclerView == null ? nextParentPosition + 1 : nextParentPosition); mIsSmoothScrolling = true; - ((LinearLayoutManager) (mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).getLayoutManager()).startSmoothScroll(mSmoothScroller); + (mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).getLayoutManager().startSmoothScroll(mSmoothScroller); } } @@ -1738,7 +1741,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic } mSmoothScroller.setTargetPosition(mCommentsRecyclerView == null ? previousParentPosition + 1 : previousParentPosition); mIsSmoothScrolling = true; - ((LinearLayoutManager) (mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).getLayoutManager()).startSmoothScroll(mSmoothScroller); + (mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).getLayoutManager().startSmoothScroll(mSmoothScroller); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f0fba961..76afcacb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -590,8 +590,9 @@ Switch to Landscape Orientation in Video Player Automatically Remember Muting Option in Post Feed Post Details - Separate Post And Comments in Portrait Mode - Separate Post And Comments in Landscape Mode + Separate Post And Comments in Portrait Mode + Separate Post And Comments in Landscape Mode + Video autoplay will be disabled in the post detail page Use Bottom Toolbar in Media Viewer Secure Mode Screenshot and video recording are not allowed. No preview in recent app screen. diff --git a/app/src/main/res/xml-sw600dp/post_details_preferences.xml b/app/src/main/res/xml-sw600dp/post_details_preferences.xml index 1bb6f4c9..0a8cf2c9 100644 --- a/app/src/main/res/xml-sw600dp/post_details_preferences.xml +++ b/app/src/main/res/xml-sw600dp/post_details_preferences.xml @@ -5,12 +5,14 @@ + app:title="@string/settings_separate_post_and_comments_in_portrait_mode_title" + app:summary="@string/settings_separate_post_and_comments_summary" /> + app:title="@string/settings_separate_post_and_comments_in_landscape_mode_title" + app:summary="@string/settings_separate_post_and_comments_summary" /> + app:title="@string/settings_separate_post_and_comments_in_landscape_mode_title" + app:summary="@string/settings_separate_post_and_comments_summary" />