summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2011-02-24 21:00:12 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-02-24 21:00:12 -0800
commitbc0127d436aa8f107100cb258ed9d058fc73dd61 (patch)
treed752ccce0536da965a9f2d2c861d54f8bcebb98c /src/com/android/camera
parent0565270359fe5bb01699bd9ff602b6ef949e0b72 (diff)
parent248232e937007384328592e0c269b42cf03c6899 (diff)
downloadLegacyCamera-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.java30
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);