summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhuw <zhuw@codeaurora.org>2018-01-05 16:50:39 +0800
committerArne Coucheron <arco68@gmail.com>2018-04-22 00:23:31 +0200
commita83f85c3061d4c7e6bfb6cbeabd1cee6198f3307 (patch)
tree8881fa1daf83d958c257457346e3d082da58f5c8
parentb06b710207ea702e8bdd6cb5f0db8c9faead2c8a (diff)
downloadandroid_packages_apps_Snap-a83f85c3061d4c7e6bfb6cbeabd1cee6198f3307.zip
android_packages_apps_Snap-a83f85c3061d4c7e6bfb6cbeabd1cee6198f3307.tar.gz
android_packages_apps_Snap-a83f85c3061d4c7e6bfb6cbeabd1cee6198f3307.tar.bz2
Add ui toast for bokeh
add ui toast change for bokeh Change-Id: I51598fbe80dd979159cbe9aadeaea26169026d4d
-rwxr-xr-xres/layout/capture_module.xml23
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java72
-rw-r--r--src/com/android/camera/CaptureUI.java25
3 files changed, 120 insertions, 0 deletions
diff --git a/res/layout/capture_module.xml b/res/layout/capture_module.xml
index 5b0b998..29da7d6 100755
--- a/res/layout/capture_module.xml
+++ b/res/layout/capture_module.xml
@@ -118,6 +118,29 @@
</com.android.camera.ui.RotateLayout>
</FrameLayout>
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <com.android.camera.ui.RotateLayout
+ android:id="@+id/bokeh_tip_rect"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentLeft="true"
+ android:visibility="gone"
+ android:layout_marginLeft="24dp"
+ android:layout_marginTop="60dp">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="#3F000000"
+ android:textColor="@android:color/white"
+ android:textSize="16sp"
+ android:id="@+id/bokeh_status"
+ android:visibility="gone"/>
+ </com.android.camera.ui.RotateLayout>
+ </FrameLayout>
+
<include
layout="@layout/scene_mode_label"/>
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 9271cff..b425057 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -162,6 +162,15 @@ public class CaptureModule implements CameraModule, PhotoController,
new MeteringRectangle(0, 0, 0, 0, 0)};
private static final String EXTRA_QUICK_CAPTURE =
"android.intent.extra.quickCapture";
+ //0~6 is for bokeh toast message
+ private static final int NO_DEPTH_EFFECT = 0;
+ private static final int DEPTH_EFFECT_SUCCESS = 1;
+ private static final int TOO_NEAR = 2;
+ private static final int TOO_FAR = 3;
+ private static final int LOW_LIGHT = 4;
+ private static final int SUBJECT_NOT_FOUND = 5;
+ private static final int TOUCH_TO_FOCUS = 6;
+
/**
* Camera state: Showing camera preview.
*/
@@ -263,6 +272,8 @@ public class CaptureModule implements CameraModule, PhotoController,
"org.codeaurora.qcamera3.bokeh.enable", Boolean.class);
public static final CaptureRequest.Key<Integer> bokeh_blur_level = new CaptureRequest.Key<>(
"org.codeaurora.qcamera3.bokeh.blurLevel", Integer.class);
+ public static final CaptureResult.Key<Integer> bokeh_status =
+ new CaptureResult.Key<>("org.codeaurora.qcamera3.bokeh.status", Integer.class);
private boolean[] mTakingPicture = new boolean[MAX_NUM_CAM];
private int mControlAFMode = CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
@@ -608,11 +619,67 @@ public class CaptureModule implements CameraModule, PhotoController,
updateGraghView();
}
}
+ showBokehStatusMessage(id, result);
processCaptureResult(result);
mPostProcessor.onMetaAvailable(result);
}
};
+ private void showBokehStatusMessage(int id, CaptureResult partialResult) {
+ if (!mBokehEnabled || partialResult == null) {
+ return;
+ }
+ Integer status = -1;
+ try {
+ status = partialResult.get(bokeh_status);
+ if (status == null) {
+ return;
+ }
+ } catch (IllegalArgumentException e) {
+ Log.d(TAG, "cannot find vendor tag: " + bokeh_status);
+ }
+ final String tip;
+ switch (status) {
+ case TOO_FAR:
+ tip = "Too far";
+ break;
+ case TOO_NEAR:
+ tip = "Too near";
+ break;
+ case LOW_LIGHT:
+ tip = "Low light";
+ break;
+ case SUBJECT_NOT_FOUND:
+ tip = "Object not found";
+ break;
+ case DEPTH_EFFECT_SUCCESS:
+ tip = "Depth effect success";
+ break;
+ case NO_DEPTH_EFFECT:
+ tip = "NO depth effect";
+ break;
+ default:
+ tip = "Message type =" + status;
+ break;
+ }
+ boolean mDepthSuccess = status == DEPTH_EFFECT_SUCCESS;
+ mActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ if (mUI.getBokehTipView() != null) {
+ if (!mDepthSuccess) {
+ mUI.getBokehTipRct().setVisibility(View.VISIBLE);
+ mUI.getBokehTipView().setVisibility(View.VISIBLE);
+ mUI.getBokehTipView().setText(tip);
+ } else {
+ mUI.getBokehTipView().setVisibility(View.GONE);
+ mUI.getBokehTipRct().setVisibility(View.GONE);
+ }
+ }
+ }
+ });
+ }
+
private final CameraDevice.StateCallback mStateCallback = new CameraDevice.StateCallback() {
@Override
@@ -5118,6 +5185,11 @@ public class CaptureModule implements CameraModule, PhotoController,
if (mPaused || !mBokehEnabled) {//disable bokeh mode
mBokehRequestBuilder = null;
}
+ if (mBokehEnabled) {
+ keepScreenOn();
+ } else {
+ keepScreenOnAwhile();
+ }
}
boolean checkSessionAndBuilder(CameraCaptureSession session, CaptureRequest.Builder builder) {
diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java
index c62c5d6..725225b 100644
--- a/src/com/android/camera/CaptureUI.java
+++ b/src/com/android/camera/CaptureUI.java
@@ -187,6 +187,8 @@ public class CaptureUI implements PreviewGestures.SingleTapListener,
private ImageView mMakeupButton;
private SeekBar mMakeupSeekBar;
private SeekBar mBokehSeekBar;
+ private TextView mBokehTipText;
+ private RotateLayout mBokehTipRect;
private View mMakeupSeekBarLayout;
private View mSeekbarBody;
private TextView mRecordingTimeView;
@@ -357,6 +359,8 @@ public class CaptureUI implements PreviewGestures.SingleTapListener,
.apply();
}
});
+ mBokehTipText = mRootView.findViewById(R.id.bokeh_status);
+ mBokehTipRect = (RotateLayout) mRootView.findViewById(R.id.bokeh_tip_rect);
initFilterModeButton();
initSceneModeButton();
initSwitchCamera();
@@ -617,11 +621,22 @@ public class CaptureUI implements PreviewGestures.SingleTapListener,
mBokehSeekBar.setVisibility(View.VISIBLE);
mVideoButton.setVisibility(View.INVISIBLE);
} else {
+ if (mBokehTipRect != null) {
+ mBokehTipRect.setVisibility(View.INVISIBLE);
+ }
mBokehSeekBar.setVisibility(View.INVISIBLE);
mVideoButton.setVisibility(View.VISIBLE);
}
}
+ public TextView getBokehTipView() {
+ return mBokehTipText;
+ }
+
+ public RotateLayout getBokehTipRct() {
+ return mBokehTipRect;
+ }
+
// called from onResume but only the first time
public void initializeFirstTime() {
// Initialize shutter button.
@@ -1468,6 +1483,16 @@ public class CaptureUI implements PreviewGestures.SingleTapListener,
}
}
+ if (mBokehTipRect != null) {
+ if (orientation == 180) {
+ mBokehTipText.setRotation(180);
+ mBokehTipRect.setOrientation(0, false);
+ } else {
+ mBokehTipText.setRotation(0);
+ mBokehTipRect.setOrientation(orientation, false);
+ }
+ }
+
if ( mSceneModeInstructionalDialog != null && mSceneModeInstructionalDialog.isShowing()) {
mSceneModeInstructionalDialog.dismiss();
mSceneModeInstructionalDialog = null;