From e66f6a8a3f9845c18121866fea6dad312891abe8 Mon Sep 17 00:00:00 2001 From: ztiany Date: Tue, 24 Sep 2019 00:28:52 +0800 Subject: [PATCH] add rxEx --- .../utils/android/views/RecyclerVIewEx.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib_base/src/main/java/com/android/base/utils/android/views/RecyclerVIewEx.kt diff --git a/lib_base/src/main/java/com/android/base/utils/android/views/RecyclerVIewEx.kt b/lib_base/src/main/java/com/android/base/utils/android/views/RecyclerVIewEx.kt new file mode 100644 index 0000000..a5495f9 --- /dev/null +++ b/lib_base/src/main/java/com/android/base/utils/android/views/RecyclerVIewEx.kt @@ -0,0 +1,19 @@ +package com.android.base.utils.android.views + +import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.SimpleItemAnimator + +/** + * 关闭默认局部刷新动画,对性能要求高的地方试用,比如一些公屏等刷新频繁的 + */ +fun RecyclerView.closeDefaultAnimator() { + itemAnimator?.let { + it.addDuration = 0 + it.changeDuration = 0 + it.moveDuration = 0 + it.removeDuration = 0 + if (it is SimpleItemAnimator) { + it.supportsChangeAnimations = false + } + } +} \ No newline at end of file