Merge pull request #4436 from wb9688/hide-leaks

Hide Leaks launcher icon
pull/4450/head
Stypox 2020-10-07 13:26:12 +02:00 zatwierdzone przez GitHub
commit 9e1bc631cf
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 27 dodań i 1 usunięć

Wyświetl plik

@ -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);

Wyświetl plik

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

Wyświetl plik

@ -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>

Wyświetl plik

@ -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>

Wyświetl plik

@ -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"