提交 6d511a68 编写于 作者: limuyang2's avatar limuyang2

clean file

上级 b94b403a
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
consumerProguardFiles 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compileOnly 'com.android.support:recyclerview-v7:28.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0-RC'
implementation project(path: ':library')
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# ServiceLoader support
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}
# Most of volatile fields are updated with AFU and should not be mangled
-keepclassmembernames class kotlinx.** {
volatile <fields>;
}
\ No newline at end of file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.chinakingo.brvahktx" />
package com.chinakingo.brvahktx
import android.support.v7.util.DiffUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chad.library.adapter.base.diff.BaseQuickDiffCallback
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
/**
* author : limuyang
* e-mail : limuyang2@163.com
* date : 2019/07/28
* desc : About the kotlin extension of the adapter
*/
/**
* this is kotlin Expansion, quick use async diff
* @receiver BaseQuickAdapter<T, K>
* @param baseQuickDiffCallback BaseQuickDiffCallback<T>
* @param detectMoves Boolean
*/
suspend inline fun <T, K : BaseViewHolder> BaseQuickAdapter<T, K>.setNewDiffDataAsync(baseQuickDiffCallback: BaseQuickDiffCallback<T>, detectMoves: Boolean) {
baseQuickDiffCallback.oldList = this.data
val diffResult = withContext(Dispatchers.IO) {
DiffUtil.calculateDiff(baseQuickDiffCallback, detectMoves)
}
this.setNewDiffData(diffResult, baseQuickDiffCallback.newList)
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册