summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui
diff options
context:
space:
mode:
authorSultanxda <sultanxda@gmail.com>2016-06-29 00:24:51 -0700
committerBruno Martins <bgcngm@gmail.com>2018-11-20 12:32:17 +0000
commit5c070a4ad04297e1ccc715c865b08c68dfef1e1f (patch)
tree5fb55a90518f03f92c4e7a36ef8283781ea38070 /src/com/android/camera/ui
parenta85c90564b4875f1fdaa0540dd85f40417863689 (diff)
downloadandroid_packages_apps_Snap-5c070a4ad04297e1ccc715c865b08c68dfef1e1f.tar.gz
android_packages_apps_Snap-5c070a4ad04297e1ccc715c865b08c68dfef1e1f.tar.bz2
android_packages_apps_Snap-5c070a4ad04297e1ccc715c865b08c68dfef1e1f.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')
-rwxr-xr-xsrc/com/android/camera/ui/ZoomRenderer.java19
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 edc9d97b2..eb88decc2 100755
--- 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;
}