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