mirror of
https://github.com/Hamza417/Inure.git
synced 2025-05-17 02:55:57 +08:00
fix: app crashing after enabling hidden apps
This commit is contained in:
@ -18,6 +18,7 @@ import app.simple.inure.preferences.AccessibilityPreferences
|
||||
import app.simple.inure.preferences.DevelopmentPreferences
|
||||
import app.simple.inure.preferences.HomePreferences
|
||||
import app.simple.inure.preferences.TrialPreferences
|
||||
import app.simple.inure.util.ArrayUtils.circularGet
|
||||
import app.simple.inure.util.ConditionUtils.isZero
|
||||
import app.simple.inure.util.RecyclerViewUtils
|
||||
|
||||
@ -71,8 +72,8 @@ class AdapterHome(private val list: List<Pair<Int, Int>>) : RecyclerView.Adapter
|
||||
holder.icon.imageTintList = ColorStateList(arrayOf(intArrayOf(
|
||||
android.R.attr.state_enabled
|
||||
), intArrayOf()), intArrayOf(
|
||||
Colors.getColors()[position],
|
||||
Colors.getColors()[position]
|
||||
Colors.getColors().circularGet(position)!!,
|
||||
Colors.getColors().circularGet(position)!!
|
||||
))
|
||||
|
||||
if (AccessibilityPreferences.isHighlightMode()) {
|
||||
|
@ -1,8 +1,10 @@
|
||||
package app.simple.inure.constants
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import app.simple.inure.preferences.AccessibilityPreferences
|
||||
|
||||
@SuppressLint("UseKtx")
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
object Colors {
|
||||
|
||||
|
@ -139,4 +139,9 @@ object ArrayUtils {
|
||||
fun <T> List<T>.second(): T {
|
||||
return this[1]
|
||||
}
|
||||
|
||||
fun <T> List<T>?.circularGet(index: Int): T? {
|
||||
if (this.isNullOrEmpty()) return null
|
||||
return this[index % size]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user