mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Merge pull request #538 from scria1000/single-scroll-fix
Make scroll button work on single comment mode
This commit is contained in:
commit
32150165d4
@ -66,6 +66,7 @@ import butterknife.ButterKnife;
|
|||||||
import im.ene.toro.exoplayer.ExoCreator;
|
import im.ene.toro.exoplayer.ExoCreator;
|
||||||
import im.ene.toro.media.PlaybackInfo;
|
import im.ene.toro.media.PlaybackInfo;
|
||||||
import im.ene.toro.media.VolumeInfo;
|
import im.ene.toro.media.VolumeInfo;
|
||||||
|
import im.ene.toro.widget.Container;
|
||||||
import ml.docilealligator.infinityforreddit.DeleteThing;
|
import ml.docilealligator.infinityforreddit.DeleteThing;
|
||||||
import ml.docilealligator.infinityforreddit.Flair;
|
import ml.docilealligator.infinityforreddit.Flair;
|
||||||
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
|
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
|
||||||
@ -1730,28 +1731,32 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void scrollToNextParentComment() {
|
public void scrollToNextParentComment() {
|
||||||
int currentPosition = ((LinearLayoutManagerBugFixed) (mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).getLayoutManager()).findFirstVisibleItemPosition();
|
RecyclerView chooseYourView = mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView;
|
||||||
if (mCommentsAdapter != null) {
|
if (mCommentsAdapter != null && chooseYourView != null) {
|
||||||
int nextParentPosition = mCommentsAdapter.getNextParentCommentPosition(mCommentsRecyclerView == null ? currentPosition - 1 : currentPosition);
|
int currentPosition = ((LinearLayoutManagerBugFixed) chooseYourView.getLayoutManager()).findFirstVisibleItemPosition();
|
||||||
|
//int nextParentPosition = mCommentsAdapter.getNextParentCommentPosition(mCommentsRecyclerView == null ? currentPosition - 1 : currentPosition);
|
||||||
|
int nextParentPosition = mCommentsAdapter.getNextParentCommentPosition(mCommentsRecyclerView == null && !isSingleCommentThreadMode ? currentPosition - 1 : currentPosition);
|
||||||
if (nextParentPosition < 0) {
|
if (nextParentPosition < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mSmoothScroller.setTargetPosition(mCommentsRecyclerView == null ? nextParentPosition + 1 : nextParentPosition);
|
mSmoothScroller.setTargetPosition(mCommentsRecyclerView == null && !isSingleCommentThreadMode ? nextParentPosition + 1 : nextParentPosition);
|
||||||
mIsSmoothScrolling = true;
|
mIsSmoothScrolling = true;
|
||||||
(mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).getLayoutManager().startSmoothScroll(mSmoothScroller);
|
chooseYourView.getLayoutManager().startSmoothScroll(mSmoothScroller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scrollToPreviousParentComment() {
|
public void scrollToPreviousParentComment() {
|
||||||
int currentPosition = ((LinearLayoutManagerBugFixed) (mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).getLayoutManager()).findFirstVisibleItemPosition();
|
RecyclerView chooseYourView = mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView;
|
||||||
if (mCommentsAdapter != null) {
|
if (mCommentsAdapter != null && chooseYourView != null) {
|
||||||
int previousParentPosition = mCommentsAdapter.getPreviousParentCommentPosition(mCommentsRecyclerView == null ? currentPosition - 1 : currentPosition);
|
int currentPosition = ((LinearLayoutManagerBugFixed) chooseYourView.getLayoutManager()).findFirstVisibleItemPosition();
|
||||||
|
//int previousParentPosition = mCommentsAdapter.getPreviousParentCommentPosition(mCommentsRecyclerView == null ? currentPosition - 1 : currentPosition);
|
||||||
|
int previousParentPosition = mCommentsAdapter.getPreviousParentCommentPosition(mCommentsRecyclerView == null && !isSingleCommentThreadMode ? currentPosition - 1 : currentPosition);
|
||||||
if (previousParentPosition < 0) {
|
if (previousParentPosition < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mSmoothScroller.setTargetPosition(mCommentsRecyclerView == null ? previousParentPosition + 1 : previousParentPosition);
|
mSmoothScroller.setTargetPosition(mCommentsRecyclerView == null && !isSingleCommentThreadMode ? previousParentPosition + 1 : previousParentPosition);
|
||||||
mIsSmoothScrolling = true;
|
mIsSmoothScrolling = true;
|
||||||
(mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).getLayoutManager().startSmoothScroll(mSmoothScroller);
|
chooseYourView.getLayoutManager().startSmoothScroll(mSmoothScroller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user