summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/PhotoUI.java
diff options
context:
space:
mode:
authorPaul Rohde <codelogic@google.com>2014-12-05 12:17:15 -0800
committerMichael Bestas <mkbestas@lineageos.org>2019-11-09 22:15:24 +0200
commitae159942ae27f5798051851160b9bae652f5a118 (patch)
treef2209f9284653a277eaff160c7a60e72c50998a6 /src/com/android/camera/PhotoUI.java
parent70e618bdd825eb8b088d66feeefc0a7f0b06c7ed (diff)
downloadandroid_packages_apps_Snap-ae159942ae27f5798051851160b9bae652f5a118.tar.gz
android_packages_apps_Snap-ae159942ae27f5798051851160b9bae652f5a118.tar.bz2
android_packages_apps_Snap-ae159942ae27f5798051851160b9bae652f5a118.zip
Drop new focus indicator into Camera2.
* Create a new custom focus view that interacts with physical lens diopter changes. * Replace all occurances of the old focus indicator with the new one. Change-Id: Ia02646ce4d1eb059ecb8a1dfccc15dfc9c167e1b
Diffstat (limited to 'src/com/android/camera/PhotoUI.java')
-rwxr-xr-xsrc/com/android/camera/PhotoUI.java67
1 files changed, 7 insertions, 60 deletions
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index b63e6525f..57c11aa1b 100755
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -58,7 +58,6 @@ import android.widget.PopupWindow;
import android.widget.Toast;
import com.android.camera.CameraPreference.OnPreferenceChangedListener;
-import com.android.camera.FocusOverlayManager.FocusUI;
import com.android.camera.TsMakeupManager.MakeupLevelListener;
import com.android.camera.ui.AbstractSettingPopup;
import com.android.camera.ui.CameraControls;
@@ -77,11 +76,11 @@ import com.android.camera.ui.RotateLayout;
import com.android.camera.ui.RotateTextToast;
import com.android.camera.ui.SelfieFlashView;
import com.android.camera.ui.ZoomRenderer;
+import com.android.camera.ui.focus.FocusRing;
import com.android.camera.util.CameraUtil;
public class PhotoUI implements PieListener,
PreviewGestures.SingleTapListener,
- FocusUI,
SurfaceHolder.Callback,
CameraRootView.MyDisplayListener,
CameraManager.CameraFaceDetectionCallback {
@@ -89,6 +88,7 @@ public class PhotoUI implements PieListener,
private static final String TAG = "CAM_UI";
private int mDownSampleFactor = 4;
private final AnimationManager mAnimationManager;
+ private final FocusRing mFocusRing;
private CameraActivity mActivity;
private PhotoController mController;
private PreviewGestures mGestures;
@@ -291,6 +291,7 @@ public class PhotoUI implements PieListener,
mFaceView = (FaceView) mRootView.findViewById(R.id.face_view);
setSurfaceTextureSizeChangedListener(mFaceView);
}
+ mFocusRing = (FocusRing) mRootView.findViewById(R.id.focus_ring);
mAnimationManager = new AnimationManager();
mOrientationResize = false;
mPrevOrientationResize = false;
@@ -543,8 +544,9 @@ public class PhotoUI implements PieListener,
@Override
public void onClick(View v) {
if (!CameraControls.isAnimating()
- && mController.getCameraState() != PhotoController.SNAPSHOT_IN_PROGRESS)
+ && mController.getCameraState() != PhotoController.SNAPSHOT_IN_PROGRESS) {
mActivity.gotoGallery();
+ }
}
});
}
@@ -948,7 +950,6 @@ public class PhotoUI implements PieListener,
CameraUtil.fadeIn(mReviewRetakeButton);
setOrientation(mOrientation, true);
mMenu.hideTopMenu(true);
- pauseFaceDetection();
}
protected void hidePostCaptureAlert() {
@@ -964,7 +965,6 @@ public class PhotoUI implements PieListener,
CameraUtil.fadeOut(mReviewDoneButton);
mShutterButton.setVisibility(View.VISIBLE);
CameraUtil.fadeOut(mReviewRetakeButton);
- resumeFaceDetection();
}
public void setDisplayOrientation(int orientation) {
@@ -1171,61 +1171,8 @@ public class PhotoUI implements PieListener,
((CameraRootView) mRootView).removeDisplayChangeListener();
}
- // focus UI implementation
-
- private FocusIndicator getFocusIndicator() {
- return (mFaceView != null && mFaceView.faceExists()) ? mFaceView : mPieRenderer;
- }
-
- @Override
- public boolean hasFaces() {
- return (mFaceView != null && mFaceView.faceExists());
- }
-
- public void clearFaces() {
- if (mFaceView != null) mFaceView.clear();
- }
-
- @Override
- public void clearFocus() {
- FocusIndicator indicator = mPieRenderer;
- if (hasFaces()) {
- mFaceView.showStart();
- }
- if (indicator != null) indicator.clear();
- }
-
- @Override
- public void setFocusPosition(int x, int y) {
- mPieRenderer.setFocus(x, y);
- }
-
- @Override
- public void onFocusStarted() {
- FocusIndicator indicator = getFocusIndicator();
- if (indicator != null) indicator.showStart();
- }
-
- @Override
- public void onFocusSucceeded(boolean timeout) {
- FocusIndicator indicator = getFocusIndicator();
- if (indicator != null) indicator.showSuccess(timeout);
- }
-
- @Override
- public void onFocusFailed(boolean timeout) {
- FocusIndicator indicator = getFocusIndicator();
- if (indicator != null) indicator.showFail(timeout);
- }
-
- @Override
- public void pauseFaceDetection() {
- if (mFaceView != null) mFaceView.pause();
- }
-
- @Override
- public void resumeFaceDetection() {
- if (mFaceView != null) mFaceView.resume();
+ public FocusRing getFocusRing() {
+ return mFocusRing;
}
public void onStartFaceDetection(int orientation, boolean mirror) {