mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-30 19:34:45 +01:00
Long press the fab in ViewPostDetailActivity to go to the previous parent comment. Fix bugs in scrollToNextParentComment() and scrollToPreviousParentComment() in ViewPostDetailFragment.
This commit is contained in:
parent
6e4a808cbb
commit
7b1221bfc9
@ -209,6 +209,17 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fab.setOnLongClickListener(view -> {
|
||||||
|
if (sectionsPagerAdapter != null) {
|
||||||
|
ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment();
|
||||||
|
if (fragment != null) {
|
||||||
|
fragment.scrollToPreviousParentComment();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
checkNewAccountAndBindView(savedInstanceState);
|
checkNewAccountAndBindView(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1660,7 +1660,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
if (mLinearLayoutManager != null) {
|
if (mLinearLayoutManager != null) {
|
||||||
int currentPosition = mLinearLayoutManager.findFirstVisibleItemPosition();
|
int currentPosition = mLinearLayoutManager.findFirstVisibleItemPosition();
|
||||||
if (mCommentsAdapter != null) {
|
if (mCommentsAdapter != null) {
|
||||||
int nextParentPosition = mCommentsAdapter.getNextParentCommentPosition(currentPosition);
|
int nextParentPosition = mCommentsAdapter.getNextParentCommentPosition(mCommentsRecyclerView == null ? currentPosition - 1 : currentPosition);
|
||||||
if (nextParentPosition < 0) {
|
if (nextParentPosition < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1677,11 +1677,11 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
if (mLinearLayoutManager != null) {
|
if (mLinearLayoutManager != null) {
|
||||||
int currentPosition = mLinearLayoutManager.findFirstVisibleItemPosition();
|
int currentPosition = mLinearLayoutManager.findFirstVisibleItemPosition();
|
||||||
if (mCommentsAdapter != null) {
|
if (mCommentsAdapter != null) {
|
||||||
int nextParentPosition = mCommentsAdapter.getPreviousParentCommentPosition(currentPosition);
|
int previousParentPosition = mCommentsAdapter.getPreviousParentCommentPosition(mCommentsRecyclerView == null ? currentPosition - 1 : currentPosition);
|
||||||
if (nextParentPosition < 0) {
|
if (previousParentPosition < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mSmoothScroller.setTargetPosition(mCommentsRecyclerView == null ? nextParentPosition + 1 : nextParentPosition);
|
mSmoothScroller.setTargetPosition(mCommentsRecyclerView == null ? previousParentPosition + 1 : previousParentPosition);
|
||||||
if (mLinearLayoutManager != null) {
|
if (mLinearLayoutManager != null) {
|
||||||
mIsSmoothScrolling = true;
|
mIsSmoothScrolling = true;
|
||||||
mLinearLayoutManager.startSmoothScroll(mSmoothScroller);
|
mLinearLayoutManager.startSmoothScroll(mSmoothScroller);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user