From bd7cd4d8efeea063496d3a0c3be4e1757adcfb03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?yJan=20Christian=20Gr=C3=BCnhage?= Date: Tue, 28 Mar 2017 15:34:35 +0200 Subject: [PATCH] This should fix #24. --- .../activities/SettingsActivity.java | 12 +++--------- .../src/main/res/xml/pref_debug_header.xml | 7 +++++++ playmusicexporter/src/main/res/xml/pref_headers.xml | 4 ---- 3 files changed, 10 insertions(+), 13 deletions(-) create mode 100644 playmusicexporter/src/main/res/xml/pref_debug_header.xml diff --git a/playmusicexporter/src/main/java/re/jcg/playmusicexporter/activities/SettingsActivity.java b/playmusicexporter/src/main/java/re/jcg/playmusicexporter/activities/SettingsActivity.java index 26b8b9a..db1aee2 100644 --- a/playmusicexporter/src/main/java/re/jcg/playmusicexporter/activities/SettingsActivity.java +++ b/playmusicexporter/src/main/java/re/jcg/playmusicexporter/activities/SettingsActivity.java @@ -25,6 +25,7 @@ import re.jcg.playmusicexporter.settings.PlayMusicExporterPreferences; import java.text.SimpleDateFormat; import java.util.List; +import java.util.stream.Collectors; /** * A {@link PreferenceActivity} that presents a set of application settings. On @@ -127,15 +128,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity { @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onBuildHeaders(List
target) { loadHeadersFromResource(R.xml.pref_headers, target); - - // Remove the Debug Fragment - if (!BuildConfig.DEBUG) { - for (int i = 0; i < target.size(); i++) { - if ("Debug".equals(target.get(i).title)) { - target.remove(i); - break; - } - } + if (BuildConfig.DEBUG) { + loadHeadersFromResource(R.xml.pref_debug_header, target); } } diff --git a/playmusicexporter/src/main/res/xml/pref_debug_header.xml b/playmusicexporter/src/main/res/xml/pref_debug_header.xml new file mode 100644 index 0000000..01bfb2d --- /dev/null +++ b/playmusicexporter/src/main/res/xml/pref_debug_header.xml @@ -0,0 +1,7 @@ + +
+ + diff --git a/playmusicexporter/src/main/res/xml/pref_headers.xml b/playmusicexporter/src/main/res/xml/pref_headers.xml index 9866a60..475de8a 100644 --- a/playmusicexporter/src/main/res/xml/pref_headers.xml +++ b/playmusicexporter/src/main/res/xml/pref_headers.xml @@ -16,9 +16,5 @@ android:fragment="re.jcg.playmusicexporter.activities.SettingsActivity$AboutPreferenceFragment" android:icon="@drawable/ic_info_black_24dp" android:title="@string/pref_header_about" /> -