am 873f9b90: am 6435c800: Merge "Fix an issue on the transition between the setup and the settings"

* commit '873f9b90f78857b13328a4a518d1aa8fa4b4f4eb':
  Fix an issue on the transition between the setup and the settings
main
Satoshi Kataoka 2013-05-15 12:46:53 -07:00 committed by Android Git Automerger
commit 7fdd34317d
1 changed files with 9 additions and 8 deletions

View File

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