mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-01-25 08:26:57 +00:00
Shows a toast indicating there is no internet available
This commit is contained in:
parent
d4ca5f031b
commit
37bccffaaa
@ -92,6 +92,14 @@ class ErrorUtil {
|
|||||||
showSnackbar(fragment, ErrorInfo(throwable, UserAction.UI_ERROR, request))
|
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
|
* 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
|
* this method if the exception happens inside a background service (player, subscription
|
||||||
|
@ -1426,6 +1426,7 @@ public final class Player implements PlaybackListener, Listener {
|
|||||||
isCatchableException = true;
|
isCatchableException = true;
|
||||||
simpleExoPlayer.pause();
|
simpleExoPlayer.pause();
|
||||||
onPaused();
|
onPaused();
|
||||||
|
ErrorUtil.showErrorToast(context, "No internet connection available");
|
||||||
break;
|
break;
|
||||||
case ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT:
|
case ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT:
|
||||||
case ERROR_CODE_UNSPECIFIED:
|
case ERROR_CODE_UNSPECIFIED:
|
||||||
|
Loading…
Reference in New Issue
Block a user