summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-03-05 09:54:25 -0800
committerDoris Liu <tianliu@google.com>2013-03-05 18:50:14 -0800
commit09106a41ee6acc6b20553662cb9b730702a8f08a (patch)
tree3059fe5a7bc6180b57c0ab75b1fa5bb2470cfd84 /src/com
parent48239f4dd39040a9ab2ffc977586035a8784fd78 (diff)
downloadandroid_packages_apps_Snap-09106a41ee6acc6b20553662cb9b730702a8f08a.tar.gz
android_packages_apps_Snap-09106a41ee6acc6b20553662cb9b730702a8f08a.tar.bz2
android_packages_apps_Snap-09106a41ee6acc6b20553662cb9b730702a8f08a.zip
Add a black bar symmetric to nav bar
Also fix bug: 8323926 Change-Id: I4886b285dee8ad71ad72a55e96bf699b7c18c9f4
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/CameraActivity.java29
-rw-r--r--src/com/android/camera/PhotoModule.java19
2 files changed, 27 insertions, 21 deletions
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();