fix: app crashing after enabling hidden apps

This commit is contained in:
Hamza417
2025-05-16 12:31:28 +05:30
parent df0f838866
commit dec33df251
3 changed files with 10 additions and 2 deletions

View File

@ -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()) {

View File

@ -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 {

View File

@ -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]
}
}