Improved settings screen

This commit is contained in:
h4h13 2019-06-02 18:58:14 +05:30
parent 960657878e
commit a81e80764d
11 changed files with 96 additions and 28 deletions

View file

@ -75,8 +75,7 @@ abstract class AbsSettingsFragment : PreferenceFragmentCompat() {
dialogFragment = AlbumCoverStylePreferenceDialog.newInstance(preference.key);
}
if (preference is MaterialListPreference) {
val entries = preference.entries
preference.entries
dialogFragment = MaterialListPreferenceDialog.newInstance(preference)
}
if (preference is BlacklistPreference) {

View file

@ -36,13 +36,6 @@ class PersonaizeSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh
activity!!.recreate()
return@setOnPreferenceChangeListener true
}
val toggleFullScreen: TwoStatePreference = findPreference("toggle_full_screen")!!
toggleFullScreen.setOnPreferenceChangeListener { _, _ ->
activity!!.recreate()
true
}
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {

View file

@ -16,11 +16,13 @@ package code.name.monkey.retromusic.preferences
import android.app.Dialog
import android.content.Context
import android.graphics.PorterDuff
import android.os.Bundle
import android.text.Html
import android.util.AttributeSet
import androidx.fragment.app.DialogFragment
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import androidx.preference.DialogPreference
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.dialogs.BlacklistFolderChooserDialog
import code.name.monkey.retromusic.providers.BlacklistStore
@ -30,7 +32,7 @@ import com.afollestad.materialdialogs.list.listItems
import java.io.File
import java.util.*
class BlacklistPreference : ATEDialogPreference {
class BlacklistPreference : DialogPreference {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
@ -38,6 +40,10 @@ class BlacklistPreference : ATEDialogPreference {
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
init {
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
}
}
class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog.FolderCallback {

View file

@ -0,0 +1,24 @@
<!--
~ Copyright (c) 2019 Hemanth Savarala.
~
~ Licensed under the GNU General Public License v3
~
~ This is free software: you can redistribute it and/or modify it under
~ the terms of the GNU General Public License as published by
~ the Free Software Foundation either version 3 of the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~ See the GNU General Public License for more details.
-->
<!-- drawable/contain.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/md_white_1000"
android:pathData="M2,3H8V5H4V19H8V21H2V3M7,17V15H9V17H7M11,17V15H13V17H11M15,17V15H17V17H15M22,3V21H16V19H20V5H16V3H22Z" />
</vector>

View file

@ -0,0 +1,24 @@
<!--
~ Copyright (c) 2019 Hemanth Savarala.
~
~ Licensed under the GNU General Public License v3
~
~ This is free software: you can redistribute it and/or modify it under
~ the terms of the GNU General Public License as published by
~ the Free Software Foundation either version 3 of the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~ See the GNU General Public License for more details.
-->
<!-- drawable/music_note_off.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/md_white_1000"
android:pathData="M12,3V8.68L15,11.68V6H19V3H12M5.28,4.5L4,5.77L10.26,12.03C7.89,12.15 6,14.1 6,16.5C6,19 8,21 10.5,21C12.9,21 14.85,19.11 14.97,16.74L19.68,21.45L20.96,20.18L15,14.22L12,11.22L5.28,4.5Z" />
</vector>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2019 Hemanth Savarala.
~
~ Licensed under the GNU General Public License v3
~
~ This is free software: you can redistribute it and/or modify it under
~ the terms of the GNU General Public License as published by
~ the Free Software Foundation either version 3 of the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~ See the GNU General Public License for more details.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/md_white_1000"
android:pathData="M21 3H3c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h18c1.1 0 2-0.9 2-2V5c0-1.1-0.9-2-2-2zm0 16.01H3V4.99h18v14.02zM8 16h2.5l1.5 1.5 1.5-1.5H16v-2.5l1.5-1.5-1.5-1.5V8h-2.5L12 6.5 10.5 8H8v2.5L6.5 12 8 13.5V16zm4-7c1.66 0 3 1.34 3 3s-1.34 3-3 3V9z" />
</vector>

View file

@ -9,28 +9,24 @@
android:max="60"
android:title="@string/pref_filter_song_title"
app:enableCopying="true"
app:icon="@drawable/ic_filter_song_white_24dp"
app:showSeekBarValue="true" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:key="pause_on_zero_volume"
android:summary="@string/pref_keep_pause_on_zero_volume_summary"
android:title="@string/pref_keep_pause_on_zero_volume_title"
app:enableCopying="true" />
app:enableCopying="true"
app:icon="@drawable/ic_pause_white_24dp" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:key="keep_screen_on"
android:summary="@string/pref_keep_screen_on_summary"
android:title="@string/pref_keep_screen_on_title"
app:enableCopying="true" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:key="snow_fall_effect"
android:title="@string/pref_snow_fall_title"
app:enableCopying="true" />
app:enableCopying="true"
app:icon="@drawable/ic_settings_brigntness_white_24dp" />
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
</androidx.preference.PreferenceScreen>

View file

@ -7,7 +7,8 @@
android:key="blacklist"
android:summary="@string/pref_summary_blacklist"
android:title="@string/pref_title_blacklist"
app:enableCopying="true" />
app:enableCopying="true"
app:icon="@drawable/ic_music_note_off_white_24dp" />
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>

View file

@ -3,17 +3,18 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
app:enableCopying="true"
android:defaultValue="true"
app:icon="@drawable/ic_image_white_24dp"
android:key="ignore_media_store_artwork"
android:summary="@string/pref_summary_ignore_media_store_artwork"
android:title="@string/pref_title_ignore_media_store_artwork" />
android:title="@string/pref_title_ignore_media_store_artwork"
app:enableCopying="true" />
<code.name.monkey.retromusic.preferences.MaterialListPreference
app:enableCopying="true"
android:defaultValue="only_wifi"
android:entries="@array/pref_auto_download_images_titles"
android:entryValues="@array/pref_auto_download_images_values"
android:key="auto_download_images_policy"
android:title="@string/pref_title_auto_download_artist_images" />
android:title="@string/pref_title_auto_download_artist_images"
app:enableCopying="true" />
</androidx.preference.PreferenceScreen>

View file

@ -5,6 +5,7 @@
android:title="@string/window"
app:enableCopying="true"
app:iconSpaceReserved="true">
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:key="corner_window"

View file

@ -1,10 +1,9 @@
package code.name.monkey.appthemehelper.common.prefs.supportv7
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.PorterDuff
import android.util.AttributeSet
import android.widget.SeekBar
import android.widget.TextView
import androidx.preference.PreferenceViewHolder
import androidx.preference.SeekBarPreference
import code.name.monkey.appthemehelper.R
@ -29,7 +28,7 @@ class ATESeekBarPreference : SeekBarPreference {
}
private fun init() {
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
}
override fun onBindViewHolder(view: PreferenceViewHolder) {