Skip to content

Commit 4ed8d24

Browse files
committed
fix: reduce crash on flexboxlayout changing on candidates update
Ref: google/flexbox-layout#363 (comment)
1 parent 083d519 commit 4ed8d24

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/src/main/java/com/osfans/trime/ime/candidates/popup/PagedCandidatesUi.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ class PagedCandidatesUi(
6262
}
6363
}
6464
}
65+
}.apply {
66+
// We must do this to avoid ArrayIndexOutOfBoundsException
67+
// https://github.com/google/flexbox-layout/issues/363#issuecomment-382949953
68+
setHasStableIds(true)
6569
}
6670

6771
private val candidatesLayoutManager =
@@ -75,6 +79,7 @@ class PagedCandidatesUi(
7579
recyclerView {
7680
visibility = View.GONE
7781

82+
itemAnimator = null
7883
isFocusable = false
7984
adapter = candidatesAdapter
8085
layoutManager = candidatesLayoutManager

0 commit comments

Comments
 (0)