diff --git a/app/build.gradle b/app/build.gradle index 4e0c1d5..b325802 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -59,7 +59,7 @@ dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.4.2' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.4.3' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.core:core-ktx:1.9.0' //Google官方授权框架 diff --git a/app/build.gradle b/app/build.gradle index 4e0c1d5..b325802 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -59,7 +59,7 @@ dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.4.2' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.4.3' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.core:core-ktx:1.9.0' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/smart/town/sanxi/adapter/ExpandableViewAdapter.kt b/app/src/main/java/com/casic/smart/town/sanxi/adapter/ExpandableViewAdapter.kt index 759647c..04f5d05 100644 --- a/app/src/main/java/com/casic/smart/town/sanxi/adapter/ExpandableViewAdapter.kt +++ b/app/src/main/java/com/casic/smart/town/sanxi/adapter/ExpandableViewAdapter.kt @@ -1,6 +1,5 @@ package com.casic.smart.town.sanxi.adapter -import android.annotation.SuppressLint import android.content.Context import android.view.LayoutInflater import android.view.View @@ -11,7 +10,6 @@ import com.casic.smart.town.sanxi.model.ExpandableDataModel import com.pengxh.kt.lite.extensions.convertColor -@SuppressLint("NotifyDataSetChanged") class ExpandableViewAdapter(private val context: Context) : RecyclerView.Adapter() { @@ -20,13 +18,14 @@ fun setExpandableData(dataSet: MutableList) { this.dataRows = dataSet - notifyDataSetChanged() + notifyItemRangeChanged(0, dataSet.size) } fun clearAll() { - if (dataRows.size != 0) { + val size = dataRows.size + if (size != 0) { dataRows.clear() - notifyDataSetChanged() + notifyItemRangeRemoved(0, size) } }