summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/FaceView.java
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-03-14 21:01:35 -0700
committerDoris Liu <tianliu@google.com>2013-04-09 10:35:50 -0700
commit753bb8aa56fff425fe16b93be368b9b236e4751f (patch)
tree92182a98004dba4fb131e9fcb020796625659276 /src/com/android/camera/ui/FaceView.java
parent15f4efb50b40fbdf108121e367bfd6f50d5b2c41 (diff)
downloadandroid_packages_apps_Snap-753bb8aa56fff425fe16b93be368b9b236e4751f.tar.gz
android_packages_apps_Snap-753bb8aa56fff425fe16b93be368b9b236e4751f.tar.bz2
android_packages_apps_Snap-753bb8aa56fff425fe16b93be368b9b236e4751f.zip
Work in progress - Put preview in TextureView
Fixed gesture recognizing and pie menu. Fixed camera picker. Exposure setting got fixed with rebasing. Rebased for new pie menu Fixed camera mode switch listener Ongoing: secure album, aspect ratio for video recording on ICS Change-Id: Iedae80815faf81cb49c791885810c8427034a6d1
Diffstat (limited to 'src/com/android/camera/ui/FaceView.java')
-rw-r--r--src/com/android/camera/ui/FaceView.java26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/com/android/camera/ui/FaceView.java b/src/com/android/camera/ui/FaceView.java
index 099f3bf4b..9840b1544 100644
--- a/src/com/android/camera/ui/FaceView.java
+++ b/src/com/android/camera/ui/FaceView.java
@@ -33,12 +33,15 @@ import android.view.View;
import com.android.camera.CameraActivity;
import com.android.camera.CameraScreenNail;
+import com.android.camera.NewPhotoUI;
import com.android.camera.Util;
import com.android.gallery3d.R;
import com.android.gallery3d.common.ApiHelper;
@TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH)
-public class FaceView extends View implements FocusIndicator, Rotatable {
+public class FaceView extends View
+ implements FocusIndicator, Rotatable,
+ NewPhotoUI.SurfaceTextureSizeChangedListener {
private static final String TAG = "CAM FaceView";
private final boolean LOGV = false;
// The value for android.hardware.Camera.setDisplayOrientation.
@@ -63,6 +66,8 @@ public class FaceView extends View implements FocusIndicator, Rotatable {
private Paint mPaint;
private volatile boolean mBlocked;
+ private int mUncroppedWidth;
+ private int mUncroppedHeight;
private static final int MSG_SWITCH_FACES = 1;
private static final int SWITCH_DELAY = 70;
private boolean mStateSwitchPending = false;
@@ -92,6 +97,11 @@ public class FaceView extends View implements FocusIndicator, Rotatable {
mPaint.setStrokeWidth(res.getDimension(R.dimen.face_circle_stroke));
}
+ public void onSurfaceTextureSizeChanged(int uncroppedWidth, int uncroppedHeight) {
+ mUncroppedWidth = uncroppedWidth;
+ mUncroppedHeight = uncroppedHeight;
+ }
+
public void setFaces(Face[] faces) {
if (LOGV) Log.v(TAG, "Num of faces=" + faces.length);
if (mPause) return;
@@ -178,9 +188,17 @@ public class FaceView extends View implements FocusIndicator, Rotatable {
@Override
protected void onDraw(Canvas canvas) {
if (!mBlocked && (mFaces != null) && (mFaces.length > 0)) {
- final CameraScreenNail sn = ((CameraActivity) getContext()).getCameraScreenNail();
- int rw = sn.getUncroppedRenderWidth();
- int rh = sn.getUncroppedRenderHeight();
+ int rw, rh;
+ if (mUncroppedWidth == 0) {
+ // TODO: This check is temporary. It needs to be removed after the
+ // refactoring is fully functioning.
+ final CameraScreenNail sn = ((CameraActivity) getContext()).getCameraScreenNail();
+ rw = sn.getUncroppedRenderWidth();
+ rh = sn.getUncroppedRenderHeight();
+ } else {
+ rw = mUncroppedWidth;
+ rh = mUncroppedHeight;
+ }
// Prepare the matrix.
if (((rh > rw) && ((mDisplayOrientation == 0) || (mDisplayOrientation == 180)))
|| ((rw > rh) && ((mDisplayOrientation == 90) || (mDisplayOrientation == 270)))) {