1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-01-09 17:00:32 +00:00

Shows a toast indicating there is no internet available

This commit is contained in:
marevr 2022-10-30 12:15:20 +11:00
parent d4ca5f031b
commit 37bccffaaa
2 changed files with 9 additions and 0 deletions

View File

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

View File

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