mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2024-12-28 17:31:33 +01:00
improved mark as read
This commit is contained in:
parent
d88e4902c3
commit
50a106474c
@ -78,7 +78,8 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentRecyclerViewFr
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
saveReadPosition();
|
||||
final LinearLayoutManager layoutManager = getLayoutManager();
|
||||
saveReadPosition(layoutManager.findFirstVisibleItemPosition());
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -344,7 +345,7 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentRecyclerViewFr
|
||||
public final boolean scrollToStart() {
|
||||
final boolean result = super.scrollToStart();
|
||||
if (result) {
|
||||
saveReadPosition();
|
||||
saveReadPosition(0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -393,11 +394,9 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentRecyclerViewFr
|
||||
|
||||
protected abstract void onLoadingFinished();
|
||||
|
||||
protected void saveReadPosition() {
|
||||
protected void saveReadPosition(int position) {
|
||||
final String readPositionTag = getReadPositionTagWithAccounts();
|
||||
if (readPositionTag == null) return;
|
||||
final LinearLayoutManager layoutManager = getLayoutManager();
|
||||
final int position = layoutManager.findFirstVisibleItemPosition();
|
||||
if (position == RecyclerView.NO_POSITION) return;
|
||||
final AbsStatusesAdapter<Data> adapter = getAdapter();
|
||||
final ParcelableStatus status = adapter.getStatus(position);
|
||||
|
Loading…
Reference in New Issue
Block a user