diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/setup')
-rw-r--r-- | java/src/com/android/inputmethod/latin/setup/SetupActivity.java | 4 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/setup/SetupStartIndicatorView.java | 31 |
2 files changed, 27 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/setup/SetupActivity.java b/java/src/com/android/inputmethod/latin/setup/SetupActivity.java index 044180bd6..bf24b11eb 100644 --- a/java/src/com/android/inputmethod/latin/setup/SetupActivity.java +++ b/java/src/com/android/inputmethod/latin/setup/SetupActivity.java @@ -30,6 +30,7 @@ import android.util.Log; import android.view.View; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; +import android.widget.ImageView; import android.widget.TextView; import android.widget.VideoView; @@ -201,11 +202,14 @@ public final class SetupActivity extends Activity implements View.OnClickListene mWelcomeVideoView.setBackgroundResource(0); } }); + final ImageView welcomeImageView = (ImageView)findViewById(R.id.setup_welcome_image); mWelcomeVideoView.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); mWelcomeVideoView.setVisibility(View.GONE); + welcomeImageView.setImageResource(R.raw.setup_welcome_image); + welcomeImageView.setVisibility(View.VISIBLE); return true; } }); diff --git a/java/src/com/android/inputmethod/latin/setup/SetupStartIndicatorView.java b/java/src/com/android/inputmethod/latin/setup/SetupStartIndicatorView.java index ca974f6b8..974dfddd3 100644 --- a/java/src/com/android/inputmethod/latin/setup/SetupStartIndicatorView.java +++ b/java/src/com/android/inputmethod/latin/setup/SetupStartIndicatorView.java @@ -51,11 +51,32 @@ public final class SetupStartIndicatorView extends LinearLayout { mIndicatorView = indicatorView; } + // TODO: Once we stop supporting ICS, uncomment {@link #setPressed(boolean)} method and + // remove this method. @Override - public void setPressed(final boolean pressed) { - super.setPressed(pressed); + protected void drawableStateChanged() { + super.drawableStateChanged(); + for (final int state : getDrawableState()) { + if (state == android.R.attr.state_pressed) { + updateIndicatorView(true /* pressed */); + return; + } + } + updateIndicatorView(false /* pressed */); + } + + // TODO: Once we stop supporting ICS, uncomment this method and remove + // {@link #drawableStateChanged()} method. +// @Override +// public void setPressed(final boolean pressed) { +// super.setPressed(pressed); +// updateIndicatorView(pressed); +// } + + private void updateIndicatorView(final boolean pressed) { if (mIndicatorView != null) { mIndicatorView.setPressed(pressed); + mIndicatorView.invalidate(); } } } @@ -73,12 +94,6 @@ public final class SetupStartIndicatorView extends LinearLayout { } @Override - public void setPressed(final boolean pressed) { - super.setPressed(pressed); - invalidate(); - } - - @Override protected void onDraw(final Canvas canvas) { super.onDraw(canvas); final int layoutDirection = ViewCompatUtils.getLayoutDirection(this); |