diff --git a/app/src/main/java/com/takisoft/preferencefix/MyPreferenceFragment.java b/app/src/main/java/com/takisoft/preferencefix/MyPreferenceFragment.java index 7131c41..7fbeae9 100644 --- a/app/src/main/java/com/takisoft/preferencefix/MyPreferenceFragment.java +++ b/app/src/main/java/com/takisoft/preferencefix/MyPreferenceFragment.java @@ -5,6 +5,7 @@ import android.support.annotation.Nullable; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceCategory; +import android.support.v7.preference.PreferenceManagerFix; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -19,6 +20,7 @@ public class MyPreferenceFragment extends PreferenceFragmentCompatDividers { @Override public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) { + PreferenceManagerFix.setDefaultValues(getPreferenceManager().getContext(), R.xml.settings, false); setPreferencesFromResource(R.xml.settings, rootKey); testDynamicPrefs(); @@ -30,7 +32,7 @@ public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String r Preference prefEmptyCheck = findPreference("pref_empty_check"); - if(prefEmptyCheck != null) { + if (prefEmptyCheck != null) { prefEmptyCheck.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { diff --git a/app/src/main/res/values/test_list_entries.xml b/app/src/main/res/values/test_list_entries.xml index 2721260..b07d698 100644 --- a/app/src/main/res/values/test_list_entries.xml +++ b/app/src/main/res/values/test_list_entries.xml @@ -1,13 +1,18 @@ + Alpha Bravo Charlie + A B C + + B + \ No newline at end of file diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml index fa3a8e4..f47ac6f 100644 --- a/app/src/main/res/xml/settings.xml +++ b/app/src/main/res/xml/settings.xml @@ -138,7 +138,7 @@ android:title="ColorPickerPreference" app:pref_size="small" />