1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-14 04:39:55 +01:00

Hide Leaks launcher icon

This commit is contained in:
wb9688 2020-10-07 12:56:22 +02:00
parent bc342b9b33
commit ca9fbe2f11
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 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);

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 -->
<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="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="show_original_time_ago_key" translatable="false">show_original_time_ago_text_key</string>

View File

@ -493,6 +493,7 @@
<!-- Debug Settings -->
<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="show_memory_leaks">Show memory leaks</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="show_original_time_ago_title">Show original time ago on items</string>
@ -673,4 +674,4 @@
<string name="channel_created_by">Created by %s</string>
<string name="video_detail_by">By %s</string>
<string name="playlist_page_summary">Playlist page</string>
</resources>
</resources>

View File

@ -12,6 +12,11 @@
android:title="@string/leakcanary"
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
app:iconSpaceReserved="false"
android:defaultValue="false"