UIPreference: Hide accent color preference on Android 12+ devices
Android 12 and above devices have system based accent color system known as monet that is highly customizable compared to our offerings. Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -4,10 +4,13 @@ import android.content.BroadcastReceiver
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import com.aurora.extensions.isSAndAbove
|
||||||
import com.aurora.store.data.work.CacheWorker
|
import com.aurora.store.data.work.CacheWorker
|
||||||
import com.aurora.store.util.Preferences
|
import com.aurora.store.util.Preferences
|
||||||
import com.aurora.store.util.Preferences.PREFERENCE_INTRO
|
import com.aurora.store.util.Preferences.PREFERENCE_INTRO
|
||||||
import com.aurora.store.util.Preferences.PREFERENCE_MIGRATION_VERSION
|
import com.aurora.store.util.Preferences.PREFERENCE_MIGRATION_VERSION
|
||||||
|
import com.aurora.store.util.Preferences.PREFERENCE_THEME_ACCENT
|
||||||
|
import com.aurora.store.util.save
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
@@ -39,6 +42,7 @@ class MigrationReceiver: BroadcastReceiver() {
|
|||||||
// 58 -> 59
|
// 58 -> 59
|
||||||
if (currentVersion == 0) {
|
if (currentVersion == 0) {
|
||||||
CacheWorker.scheduleAutomatedCacheCleanup(context)
|
CacheWorker.scheduleAutomatedCacheCleanup(context)
|
||||||
|
if (isSAndAbove()) context.save(PREFERENCE_THEME_ACCENT, 0)
|
||||||
currentVersion++
|
currentVersion++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package com.aurora.store.view.ui.preferences
|
|||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@@ -77,6 +78,7 @@ class UIPreference : BasePreferenceFragment() {
|
|||||||
|
|
||||||
val accentPreference: ListPreference? = findPreference(Preferences.PREFERENCE_THEME_ACCENT)
|
val accentPreference: ListPreference? = findPreference(Preferences.PREFERENCE_THEME_ACCENT)
|
||||||
accentPreference?.let {
|
accentPreference?.let {
|
||||||
|
it.isVisible = Build.VERSION.SDK_INT < Build.VERSION_CODES.S
|
||||||
it.setOnPreferenceChangeListener { _, newValue ->
|
it.setOnPreferenceChangeListener { _, newValue ->
|
||||||
val accentId = Integer.parseInt(newValue.toString())
|
val accentId = Integer.parseInt(newValue.toString())
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
app:entries="@array/pref_accent"
|
app:entries="@array/pref_accent"
|
||||||
app:entryValues="@array/pref_accent_values"
|
app:entryValues="@array/pref_accent_values"
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
|
app:isPreferenceVisible="false"
|
||||||
app:key="PREFERENCE_THEME_ACCENT"
|
app:key="PREFERENCE_THEME_ACCENT"
|
||||||
app:title="@string/pref_ui_accent_title"
|
app:title="@string/pref_ui_accent_title"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|||||||
Reference in New Issue
Block a user