diff options
author | Sultanxda <sultanxda@gmail.com> | 2016-06-29 00:24:51 -0700 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2018-01-27 00:41:43 +0100 |
commit | 27f82dac9adcd990e7abfc34580ed4e9edf422d5 (patch) | |
tree | d3888ff66f913749f6da82d59997b9ca310fcbe1 /src/com/android/camera/ui | |
parent | ca34c971be8974fa2ca1a9faca633f635533ce78 (diff) | |
download | android_packages_apps_Snap-27f82dac9adcd990e7abfc34580ed4e9edf422d5.tar.gz android_packages_apps_Snap-27f82dac9adcd990e7abfc34580ed4e9edf422d5.tar.bz2 android_packages_apps_Snap-27f82dac9adcd990e7abfc34580ed4e9edf422d5.zip |
Snap: Render zoom circle in the center of the camera preview
Previously, the zoom circle was rendered in the center of the entire screen,
making it look unevenly placed due to the uneven sizes of the top and bottom
UI panes. The camera preview in this case is calculated to be the portion
of the screen between the top and bottom UI panes.
Change-Id: I67678f7bc227cf2b7a6eed3161805b2b107c488a
Diffstat (limited to 'src/com/android/camera/ui')
-rw-r--r-- | src/com/android/camera/ui/ZoomRenderer.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/com/android/camera/ui/ZoomRenderer.java b/src/com/android/camera/ui/ZoomRenderer.java index 3e436cff8..27e353c0f 100644 --- a/src/com/android/camera/ui/ZoomRenderer.java +++ b/src/com/android/camera/ui/ZoomRenderer.java @@ -16,11 +16,13 @@ package com.android.camera.ui; +import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; +import android.graphics.Point; import android.graphics.Rect; import android.os.Handler; import android.view.ScaleGestureDetector; @@ -57,6 +59,10 @@ public class ZoomRenderer extends OverlayRenderer private float mZoomMinValue; private float mZoomMaxValue; + private Point mDispSize; + private int mBottomMargin; + private int mTopMargin; + public interface OnZoomChangedListener { void onZoomStart(); void onZoomEnd(); @@ -81,6 +87,13 @@ public class ZoomRenderer extends OverlayRenderer mMinCircle = res.getDimensionPixelSize(R.dimen.zoom_ring_min); mTextBounds = new Rect(); setVisible(false); + mBottomMargin = + ctx.getResources().getDimensionPixelSize(R.dimen.preview_bottom_margin); + mTopMargin = + ctx.getResources().getDimensionPixelSize(R.dimen.preview_top_margin); + mDispSize = new Point(); + Activity activity = (Activity) ctx; + activity.getWindowManager().getDefaultDisplay().getRealSize(mDispSize); } // set from module @@ -119,9 +132,13 @@ public class ZoomRenderer extends OverlayRenderer @Override public void layout(int l, int t, int r, int b) { + l = 0; + t = mTopMargin; + r = mDispSize.x; + b = mDispSize.y - mBottomMargin; super.layout(l, t, r, b); mCenterX = (r - l) / 2; - mCenterY = (b - t) / 2; + mCenterY = ((b - t) / 2) + t; mMaxCircle = Math.min(getWidth(), getHeight()); mMaxCircle = (mMaxCircle - mMinCircle) / 2; } |