mirror of
https://github.com/Hamza417/Inure.git
synced 2025-07-01 21:58:01 +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.DevelopmentPreferences
|
||||||
import app.simple.inure.preferences.HomePreferences
|
import app.simple.inure.preferences.HomePreferences
|
||||||
import app.simple.inure.preferences.TrialPreferences
|
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.ConditionUtils.isZero
|
||||||
import app.simple.inure.util.RecyclerViewUtils
|
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(
|
holder.icon.imageTintList = ColorStateList(arrayOf(intArrayOf(
|
||||||
android.R.attr.state_enabled
|
android.R.attr.state_enabled
|
||||||
), intArrayOf()), intArrayOf(
|
), intArrayOf()), intArrayOf(
|
||||||
Colors.getColors()[position],
|
Colors.getColors().circularGet(position)!!,
|
||||||
Colors.getColors()[position]
|
Colors.getColors().circularGet(position)!!
|
||||||
))
|
))
|
||||||
|
|
||||||
if (AccessibilityPreferences.isHighlightMode()) {
|
if (AccessibilityPreferences.isHighlightMode()) {
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package app.simple.inure.constants
|
package app.simple.inure.constants
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import app.simple.inure.preferences.AccessibilityPreferences
|
import app.simple.inure.preferences.AccessibilityPreferences
|
||||||
|
|
||||||
|
@SuppressLint("UseKtx")
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
object Colors {
|
object Colors {
|
||||||
|
|
||||||
|
@ -139,4 +139,9 @@ object ArrayUtils {
|
|||||||
fun <T> List<T>.second(): T {
|
fun <T> List<T>.second(): T {
|
||||||
return this[1]
|
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