Add crash button to debug settings

pull/5672/head
Stypox 2021-02-22 21:59:04 +01:00
rodzic 1f77e00df4
commit 9be970a4c4
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4BDF1B40A49FDD23
4 zmienionych plików z 24 dodań i 5 usunięć

Wyświetl plik

@ -3,6 +3,7 @@ package org.schabi.newpipe.settings;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.preference.Preference;
import org.schabi.newpipe.R;
@ -13,11 +14,22 @@ public class DebugSettingsFragment extends BasePreferenceFragment {
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;
});
final Preference showMemoryLeaksPreference
= findPreference(getString(R.string.show_memory_leaks_key));
final Preference crashTheAppPreference
= findPreference(getString(R.string.crash_the_app_key));
assert showMemoryLeaksPreference != null;
assert crashTheAppPreference != null;
showMemoryLeaksPreference.setOnPreferenceClickListener(preference -> {
startActivity(LeakCanary.INSTANCE.newLeakDisplayActivityIntent());
return true;
});
crashTheAppPreference.setOnPreferenceClickListener(preference -> {
throw new RuntimeException();
});
}
@Override

Wyświetl plik

@ -172,6 +172,7 @@
<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>
<string name="crash_the_app_key" translatable="false">crash_the_app_key</string>
<!-- THEMES -->
<string name="theme_key" translatable="false">theme</string>

Wyświetl plik

@ -518,6 +518,7 @@
<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_summary">Original texts from services will be visible in stream items</string>
<string name="crash_the_app">Crash the app</string>
<!-- Subscriptions import/export -->
<string name="import_export_title">Import/export</string>
<string name="import_title">Import</string>

Wyświetl plik

@ -29,4 +29,9 @@
android:summary="@string/show_original_time_ago_summary"
android:title="@string/show_original_time_ago_title"
app:iconSpaceReserved="false" />
<Preference
android:key="@string/crash_the_app_key"
android:title="@string/crash_the_app"
app:iconSpaceReserved="false" />
</PreferenceScreen>