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

Merge pull request #5672 from Stypox/crash-button

Add crash button to debug settings
This commit is contained in:
Tobi 2021-02-22 22:13:59 +01:00 committed by GitHub
commit d6855a6b50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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