日期等选择器使用
This commit is contained in:
@@ -68,7 +68,7 @@ dependencies {
|
||||
api rootProject.ext.dependencies["statusbaruitl"]
|
||||
api rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
|
||||
api rootProject.ext.dependencies["PhotoPicker"]
|
||||
api rootProject.ext.dependencies["PickerView"]
|
||||
// api rootProject.ext.dependencies["PickerView"]
|
||||
api rootProject.ext.dependencies["Xpopup"]
|
||||
api rootProject.ext.dependencies["Countdownview"]
|
||||
api rootProject.ext.dependencies["CheckVersionLib"]
|
||||
@@ -80,6 +80,8 @@ dependencies {
|
||||
api rootProject.ext.dependencies["MagicIndicator"]
|
||||
api rootProject.ext.dependencies["glide-okhttps"]
|
||||
api rootProject.ext.dependencies["Permissionx"]
|
||||
api rootProject.ext.dependencies["WheelPicker"]
|
||||
api rootProject.ext.dependencies["AddressPicker"]
|
||||
api 'pub.devrel:easypermissions:3.0.0'
|
||||
api 'io.github.lucksiege:compress:v3.11.2'
|
||||
// api 'com.gyf.cactus:cactus:1.1.3-beta13'
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.dahe.mylibrary.base
|
||||
|
||||
import android.content.Context
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
/**
|
||||
* @ClassName SingletonHolder
|
||||
* @Author john
|
||||
* @Date 2024/2/5 15:35
|
||||
* @Description TODO
|
||||
*/
|
||||
open class SingletonHolder<out T, in A>(creator: (A) -> T) {
|
||||
|
||||
private var creator: ((A) -> T)? = creator
|
||||
|
||||
@Volatile
|
||||
private var instance: T? = null
|
||||
|
||||
//对上述方法的一种更简洁的写法
|
||||
fun getInstance(arg: A): T =
|
||||
instance ?: synchronized(this) {
|
||||
instance ?: creator!!(arg).apply {
|
||||
instance = this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class SingletonNoPHolder<out T>(creator: () -> T) {
|
||||
|
||||
private var creator: (() -> T)? = creator
|
||||
|
||||
@Volatile
|
||||
private var instance: T? = null
|
||||
|
||||
//对上述方法的一种更简洁的写法
|
||||
fun getInstance(): T =
|
||||
instance ?: synchronized(this) {
|
||||
instance ?: creator!!().apply {
|
||||
instance = this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//使用
|
||||
//class SkinManager private constructor(context: Context) {
|
||||
// companion object : SingletonHolder<SkinManager, Context>(::SkinManager)
|
||||
//}
|
||||
Reference in New Issue
Block a user