diff --git a/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt b/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt index 86e2e1028..1a3ad203a 100644 --- a/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt +++ b/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt @@ -92,6 +92,14 @@ class ErrorUtil { showSnackbar(fragment, ErrorInfo(throwable, UserAction.UI_ERROR, request)) } + /** + * Shortcut to calling [Toast.makeText] + */ + @JvmStatic + fun showErrorToast(context: Context, message: String) { + Toast.makeText(context, message, Toast.LENGTH_LONG).show() + } + /** * Create an error notification. Tapping on the notification opens the error activity. Use * this method if the exception happens inside a background service (player, subscription diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 603a44eba..aeca866fd 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -1426,6 +1426,7 @@ public final class Player implements PlaybackListener, Listener { isCatchableException = true; simpleExoPlayer.pause(); onPaused(); + ErrorUtil.showErrorToast(context, "No internet connection available"); break; case ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT: case ERROR_CODE_UNSPECIFIED: