1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 16:40:32 +00:00

Merge pull request #4436 from wb9688/hide-leaks

Hide Leaks launcher icon
This commit is contained in:
Stypox 2020-10-07 13:26:12 +02:00 committed by GitHub
commit 9e1bc631cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 1 deletions

View File

@ -2,9 +2,24 @@ package org.schabi.newpipe.settings;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.Nullable;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import leakcanary.LeakCanary;
public class DebugSettingsFragment extends BasePreferenceFragment { 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 @Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) { public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
addPreferencesFromResource(R.xml.debug_settings); addPreferencesFromResource(R.xml.debug_settings);

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="leak_canary_add_launcher_icon">false</bool>
</resources>

View File

@ -166,6 +166,7 @@
<!-- DEBUG ONLY --> <!-- DEBUG ONLY -->
<string name="debug_pref_screen_key" translatable="false">debug_pref_screen_key</string> <string name="debug_pref_screen_key" translatable="false">debug_pref_screen_key</string>
<string name="allow_heap_dumping_key" translatable="false">allow_heap_dumping_key</string> <string name="allow_heap_dumping_key" translatable="false">allow_heap_dumping_key</string>
<string name="show_memory_leaks_key" translatable="false">show_memory_leaks_key</string>
<string name="allow_disposed_exceptions_key" translatable="false">allow_disposed_exceptions_key</string> <string name="allow_disposed_exceptions_key" translatable="false">allow_disposed_exceptions_key</string>
<string name="show_original_time_ago_key" translatable="false">show_original_time_ago_text_key</string> <string name="show_original_time_ago_key" translatable="false">show_original_time_ago_text_key</string>

View File

@ -493,6 +493,7 @@
<!-- Debug Settings --> <!-- Debug Settings -->
<string name="leakcanary" translatable="false">LeakCanary</string> <string name="leakcanary" translatable="false">LeakCanary</string>
<string name="enable_leak_canary_summary">Memory leak monitoring may cause the app to become unresponsive when heap dumping</string> <string name="enable_leak_canary_summary">Memory leak monitoring may cause the app to become unresponsive when heap dumping</string>
<string name="show_memory_leaks">Show memory leaks</string>
<string name="enable_disposed_exceptions_title">Report out-of-lifecycle errors</string> <string name="enable_disposed_exceptions_title">Report out-of-lifecycle errors</string>
<string name="enable_disposed_exceptions_summary">Force reporting of undeliverable Rx exceptions outside of fragment or activity lifecycle after disposal</string> <string name="enable_disposed_exceptions_summary">Force reporting of undeliverable Rx exceptions outside of fragment or activity lifecycle after disposal</string>
<string name="show_original_time_ago_title">Show original time ago on items</string> <string name="show_original_time_ago_title">Show original time ago on items</string>

View File

@ -12,6 +12,11 @@
android:title="@string/leakcanary" android:title="@string/leakcanary"
android:summary="@string/enable_leak_canary_summary"/> android:summary="@string/enable_leak_canary_summary"/>
<Preference
app:iconSpaceReserved="false"
android:key="@string/show_memory_leaks_key"
android:title="@string/show_memory_leaks"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
app:iconSpaceReserved="false" app:iconSpaceReserved="false"
android:defaultValue="false" android:defaultValue="false"