mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 02:53:09 +01:00
Add debug prefs to show error snackbar/notification
This commit is contained in:
parent
c8e2ab4c83
commit
c000c1d455
@ -5,6 +5,9 @@ import android.os.Bundle;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.error.ErrorInfo;
|
||||
import org.schabi.newpipe.error.ErrorUtil;
|
||||
import org.schabi.newpipe.error.UserAction;
|
||||
import org.schabi.newpipe.util.PicassoHelper;
|
||||
|
||||
import leakcanary.LeakCanary;
|
||||
@ -20,10 +23,16 @@ public class DebugSettingsFragment extends BasePreferenceFragment {
|
||||
= findPreference(getString(R.string.show_image_indicators_key));
|
||||
final Preference crashTheAppPreference
|
||||
= findPreference(getString(R.string.crash_the_app_key));
|
||||
final Preference showErrorSnackbarPreference
|
||||
= findPreference(getString(R.string.show_error_snackbar_key));
|
||||
final Preference createErrorNotificationPreference
|
||||
= findPreference(getString(R.string.create_error_notification_key));
|
||||
|
||||
assert showMemoryLeaksPreference != null;
|
||||
assert showImageIndicatorsPreference != null;
|
||||
assert crashTheAppPreference != null;
|
||||
assert showErrorSnackbarPreference != null;
|
||||
assert createErrorNotificationPreference != null;
|
||||
|
||||
showMemoryLeaksPreference.setOnPreferenceClickListener(preference -> {
|
||||
startActivity(LeakCanary.INSTANCE.newLeakDisplayActivityIntent());
|
||||
@ -38,5 +47,17 @@ public class DebugSettingsFragment extends BasePreferenceFragment {
|
||||
crashTheAppPreference.setOnPreferenceClickListener(preference -> {
|
||||
throw new RuntimeException();
|
||||
});
|
||||
|
||||
showErrorSnackbarPreference.setOnPreferenceClickListener(preference -> {
|
||||
ErrorUtil.showUiErrorSnackbar(DebugSettingsFragment.this,
|
||||
"Dummy", new RuntimeException("Dummy"));
|
||||
return true;
|
||||
});
|
||||
|
||||
createErrorNotificationPreference.setOnPreferenceClickListener(preference -> {
|
||||
ErrorUtil.createNotification(requireContext(),
|
||||
new ErrorInfo(new RuntimeException("Dummy"), UserAction.UI_ERROR, "Dummy"));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -186,9 +186,11 @@
|
||||
<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_key</string>
|
||||
<string name="disable_media_tunneling_key" translatable="false">disable_media_tunneling_key</string>
|
||||
<string name="crash_the_app_key" translatable="false">crash_the_app_key</string>
|
||||
<string name="show_image_indicators_key" translatable="false">show_image_indicators_key</string>
|
||||
<string name="show_crash_the_player_key" translatable="false">show_crash_the_player_key</string>
|
||||
<string name="crash_the_app_key" translatable="false">crash_the_app_key</string>
|
||||
<string name="show_error_snackbar_key" translatable="false">show_error_snackbar_key</string>
|
||||
<string name="create_error_notification_key" translatable="false">create_error_notification_key</string>
|
||||
|
||||
<!-- THEMES -->
|
||||
<string name="theme_key" translatable="false">theme</string>
|
||||
|
@ -477,9 +477,11 @@
|
||||
<string name="disable_media_tunneling_summary">Disable media tunneling if you experience a black screen or stuttering on video playback</string>
|
||||
<string name="show_image_indicators_title">Show image indicators</string>
|
||||
<string name="show_image_indicators_summary">Show Picasso colored ribbons on top of images indicating their source: red for network, blue for disk and green for memory</string>
|
||||
<string name="crash_the_app">Crash the app</string>
|
||||
<string name="show_crash_the_player_title">Show \"crash the player\"</string>
|
||||
<string name="show_crash_the_player_summary">Shows a crash option when using the player</string>
|
||||
<string name="crash_the_app">Crash the app</string>
|
||||
<string name="show_error_snackbar">Show an error snackbar</string>
|
||||
<string name="create_error_notification">Create an error notification</string>
|
||||
<!-- Subscriptions import/export -->
|
||||
<string name="import_title">Import</string>
|
||||
<string name="import_from">Import from</string>
|
||||
|
@ -49,18 +49,28 @@
|
||||
android:title="@string/show_image_indicators_title"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/show_crash_the_player_key"
|
||||
android:summary="@string/show_crash_the_player_summary"
|
||||
android:title="@string/show_crash_the_player_title"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/crash_the_app_key"
|
||||
android:title="@string/crash_the_app"
|
||||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:defaultValue="false"
|
||||
android:key="@string/show_crash_the_player_key"
|
||||
android:summary="@string/show_crash_the_player_summary"
|
||||
android:title="@string/show_crash_the_player_title"
|
||||
<Preference
|
||||
android:key="@string/show_error_snackbar_key"
|
||||
android:title="@string/show_error_snackbar"
|
||||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/create_error_notification_key"
|
||||
android:title="@string/create_error_notification"
|
||||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
</PreferenceScreen>
|
||||
|
Loading…
Reference in New Issue
Block a user