diff options
Diffstat (limited to 'app/src/main/java/ml')
2 files changed, 18 insertions, 12 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<Recycler private boolean mHideSubredditAndUserPrefix; private boolean mHideTheNumberOfVotes; private boolean mHideTheNumberOfComments; + private boolean mSeparatePostAndComments; private PostDetailRecyclerViewAdapterCallback mPostDetailRecyclerViewAdapterCallback; private int mColorAccent; @@ -203,7 +204,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler Executor executor, CustomThemeWrapper customThemeWrapper, Retrofit retrofit, Retrofit oauthRetrofit, Retrofit gfycatRetrofit, Retrofit redgifsRetrofit, RedditDataRoomDatabase redditDataRoomDatabase, - RequestManager glide, int imageViewWidth, String accessToken, + RequestManager glide, int imageViewWidth, + boolean separatePostAndComments, String accessToken, String accountName, Post post, Locale locale, SharedPreferences sharedPreferences, SharedPreferences nsfwAndSpoilerSharedPreferences, @@ -335,6 +337,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler .textLayoutIsRoot(R.layout.view_table_entry_cell))) .build(); mImageViewWidth = imageViewWidth; + mSeparatePostAndComments = separatePostAndComments; mAccessToken = accessToken; mAccountName = accountName; mPost = post; @@ -424,7 +427,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler public int getItemViewType(int position) { switch (mPost.getPostType()) { case Post.VIDEO_TYPE: - if (mAutoplay) { + if (mAutoplay && !mSeparatePostAndComments) { if (!mAutoplayNsfwVideos && mPost.isNSFW()) { return VIEW_TYPE_POST_DETAIL_VIDEO_AND_GIF_PREVIEW; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java index 1a97ab9f..27fa301f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java @@ -1,5 +1,10 @@ package ml.docilealligator.infinityforreddit.fragments; +import static im.ene.toro.media.PlaybackInfo.INDEX_UNSET; +import static im.ene.toro.media.PlaybackInfo.TIME_UNSET; +import static ml.docilealligator.infinityforreddit.activities.CommentActivity.RETURN_EXTRA_COMMENT_DATA_KEY; +import static ml.docilealligator.infinityforreddit.activities.CommentActivity.WRITE_COMMENT_REQUEST_CODE; + import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; @@ -111,11 +116,6 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -import static im.ene.toro.media.PlaybackInfo.INDEX_UNSET; -import static im.ene.toro.media.PlaybackInfo.TIME_UNSET; -import static ml.docilealligator.infinityforreddit.activities.CommentActivity.RETURN_EXTRA_COMMENT_DATA_KEY; -import static ml.docilealligator.infinityforreddit.activities.CommentActivity.WRITE_COMMENT_REQUEST_CODE; - public class ViewPostDetailFragment extends Fragment implements FragmentCommunicator { public static final String EXTRA_POST_DATA = "EPD"; @@ -218,6 +218,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic private boolean mLockFab; private boolean mSwipeUpToHideFab; private boolean mExpandChildren; + private boolean mSeparatePostAndComments = false; private int mWindowWidth; private ConcatAdapter mConcatAdapter; private PostDetailRecyclerViewAdapter mPostAdapter; @@ -272,6 +273,8 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic mCommentsRecyclerView.setVisibility(View.GONE); mCommentsRecyclerView = null; } + } else { + mSeparatePostAndComments = true; } if (activity != null && activity.isImmersiveInterface()) { @@ -541,7 +544,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic mPostAdapter = new PostDetailRecyclerViewAdapter(activity, this, mExecutor, mCustomThemeWrapper, mRetrofit, mOauthRetrofit, mGfycatRetrofit, mRedgifsRetrofit, mRedditDataRoomDatabase, mGlide, - mWindowWidth, mAccessToken, mAccountName, mPost, mLocale, + mWindowWidth, mSeparatePostAndComments, mAccessToken, mAccountName, mPost, mLocale, mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostDetailsSharedPreferences, mExoCreator, post -> 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); } } |