summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2011-08-04 17:49:56 +0800
committerWu-cheng Li <wuchengli@google.com>2011-08-05 15:47:16 +0800
commitc6bf6547259e75a4fc0e3ac61ab589f456031837 (patch)
tree37bc72c1b5812e5909db9dd67a264469ff013537 /src
parenta955261dd734524eb7d8e1af76c695122efc8aa7 (diff)
downloadLegacyCamera-c6bf6547259e75a4fc0e3ac61ab589f456031837.zip
LegacyCamera-c6bf6547259e75a4fc0e3ac61ab589f456031837.tar.gz
LegacyCamera-c6bf6547259e75a4fc0e3ac61ab589f456031837.tar.bz2
Enables zoom buttons during recording.
This also fixes indicator buttons are not disabled during snapshot. bug:5029304 Change-Id: I4496d8333ecb0c6e02e30cd4eb1f7424b95a9912
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/ui/AbstractIndicatorButton.java3
-rw-r--r--src/com/android/camera/ui/IndicatorControl.java13
-rw-r--r--src/com/android/camera/ui/IndicatorWheel.java30
3 files changed, 31 insertions, 15 deletions
diff --git a/src/com/android/camera/ui/AbstractIndicatorButton.java b/src/com/android/camera/ui/AbstractIndicatorButton.java
index 414ec4e..07cdf0d 100644
--- a/src/com/android/camera/ui/AbstractIndicatorButton.java
+++ b/src/com/android/camera/ui/AbstractIndicatorButton.java
@@ -23,7 +23,6 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
-import android.widget.ImageView;
// This is an indicator button and pressing it opens a popup window. Ex: flash or other settings.
public abstract class AbstractIndicatorButton extends RotateImageView {
@@ -53,6 +52,8 @@ public abstract class AbstractIndicatorButton extends RotateImageView {
@Override
public boolean onTouchEvent(MotionEvent ev) {
+ if (!isEnabled()) return false;
+
int action = ev.getAction();
if (action == MotionEvent.ACTION_DOWN && !isOverridden()) {
if (mPopup == null || mPopup.getVisibility() != View.VISIBLE) {
diff --git a/src/com/android/camera/ui/IndicatorControl.java b/src/com/android/camera/ui/IndicatorControl.java
index 2791c20..5a2a72c 100644
--- a/src/com/android/camera/ui/IndicatorControl.java
+++ b/src/com/android/camera/ui/IndicatorControl.java
@@ -174,4 +174,17 @@ public abstract class IndicatorControl extends ViewGroup implements
b.reloadPreferences();
}
}
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ final int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ View v = getChildAt(i);
+ // Zoom buttons and shutter button are controlled by the activity.
+ if (v instanceof AbstractIndicatorButton) {
+ v.setEnabled(enabled);
+ }
+ }
+ }
}
diff --git a/src/com/android/camera/ui/IndicatorWheel.java b/src/com/android/camera/ui/IndicatorWheel.java
index ac336c1..fa2a1d3 100644
--- a/src/com/android/camera/ui/IndicatorWheel.java
+++ b/src/com/android/camera/ui/IndicatorWheel.java
@@ -28,8 +28,6 @@ import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
-import java.util.ArrayList;
-
/**
* A view that contains shutter button and camera setting indicators. The
* indicators are spreaded around the shutter button. The first child is always
@@ -107,7 +105,6 @@ public class IndicatorWheel extends IndicatorControl {
}
return false;
}
- if (!isEnabled()) return false;
double dx = event.getX() - mCenterX;
double dy = mCenterY - event.getY();
@@ -134,30 +131,35 @@ public class IndicatorWheel extends IndicatorControl {
// Zoom button or back/front camera switch is pressed.
dismissSettingPopup();
}
- child.dispatchTouchEvent(event);
+ if (child.dispatchTouchEvent(event)) {
+ mPressedIndex = i;
+ }
invalidate();
- mPressedIndex = i;
} else if (action == MotionEvent.ACTION_UP) {
child.dispatchTouchEvent(event);
invalidate();
mPressedIndex = -1;
} else if (action == MotionEvent.ACTION_MOVE) {
// Dispatch the event if the location across a sector.
- if (mPressedIndex != -1 && i != mPressedIndex) {
+ if (i != mPressedIndex) {
dismissSettingPopup();
// Cancel the previous one.
- View cancelChild = getChildAt(mPressedIndex + 1);
- event.setAction(MotionEvent.ACTION_CANCEL);
- cancelChild.dispatchTouchEvent(event);
+ if (mPressedIndex != -1) {
+ View cancelChild = getChildAt(mPressedIndex + 1);
+ event.setAction(MotionEvent.ACTION_CANCEL);
+ cancelChild.dispatchTouchEvent(event);
+ mPressedIndex = -1;
+ }
// Send down to the current one.
event.setAction(MotionEvent.ACTION_DOWN);
- child.dispatchTouchEvent(event);
- event.setAction(action); // Set the action back
+ if (child.dispatchTouchEvent(event)) {
+ mPressedIndex = i;
+ }
invalidate();
}
- // The children do not care about ACTION_MOVE. Besides, the press
- // state will be wrong because of View.pointInView.
- mPressedIndex = i;
+ // The children do not care about ACTION_MOVE.
+ // Besides, the press state will be wrong
+ // because of View.pointInView.
}
return true;
}