diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-02-24 21:00:12 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-24 21:00:12 -0800 |
commit | bc0127d436aa8f107100cb258ed9d058fc73dd61 (patch) | |
tree | d752ccce0536da965a9f2d2c861d54f8bcebb98c /src/com/android/camera | |
parent | 0565270359fe5bb01699bd9ff602b6ef949e0b72 (diff) | |
parent | 248232e937007384328592e0c269b42cf03c6899 (diff) | |
download | LegacyCamera-bc0127d436aa8f107100cb258ed9d058fc73dd61.zip LegacyCamera-bc0127d436aa8f107100cb258ed9d058fc73dd61.tar.gz LegacyCamera-bc0127d436aa8f107100cb258ed9d058fc73dd61.tar.bz2 |
Merge "Make arc-shaped animation in time-lapse recording look better."
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/ui/IndicatorWheel.java | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/com/android/camera/ui/IndicatorWheel.java b/src/com/android/camera/ui/IndicatorWheel.java index 77ca59f..b2ea30e 100644 --- a/src/com/android/camera/ui/IndicatorWheel.java +++ b/src/com/android/camera/ui/IndicatorWheel.java @@ -81,7 +81,6 @@ public class IndicatorWheel extends ViewGroup implements private int mTimeLapseInterval; // in ms private long mRecordingStartTime = 0; private long mNumberOfFrames = 0; - private float mLastEndAngle; private Context mContext; private PreferenceGroup mPreferenceGroup; @@ -93,13 +92,6 @@ public class IndicatorWheel extends ViewGroup implements // The previous view that has the animation. The animation may have stopped. private View mPrevAnimatingView; - private Handler mHandler = new Handler(); - private final Runnable mRunnable = new Runnable() { - public void run() { - invalidate(); - } - }; - static public interface Listener { public void onSharedPreferenceChanged(); public void onRestorePreferencesClicked(); @@ -218,7 +210,7 @@ public class IndicatorWheel extends ViewGroup implements super.onFinishInflate(); // The first view is shutter button. mShutterButton = getChildAt(0); - mHandler.postDelayed(mRunnable, 0); + invalidate(); } public void removeIndicators() { @@ -318,7 +310,6 @@ public class IndicatorWheel extends ViewGroup implements mTimeLapseInterval = timeLapseInterval; mRecordingStartTime = startTime; mNumberOfFrames = 0; - mLastEndAngle = 0f; invalidate(); } @@ -363,23 +354,18 @@ public class IndicatorWheel extends ViewGroup implements // Compute the start angle and sweep angle. long timeDelta = SystemClock.uptimeMillis() - mRecordingStartTime; long numberOfFrames = timeDelta / mTimeLapseInterval; - float sweepAngle, startAngle; - float endAngle = ((float) timeDelta) % mTimeLapseInterval / mTimeLapseInterval * 360f; + float sweepAngle; if (numberOfFrames > mNumberOfFrames) { - // The arc just acrosses 0 degree. Draw the arc from the degree - // of last onDraw. Otherwise some parts of the arc will be never - // drawn. - startAngle = mLastEndAngle; - sweepAngle = endAngle + 360f - mLastEndAngle; + // The arc just acrosses 0 degree. Draw a full circle so it + // looks better. + sweepAngle = 360; mNumberOfFrames = numberOfFrames; } else { - startAngle = 0; - sweepAngle = endAngle; + sweepAngle = timeDelta % mTimeLapseInterval * 360f / mTimeLapseInterval; } - mLastEndAngle = endAngle; - canvas.drawArc(mBackgroundRect, startAngle, sweepAngle, false, mBackgroundPaint); - mHandler.postDelayed(mRunnable, 0); + canvas.drawArc(mBackgroundRect, 0, sweepAngle, false, mBackgroundPaint); + invalidate(); } super.onDraw(canvas); |