Set default value on debug preferences

pull/1309/head
Alex Baker 5 years ago
parent 759fb2b2ca
commit 20f74bec33

@ -2,18 +2,22 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="false"
android:key="@string/p_leakcanary" android:key="@string/p_leakcanary"
android:title="@string/debug_leakcanary" /> android:title="@string/debug_leakcanary" />
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="false"
android:key="@string/p_flipper" android:key="@string/p_flipper"
android:title="@string/debug_flipper"/> android:title="@string/debug_flipper"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="false"
android:key="@string/p_strict_mode_vm" android:key="@string/p_strict_mode_vm"
android:title="@string/debug_strict_mode_vm"/> android:title="@string/debug_strict_mode_vm"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="false"
android:key="@string/p_strict_mode_thread" android:key="@string/p_strict_mode_thread"
android:title="@string/debug_strict_mode_thread"/> android:title="@string/debug_strict_mode_thread"/>
@ -23,6 +27,7 @@
android:title="@string/debug_main_queries" /> android:title="@string/debug_main_queries" />
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="false"
android:key="@string/p_debug_pro" android:key="@string/p_debug_pro"
android:title="@string/debug_pro"/> android:title="@string/debug_pro"/>

@ -242,7 +242,7 @@ class Preferences @JvmOverloads constructor(
fun getBoolean(key: String?, defValue: Boolean): Boolean = try { fun getBoolean(key: String?, defValue: Boolean): Boolean = try {
prefs.getBoolean(key, defValue) prefs.getBoolean(key, defValue)
} catch (e: ClassCastException) { } catch (e: ClassCastException) {
Timber.e(e) Timber.w(e)
defValue defValue
} }

Loading…
Cancel
Save