summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-11-11 17:46:10 -0800
committerSteve Kondik <steve@cyngn.com>2016-11-13 23:33:36 -0800
commit9916e1e62cc36b25a7c30d1fd9aaace5d05a26dc (patch)
tree195a693c21c860eff82753b8b154cd1bc7a21b5f
parentb57349c3fc0db67c705a2ee0c4b084d627dbb6f5 (diff)
downloadandroid_packages_apps_Snap-9916e1e62cc36b25a7c30d1fd9aaace5d05a26dc.zip
android_packages_apps_Snap-9916e1e62cc36b25a7c30d1fd9aaace5d05a26dc.tar.gz
android_packages_apps_Snap-9916e1e62cc36b25a7c30d1fd9aaace5d05a26dc.tar.bz2
snap: Hide overlays early when going to filmstrip
Change-Id: Ic66abb6dbce0283f3c76512f40daf6bb4a9b8f54
-rw-r--r--src/com/android/camera/BaseUI.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/com/android/camera/BaseUI.java b/src/com/android/camera/BaseUI.java
index f48b287..7fd3c18 100644
--- a/src/com/android/camera/BaseUI.java
+++ b/src/com/android/camera/BaseUI.java
@@ -4,6 +4,7 @@ import android.graphics.Point;
import android.graphics.RectF;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewStub;
import com.android.camera.ui.CameraControls;
import com.android.camera.ui.CaptureAnimationOverlay;
@@ -12,6 +13,9 @@ import com.android.camera.util.CameraUtil;
import org.codeaurora.snapcam.R;
+import java.util.ArrayList;
+import java.util.List;
+
/** we can start accumulating common code between UI classes here
* toward an eventual unification - WF */
public abstract class BaseUI {
@@ -27,6 +31,9 @@ public abstract class BaseUI {
protected int mBottomMargin = 0;
protected int mScreenRatio = CameraUtil.RATIO_UNKNOWN;
+ private boolean mOverlaysDisabled;
+ private final List<View> mDisabledViews = new ArrayList<>();
+
public BaseUI(CameraActivity activity, ViewGroup rootView, int layout) {
mActivity = activity;
mRootView = rootView;
@@ -55,12 +62,14 @@ public abstract class BaseUI {
public void showPreviewCover() {
if (mPreviewCover != null && mPreviewCover.getVisibility() != View.VISIBLE) {
mPreviewCover.setVisibility(View.VISIBLE);
+ disableOverlays();
}
}
public void hidePreviewCover() {
if (mPreviewCover != null && mPreviewCover.getVisibility() != View.GONE) {
mPreviewCover.setVisibility(View.GONE);
+ enableOverlays();
}
}
@@ -133,4 +142,41 @@ public abstract class BaseUI {
protected void onPreviewRectChanged(RectF rect) {
mCaptureOverlay.setPreviewRect(rect);
}
+
+ private void enableOverlays() {
+ synchronized (mDisabledViews) {
+ if (!mOverlaysDisabled) {
+ return;
+ }
+
+ for (View v : mDisabledViews) {
+ v.setVisibility(View.VISIBLE);
+ }
+
+ mDisabledViews.clear();
+ mOverlaysDisabled = false;
+ }
+ }
+
+ private void disableOverlays() {
+ synchronized (mDisabledViews) {
+ if (mOverlaysDisabled) {
+ return;
+ }
+
+ mOverlaysDisabled = true;
+
+ View focusRingView = mRootView.findViewById(R.id.focus_ring);
+ if (focusRingView != null && focusRingView.getVisibility() == View.VISIBLE) {
+ focusRingView.setVisibility(View.GONE);
+ mDisabledViews.add(focusRingView);
+ }
+
+ View faceView = mRootView.findViewById(R.id.face_view);
+ if (faceView != null && faceView.getVisibility() == View.VISIBLE) {
+ faceView.setVisibility(View.GONE);
+ mDisabledViews.add(faceView);
+ }
+ }
+ }
}