– capitalize and stylize comments
– fix history items duplication
– fix refresh glitching after removing multiple history items
upstream-sync
mike a 2 years ago committed by mergify[bot]
parent ebf4ce2fe7
commit 8ca01de0fa

@ -19,7 +19,7 @@ class HistoryDataSource(
override fun getRefreshKey(state: PagingState<Int, History>): Int? = null
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, History> {
// Get the offset of the last loaded page or default to 0 when it is null, on the initial
// Get the offset of the last loaded page or default to 0 when it is null on the initial
// load or a refresh.
val offset = params.key ?: 0
val historyItems = historyProvider.getHistory(offset, params.loadSize).run {
@ -28,7 +28,7 @@ class HistoryDataSource(
val nextOffset = if (historyItems.isEmpty()) {
null
} else {
(offset + historyItems.size) + 1
historyItems.last().position + 1
}
return LoadResult.Page(
data = historyItems,

@ -35,13 +35,12 @@ class HistoryView(
val historyAdapter = HistoryAdapter(interactor).apply {
addLoadStateListener {
// first call will always have itemCount == 0, but we want to keep adapterItemCount
// First call will always have itemCount == 0, but we want to keep adapterItemCount
// as null until we can distinguish an empty list from populated, so updateEmptyState()
// could work correctly
if (itemCount != 0) {
// could work correctly.
if (itemCount > 0) {
adapterItemCount = itemCount
}
if (it.source.refresh is LoadState.NotLoading &&
} else if (it.source.refresh is LoadState.NotLoading &&
it.append.endOfPaginationReached &&
itemCount < 1
) {

@ -25,7 +25,7 @@
layout="@layout/recently_closed_nav_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/progress_bar" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/history_empty_view"

Loading…
Cancel
Save