mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Show Material You as accent color on Android 12+
This commit is contained in:
parent
5bbd699ba3
commit
c1f6b442d3
@ -1,9 +1,11 @@
|
||||
package com.github.libretube.ui.preferences
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.SwitchPreferenceCompat
|
||||
import com.github.libretube.BuildConfig
|
||||
import com.github.libretube.R
|
||||
import com.github.libretube.constants.PreferenceKeys
|
||||
import com.github.libretube.ui.adapters.IconsSheetAdapter
|
||||
@ -78,16 +80,17 @@ class AppearanceSettings : BasePreferenceFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
// remove material you from accent color option if not available
|
||||
/**
|
||||
* Remove material you from accent color option if not available
|
||||
*/
|
||||
private fun updateAccentColorValues(pref: ListPreference) {
|
||||
val dynamicColorsAvailable = DynamicColors.isDynamicColorAvailable()
|
||||
if (!dynamicColorsAvailable) {
|
||||
val entries = pref.entries.toMutableList()
|
||||
entries -= entries[0]
|
||||
pref.entries = entries.toTypedArray()
|
||||
val values = pref.entryValues.toMutableList()
|
||||
values -= values[0]
|
||||
pref.entryValues = values.toTypedArray()
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||
pref.entries = pref.entries.toMutableList().apply {
|
||||
removeFirst()
|
||||
}.toTypedArray()
|
||||
pref.entryValues = pref.entryValues.toMutableList().apply {
|
||||
removeFirst()
|
||||
}.toTypedArray()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user