Merge pull request #368 from 1552980358/master

Modify code style of package `io.legado.app.base` and `io.legado.app.constant`
pull/370/head
kunfei 4 years ago committed by GitHub
commit 6430673f94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  2. 4
      app/src/main/java/io/legado/app/base/BaseDialogFragment.kt
  3. 8
      app/src/main/java/io/legado/app/base/BaseService.kt
  4. 299
      app/src/main/java/io/legado/app/base/adapter/CommonRecyclerAdapter.kt
  5. 23
      app/src/main/java/io/legado/app/base/adapter/ItemAnimation.kt
  6. 19
      app/src/main/java/io/legado/app/constant/Theme.kt

@ -108,9 +108,7 @@ abstract class BaseActivity(
return true return true
} }
open fun onCompatCreateOptionsMenu(menu: Menu): Boolean { open fun onCompatCreateOptionsMenu(menu: Menu) = super.onCreateOptionsMenu(menu)
return super.onCreateOptionsMenu(menu)
}
final override fun onOptionsItemSelected(item: MenuItem?): Boolean { final override fun onOptionsItemSelected(item: MenuItem?): Boolean {
item?.let { item?.let {
@ -122,9 +120,7 @@ abstract class BaseActivity(
return item != null && onCompatOptionsItemSelected(item) return item != null && onCompatOptionsItemSelected(item)
} }
open fun onCompatOptionsItemSelected(item: MenuItem): Boolean { open fun onCompatOptionsItemSelected(item: MenuItem) = super.onOptionsItemSelected(item)
return super.onOptionsItemSelected(item)
}
private fun initTheme() { private fun initTheme() {
when (theme) { when (theme) {

@ -51,9 +51,7 @@ abstract class BaseDialogFragment : DialogFragment(), CoroutineScope {
scope: CoroutineScope = this, scope: CoroutineScope = this,
context: CoroutineContext = Dispatchers.IO, context: CoroutineContext = Dispatchers.IO,
block: suspend CoroutineScope.() -> T block: suspend CoroutineScope.() -> T
): Coroutine<T> { ) = Coroutine.async(scope, context) { block() }
return Coroutine.async(scope, context) { block() }
}
open fun observeLiveBus() { open fun observeLiveBus() {
} }

@ -16,13 +16,9 @@ abstract class BaseService : Service(), CoroutineScope by MainScope() {
scope: CoroutineScope = this, scope: CoroutineScope = this,
context: CoroutineContext = Dispatchers.IO, context: CoroutineContext = Dispatchers.IO,
block: suspend CoroutineScope.() -> T block: suspend CoroutineScope.() -> T
): Coroutine<T> { ) = Coroutine.async(scope, context) { block() }
return Coroutine.async(scope, context) { block() }
}
override fun onBind(intent: Intent?): IBinder? { override fun onBind(intent: Intent?) = null
return null
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()

@ -10,73 +10,72 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import java.util.* import java.util.*
/** /**
* Created by Invincible on 2017/11/24. * Created by Invincible on 2017/11/24.
* *
* 通用的adapter 可添加headerfooter以及不同类型item * 通用的adapter 可添加headerfooter以及不同类型item
*/ */
abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) : abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context):
RecyclerView.Adapter<ItemViewHolder>() { RecyclerView.Adapter<ItemViewHolder>() {
constructor(context: Context, vararg delegates: ItemViewDelegate<ITEM>) : this(context) { constructor(context: Context, vararg delegates: ItemViewDelegate<ITEM>): this(context) {
addItemViewDelegates(*delegates) addItemViewDelegates(*delegates)
} }
constructor( constructor(
context: Context, context: Context,
vararg delegates: Pair<Int, ItemViewDelegate<ITEM>> vararg delegates: Pair<Int, ItemViewDelegate<ITEM>>
) : this(context) { ): this(context) {
addItemViewDelegates(*delegates) addItemViewDelegates(*delegates)
} }
private val inflater: LayoutInflater = LayoutInflater.from(context) private val inflater: LayoutInflater = LayoutInflater.from(context)
private var headerItems: SparseArray<View>? = null private var headerItems: SparseArray<View>? = null
private var footerItems: SparseArray<View>? = null private var footerItems: SparseArray<View>? = null
private val itemDelegates: HashMap<Int, ItemViewDelegate<ITEM>> = hashMapOf() private val itemDelegates: HashMap<Int, ItemViewDelegate<ITEM>> = hashMapOf()
private val items: MutableList<ITEM> = mutableListOf() private val items: MutableList<ITEM> = mutableListOf()
private val lock = Object() private val lock = Object()
private var itemClickListener: ((holder: ItemViewHolder, item: ITEM) -> Unit)? = null private var itemClickListener: ((holder: ItemViewHolder, item: ITEM) -> Unit)? = null
private var itemLongClickListener: ((holder: ItemViewHolder, item: ITEM) -> Boolean)? = null private var itemLongClickListener: ((holder: ItemViewHolder, item: ITEM) -> Boolean)? = null
private var itemAnimation: ItemAnimation? = null // 这个用Kotlin的setter就行了, 不需要手动开一个函数进行设置
var itemAnimation: ItemAnimation? = null
fun setOnItemClickListener(listener: (holder: ItemViewHolder, item: ITEM) -> Unit) { fun setOnItemClickListener(listener: (holder: ItemViewHolder, item: ITEM) -> Unit) {
itemClickListener = listener itemClickListener = listener
} }
fun setOnItemLongClickListener(listener: (holder: ItemViewHolder, item: ITEM) -> Boolean) { fun setOnItemLongClickListener(listener: (holder: ItemViewHolder, item: ITEM) -> Boolean) {
itemLongClickListener = listener itemLongClickListener = listener
} }
fun bindToRecyclerView(recyclerView: RecyclerView) { fun bindToRecyclerView(recyclerView: RecyclerView) {
recyclerView.adapter = this recyclerView.adapter = this
} }
fun <DELEGATE : ItemViewDelegate<ITEM>> addItemViewDelegate(viewType: Int, delegate: DELEGATE) { fun <DELEGATE: ItemViewDelegate<ITEM>> addItemViewDelegate(viewType: Int, delegate: DELEGATE) {
itemDelegates[viewType] = delegate itemDelegates[viewType] = delegate
} }
fun <DELEGATE : ItemViewDelegate<ITEM>> addItemViewDelegate(delegate: DELEGATE) { fun <DELEGATE: ItemViewDelegate<ITEM>> addItemViewDelegate(delegate: DELEGATE) {
itemDelegates[itemDelegates.size] = delegate itemDelegates[itemDelegates.size] = delegate
} }
fun <DELEGATE : ItemViewDelegate<ITEM>> addItemViewDelegates(vararg delegates: DELEGATE) { fun <DELEGATE: ItemViewDelegate<ITEM>> addItemViewDelegates(vararg delegates: DELEGATE) {
delegates.forEach { delegates.forEach {
addItemViewDelegate(it) addItemViewDelegate(it)
} }
} }
fun addItemViewDelegates(vararg delegates: Pair<Int, ItemViewDelegate<ITEM>>) { fun addItemViewDelegates(vararg delegates: Pair<Int, ItemViewDelegate<ITEM>>) =
delegates.forEach { delegates.forEach {
addItemViewDelegate(it.first, it.second) addItemViewDelegate(it.first, it.second)
} }
}
fun addHeaderView(header: View) { fun addHeaderView(header: View) {
synchronized(lock) { synchronized(lock) {
if (headerItems == null) { if (headerItems == null) {
@ -89,8 +88,8 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
fun addFooterView(footer: View) { fun addFooterView(footer: View) =
synchronized(lock) { synchronized(lock) {
if (footerItems == null) { if (footerItems == null) {
footerItems = SparseArray() footerItems = SparseArray()
@ -101,9 +100,9 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
notifyItemInserted(index) notifyItemInserted(index)
} }
} }
}
fun removeHeaderView(header: View) { fun removeHeaderView(header: View) =
synchronized(lock) { synchronized(lock) {
headerItems?.let { headerItems?.let {
val index = it.indexOfValue(header) val index = it.indexOfValue(header)
@ -113,9 +112,8 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
}
fun removeFooterView(footer: View) =
fun removeFooterView(footer: View) {
synchronized(lock) { synchronized(lock) {
footerItems?.let { footerItems?.let {
val index = it.indexOfValue(footer) val index = it.indexOfValue(footer)
@ -125,8 +123,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
}
fun setItems(items: List<ITEM>?) { fun setItems(items: List<ITEM>?) {
synchronized(lock) { synchronized(lock) {
if (this.items.isNotEmpty()) { if (this.items.isNotEmpty()) {
@ -138,7 +135,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
notifyDataSetChanged() notifyDataSetChanged()
} }
} }
fun setItems(items: List<ITEM>?, diffResult: DiffUtil.DiffResult) { fun setItems(items: List<ITEM>?, diffResult: DiffUtil.DiffResult) {
synchronized(lock) { synchronized(lock) {
if (this.items.isNotEmpty()) { if (this.items.isNotEmpty()) {
@ -150,7 +147,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
diffResult.dispatchUpdatesTo(this) diffResult.dispatchUpdatesTo(this)
} }
} }
fun setItem(position: Int, item: ITEM) { fun setItem(position: Int, item: ITEM) {
synchronized(lock) { synchronized(lock) {
val oldSize = getActualItemCount() val oldSize = getActualItemCount()
@ -160,7 +157,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
fun addItem(item: ITEM) { fun addItem(item: ITEM) {
synchronized(lock) { synchronized(lock) {
val oldSize = getActualItemCount() val oldSize = getActualItemCount()
@ -169,7 +166,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
fun addItems(position: Int, newItems: List<ITEM>) { fun addItems(position: Int, newItems: List<ITEM>) {
synchronized(lock) { synchronized(lock) {
if (this.items.addAll(position, newItems)) { if (this.items.addAll(position, newItems)) {
@ -177,7 +174,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
fun addItems(newItems: List<ITEM>) { fun addItems(newItems: List<ITEM>) {
synchronized(lock) { synchronized(lock) {
val oldSize = getActualItemCount() val oldSize = getActualItemCount()
@ -190,7 +187,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
fun removeItem(position: Int) { fun removeItem(position: Int) {
synchronized(lock) { synchronized(lock) {
if (this.items.removeAt(position) != null) { if (this.items.removeAt(position) != null) {
@ -198,7 +195,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
fun removeItem(item: ITEM) { fun removeItem(item: ITEM) {
synchronized(lock) { synchronized(lock) {
if (this.items.remove(item)) { if (this.items.remove(item)) {
@ -206,7 +203,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
fun removeItems(items: List<ITEM>) { fun removeItems(items: List<ITEM>) {
synchronized(lock) { synchronized(lock) {
if (this.items.removeAll(items)) { if (this.items.removeAll(items)) {
@ -214,7 +211,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
fun swapItem(oldPosition: Int, newPosition: Int) { fun swapItem(oldPosition: Int, newPosition: Int) {
synchronized(lock) { synchronized(lock) {
val size = getActualItemCount() val size = getActualItemCount()
@ -227,8 +224,8 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
fun updateItem(item: ITEM) { fun updateItem(item: ITEM) =
synchronized(lock) { synchronized(lock) {
val index = this.items.indexOf(item) val index = this.items.indexOf(item)
if (index >= 0) { if (index >= 0) {
@ -236,18 +233,16 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
notifyItemChanged(index) notifyItemChanged(index)
} }
} }
}
fun updateItem(position: Int, payload: Any) =
fun updateItem(position: Int, payload: Any) {
synchronized(lock) { synchronized(lock) {
val size = getActualItemCount() val size = getActualItemCount()
if (position in 0 until size) { if (position in 0 until size) {
notifyItemChanged(position + getHeaderCount(), payload) notifyItemChanged(position + getHeaderCount(), payload)
} }
} }
}
fun updateItems(fromPosition: Int, toPosition: Int, payloads: Any) =
fun updateItems(fromPosition: Int, toPosition: Int, payloads: Any) {
synchronized(lock) { synchronized(lock) {
val size = getActualItemCount() val size = getActualItemCount()
if (fromPosition in 0 until size && toPosition in 0 until size) { if (fromPosition in 0 until size && toPosition in 0 until size) {
@ -258,119 +253,94 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
) )
} }
} }
}
fun clearItems() =
fun clearItems() {
synchronized(lock) { synchronized(lock) {
this.items.clear() this.items.clear()
notifyDataSetChanged() notifyDataSetChanged()
} }
}
fun isEmpty() = items.isEmpty()
fun isEmpty(): Boolean {
return items.isEmpty() fun isNotEmpty() = items.isNotEmpty()
}
fun isNotEmpty(): Boolean {
return items.isNotEmpty()
}
/** /**
* 除去header和footer * 除去header和footer
*/ */
fun getActualItemCount(): Int { fun getActualItemCount() = items.size
return items.size
}
fun getHeaderCount() = headerItems?.size() ?: 0
fun getHeaderCount(): Int {
return headerItems?.size() ?: 0
} fun getFooterCount() = footerItems?.size() ?: 0
fun getFooterCount(): Int {
return footerItems?.size() ?: 0
}
fun getItem(position: Int): ITEM? = items.getOrNull(position) fun getItem(position: Int): ITEM? = items.getOrNull(position)
fun getItemByLayoutPosition(position: Int): ITEM? { fun getItemByLayoutPosition(position: Int) = items.getOrNull(position - getHeaderCount())
val pos = position - getHeaderCount()
return items.getOrNull(pos)
}
fun getItems(): List<ITEM> = items fun getItems(): List<ITEM> = items
protected open fun getItemViewType(item: ITEM, position: Int): Int { protected open fun getItemViewType(item: ITEM, position: Int) = 0
return 0
}
/** /**
* grid 模式下使用 * grid 模式下使用
*/ */
protected open fun getSpanSize(item: ITEM, viewType: Int, position: Int): Int { protected open fun getSpanSize(item: ITEM, viewType: Int, position: Int) = 1
return 1
} final override fun getItemCount() = getActualItemCount() + getHeaderCount() + getFooterCount()
final override fun getItemCount(): Int { final override fun getItemViewType(position: Int) = when {
return getActualItemCount() + getHeaderCount() + getFooterCount() isHeader(position) -> TYPE_HEADER_VIEW + position
} isFooter(position) -> TYPE_FOOTER_VIEW + position - getActualItemCount() - getHeaderCount()
else -> getItem(getActualPosition(position))?.let {
final override fun getItemViewType(position: Int): Int { getItemViewType(it, getActualPosition(position))
return when { } ?: 0
isHeader(position) -> TYPE_HEADER_VIEW + position }
isFooter(position) -> TYPE_FOOTER_VIEW + position - getActualItemCount() - getHeaderCount()
else -> getItem(getActualPosition(position))?.let { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = when {
getItemViewType(it, getActualPosition(position)) viewType < TYPE_HEADER_VIEW + getHeaderCount() -> {
} ?: 0 ItemViewHolder(headerItems!!.get(viewType))
} }
}
viewType >= TYPE_FOOTER_VIEW -> {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder { ItemViewHolder(footerItems!!.get(viewType))
return when { }
viewType < TYPE_HEADER_VIEW + getHeaderCount() -> {
ItemViewHolder(headerItems!!.get(viewType)) else -> {
} val holder = ItemViewHolder(
inflater.inflate(
viewType >= TYPE_FOOTER_VIEW -> { itemDelegates.getValue(viewType).layoutId,
ItemViewHolder(footerItems!!.get(viewType)) parent,
} false
else -> {
val holder = ItemViewHolder(
inflater.inflate(
itemDelegates.getValue(viewType).layoutId,
parent,
false
)
) )
)
itemDelegates.getValue(viewType)
.registerListener(holder) itemDelegates.getValue(viewType)
.registerListener(holder)
if (itemClickListener != null) {
holder.itemView.setOnClickListener { if (itemClickListener != null) {
getItem(holder.layoutPosition)?.let { holder.itemView.setOnClickListener {
itemClickListener?.invoke(holder, it) getItem(holder.layoutPosition)?.let {
} itemClickListener?.invoke(holder, it)
} }
} }
}
if (itemLongClickListener != null) {
holder.itemView.setOnLongClickListener { if (itemLongClickListener != null) {
getItem(holder.layoutPosition)?.let { holder.itemView.setOnLongClickListener {
itemLongClickListener?.invoke(holder, it) ?: true getItem(holder.layoutPosition)?.let {
} ?: true itemLongClickListener?.invoke(holder, it) ?: true
} } ?: true
} }
holder
} }
holder
} }
} }
final override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {}
final override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
}
final override fun onBindViewHolder( final override fun onBindViewHolder(
holder: ItemViewHolder, holder: ItemViewHolder,
position: Int, position: Int,
@ -383,19 +353,19 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
override fun onViewAttachedToWindow(holder: ItemViewHolder) { override fun onViewAttachedToWindow(holder: ItemViewHolder) {
super.onViewAttachedToWindow(holder) super.onViewAttachedToWindow(holder)
if (!isHeader(holder.layoutPosition) && !isFooter(holder.layoutPosition)) { if (!isHeader(holder.layoutPosition) && !isFooter(holder.layoutPosition)) {
addAnimation(holder) addAnimation(holder)
} }
} }
override fun onAttachedToRecyclerView(recyclerView: RecyclerView) { override fun onAttachedToRecyclerView(recyclerView: RecyclerView) {
super.onAttachedToRecyclerView(recyclerView) super.onAttachedToRecyclerView(recyclerView)
val manager = recyclerView.layoutManager val manager = recyclerView.layoutManager
if (manager is GridLayoutManager) { if (manager is GridLayoutManager) {
manager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { manager.spanSizeLookup = object: GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int { override fun getSpanSize(position: Int): Int {
return getItem(position)?.let { return getItem(position)?.let {
if (isHeader(position) || isFooter(position)) manager.spanCount else getSpanSize( if (isHeader(position) || isFooter(position)) manager.spanCount else getSpanSize(
@ -406,23 +376,13 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
fun setItemAnimation(item: ItemAnimation) { private fun isHeader(position: Int) = position < getHeaderCount()
itemAnimation = item
} private fun isFooter(position: Int) = position >= getActualItemCount() + getHeaderCount()
private fun isHeader(position: Int): Boolean { private fun getActualPosition(position: Int) = position - getHeaderCount()
return position < getHeaderCount()
}
private fun isFooter(position: Int): Boolean {
return position >= getActualItemCount() + getHeaderCount()
}
private fun getActualPosition(position: Int): Int {
return position - getHeaderCount()
}
private fun addAnimation(holder: ItemViewHolder) { private fun addAnimation(holder: ItemViewHolder) {
itemAnimation?.let { itemAnimation?.let {
if (it.itemAnimEnabled) { if (it.itemAnimEnabled) {
@ -433,8 +393,7 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
protected open fun startAnimation(holder: ItemViewHolder, item: ItemAnimation) { protected open fun startAnimation(holder: ItemViewHolder, item: ItemAnimation) {
item.itemAnimation?.let { item.itemAnimation?.let {
for (anim in it.getAnimators(holder.itemView)) { for (anim in it.getAnimators(holder.itemView)) {
@ -443,12 +402,12 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
} }
} }
} }
companion object { companion object {
private const val TYPE_HEADER_VIEW = Int.MIN_VALUE private const val TYPE_HEADER_VIEW = Int.MIN_VALUE
private const val TYPE_FOOTER_VIEW = Int.MAX_VALUE - 999 private const val TYPE_FOOTER_VIEW = Int.MAX_VALUE - 999
} }
} }

@ -16,22 +16,19 @@ class ItemAnimation private constructor() {
var itemAnimDuration: Long = 300L var itemAnimDuration: Long = 300L
var itemAnimStartPosition: Int = -1 var itemAnimStartPosition: Int = -1
fun interpolator(interpolator: Interpolator): ItemAnimation { fun interpolator(interpolator: Interpolator) = apply {
itemAnimInterpolator = interpolator itemAnimInterpolator = interpolator
return this
} }
fun duration(duration: Long): ItemAnimation { fun duration(duration: Long) = apply {
itemAnimDuration = duration itemAnimDuration = duration
return this
} }
fun startPostion(startPos: Int): ItemAnimation { fun startPosition(startPos: Int) = apply {
itemAnimStartPosition = startPos itemAnimStartPosition = startPos
return this
} }
fun animation(animationType: Int = NONE, animation: BaseAnimation? = null): ItemAnimation { fun animation(animationType: Int = NONE, animation: BaseAnimation? = null) = apply {
if (animation != null) { if (animation != null) {
itemAnimation = animation itemAnimation = animation
} else { } else {
@ -43,17 +40,14 @@ class ItemAnimation private constructor() {
RIGHT_SLIDE_IN -> itemAnimation = SlideInRightAnimation() RIGHT_SLIDE_IN -> itemAnimation = SlideInRightAnimation()
} }
} }
return this
} }
fun enabled(enabled: Boolean): ItemAnimation { fun enabled(enabled: Boolean) = apply {
itemAnimEnabled = enabled itemAnimEnabled = enabled
return this
} }
fun firstOnly(firstOnly: Boolean): ItemAnimation { fun firstOnly(firstOnly: Boolean) = apply {
itemAnimFirstOnly = firstOnly itemAnimFirstOnly = firstOnly
return this
} }
companion object { companion object {
@ -79,8 +73,7 @@ class ItemAnimation private constructor() {
*/ */
const val RIGHT_SLIDE_IN: Int = 0x00000005 const val RIGHT_SLIDE_IN: Int = 0x00000005
fun create(): ItemAnimation { fun create() = ItemAnimation()
return ItemAnimation()
}
} }
} }

@ -7,18 +7,13 @@ enum class Theme {
Dark, Light, Auto, Transparent; Dark, Light, Auto, Transparent;
companion object { companion object {
fun getTheme(): Theme { fun getTheme() =
return if (AppConfig.isNightTheme) { if (AppConfig.isNightTheme) Dark
Dark else Light
} else Light
}
fun getTheme(backgroundColor: Int): Theme { fun getTheme(backgroundColor: Int) =
return if (ColorUtils.isColorLight(backgroundColor)) { if (ColorUtils.isColorLight(backgroundColor)) Light
Light else Dark
} else {
Dark
}
}
} }
} }
Loading…
Cancel
Save