From ca9fbe2f110d5678df3c92e9a9712e3bb3fe13e6 Mon Sep 17 00:00:00 2001 From: wb9688 Date: Wed, 7 Oct 2020 12:56:22 +0200 Subject: [PATCH] Hide Leaks launcher icon --- .../newpipe/settings/DebugSettingsFragment.java | 15 +++++++++++++++ app/src/main/res/values/bools.xml | 4 ++++ app/src/main/res/values/settings_keys.xml | 1 + app/src/main/res/values/strings.xml | 3 ++- app/src/main/res/xml/debug_settings.xml | 5 +++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/values/bools.xml diff --git a/app/src/main/java/org/schabi/newpipe/settings/DebugSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/DebugSettingsFragment.java index af3e3f5a9..3d63414a8 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/DebugSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/DebugSettingsFragment.java @@ -2,9 +2,24 @@ package org.schabi.newpipe.settings; import android.os.Bundle; +import androidx.annotation.Nullable; + import org.schabi.newpipe.R; +import leakcanary.LeakCanary; + public class DebugSettingsFragment extends BasePreferenceFragment { + @Override + public void onCreate(@Nullable final Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + findPreference(getString(R.string.show_memory_leaks_key)) + .setOnPreferenceClickListener(preference -> { + startActivity(LeakCanary.INSTANCE.newLeakDisplayActivityIntent()); + return true; + }); + } + @Override public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) { addPreferencesFromResource(R.xml.debug_settings); diff --git a/app/src/main/res/values/bools.xml b/app/src/main/res/values/bools.xml new file mode 100644 index 000000000..2ccacb24c --- /dev/null +++ b/app/src/main/res/values/bools.xml @@ -0,0 +1,4 @@ + + + false + diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 8d2dd7dcb..cda95103f 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -166,6 +166,7 @@ debug_pref_screen_key allow_heap_dumping_key + show_memory_leaks_key allow_disposed_exceptions_key show_original_time_ago_text_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index eebdda023..331ea011b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -493,6 +493,7 @@ LeakCanary Memory leak monitoring may cause the app to become unresponsive when heap dumping + Show memory leaks Report out-of-lifecycle errors Force reporting of undeliverable Rx exceptions outside of fragment or activity lifecycle after disposal Show original time ago on items @@ -673,4 +674,4 @@ Created by %s By %s Playlist page - \ No newline at end of file + diff --git a/app/src/main/res/xml/debug_settings.xml b/app/src/main/res/xml/debug_settings.xml index 3cc2db9a3..cdb8f6a19 100644 --- a/app/src/main/res/xml/debug_settings.xml +++ b/app/src/main/res/xml/debug_settings.xml @@ -12,6 +12,11 @@ android:title="@string/leakcanary" android:summary="@string/enable_leak_canary_summary"/> + +