Skip to content

Commit b0eea1d

Browse files
committed
fix: unrolled candidates size was still limited to about 144
4e7247c reverts the last fix about this, my bad.
1 parent 4e7247c commit b0eea1d

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

app/src/main/java/com/osfans/trime/ime/candidates/unrolled/CandidatesPagingSource.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import com.osfans.trime.core.CandidateItem
1010
import com.osfans.trime.daemon.RimeSession
1111
import timber.log.Timber
1212

13-
class CandidatesPagingSource(val rime: RimeSession, val total: Int, val offset: Int) :
13+
class CandidatesPagingSource(val rime: RimeSession, val offset: Int) :
1414
PagingSource<Int, CandidateItem>() {
1515
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, CandidateItem> {
1616
// use candidate index for key, null means load from beginning (including offset)
@@ -22,12 +22,7 @@ class CandidatesPagingSource(val rime: RimeSession, val total: Int, val offset:
2222
getCandidates(startIndex, pageSize)
2323
}
2424
val prevKey = if (startIndex >= pageSize) startIndex - pageSize else null
25-
val nextKey =
26-
if (total > 0) {
27-
if (startIndex + pageSize + 1 >= total) null else startIndex + pageSize
28-
} else {
29-
if (candidates.size < pageSize) null else startIndex + pageSize
30-
}
25+
val nextKey = if (candidates.size < pageSize) null else startIndex + pageSize
3126
return LoadResult.Page(candidates.toList(), prevKey, nextKey)
3227
}
3328

app/src/main/java/com/osfans/trime/ime/candidates/unrolled/window/BaseUnrolledCandidateWindow.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ abstract class BaseUnrolledCandidateWindow(
8282
Pager(PagingConfig(pageSize = 48)) {
8383
CandidatesPagingSource(
8484
rime,
85-
total = compactCandidate.adapter.run { before + itemCount },
8685
offset = adapter.offset,
8786
)
8887
}

0 commit comments

Comments
 (0)