diff options
Diffstat (limited to 'src/com/android/camera/ui/CameraControls.java')
-rw-r--r-- | src/com/android/camera/ui/CameraControls.java | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/com/android/camera/ui/CameraControls.java b/src/com/android/camera/ui/CameraControls.java index b6e31ada2..15836353e 100644 --- a/src/com/android/camera/ui/CameraControls.java +++ b/src/com/android/camera/ui/CameraControls.java @@ -23,9 +23,8 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.drawable.AnimationDrawable; import android.graphics.Paint; -import android.graphics.Rect; -import android.graphics.Paint; import android.graphics.Path; +import android.graphics.Rect; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; @@ -82,6 +81,7 @@ public class CameraControls extends RotatableLayout { private LinearLayout mRemainingPhotos; private TextView mRemainingPhotosText; private int mOrientation; + private final Rect mInsets = new Rect(); private int mPreviewRatio; private static int mTopMargin = 0; @@ -240,6 +240,12 @@ public class CameraControls extends RotatableLayout { } @Override + protected boolean fitSystemWindows(Rect insets) { + mInsets.set(insets); + return false; + } + + @Override public void onLayout(boolean changed, int l, int t, int r, int b) { int orientation = getResources().getConfiguration().orientation; int size = getResources().getDimensionPixelSize(R.dimen.camera_controls_size); @@ -247,18 +253,24 @@ public class CameraControls extends RotatableLayout { adjustBackground(); // As l,t,r,b are positions relative to parents, we need to convert them // to child's coordinates - r = r - l; - b = b - t; + r = r - l - mInsets.right; + b = b - t - mInsets.bottom; l = 0; t = 0; for (int i = 0; i < getChildCount(); i++) { View v = getChildAt(i); - v.layout(l, t, r, b); + if (v == mBackgroundView) { + v.layout(l, t, r + mInsets.right, b + mInsets.bottom); + } else { + v.layout(l, t, r, b); + } } + Rect shutter = new Rect(); center(mShutter, l, t, r, b, orientation, rotation, shutter, SHUTTER_INDEX); mSize = (int) (Math.max(shutter.right - shutter.left, shutter.bottom - shutter.top) * 1.2f); - center(mBackgroundView, l, t, r, b, orientation, rotation, new Rect(), -1); + center(mBackgroundView, l, t, r + mInsets.right, b + mInsets.bottom, + orientation, rotation, new Rect(), -1); mBackgroundView.setVisibility(View.GONE); setLocation(r - l, b - t); |