Android12+: use user-defined DynamicColors.

This commit is contained in:
Dennis Guse
2023-10-08 22:51:39 +02:00
parent 54fb70053c
commit 5fbc079d96
6 changed files with 29 additions and 5 deletions
@@ -307,6 +307,11 @@ public class PreferencesUtils {
return getBoolean(R.string.stats_fullscreen_while_recording_key, DEFAULT);
}
public static boolean shouldUseDynamicColors() {
final boolean DEFAULT = resources.getBoolean(R.bool.settings_ui_dynamic_colors_default);
return getBoolean(R.string.settings_ui_dynamic_colors_key, DEFAULT);
}
public static boolean shouldVoiceAnnouncementOnDeviceSpeaker() {
final boolean DEFAULT = resources.getBoolean(R.bool.voice_on_device_speaker_default);
return getBoolean(R.string.voice_on_device_speaker_key, DEFAULT);
@@ -2,6 +2,7 @@ package de.dennisguse.opentracks.settings;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import androidx.fragment.app.DialogFragment;
@@ -34,6 +35,9 @@ public class UserInterfaceSettingsFragment extends PreferenceFragmentCompat {
return true;
});
Preference dynamicColors = findPreference(getString(R.string.settings_ui_dynamic_colors_key));
dynamicColors.setEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU);
setShowOnMapFormatOptions();
}