summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Haeberling <haeberling@google.com>2014-01-17 19:03:52 -0800
committerSascha Haeberling <haeberling@google.com>2014-01-22 12:40:33 -0800
commite2914fddcd6d4f78d812ef818d43364d9aa469d4 (patch)
treee935f07dd0859accfc476a2586d66abd1eb2640c
parent406468ebe4c90ecc5e5defa8dafd496965118551 (diff)
downloadandroid_packages_apps_Camera2-e2914fddcd6d4f78d812ef818d43364d9aa469d4.tar.gz
android_packages_apps_Camera2-e2914fddcd6d4f78d812ef818d43364d9aa469d4.tar.bz2
android_packages_apps_Camera2-e2914fddcd6d4f78d812ef818d43364d9aa469d4.zip
Move focus overlay into generic_module.
Bug: 12563457 Also cleans up the focus overlay API. Change-Id: I8a63b7abf7cc9390cc709c275807b1d3d2e344a6
-rw-r--r--res/layout/generic_module.xml15
-rw-r--r--res/layout/photo_module.xml4
-rw-r--r--res/layout/video_module.xml4
-rw-r--r--src/com/android/camera/FocusOverlayManager.java16
-rw-r--r--src/com/android/camera/PhotoUI.java15
-rw-r--r--src/com/android/camera/app/CameraAppUI.java3
-rw-r--r--src/com/android/camera/ui/FocusOverlay.java7
7 files changed, 29 insertions, 35 deletions
diff --git a/res/layout/generic_module.xml b/res/layout/generic_module.xml
index d2eacbe45..e223fcd07 100644
--- a/res/layout/generic_module.xml
+++ b/res/layout/generic_module.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 The Android Open Source Project
+<!--
+ Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -15,14 +16,19 @@
-->
<!-- This layout is shared by phone and tablet in landscape orientation. -->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:layout_width="match_parent">
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
<TextureView
android:id="@+id/preview_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
+ <com.android.camera.ui.FocusOverlay
+ android:id="@+id/focus_overlay"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
<com.android.camera.ui.CaptureAnimationOverlay
android:id="@+id/capture_overlay"
android:layout_width="match_parent"
@@ -33,6 +39,7 @@
android:id="@+id/preview_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent" />
+
<FrameLayout
android:id="@+id/module_layout"
android:layout_width="match_parent"
@@ -40,4 +47,4 @@
<include layout="@layout/indicator_bottombar" />
-</merge>
+</merge> \ No newline at end of file
diff --git a/res/layout/photo_module.xml b/res/layout/photo_module.xml
index 778ae17e6..250819b82 100644
--- a/res/layout/photo_module.xml
+++ b/res/layout/photo_module.xml
@@ -24,10 +24,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
- <com.android.camera.ui.FocusOverlay
- android:id="@+id/focus_overlay"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
<ImageView
android:id="@+id/review_image"
android:layout_width="match_parent"
diff --git a/res/layout/video_module.xml b/res/layout/video_module.xml
index f2de26bf5..4f249dbd6 100644
--- a/res/layout/video_module.xml
+++ b/res/layout/video_module.xml
@@ -21,10 +21,6 @@
style="@style/ViewfinderLabelLayout">
<include layout="@layout/viewfinder_labels_video" android:id="@+id/labels" />
</com.android.camera.ui.RotateLayout>
- <com.android.camera.ui.FocusOverlay
- android:id="@+id/focus_overlay"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
<ImageView android:id="@+id/review_image"
android:layout_height="match_parent"
android:layout_width="match_parent"
diff --git a/src/com/android/camera/FocusOverlayManager.java b/src/com/android/camera/FocusOverlayManager.java
index 5a211cd90..d306cfc59 100644
--- a/src/com/android/camera/FocusOverlayManager.java
+++ b/src/com/android/camera/FocusOverlayManager.java
@@ -100,8 +100,8 @@ public class FocusOverlayManager implements PreviewStatusListener.PreviewAreaSiz
public void clearFocus();
public void setFocusPosition(int x, int y);
public void onFocusStarted();
- public void onFocusSucceeded(boolean timeOut);
- public void onFocusFailed(boolean timeOut);
+ public void onFocusSucceeded();
+ public void onFocusFailed();
public void pauseFaceDetection();
public void resumeFaceDetection();
}
@@ -324,7 +324,7 @@ public class FocusOverlayManager implements PreviewStatusListener.PreviewAreaSiz
mUI.setFocusPosition(mPreviewRect.centerX(), mPreviewRect.centerY());
mUI.onFocusStarted();
} else if (!moving) {
- mUI.onFocusSucceeded(true);
+ mUI.onFocusSucceeded();
}
mPreviousMoving = moving;
}
@@ -353,10 +353,6 @@ public class FocusOverlayManager implements PreviewStatusListener.PreviewAreaSiz
calculateTapArea(x, y, 1.5f, mMeteringArea.get(0).rect);
}
- private void resetMeteringAreas() {
- mMeteringArea = null;
- }
-
public void onSingleTapUp(int x, int y) {
if (!mInitialized || mState == STATE_FOCUSING_SNAP_ON_FINISH) return;
@@ -504,11 +500,11 @@ public class FocusOverlayManager implements PreviewStatusListener.PreviewAreaSiz
} else {
if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusMode)) {
// TODO: check HAL behavior and decide if this can be removed.
- mUI.onFocusSucceeded(false);
+ mUI.onFocusSucceeded();
} else if (mState == STATE_SUCCESS) {
- mUI.onFocusSucceeded(false);
+ mUI.onFocusSucceeded();
} else if (mState == STATE_FAIL) {
- mUI.onFocusFailed(false);
+ mUI.onFocusFailed();
}
}
}
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 29ef001c6..236e4c382 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -32,7 +32,6 @@ import android.view.ViewGroup;
import android.view.ViewStub;
import com.android.camera.FocusOverlayManager.FocusUI;
-import com.android.camera.app.CameraAppUI;
import com.android.camera.app.CameraManager;
import com.android.camera.ui.FaceView;
import com.android.camera.ui.PreviewOverlay;
@@ -51,10 +50,10 @@ public class PhotoUI implements PreviewStatusListener,
private final PreviewOverlay mPreviewOverlay;
private final FocusUI mFocusUI;
- private CameraActivity mActivity;
- private PhotoController mController;
+ private final CameraActivity mActivity;
+ private final PhotoController mController;
- private View mRootView;
+ private final View mRootView;
private SurfaceTexture mSurfaceTexture;
private FaceView mFaceView;
@@ -65,7 +64,7 @@ public class PhotoUI implements PreviewStatusListener,
private int mPreviewWidth = 0;
private int mPreviewHeight = 0;
- private TextureView mTextureView;
+ private final TextureView mTextureView;
private float mAspectRatio = UNSET;
private final Object mSurfaceTextureLock = new Object();
@@ -111,8 +110,8 @@ public class PhotoUI implements PreviewStatusListener,
private class DecodeTask extends AsyncTask<Void, Void, Bitmap> {
private final byte [] mData;
- private int mOrientation;
- private boolean mMirror;
+ private final int mOrientation;
+ private final boolean mMirror;
public DecodeTask(byte[] data, int orientation, boolean mirror) {
mData = data;
@@ -159,7 +158,7 @@ public class PhotoUI implements PreviewStatusListener,
ViewGroup moduleRoot = (ViewGroup) mRootView.findViewById(R.id.module_layout);
mActivity.getLayoutInflater().inflate(R.layout.photo_module,
- (ViewGroup) moduleRoot, true);
+ moduleRoot, true);
// display the view
mTextureView = (TextureView) mRootView.findViewById(R.id.preview_content);
initIndicators();
diff --git a/src/com/android/camera/app/CameraAppUI.java b/src/com/android/camera/app/CameraAppUI.java
index 6f183f7c4..bea5796a0 100644
--- a/src/com/android/camera/app/CameraAppUI.java
+++ b/src/com/android/camera/app/CameraAppUI.java
@@ -33,9 +33,8 @@ import android.widget.FrameLayout;
import com.android.camera.AnimationManager;
import com.android.camera.ButtonManager;
-import com.android.camera.TextureViewHelper;
import com.android.camera.ShutterButton;
-import com.android.camera.app.CameraProvider;
+import com.android.camera.TextureViewHelper;
import com.android.camera.filmstrip.FilmstripContentPanel;
import com.android.camera.hardware.HardwareSpec;
import com.android.camera.module.ModuleController;
diff --git a/src/com/android/camera/ui/FocusOverlay.java b/src/com/android/camera/ui/FocusOverlay.java
index 9bf0ea9b4..1b5dcef46 100644
--- a/src/com/android/camera/ui/FocusOverlay.java
+++ b/src/com/android/camera/ui/FocusOverlay.java
@@ -43,7 +43,7 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI {
private int mPositionY;
private int mAngle;
// TODO: make this dp in dimens.xml when UI has a spec
- private int mFocusIndicatorSize = 200;
+ private final int mFocusIndicatorSize = 200;
private boolean mShowIndicator;
public FocusOverlay(Context context, AttributeSet attrs) {
@@ -87,14 +87,14 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI {
}
@Override
- public void onFocusSucceeded(boolean timeOut) {
+ public void onFocusSucceeded() {
mFocusAnimation.cancel();
mShowIndicator = false;
invalidate();
}
@Override
- public void onFocusFailed(boolean timeOut) {
+ public void onFocusFailed() {
mFocusAnimation.cancel();
mShowIndicator = false;
invalidate();
@@ -110,6 +110,7 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI {
// TODO: Add face detection support.
}
+ @Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);