diff options
author | Owen Lin <> | 2009-03-27 16:30:02 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-27 16:30:02 -0700 |
commit | 31817e9f8ce6215307ff0bdc33c28bde2de2f867 (patch) | |
tree | cb31e0c1a3bdb82b73edc69f6dea11f225d4508a /src/com/android/camera/ViewImage.java | |
parent | eb9d8a271a8c16514cc75a0ba1c54cfcf5d311fd (diff) | |
download | LegacyCamera-31817e9f8ce6215307ff0bdc33c28bde2de2f867.zip LegacyCamera-31817e9f8ce6215307ff0bdc33c28bde2de2f867.tar.gz LegacyCamera-31817e9f8ce6215307ff0bdc33c28bde2de2f867.tar.bz2 |
AI 143178: am: CL 142891 Fix issue 1578783. Show the on screen controlls when user tap on the screen
so that it won't get dissapeared.
Also fix layout issue in camera review mode. The shutter button is misplaced
by 5 pixel in both X, Y coordinate.
Use next/prev buttons to go to next/prev images in all cases. Also set the
height these buttons as screen's height so that it works as same as before.
Original author: owenlin
Merged from: //branches/cupcake/...
Automated import of CL 143178
Diffstat (limited to 'src/com/android/camera/ViewImage.java')
-rw-r--r-- | src/com/android/camera/ViewImage.java | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/com/android/camera/ViewImage.java b/src/com/android/camera/ViewImage.java index f1f25b7..00445a0 100644 --- a/src/com/android/camera/ViewImage.java +++ b/src/com/android/camera/ViewImage.java @@ -55,7 +55,6 @@ import com.android.camera.ImageManager.IImage; public class ViewImage extends Activity implements View.OnClickListener { private static final String TAG = "ViewImage"; - private static final int TOUCH_AREA_WIDTH = 60; private ImageGetter mGetter; private Uri mSavedUri; @@ -164,19 +163,36 @@ public class ViewImage extends Activity implements View.OnClickListener } private void showOnScreenControls() { + mHandler.removeCallbacks(mDismissOnScreenControlsRunnable); updateNextPrevControls(); updateZoomButtonsEnabled(); mZoomButtonsController.setVisible(true); - scheduleDismissOnScreenControls(); } @Override public boolean dispatchTouchEvent(MotionEvent m) { boolean sup = super.dispatchTouchEvent(m); + + // This is a hack to show the on screen controls. We should make sure + // this event is not handled by others(ie. sup == false), and listen for + // the events on zoom/prev/next buttons. + // However, since we have no other pressable views, it is OK now. + // TODO: Fix the above issue. + if (mMode == MODE_NORMAL) { + switch (m.getAction()) { + case MotionEvent.ACTION_DOWN: + showOnScreenControls(); + break; + case MotionEvent.ACTION_UP: + scheduleDismissOnScreenControls(); + break; + } + } + if (sup == false) { if (mMode == MODE_SLIDESHOW) { mSlideShowImageViews[mSlideShowImageCurrent].handleTouchEvent(m); - } else if (mMode == MODE_NORMAL){ + } else if (mMode == MODE_NORMAL) { mImageViews[1].handleTouchEvent(m); } return true; @@ -225,7 +241,6 @@ public class ViewImage extends Activity implements View.OnClickListener } else { mImageViews[1].zoomOut(); } - showOnScreenControls(); } }); } @@ -241,22 +256,12 @@ public class ViewImage extends Activity implements View.OnClickListener imageView.postTranslate(-distanceX, -distanceY, sUseBounce); imageView.center(true, true, false); } - showOnScreenControls(); return true; } @Override public boolean onSingleTapUp(MotionEvent e) { - int viewWidth = mImageViews[1].getWidth(); - int x = (int) e.getX(); - int y = (int) e.getY(); - if (x < TOUCH_AREA_WIDTH) { - moveNextOrPrevious(-1); - } else if (x > viewWidth - TOUCH_AREA_WIDTH) { - moveNextOrPrevious(1); - } setMode(MODE_NORMAL); - showOnScreenControls(); return true; } } @@ -314,9 +319,6 @@ public class ViewImage extends Activity implements View.OnClickListener protected void postTranslate(float dx, float dy, boolean bounceOK) { super.postTranslate(dx, dy); - if (dx != 0F || dy != 0F) { - mViewImage.showOnScreenControls(); - } if (!sUseBounce) { center(true, false, false); @@ -567,6 +569,7 @@ public class ViewImage extends Activity implements View.OnClickListener .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { showOnScreenControls(); + scheduleDismissOnScreenControls(); return true; } }) @@ -967,6 +970,7 @@ public class ViewImage extends Activity implements View.OnClickListener } showOnScreenControls(); + scheduleDismissOnScreenControls(); } @Override |