0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-25 12:45:12 +00:00

removed theme settings for android 6 and lower

This commit is contained in:
X1nto 2020-05-02 20:12:40 +04:00
parent 95db18de9a
commit d61db7ace6
3 changed files with 25 additions and 30 deletions

View file

@ -6,10 +6,7 @@ import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import androidx.fragment.app.FragmentManager
import androidx.preference.DialogPreference
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.*
import com.vanced.manager.R
class SettingsFragment : PreferenceFragmentCompat() {
@ -17,11 +14,13 @@ class SettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.preferences, rootKey)
//Fuck Android 6 and 5 users! Because theme is not working
//Fuck Android 6 android 5 users! Because theme is not working
//we can't display preference for them.
// They should've upgraded to something newer
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
setPreferencesFromResource(R.xml.theme_preference, rootKey)
//They should've upgraded to something newer
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
val prefScreen: PreferenceScreen? = findPreference("prefScreen")
val prefCategory: PreferenceCategory? = findPreference("interface_category")
prefScreen?.removePreference(prefCategory)
}
activity?.title = getString(R.string.title_settings)

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:key="prefScreen">
<PreferenceCategory
android:title="@string/category_manager"
@ -20,4 +21,20 @@
</PreferenceCategory>
<PreferenceCategory
android:title="@string/category_interface"
android:key="interface_category"
app:iconSpaceReserved="false">
<ListPreference
android:icon="@drawable/ic_brush_black_24dp"
android:key="theme_mode"
android:title="@string/theme"
android:summary="@string/theme_summary"
android:entries="@array/theme_modes"
android:entryValues="@array/theme_modes_values"
android:defaultValue="LIGHT"/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
android:title="@string/category_interface"
app:iconSpaceReserved="false">
<ListPreference
android:icon="@drawable/ic_brush_black_24dp"
android:key="theme_mode"
android:title="@string/theme"
android:summary="@string/theme_summary"
android:entries="@array/theme_modes"
android:entryValues="@array/theme_modes_values"
android:defaultValue="LIGHT"/>
</PreferenceCategory>
</PreferenceScreen>