summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamera Software Integration <camswint@localhost>2016-12-11 04:22:40 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-12-11 04:22:40 -0800
commitddf548de2c5d09734add6e23fee5ebf998734c78 (patch)
tree00174089d228ac6ce9558491e301d45b8326a73a
parentad446334f0b6b12939c8bf406586e93bb7de2403 (diff)
parent10f9ed035975937f670679a9d238d9db9e9952f1 (diff)
downloadandroid_packages_apps_Snap-ddf548de2c5d09734add6e23fee5ebf998734c78.tar.gz
android_packages_apps_Snap-ddf548de2c5d09734add6e23fee5ebf998734c78.tar.bz2
android_packages_apps_Snap-ddf548de2c5d09734add6e23fee5ebf998734c78.zip
Merge "SnapdragonCamera:Modify Camera2 VideoRecording UI" into camera.lnx.1.0-dev.1.0
-rwxr-xr-x[-rw-r--r--]res/layout/capture_module.xml28
-rwxr-xr-xres/layout/one_ui_layout.xml18
-rwxr-xr-x[-rw-r--r--]res/values/dimens.xml3
-rwxr-xr-xsrc/com/android/camera/CaptureUI.java31
-rwxr-xr-x[-rw-r--r--]src/com/android/camera/PauseButton.java4
-rwxr-xr-x[-rw-r--r--]src/com/android/camera/ui/OneUICameraControls.java56
6 files changed, 95 insertions, 45 deletions
diff --git a/res/layout/capture_module.xml b/res/layout/capture_module.xml
index fc05fd0ca..0063a2e6a 100644..100755
--- a/res/layout/capture_module.xml
+++ b/res/layout/capture_module.xml
@@ -67,30 +67,24 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
- <com.android.camera.ui.RotateLayout
- android:id="@+id/recording_time_rect"
+
+ <FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
-
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+ <com.android.camera.ui.RotateLayout
+ android:id="@+id/recording_time_rect"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="horizontal">
-
- <com.android.camera.PauseButton
- android:id="@+id/video_pause"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="70dp"
- android:padding="23dp"
- android:src="@drawable/btn_pause_recording"/>
-
+ android:layout_alignParentTop="true"
+ android:layout_alignParentLeft="true"
+ android:visibility="gone"
+ android:layout_marginLeft="24dp"
+ android:layout_marginTop="80dp">
<include
android:id="@+id/labels"
layout="@layout/viewfinder_labels_video"/>
- </LinearLayout>
- </com.android.camera.ui.RotateLayout>
+ </com.android.camera.ui.RotateLayout>
+ </FrameLayout>
<include
style="@style/CameraControls"
diff --git a/res/layout/one_ui_layout.xml b/res/layout/one_ui_layout.xml
index d87040cde..53174698c 100755
--- a/res/layout/one_ui_layout.xml
+++ b/res/layout/one_ui_layout.xml
@@ -40,8 +40,8 @@
<com.android.camera.ShutterButton
android:id="@+id/shutter_button"
- android:layout_width="70dp"
- android:layout_height="70dp"
+ android:layout_width="@dimen/one_ui_bottom_large"
+ android:layout_height="@dimen/one_ui_bottom_large"
android:clickable="true"
android:contentDescription="@string/accessibility_shutter_button"
android:focusable="true"
@@ -50,14 +50,24 @@
<com.android.camera.ui.RotateImageView
android:id="@+id/video_button"
- android:layout_width="55dp"
- android:layout_height="55dp"
+ android:layout_width="@dimen/one_ui_bottom_small"
+ android:layout_height="@dimen/one_ui_bottom_small"
android:clickable="true"
android:contentDescription="@string/accessibility_shutter_button"
android:focusable="true"
android:scaleType="fitCenter"
android:src="@drawable/video_capture" />
+ <com.android.camera.PauseButton
+ android:id="@+id/video_pause"
+ android:layout_width="@dimen/one_ui_bottom_small"
+ android:layout_height="@dimen/one_ui_bottom_small"
+ android:focusable="true"
+ android:clickable="true"
+ android:scaleType="fitCenter"
+ android:visibility="gone"
+ android:src="@drawable/btn_pause_recording"/>
+
<com.android.camera.ui.RotateImageView
android:id="@+id/preview_thumb"
android:layout_width="@dimen/capture_size"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 2a58a33e2..d89d0a990 100644..100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -180,4 +180,7 @@
<dimen name="refocus_circle_diameter_3">95dp</dimen>
<dimen name="refocus_cross_length">19dp</dimen>
<dimen name="refocus_stroke_width">2dp</dimen>
+
+ <dimen name="one_ui_bottom_large">75dp</dimen>
+ <dimen name="one_ui_bottom_small">55dp</dimen>
</resources>
diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java
index b026af892..ed6e55963 100755
--- a/src/com/android/camera/CaptureUI.java
+++ b/src/com/android/camera/CaptureUI.java
@@ -194,7 +194,15 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
private void previewUIReady() {
if((mSurfaceHolder != null && mSurfaceHolder.getSurface().isValid())) {
mModule.onPreviewUIReady();
- mActivity.updateThumbnail(mThumbnail);
+ if (mIsVideoUI && mThumbnail != null) {
+ mThumbnail.setVisibility(View.INVISIBLE);
+ mThumbnail = null;
+ mActivity.updateThumbnail(mThumbnail);
+ } else if (!mIsVideoUI){
+ if (mThumbnail == null)
+ mThumbnail = (ImageView) mRootView.findViewById(R.id.preview_thumb);
+ mActivity.updateThumbnail(mThumbnail);
+ }
}
}
@@ -369,7 +377,7 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
mRenderOverlay.requestLayout();
mActivity.setPreviewGestures(mGestures);
- ((ViewGroup)mRootView).removeView(mRecordingTimeRect);
+ mRecordingTimeRect.setVisibility(View.GONE);
showFirstTimeHelp();
}
@@ -590,13 +598,13 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
}
mVideoButton.setImageResource(R.drawable.video_stop);
mRecordingTimeView.setText("");
- ((ViewGroup)mRootView).addView(mRecordingTimeRect);
+ mRecordingTimeRect.setVisibility(View.VISIBLE);
mMuteButton.setVisibility(View.VISIBLE);
} else {
mFlashButton.setVisibility(View.VISIBLE);
mFlashButton.init(false);
mVideoButton.setImageResource(R.drawable.video_capture);
- ((ViewGroup)mRootView).removeView(mRecordingTimeRect);
+ mRecordingTimeRect.setVisibility(View.GONE);
mMuteButton.setVisibility(View.INVISIBLE);
}
}
@@ -609,25 +617,26 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
}
public void hideUIwhileRecording() {
- mCameraControls.setWillNotDraw(true);
+ mCameraControls.setVideoMode(true);
mFrontBackSwitcher.setVisibility(View.INVISIBLE);
mFilterModeSwitcher.setVisibility(View.INVISIBLE);
mSceneModeSwitcher.setVisibility(View.INVISIBLE);
-
String value = mSettingsManager.getValue(SettingsManager.KEY_MAKEUP);
if(value != null && value.equals("0")) {
mMakeupButton.setVisibility(View.INVISIBLE);
}
mIsVideoUI = true;
+ mPauseButton.setVisibility(View.VISIBLE);
}
public void showUIafterRecording() {
- mCameraControls.setWillNotDraw(false);
+ mCameraControls.setVideoMode(false);
mFrontBackSwitcher.setVisibility(View.VISIBLE);
mFilterModeSwitcher.setVisibility(View.VISIBLE);
mSceneModeSwitcher.setVisibility(View.VISIBLE);
mMakeupButton.setVisibility(View.VISIBLE);
mIsVideoUI = false;
+ mPauseButton.setVisibility(View.INVISIBLE);
}
public void addFilterMode() {
@@ -1198,13 +1207,7 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
}
}
if (mRecordingTimeRect != null) {
- if (orientation == 180) {
- mRecordingTimeRect.setOrientation(0, false);
- mRecordingTimeView.setRotation(180);
- } else {
- mRecordingTimeView.setRotation(0);
- mRecordingTimeRect.setOrientation(orientation, false);
- }
+ mRecordingTimeView.setRotation(-orientation);
}
if (mFaceView != null) {
mFaceView.setDisplayRotation(orientation);
diff --git a/src/com/android/camera/PauseButton.java b/src/com/android/camera/PauseButton.java
index a785050fd..6511e0e08 100644..100755
--- a/src/com/android/camera/PauseButton.java
+++ b/src/com/android/camera/PauseButton.java
@@ -36,11 +36,13 @@ import android.view.MotionEvent;
import android.view.View;
import android.util.Log;
+import com.android.camera.ui.RotateImageView;
+
/**
* A button designed to be used for the on-screen recording
* pausing-continue button.
*/
-public class PauseButton extends ImageView {
+public class PauseButton extends RotateImageView {
public interface OnPauseButtonListener {
void onButtonPause();
diff --git a/src/com/android/camera/ui/OneUICameraControls.java b/src/com/android/camera/ui/OneUICameraControls.java
index 413221211..0388b5761 100644..100755
--- a/src/com/android/camera/ui/OneUICameraControls.java
+++ b/src/com/android/camera/ui/OneUICameraControls.java
@@ -24,10 +24,12 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
+import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
+import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
@@ -43,6 +45,7 @@ public class OneUICameraControls extends RotatableLayout {
private View mShutter;
private View mVideoShutter;
+ private View mPauseButton;
private View mFlashButton;
private View mMute;
private View mFrontBackSwitcher;
@@ -78,6 +81,9 @@ public class OneUICameraControls extends RotatableLayout {
private int mWidth;
private int mHeight;
private boolean mVisible;
+ private boolean mIsVideoMode = false;
+ private int mBottomLargeSize;
+ private int mBottomSmallSize;
private ProMode mProMode;
private ImageView mExposureIcon;
@@ -124,6 +130,7 @@ public class OneUICameraControls extends RotatableLayout {
super.onFinishInflate();
mShutter = findViewById(R.id.shutter_button);
mVideoShutter = findViewById(R.id.video_button);
+ mPauseButton = findViewById(R.id.video_pause);
mFrontBackSwitcher = findViewById(R.id.front_back_switcher);
mTsMakeupSwitcher = findViewById(R.id.ts_makeup_switcher);
mMakeupSeekBarLowText = findViewById(R.id.makeup_low_text);
@@ -217,9 +224,13 @@ public class OneUICameraControls extends RotatableLayout {
mViews = new View[]{
mSceneModeSwitcher, mFilterModeSwitcher, mFrontBackSwitcher,
- mTsMakeupSwitcher, mFlashButton, mShutter, mPreview, mVideoShutter
+ mTsMakeupSwitcher, mFlashButton, mShutter, mPreview, mVideoShutter,
+ mPauseButton
};
-
+ mBottomLargeSize = getResources().getDimensionPixelSize(
+ R.dimen.one_ui_bottom_large);
+ mBottomSmallSize = getResources().getDimensionPixelSize(
+ R.dimen.one_ui_bottom_small);
if(!BeautificationFilter.isSupportedStatic()) {
mTsMakeupSwitcher.setVisibility(View.GONE);
mTsMakeupSwitcher = null;
@@ -311,18 +322,34 @@ public class OneUICameraControls extends RotatableLayout {
int rotation = getUnifiedRotation();
setLocation(mSceneModeSwitcher, true, 0);
setLocation(mFilterModeSwitcher, true, 1);
- setLocation(mFrontBackSwitcher, true, 2);
- setLocation(mTsMakeupSwitcher, true, 3);
- setLocation(mFlashButton, true, 4);
- setLocation(mPreview, false, 0);
- setLocation(mShutter, false, 2);
- setLocation(mVideoShutter, false, 3.15f);
+ if (mIsVideoMode) {
+ setLocation(mMute, true, 2);
+ setLocation(mTsMakeupSwitcher, true, 3);
+ setLocation(mFlashButton, true, 4);
+ setLocation(mPauseButton, false, 3.15f);
+ setLocation(mShutter, false , 0.85f);
+ setLocation(mVideoShutter, false, 2);
+ } else {
+ setLocation(mFrontBackSwitcher, true, 2);
+ setLocation(mTsMakeupSwitcher, true, 3);
+ setLocation(mFlashButton, true, 4);
+ setLocation(mPreview, false, 0);
+ setLocation(mShutter, false, 2);
+ setLocation(mVideoShutter, false, 3.15f);
+ }
setLocationCustomBottom(mMakeupSeekBarLayout, 0, 1);
setLocation(mProModeCloseButton, false, 4);
layoutToast(mRefocusToast, w, h, rotation);
}
+ private void setBottomButtionSize(View view, int width, int height) {
+ FrameLayout.LayoutParams layout = (FrameLayout.LayoutParams)view.getLayoutParams();
+ layout.height = height;
+ layout.width = width;
+ view.setLayoutParams(layout);
+ }
+
private void layoutToast(final View v, int w, int h, int rotation) {
int tw = v.getMeasuredWidth();
int th = v.getMeasuredHeight();
@@ -378,6 +405,17 @@ public class OneUICameraControls extends RotatableLayout {
mVisible = true;
}
+ public void setVideoMode(boolean videoMode) {
+ mIsVideoMode = videoMode;
+ if (mIsVideoMode) {
+ setBottomButtionSize(mVideoShutter, mBottomLargeSize, mBottomLargeSize);
+ setBottomButtionSize(mShutter, mBottomSmallSize, mBottomSmallSize);
+ } else {
+ setBottomButtionSize(mShutter, mBottomLargeSize, mBottomLargeSize);
+ setBottomButtionSize(mVideoShutter, mBottomSmallSize, mBottomSmallSize);
+ }
+ }
+
private void layoutRemaingPhotos() {
int rl = mPreview.getLeft();
int rt = mPreview.getTop();
@@ -431,7 +469,7 @@ public class OneUICameraControls extends RotatableLayout {
View[] views = {
mSceneModeSwitcher, mFilterModeSwitcher, mFrontBackSwitcher,
mTsMakeupSwitcher, mFlashButton, mPreview, mMute, mShutter, mVideoShutter,
- mMakeupSeekBarLowText, mMakeupSeekBarHighText
+ mMakeupSeekBarLowText, mMakeupSeekBarHighText, mPauseButton
};
for (View v : views) {