mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-17 12:11:07 -04:00
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.Intent
|
||||
import android.util.Log
|
||||
import com.aurora.extensions.isSAndAbove
|
||||
import com.aurora.store.data.work.CacheWorker
|
||||
import com.aurora.store.util.Preferences
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INTRO
|
||||
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
|
||||
|
||||
@AndroidEntryPoint
|
||||
@@ -39,6 +42,7 @@ class MigrationReceiver: BroadcastReceiver() {
|
||||
// 58 -> 59
|
||||
if (currentVersion == 0) {
|
||||
CacheWorker.scheduleAutomatedCacheCleanup(context)
|
||||
if (isSAndAbove()) context.save(PREFERENCE_THEME_ACCENT, 0)
|
||||
currentVersion++
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ package com.aurora.store.view.ui.preferences
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.view.View
|
||||
@@ -77,6 +78,7 @@ class UIPreference : BasePreferenceFragment() {
|
||||
|
||||
val accentPreference: ListPreference? = findPreference(Preferences.PREFERENCE_THEME_ACCENT)
|
||||
accentPreference?.let {
|
||||
it.isVisible = Build.VERSION.SDK_INT < Build.VERSION_CODES.S
|
||||
it.setOnPreferenceChangeListener { _, newValue ->
|
||||
val accentId = Integer.parseInt(newValue.toString())
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
app:entries="@array/pref_accent"
|
||||
app:entryValues="@array/pref_accent_values"
|
||||
app:iconSpaceReserved="false"
|
||||
app:isPreferenceVisible="false"
|
||||
app:key="PREFERENCE_THEME_ACCENT"
|
||||
app:title="@string/pref_ui_accent_title"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
Reference in New Issue
Block a user