From 409362ddb4b066077aae7e84bed924c6040d139d Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Wed, 3 Jan 2024 00:48:26 +0100 Subject: launcher: Remove intro video when not supported Previously, this would trigger an error popup and make the activity unresponsive. --- srcs/juloo.keyboard2/LauncherActivity.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'srcs/juloo.keyboard2') diff --git a/srcs/juloo.keyboard2/LauncherActivity.java b/srcs/juloo.keyboard2/LauncherActivity.java index 8b89770..f766466 100644 --- a/srcs/juloo.keyboard2/LauncherActivity.java +++ b/srcs/juloo.keyboard2/LauncherActivity.java @@ -48,7 +48,7 @@ public class LauncherActivity extends Activity imm.showInputMethodPicker(); } - static void setup_intro_video(VideoView v) + static void setup_intro_video(final VideoView v) { if (VERSION.SDK_INT >= 26) v.setAudioFocusRequest(AudioManager.AUDIOFOCUS_NONE); @@ -57,10 +57,21 @@ public class LauncherActivity extends Activity v.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override - public void onPrepared(MediaPlayer mp) { + public void onPrepared(MediaPlayer mp) + { mp.setLooping(true); } }); + v.setOnErrorListener(new MediaPlayer.OnErrorListener() + { + @Override + public boolean onError(MediaPlayer mp, int what, int extra) + { + v.stopPlayback(); + v.setVisibility(View.GONE); + return true; + } + }); v.start(); } -- cgit v1.2.3