fix(compose-auto-complete): check if the animator is null before doing animations
Fixes #591 #564 #517 #434 #328
This commit is contained in:
@@ -1008,6 +1008,9 @@ public class UiUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void updateList(List<T> oldList, List<T> newList, RecyclerView list, RecyclerView.Adapter<?> adapter, BiPredicate<T, T> areItemsSame) {
|
public static <T> void updateList(List<T> oldList, List<T> newList, RecyclerView list, RecyclerView.Adapter<?> adapter, BiPredicate<T, T> areItemsSame) {
|
||||||
|
RecyclerView.ItemAnimator animator=list.getItemAnimator();
|
||||||
|
if(animator!=null)
|
||||||
|
animator.endAnimations();
|
||||||
// Save topmost item position and offset because for some reason RecyclerView would scroll the list to weird places when you insert items at the top
|
// Save topmost item position and offset because for some reason RecyclerView would scroll the list to weird places when you insert items at the top
|
||||||
int topItem, topItemOffset;
|
int topItem, topItemOffset;
|
||||||
if (list.getChildCount() == 0) {
|
if (list.getChildCount() == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user