diff options
author | Chung-yih Wang <cywang@google.com> | 2011-09-07 17:56:47 +0800 |
---|---|---|
committer | Chung-yih Wang <cywang@google.com> | 2011-09-07 17:56:47 +0800 |
commit | f09f58c11f3e6b5670cfb1317bb2d7cf1e412d7c (patch) | |
tree | de75a2af023b05ee92684facc7ffacaaba5c9bdd /src/com/android/camera | |
parent | 03e53d81e5d64542fba64565962b9c0049525f71 (diff) | |
download | packages_apps_LegacyCamera-f09f58c11f3e6b5670cfb1317bb2d7cf1e412d7c.zip packages_apps_LegacyCamera-f09f58c11f3e6b5670cfb1317bb2d7cf1e412d7c.tar.gz packages_apps_LegacyCamera-f09f58c11f3e6b5670cfb1317bb2d7cf1e412d7c.tar.bz2 |
Fix Divide-By-Zero bugs.
bug:5261752
Change-Id: I780e1e1187242b6f44e6844b92b7a9eac2d3b1d1
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/ui/IndicatorControlWheel.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/ui/ZoomControl.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/ui/ZoomControlWheel.java | 1 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/camera/ui/IndicatorControlWheel.java b/src/com/android/camera/ui/IndicatorControlWheel.java index 9279cc2..9be34b5 100644 --- a/src/com/android/camera/ui/IndicatorControlWheel.java +++ b/src/com/android/camera/ui/IndicatorControlWheel.java @@ -367,7 +367,7 @@ public class IndicatorControlWheel extends IndicatorControl implements private void presetSecondLevelChildRadians() { int count = getChildCountByLevel(1); - int sectors = (count <= 1) ? 0 : (count - 1); + int sectors = (count <= 1) ? 1 : (count - 1); double sectorDegrees = ((SECOND_LEVEL_END_DEGREES - SECOND_LEVEL_START_DEGREES) / sectors); mSectorRadians[1] = Math.toRadians(sectorDegrees); diff --git a/src/com/android/camera/ui/ZoomControl.java b/src/com/android/camera/ui/ZoomControl.java index 6ab2573..be2bdb9 100644 --- a/src/com/android/camera/ui/ZoomControl.java +++ b/src/com/android/camera/ui/ZoomControl.java @@ -130,7 +130,11 @@ public abstract class ZoomControl extends RelativeLayout { } mZoomIndex = index; if (mIndexListener != null) { - mIndexListener.onZoomIndexChanged(1.0d * mZoomIndex / mZoomMax); + if (mZoomMax == 0) { + mIndexListener.onZoomIndexChanged(0.0d); + } else { + mIndexListener.onZoomIndexChanged(1.0d * mZoomIndex / mZoomMax); + } } invalidate(); } diff --git a/src/com/android/camera/ui/ZoomControlWheel.java b/src/com/android/camera/ui/ZoomControlWheel.java index aa8ae4e..bb70ddf 100644 --- a/src/com/android/camera/ui/ZoomControlWheel.java +++ b/src/com/android/camera/ui/ZoomControlWheel.java @@ -145,6 +145,7 @@ public class ZoomControlWheel extends ZoomControl { } private double getZoomIndexAngle() { + if (mZoomMax == 0) return Math.PI; return Math.toRadians(MAX_SLIDER_ANGLE - (MAX_SLIDER_ANGLE - MIN_SLIDER_ANGLE) * mZoomIndex / mZoomMax); } |