1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-01-30 08:25:01 +01:00
This commit is contained in:
Mariotaku Lee 2016-02-10 10:04:15 +08:00
parent 038f16cbc8
commit aee2e0d049
2 changed files with 8 additions and 4 deletions

View File

@ -259,9 +259,9 @@ public abstract class AbsActivitiesFragment<Data> extends AbsContentListRecycler
} else {
lastVisiblePos = layoutManager.findFirstVisibleItemPosition();
}
final int activityStartIndex = adapter.getActivityStartIndex();
final int activityEndIndex = activityStartIndex + adapter.getActivityCount();
if (lastVisiblePos != RecyclerView.NO_POSITION && lastVisiblePos < adapter.getItemCount()) {
final int activityStartIndex = adapter.getActivityStartIndex();
final int activityEndIndex = activityStartIndex + adapter.getActivityCount();
final int lastItemIndex = Math.min(activityEndIndex, lastVisiblePos);
lastReadId = adapter.getTimestamp(lastItemIndex);
final View positionView = layoutManager.findViewByPosition(lastItemIndex);
@ -275,6 +275,8 @@ public abstract class AbsActivitiesFragment<Data> extends AbsContentListRecycler
}
adapter.setData(data);
setRefreshEnabled(true);
final int activityStartIndex = adapter.getActivityStartIndex();
final int activityEndIndex = activityStartIndex + adapter.getActivityCount();
if (!(loader instanceof IExtendedLoader) || ((IExtendedLoader) loader).isFromUser()) {
adapter.setLoadMoreSupportedPosition(hasMoreData(data) ? IndicatorPosition.END : IndicatorPosition.NONE);
int pos = -1;

View File

@ -269,9 +269,9 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentListRecyclerVi
} else {
lastVisiblePos = layoutManager.findFirstVisibleItemPosition();
}
final int statusStartIndex = adapter.getStatusStartIndex();
final int statusEndIndex = statusStartIndex + adapter.getStatusCount();
if (lastVisiblePos != RecyclerView.NO_POSITION && lastVisiblePos < adapter.getItemCount()) {
final int statusStartIndex = adapter.getStatusStartIndex();
final int statusEndIndex = statusStartIndex + adapter.getStatusCount();
final int lastItemIndex = Math.min(statusEndIndex, lastVisiblePos);
lastReadId = adapter.getStatusId(lastItemIndex);
final View positionView = layoutManager.findViewByPosition(lastItemIndex);
@ -285,6 +285,8 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentListRecyclerVi
}
adapter.setData(data);
setRefreshEnabled(true);
final int statusStartIndex = adapter.getStatusStartIndex();
final int statusEndIndex = statusStartIndex + adapter.getStatusCount();
if (!(loader instanceof IExtendedLoader) || ((IExtendedLoader) loader).isFromUser()) {
adapter.setLoadMoreSupportedPosition(hasMoreData(data) ? IndicatorPosition.END : IndicatorPosition.NONE);
int pos = -1;