mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Add crash button to debug settings
This commit is contained in:
		| @@ -3,6 +3,7 @@ package org.schabi.newpipe.settings; | |||||||
| import android.os.Bundle; | import android.os.Bundle; | ||||||
|  |  | ||||||
| import androidx.annotation.Nullable; | import androidx.annotation.Nullable; | ||||||
|  | import androidx.preference.Preference; | ||||||
|  |  | ||||||
| import org.schabi.newpipe.R; | import org.schabi.newpipe.R; | ||||||
|  |  | ||||||
| @@ -13,11 +14,22 @@ public class DebugSettingsFragment extends BasePreferenceFragment { | |||||||
|     public void onCreate(@Nullable final Bundle savedInstanceState) { |     public void onCreate(@Nullable final Bundle savedInstanceState) { | ||||||
|         super.onCreate(savedInstanceState); |         super.onCreate(savedInstanceState); | ||||||
|  |  | ||||||
|         findPreference(getString(R.string.show_memory_leaks_key)) |         final Preference showMemoryLeaksPreference | ||||||
|                 .setOnPreferenceClickListener(preference -> { |                 = findPreference(getString(R.string.show_memory_leaks_key)); | ||||||
|                     startActivity(LeakCanary.INSTANCE.newLeakDisplayActivityIntent()); |         final Preference crashTheAppPreference | ||||||
|                     return true; |                 = 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 |     @Override | ||||||
|   | |||||||
| @@ -172,6 +172,7 @@ | |||||||
|     <string name="show_memory_leaks_key" translatable="false">show_memory_leaks_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> | ||||||
|  |     <string name="crash_the_app_key" translatable="false">crash_the_app_key</string> | ||||||
|  |  | ||||||
|     <!-- THEMES --> |     <!-- THEMES --> | ||||||
|     <string name="theme_key" translatable="false">theme</string> |     <string name="theme_key" translatable="false">theme</string> | ||||||
|   | |||||||
| @@ -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="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> | ||||||
|     <string name="show_original_time_ago_summary">Original texts from services will be visible in stream 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 --> |     <!-- Subscriptions import/export --> | ||||||
|     <string name="import_export_title">Import/export</string> |     <string name="import_export_title">Import/export</string> | ||||||
|     <string name="import_title">Import</string> |     <string name="import_title">Import</string> | ||||||
|   | |||||||
| @@ -29,4 +29,9 @@ | |||||||
|         android:summary="@string/show_original_time_ago_summary" |         android:summary="@string/show_original_time_ago_summary" | ||||||
|         android:title="@string/show_original_time_ago_title" |         android:title="@string/show_original_time_ago_title" | ||||||
|         app:iconSpaceReserved="false" /> |         app:iconSpaceReserved="false" /> | ||||||
|  |  | ||||||
|  |     <Preference | ||||||
|  |         android:key="@string/crash_the_app_key" | ||||||
|  |         android:title="@string/crash_the_app" | ||||||
|  |         app:iconSpaceReserved="false" /> | ||||||
| </PreferenceScreen> | </PreferenceScreen> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox