am 769427cf: Adjust aspect ratio of setup image
* commit '769427cff24944958f5f1f6179090a86444f3eab': Adjust aspect ratio of setup imagemain
commit
c52793c076
|
@ -26,7 +26,6 @@
|
|||
android:paddingTop="@dimen/setup_welcome_video_vertical_margin"
|
||||
android:paddingBottom="@dimen/setup_welcome_video_vertical_margin">
|
||||
<LinearLayout
|
||||
android:id="@+id/setup_welcome_video_frame"
|
||||
android:layout_weight="@integer/setup_welcome_video_weight_in_screen"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -42,6 +41,7 @@
|
|||
android:id="@+id/setup_welcome_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
<View
|
||||
|
|
|
@ -27,7 +27,6 @@ import android.os.Message;
|
|||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
@ -47,11 +46,14 @@ import java.util.ArrayList;
|
|||
public final class SetupWizardActivity extends Activity implements View.OnClickListener {
|
||||
static final String TAG = SetupWizardActivity.class.getSimpleName();
|
||||
|
||||
private static final boolean ENABLE_WELCOME_VIDEO = true;
|
||||
|
||||
private View mSetupWizard;
|
||||
private View mWelcomeScreen;
|
||||
private View mSetupScreen;
|
||||
private Uri mWelcomeVideoUri;
|
||||
private VideoView mWelcomeVideoView;
|
||||
private ImageView mWelcomeImageView;
|
||||
private View mActionStart;
|
||||
private View mActionNext;
|
||||
private TextView mStep1Bullet;
|
||||
|
@ -192,23 +194,16 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
|
|||
mp.setLooping(true);
|
||||
}
|
||||
});
|
||||
final ImageView welcomeImageView = (ImageView)findViewById(R.id.setup_welcome_image);
|
||||
welcomeVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
|
||||
@Override
|
||||
public boolean onError(final MediaPlayer mp, final int what, final int extra) {
|
||||
Log.e(TAG, "Playing welcome video causes error: what=" + what + " extra=" + extra);
|
||||
welcomeVideoView.setVisibility(View.GONE);
|
||||
welcomeImageView.setImageResource(R.raw.setup_welcome_image);
|
||||
welcomeImageView.setVisibility(View.VISIBLE);
|
||||
// Remove unnecessary light gray background around still image.
|
||||
final ViewGroup videoFrame = (ViewGroup)findViewById(
|
||||
R.id.setup_welcome_video_frame);
|
||||
videoFrame.setBackgroundColor(getResources().getColor(R.color.setup_background));
|
||||
videoFrame.requestLayout();
|
||||
hideWelcomeVideoAndShowWelcomeImage();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mWelcomeVideoView = welcomeVideoView;
|
||||
mWelcomeImageView = (ImageView)findViewById(R.id.setup_welcome_image);
|
||||
|
||||
mActionStart = findViewById(R.id.setup_start_label);
|
||||
mActionStart.setOnClickListener(this);
|
||||
|
@ -350,14 +345,26 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
|
|||
super.onBackPressed();
|
||||
}
|
||||
|
||||
private static void hideAndStopVideo(final VideoView videoView) {
|
||||
videoView.stopPlayback();
|
||||
videoView.setVisibility(View.INVISIBLE);
|
||||
void hideWelcomeVideoAndShowWelcomeImage() {
|
||||
mWelcomeVideoView.setVisibility(View.GONE);
|
||||
mWelcomeImageView.setImageResource(R.raw.setup_welcome_image);
|
||||
mWelcomeImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void showAndStartWelcomeVideo() {
|
||||
mWelcomeVideoView.setVisibility(View.VISIBLE);
|
||||
mWelcomeVideoView.setVideoURI(mWelcomeVideoUri);
|
||||
mWelcomeVideoView.start();
|
||||
}
|
||||
|
||||
private void hideAndStopWelcomeVideo() {
|
||||
mWelcomeVideoView.stopPlayback();
|
||||
mWelcomeVideoView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
hideAndStopVideo(mWelcomeVideoView);
|
||||
hideAndStopWelcomeVideo();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
@ -376,12 +383,14 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
|
|||
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();
|
||||
if (ENABLE_WELCOME_VIDEO) {
|
||||
showAndStartWelcomeVideo();
|
||||
} else {
|
||||
hideWelcomeVideoAndShowWelcomeImage();
|
||||
}
|
||||
return;
|
||||
}
|
||||
hideAndStopVideo(mWelcomeVideoView);
|
||||
hideAndStopWelcomeVideo();
|
||||
final boolean isStepActionAlreadyDone = mStepNumber < determineSetupStepNumber();
|
||||
mSetupStepGroup.enableStep(mStepNumber, isStepActionAlreadyDone);
|
||||
mActionNext.setVisibility(isStepActionAlreadyDone ? View.VISIBLE : View.GONE);
|
||||
|
|
Loading…
Reference in New Issue