0
0
mirror of https://github.com/MuntashirAkon/Metro.git synced 2024-09-19 19:42:21 +02:00

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

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>
<bool name="md3_available">true</bool>
<bool name="md3_enabled">true</bool>
<bool name="wallpaper_accent_visible">false</bool>
</resources>

View File

@ -5,9 +5,5 @@
<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>
</resources>

View File

@ -2,15 +2,6 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
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
android:defaultValue="0"
android:key="audio_fade_duration"

View File

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