Fix an issue on the transition between the setup and the settings

Bug: 8853220

Change-Id: I99b6c46d900e9391f77986d1ae6e3edeaeff01e5
This commit is contained in:
Tadashi G. Takaoka 2013-05-08 12:09:04 +09:00 committed by Satoshi Kataoka
parent 244a24e368
commit 331d256f21

View file

@ -190,18 +190,13 @@ public final class SetupActivity extends Activity implements View.OnClickListene
.path(Integer.toString(R.raw.setup_welcome_video))
.build();
mWelcomeVideoView = (VideoView)findViewById(R.id.setup_welcome_video);
mWelcomeVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(final MediaPlayer mp) {
mp.start();
}
});
mWelcomeVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(final MediaPlayer mp) {
// Now VideoView has been laid-out and ready to play, remove background of it to
// reveal the video.
mWelcomeVideoView.setBackgroundResource(0);
mp.setLooping(true);
}
});
final ImageView welcomeImageView = (ImageView)findViewById(R.id.setup_welcome_image);
@ -365,9 +360,14 @@ public final class SetupActivity extends Activity implements View.OnClickListene
super.onBackPressed();
}
private static void hideAndStopVideo(final VideoView videoView) {
videoView.stopPlayback();
videoView.setVisibility(View.INVISIBLE);
}
@Override
protected void onPause() {
mWelcomeVideoView.stopPlayback();
hideAndStopVideo(mWelcomeVideoView);
super.onPause();
}
@ -385,11 +385,12 @@ public final class SetupActivity extends Activity implements View.OnClickListene
mWelcomeScreen.setVisibility(welcomeScreen ? View.VISIBLE : View.GONE);
mSetupScreen.setVisibility(welcomeScreen ? View.GONE: View.VISIBLE);
if (welcomeScreen) {
mWelcomeVideoView.setVisibility(View.VISIBLE);
mWelcomeVideoView.setVideoURI(mWelcomeVideoUri);
mWelcomeVideoView.start();
return;
}
mWelcomeVideoView.stopPlayback();
hideAndStopVideo(mWelcomeVideoView);
final boolean isStepActionAlreadyDone = mStepNumber < determineSetupStepNumber();
mSetupStepGroup.enableStep(mStepNumber, isStepActionAlreadyDone);
mActionNext.setVisibility(isStepActionAlreadyDone ? View.VISIBLE : View.GONE);