diff options
author | Chung-yih Wang <cywang@google.com> | 2011-08-24 23:48:29 +0800 |
---|---|---|
committer | Chung-yih Wang <cywang@google.com> | 2011-08-29 17:21:24 +0800 |
commit | ab2ffa88872149978823c3184d0af162d3cdca13 (patch) | |
tree | a44ada0a2acc03353fe87a0cd4ed29040e4eddcf /src/com/android/camera/ui/IndicatorControlBar.java | |
parent | 5f47cc1a9ce83a5656751df5705674a1711687d1 (diff) | |
download | LegacyCamera-ab2ffa88872149978823c3184d0af162d3cdca13.zip LegacyCamera-ab2ffa88872149978823c3184d0af162d3cdca13.tar.gz LegacyCamera-ab2ffa88872149978823c3184d0af162d3cdca13.tar.bz2 |
Add ZoomControlWheel.
bug:5083780
Change-Id: I1a18c247d638edd3f8e5e0588170b6820f280f96
Diffstat (limited to 'src/com/android/camera/ui/IndicatorControlBar.java')
-rw-r--r-- | src/com/android/camera/ui/IndicatorControlBar.java | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/com/android/camera/ui/IndicatorControlBar.java b/src/com/android/camera/ui/IndicatorControlBar.java index 6c2d15f..748e23c 100644 --- a/src/com/android/camera/ui/IndicatorControlBar.java +++ b/src/com/android/camera/ui/IndicatorControlBar.java @@ -21,6 +21,7 @@ import com.android.camera.R; import android.content.Context; import android.util.AttributeSet; +import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; @@ -28,7 +29,7 @@ import android.widget.ImageView; * A view that contains the top-level indicator control. */ public class IndicatorControlBar extends IndicatorControl implements - View.OnClickListener { + View.OnClickListener, View.OnTouchListener { private static final String TAG = "IndicatorControlBar"; private ImageView mZoomIcon; @@ -41,7 +42,8 @@ public class IndicatorControlBar extends IndicatorControl implements public void initialize(Context context, PreferenceGroup group, String flashSetting, boolean zoomSupported) { // From UI spec, we have camera_flash setting on the first level. - super.initialize(context, group, new String[] {flashSetting}, null); + setPreferenceGroup(group); + addControls(new String[] {flashSetting}, null); // Add CameraPicker control. initializeCameraPicker(); @@ -49,7 +51,7 @@ public class IndicatorControlBar extends IndicatorControl implements // add Zoom Icon. if (zoomSupported) { mZoomIcon = (ImageView) findViewById(R.id.zoom_control_icon); - mZoomIcon.setOnClickListener(this); + mZoomIcon.setOnTouchListener(this); mZoomIcon.setVisibility(View.VISIBLE); } @@ -58,15 +60,21 @@ public class IndicatorControlBar extends IndicatorControl implements requestLayout(); } - public void onClick(View view) { + public boolean onTouch(View v, MotionEvent event) { dismissSettingPopup(); - if (view == mZoomIcon) { - mOnIndicatorEventListener.onIndicatorEvent( - OnIndicatorEventListener.EVENT_ENTER_ZOOM_CONTROL_BAR); - } else if (view == mSecondLevelIcon) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { mOnIndicatorEventListener.onIndicatorEvent( - OnIndicatorEventListener.EVENT_ENTER_SECOND_LEVEL_INDICATOR_BAR); + OnIndicatorEventListener.EVENT_ENTER_ZOOM_CONTROL); + return true; } + return false; + } + + public void onClick(View view) { + dismissSettingPopup(); + // Only for the click on mSecondLevelIcon. + mOnIndicatorEventListener.onIndicatorEvent( + OnIndicatorEventListener.EVENT_ENTER_SECOND_LEVEL_INDICATOR_BAR); } @Override |