summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSultanxda <sultanxda@gmail.com>2016-06-29 00:24:51 -0700
committerChippa-a <vusal1372@gmail.com>2019-10-25 15:55:25 +0300
commit62b658124f72357718706228bec4c434db1af542 (patch)
treec58536f93c8bba0541681c0eb01b1d407c8d62f1 /src
parent5ee62ade8be38d030c80405bc855a4256480bc4b (diff)
downloadandroid_packages_apps_Snap-62b658124f72357718706228bec4c434db1af542.tar.gz
android_packages_apps_Snap-62b658124f72357718706228bec4c434db1af542.tar.bz2
android_packages_apps_Snap-62b658124f72357718706228bec4c434db1af542.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')
-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 5c31cf570..c9678f008 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;
}