diff options
author | Doris Liu <tianliu@google.com> | 2013-03-04 22:19:10 -0800 |
---|---|---|
committer | Doris Liu <tianliu@google.com> | 2013-03-05 14:11:05 -0800 |
commit | 8d2d0f5f0f7fffce9dbcc70da6924af545eba26d (patch) | |
tree | 0c61af8e47a3006ec901ca3fd0a3a68c07d21e0f /src/com/android/camera/CameraActivity.java | |
parent | a0adf2113b8728d92f270953ca8cab50335fe68e (diff) | |
download | android_packages_apps_Gallery2-8d2d0f5f0f7fffce9dbcc70da6924af545eba26d.tar.gz android_packages_apps_Gallery2-8d2d0f5f0f7fffce9dbcc70da6924af545eba26d.tar.bz2 android_packages_apps_Gallery2-8d2d0f5f0f7fffce9dbcc70da6924af545eba26d.zip |
Keep camera controls on the same physical side
Change-Id: I09c50650c77a89fadfeb376564ef43e750994f8a
Diffstat (limited to 'src/com/android/camera/CameraActivity.java')
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index eed347079..b1f0847d8 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -61,7 +61,6 @@ public class CameraActivity extends ActivityBase private View mCameraControls; private View mControlsBackground; private View mPieMenuButton; - private View mSwitcherControl; private Drawable[] mDrawables; private int mCurrentModuleIndex; private MotionEvent mDown; @@ -122,8 +121,7 @@ public class CameraActivity extends ActivityBase mCameraControls = findViewById(R.id.camera_controls); mShutter = (ShutterButton) findViewById(R.id.shutter_button); mSwitcher = (CameraSwitcher) findViewById(R.id.camera_switcher); - mPieMenuButton = findViewById(R.id.menu_button); - mSwitcherControl = findViewById(R.id.switcher_control); + mPieMenuButton = findViewById(R.id.menu); int totaldrawid = (LightCycleHelper.hasLightCycleCapture(this) ? DRAW_IDS.length : DRAW_IDS.length - 1); if (!ApiHelper.HAS_OLD_PANORAMA) totaldrawid--; @@ -222,11 +220,8 @@ public class CameraActivity extends ActivityBase mCurrentModule = LightCycleHelper.createPanoramaModule(); break; } - if (mCurrentModule.needsPieMenu()) { - mPieMenuButton.setVisibility(View.VISIBLE); - } else { - mPieMenuButton.setVisibility(View.INVISIBLE); - } + showPieMenuButton(mCurrentModule.needsPieMenu()); + openModule(mCurrentModule, canReuse); mCurrentModule.onOrientationChanged(mLastRawOrientation); if (mMediaSaveService != null) { @@ -236,6 +231,18 @@ public class CameraActivity extends ActivityBase getCameraScreenNail().setOnFrameDrawnOneShot(mOnFrameDrawn); } + public void showPieMenuButton(boolean show) { + if (show) { + findViewById(R.id.blocker).setVisibility(View.VISIBLE); + findViewById(R.id.menu).setVisibility(View.VISIBLE); + findViewById(R.id.on_screen_indicators).setVisibility(View.VISIBLE); + } else { + findViewById(R.id.blocker).setVisibility(View.INVISIBLE); + findViewById(R.id.menu).setVisibility(View.INVISIBLE); + findViewById(R.id.on_screen_indicators).setVisibility(View.INVISIBLE); + } + } + private Runnable mOnFrameDrawn = new Runnable() { @Override @@ -313,17 +320,23 @@ public class CameraActivity extends ActivityBase ViewGroup appRoot = (ViewGroup) findViewById(R.id.content); boolean landscape = (config.orientation == Configuration.ORIENTATION_LANDSCAPE); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) appRoot.getLayoutParams(); + int offset = getResources().getDimensionPixelSize(R.dimen.margin_systemui_offset); + int navBarHeight = getResources().getDimensionPixelSize(R.dimen.navigation_bar_height); if (landscape) { - lp.rightMargin = getResources().getDimensionPixelSize(R.dimen.margin_systemui_offset); + lp.rightMargin = offset; } else { lp.rightMargin = 0; } appRoot.setLayoutParams(lp); - // Reset the background after rotation - mControlsBackground.setBackgroundResource(0); // remove the current background - mControlsBackground.setBackgroundResource(R.drawable.switcher_bg); - + // Set padding to move camera controls away from the edge of the screen + // so that they are in the same place as if there was a navigation bar between + // the screen edge and the controls + if (landscape) { + mCameraControls.setPadding(navBarHeight, 0, 0, 0); + } else { + mCameraControls.setPadding(0, navBarHeight, 0, 0); + } mCurrentModule.onConfigurationChanged(config); } @@ -466,7 +479,7 @@ public class CameraActivity extends ActivityBase if ((mSwitcher != null) && mSwitcher.showsPopup() && !mSwitcher.isInsidePopup(m)) { return mSwitcher.onTouch(null, m); } else { - return mSwitcherControl.dispatchTouchEvent(m) + return mCameraControls.dispatchTouchEvent(m) || mCurrentModule.dispatchTouchEvent(m); } } |