diff options
| author | Jules Aguillon | 2024-01-03 00:48:26 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2024-01-03 00:48:26 +0100 |
| commit | 409362ddb4b066077aae7e84bed924c6040d139d (patch) | |
| tree | b643d04a615ec778b7d5385d6ac68cdabc21fc1f | |
| parent | c524caa6f1d13e6bfb5f88d8a8c8512d23dd5294 (diff) | |
| download | unexpected-keyboard-409362ddb4b066077aae7e84bed924c6040d139d.tar.gz unexpected-keyboard-409362ddb4b066077aae7e84bed924c6040d139d.zip | |
launcher: Remove intro video when not supported
Previously, this would trigger an error popup and make the activity
unresponsive.
| -rw-r--r-- | srcs/juloo.keyboard2/LauncherActivity.java | 15 |
1 files changed, 13 insertions, 2 deletions
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(); } |
