Fix ClassCastException when showing error message on video player

This commit is contained in:
ByteHamster 2023-08-19 10:55:32 +02:00 committed by ByteHamster
parent 18ab4ab8c6
commit 056d262ab5

View File

@ -21,8 +21,11 @@ public class MediaPlayerErrorDialog {
genericMessage.length(), errorMessage.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
errorDialog.setMessage(errorMessage);
errorDialog.setPositiveButton(android.R.string.ok, (dialog, which) ->
((MainActivity) activity).getBottomSheet().setState(BottomSheetBehavior.STATE_COLLAPSED));
errorDialog.setPositiveButton(android.R.string.ok, (dialog, which) -> {
if (activity instanceof MainActivity) {
((MainActivity) activity).getBottomSheet().setState(BottomSheetBehavior.STATE_COLLAPSED);
}
});
errorDialog.create().show();
}
}