Skip to content

Commit

Permalink
launcher: Remove intro video when not supported
Browse files Browse the repository at this point in the history
Previously, this would trigger an error popup and make the activity
unresponsive.
  • Loading branch information
Julow committed Jan 2, 2024
1 parent c524caa commit 409362d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions srcs/juloo.keyboard2/LauncherActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void launch_imepicker(View v)
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);
Expand All @@ -57,10 +57,21 @@ static void setup_intro_video(VideoView v)
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();
}

Expand Down

0 comments on commit 409362d

Please sign in to comment.