diff options
author | Owen Lin <owenlin@google.com> | 2010-02-03 16:31:38 -0800 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2010-02-03 16:50:52 -0800 |
commit | 4ea5d83539da6ab77a56415f69e9d5dbe205766a (patch) | |
tree | bf142a0ba24a23135de5c71b3efead5868ae26b5 /src | |
parent | cc0a1360f79b09e34a96123b6cb26c6a0ac7c5df (diff) | |
download | LegacyCamera-4ea5d83539da6ab77a56415f69e9d5dbe205766a.zip LegacyCamera-4ea5d83539da6ab77a56415f69e9d5dbe205766a.tar.gz LegacyCamera-4ea5d83539da6ab77a56415f69e9d5dbe205766a.tar.bz2 |
Fix the switcher could be in wrong place some time.
Change-Id: I504978763da3da797f71ca9fd00116d8b27729ee
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/Switcher.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/android/camera/Switcher.java b/src/com/android/camera/Switcher.java index 6a62b57..959022d 100644 --- a/src/com/android/camera/Switcher.java +++ b/src/com/android/camera/Switcher.java @@ -20,6 +20,7 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.util.AttributeSet; +import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.animation.AnimationUtils; @@ -45,7 +46,7 @@ public class Switcher extends ImageView implements View.OnTouchListener { private boolean mSwitch = false; private int mPosition = 0; - private long mAnimationStartTime = 0; + private long mAnimationStartTime = NO_ANIMATION; private int mAnimationStartPosition; private OnSwitchListener mListener; @@ -141,9 +142,9 @@ public class Switcher extends ImageView implements View.OnTouchListener { return; // nothing to draw (empty bounds) } + final int available = getHeight() - getPaddingTop() + - getPaddingBottom() - drawableHeight; if (mAnimationStartTime != NO_ANIMATION) { - final int available = getHeight() - getPaddingTop() - getPaddingBottom() - - drawableHeight; long time = AnimationUtils.currentAnimationTimeMillis(); int deltaTime = (int) (time - mAnimationStartTime); mPosition = mAnimationStartPosition + @@ -156,9 +157,13 @@ public class Switcher extends ImageView implements View.OnTouchListener { } else { mAnimationStartTime = NO_ANIMATION; } + } else { + mPosition = mSwitch ? available : 0; } - int offsetTop = getPaddingTop() + mPosition; + Log.v(TAG, "mPosition = " + mPosition + + ", mAnimationStartTime = " + mAnimationStartTime + + ", mSwitch = " + mSwitch); int offsetLeft = (getWidth() - drawableWidth - getPaddingLeft() - getPaddingRight()) / 2; int saveCount = canvas.getSaveCount(); |