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_LAND = "playlist_grid_size_land"
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_SLEEP_TIMER_VALUE = "last_sleep_timer_value"
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()) {
bluetoothPreference?.setOnPreferenceChangeListener { _, newValue ->
if (newValue as Boolean) {
if (ActivityCompat.checkSelfPermission(requireContext(),
BLUETOOTH_CONNECT) != PERMISSION_GRANTED
if (ActivityCompat.checkSelfPermission(
requireContext(),
BLUETOOTH_CONNECT
) != PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(requireActivity(), arrayOf(
BLUETOOTH_CONNECT), BLUETOOTH_PERMISSION_REQUEST)
ActivityCompat.requestPermissions(
requireActivity(), arrayOf(
BLUETOOTH_CONNECT
), BLUETOOTH_PERMISSION_REQUEST
)
}
}
return@setOnPreferenceChangeListener true

View file

@ -16,6 +16,7 @@ package code.name.monkey.retromusic.fragments.settings
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.View
import androidx.core.content.edit
import androidx.preference.Preference
import androidx.preference.TwoStatePreference
@ -139,5 +140,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
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
)
val isAudioDucking
get() = sharedPreferences.getBoolean(
AUDIO_DUCKING, true
)
val isBluetoothSpeaker
get() = sharedPreferences.getBoolean(
BLUETOOTH_PLAYBACK, false