Code Cleanup

This commit is contained in:
Prathamesh More 2023-03-14 13:36:07 +05:30
parent ccf3b7f6a5
commit 6ec2e6ee9a
10 changed files with 14 additions and 36 deletions

View file

@ -119,7 +119,6 @@ const val ARTIST_GRID_SIZE_LAND = "artist_grid_size_land"
const val PLAYLIST_GRID_SIZE = "playlist_grid_size" const val PLAYLIST_GRID_SIZE = "playlist_grid_size"
const val PLAYLIST_GRID_SIZE_LAND = "playlist_grid_size_land" const val PLAYLIST_GRID_SIZE_LAND = "playlist_grid_size_land"
const val COLORED_APP_SHORTCUTS = "colored_app_shortcuts" const val COLORED_APP_SHORTCUTS = "colored_app_shortcuts"
const val AUDIO_DUCKING = "audio_ducking"
const val LAST_ADDED_CUTOFF = "last_added_interval" const val LAST_ADDED_CUTOFF = "last_added_interval"
const val LAST_SLEEP_TIMER_VALUE = "last_sleep_timer_value" const val LAST_SLEEP_TIMER_VALUE = "last_sleep_timer_value"
const val NEXT_SLEEP_TIMER_ELAPSED_REALTIME = "next_sleep_timer_elapsed_real_time" const val NEXT_SLEEP_TIMER_ELAPSED_REALTIME = "next_sleep_timer_elapsed_real_time"

View file

@ -49,11 +49,16 @@ class AudioSettings : AbsSettingsFragment() {
if (VersionUtils.hasS()) { if (VersionUtils.hasS()) {
bluetoothPreference?.setOnPreferenceChangeListener { _, newValue -> bluetoothPreference?.setOnPreferenceChangeListener { _, newValue ->
if (newValue as Boolean) { if (newValue as Boolean) {
if (ActivityCompat.checkSelfPermission(requireContext(), if (ActivityCompat.checkSelfPermission(
BLUETOOTH_CONNECT) != PERMISSION_GRANTED requireContext(),
BLUETOOTH_CONNECT
) != PERMISSION_GRANTED
) { ) {
ActivityCompat.requestPermissions(requireActivity(), arrayOf( ActivityCompat.requestPermissions(
BLUETOOTH_CONNECT), BLUETOOTH_PERMISSION_REQUEST) requireActivity(), arrayOf(
BLUETOOTH_CONNECT
), BLUETOOTH_PERMISSION_REQUEST
)
} }
} }
return@setOnPreferenceChangeListener true return@setOnPreferenceChangeListener true

View file

@ -16,6 +16,7 @@ package code.name.monkey.retromusic.fragments.settings
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.os.Bundle import android.os.Bundle
import android.view.View
import androidx.core.content.edit import androidx.core.content.edit
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.TwoStatePreference import androidx.preference.TwoStatePreference
@ -139,5 +140,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.pref_general) addPreferencesFromResource(R.xml.pref_general)
val wallpaperAccent: ATESwitchPreference? = findPreference(WALLPAPER_ACCENT)
wallpaperAccent?.isVisible = VersionUtils.hasOreoMR1() && !VersionUtils.hasS()
} }
} }

View file

@ -266,11 +266,6 @@ object PreferenceUtil {
ALBUM_ART_ON_LOCK_SCREEN, true ALBUM_ART_ON_LOCK_SCREEN, true
) )
val isAudioDucking
get() = sharedPreferences.getBoolean(
AUDIO_DUCKING, true
)
val isBluetoothSpeaker val isBluetoothSpeaker
get() = sharedPreferences.getBoolean( get() = sharedPreferences.getBoolean(
BLUETOOTH_PLAYBACK, false BLUETOOTH_PLAYBACK, false

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isNotOreo">false</bool>
</resources>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="wallpaper_accent_visible">true</bool>
</resources>

View file

@ -2,6 +2,4 @@
<resources> <resources>
<bool name="md3_available">true</bool> <bool name="md3_available">true</bool>
<bool name="md3_enabled">true</bool> <bool name="md3_enabled">true</bool>
<bool name="wallpaper_accent_visible">false</bool>
</resources> </resources>

View file

@ -5,9 +5,5 @@
<bool name="allowBackup">true</bool> <bool name="allowBackup">true</bool>
<bool name="wallpaper_accent_enabled">false</bool>
<bool name="wallpaper_accent_visible">false</bool>
<bool name="isNotOreo">true</bool>
<bool name="isMarshmallow">false</bool> <bool name="isMarshmallow">false</bool>
</resources> </resources>

View file

@ -2,15 +2,6 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="true"
android:key="audio_ducking"
android:layout="@layout/list_item_view_switch"
android:summary="@string/pref_summary_audio_ducking"
android:title="@string/pref_title_audio_ducking"
app:icon="@drawable/ic_volume_down"
app:isPreferenceVisible="@bool/isNotOreo"/>
<code.name.monkey.retromusic.preferences.DurationPreference <code.name.monkey.retromusic.preferences.DurationPreference
android:defaultValue="0" android:defaultValue="0"
android:key="audio_fade_duration" android:key="audio_fade_duration"

View file

@ -43,12 +43,11 @@
android:title="@string/colors"> android:title="@string/colors">
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference <code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="@bool/wallpaper_accent_enabled" android:defaultValue="false"
android:key="wallpaper_accent" android:key="wallpaper_accent"
android:layout="@layout/list_item_view_switch" android:layout="@layout/list_item_view_switch"
android:summary="@string/pref_summary_wallpaper_accent" android:summary="@string/pref_summary_wallpaper_accent"
android:title="@string/pref_title_wallpaper_accent" android:title="@string/pref_title_wallpaper_accent" />
app:isPreferenceVisible="@bool/wallpaper_accent_visible" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEColorPreference <code.name.monkey.appthemehelper.common.prefs.supportv7.ATEColorPreference
android:dependency="material_you" android:dependency="material_you"