From: Doris Liu Date: Tue, 5 Mar 2013 17:54:25 +0000 (-0800) Subject: Add a black bar symmetric to nav bar X-Git-Tag: android-x86-7.1-r1~1041^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7298e88db5eabc049da1ba3b092f9800a5ccedad;p=android-x86%2Fpackages-apps-Gallery2.git Add a black bar symmetric to nav bar Also fix bug: 8323926 Change-Id: I4886b285dee8ad71ad72a55e96bf699b7c18c9f4 --- diff --git a/res/layout-port/camera_controls.xml b/res/layout-port/camera_controls.xml index 7108b3c16..aa15da1ca 100644 --- a/res/layout-port/camera_controls.xml +++ b/res/layout-port/camera_controls.xml @@ -40,7 +40,7 @@ android:layout_marginBottom="2dip" android:contentDescription="@string/accessibility_menu_button" /> - - + \ No newline at end of file diff --git a/res/values/dimens.xml b/res/values/dimens.xml index c51b8375a..d2720d966 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -88,8 +88,8 @@ 2dip 14pt -22dp - 6dip 200dip 600dip 48dip + 42dip diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index b1f0847d8..24c49ba8a 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -117,6 +117,8 @@ public class CameraActivity extends ActivityBase } public void init() { + boolean landscape = Util.getDisplayRotation(this) % 180 == 90; + setMargins(landscape); mControlsBackground = findViewById(R.id.blocker); mCameraControls = findViewById(R.id.camera_controls); mShutter = (ShutterButton) findViewById(R.id.shutter_button); @@ -316,28 +318,22 @@ public class CameraActivity extends ActivityBase @Override public void onConfigurationChanged(Configuration config) { super.onConfigurationChanged(config); + boolean landscape = (config.orientation == Configuration.ORIENTATION_LANDSCAPE); + setMargins(landscape); + mCurrentModule.onConfigurationChanged(config); + } + private void setMargins(boolean landscape) { 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 navBarWidth = getResources().getDimensionPixelSize(R.dimen.navigation_bar_width); int navBarHeight = getResources().getDimensionPixelSize(R.dimen.navigation_bar_height); if (landscape) { - lp.rightMargin = offset; + lp.setMargins(navBarHeight, 0, navBarHeight - navBarWidth, 0); } else { - lp.rightMargin = 0; + lp.setMargins(0, navBarHeight, 0, 0); } appRoot.setLayoutParams(lp); - - // 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); } @Override @@ -478,9 +474,10 @@ public class CameraActivity extends ActivityBase } if ((mSwitcher != null) && mSwitcher.showsPopup() && !mSwitcher.isInsidePopup(m)) { return mSwitcher.onTouch(null, m); + } else if ((mSwitcher != null) && mSwitcher.isInsidePopup(m)) { + return superDispatchTouchEvent(m); } else { - return mCameraControls.dispatchTouchEvent(m) - || mCurrentModule.dispatchTouchEvent(m); + return mCurrentModule.dispatchTouchEvent(m); } } diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index 9a4546142..4049aa573 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -215,6 +215,8 @@ public class PhotoModule onScreenSizeChanged(right - left, bottom - top); } }; + private int mPreviewWidth = 0; + private int mPreviewHeight = 0; private final StringBuilder mBuilder = new StringBuilder(); private final Formatter mFormatter = new Formatter(mBuilder); private final Object[] mFormatterArgs = new Object[1]; @@ -615,12 +617,17 @@ public class PhotoModule } public void onScreenSizeChanged(int width, int height) { - if (mFocusManager != null) mFocusManager.setPreviewSize(width, height); // Full-screen screennail - if (Util.getDisplayRotation(mActivity) % 180 == 0) { - ((CameraScreenNail) mActivity.mCameraScreenNail).setPreviewFrameLayoutSize(width, height); - } else { - ((CameraScreenNail) mActivity.mCameraScreenNail).setPreviewFrameLayoutSize(height, width); + int w = width; + int h = height; + if (Util.getDisplayRotation(mActivity) % 180 != 0) { + w = height; + h = width; + } + if (mPreviewWidth != w || mPreviewHeight != h) { + Log.d(TAG, "Preview size changed."); + if (mFocusManager != null) mFocusManager.setPreviewSize(width, height); + ((CameraScreenNail) mActivity.mCameraScreenNail).setPreviewFrameLayoutSize(w, h); } } @@ -1639,6 +1646,8 @@ public class PhotoModule mHandler.removeMessages(CAMERA_DISABLED); mRootView.removeOnLayoutChangeListener(mLayoutChangeListener); + mPreviewWidth = 0; + mPreviewHeight = 0; mPendingSwitchCameraId = -1; if (mFocusManager != null) mFocusManager.removeMessages(); MediaSaveService s = mActivity.getMediaSaveService();