summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-11-14 00:52:18 -0800
committerSteve Kondik <steve@cyngn.com>2016-11-14 13:51:42 -0800
commite003727e367b17a0bea0103b6dee42bc39208cb9 (patch)
treeddce3f6a61b3e6508aa4503a1be2752cdf8c5d46
parentee62781b8d80b4426f70d85724255181f8d35f61 (diff)
downloadandroid_packages_apps_Snap-e003727e367b17a0bea0103b6dee42bc39208cb9.zip
android_packages_apps_Snap-e003727e367b17a0bea0103b6dee42bc39208cb9.tar.gz
android_packages_apps_Snap-e003727e367b17a0bea0103b6dee42bc39208cb9.tar.bz2
snap: Use new widgets for CaptureUI
Change-Id: I1d142d60af3f51c71ce3711642d074faf7b456c2
-rw-r--r--res/layout/capture_module.xml26
-rw-r--r--src/com/android/camera/BaseUI.java42
-rw-r--r--src/com/android/camera/CaptureModule.java118
-rw-r--r--src/com/android/camera/CaptureUI.java64
-rw-r--r--src/com/android/camera/PauseButton.java4
-rw-r--r--src/com/android/camera/PhotoUI.java4
-rw-r--r--src/com/android/camera/VideoModule.java8
-rw-r--r--src/com/android/camera/VideoUI.java79
8 files changed, 87 insertions, 258 deletions
diff --git a/res/layout/capture_module.xml b/res/layout/capture_module.xml
index eee33f5..d52a8fa 100644
--- a/res/layout/capture_module.xml
+++ b/res/layout/capture_module.xml
@@ -78,30 +78,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
- <com.android.camera.ui.RotateLayout
- android:id="@+id/recording_time_rect"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- 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"/>
-
- <include
- android:id="@+id/labels"
- layout="@layout/viewfinder_labels_video"/>
- </LinearLayout>
- </com.android.camera.ui.RotateLayout>
+ <include layout="@layout/recording_time"
+ android:id="@+id/recording_time" />
<include layout="@layout/camera_controls"
android:layout_gravity="center"
diff --git a/src/com/android/camera/BaseUI.java b/src/com/android/camera/BaseUI.java
index c5c3c2b..384c166 100644
--- a/src/com/android/camera/BaseUI.java
+++ b/src/com/android/camera/BaseUI.java
@@ -12,6 +12,7 @@ import android.view.ViewStub;
import com.android.camera.ui.CameraControls;
import com.android.camera.ui.CaptureAnimationOverlay;
import com.android.camera.ui.ModuleSwitcher;
+import com.android.camera.ui.RecordingTime;
import com.android.camera.util.CameraUtil;
import org.codeaurora.snapcam.R;
@@ -29,11 +30,13 @@ public abstract class BaseUI {
protected final CameraActivity mActivity;
protected final ViewGroup mRootView;
- protected CameraControls mCameraControls;
+ protected final CameraControls mCameraControls;
+ protected final RecordingTime mRecordingTime;
protected int mTopMargin = 0;
protected int mBottomMargin = 0;
protected int mScreenRatio = CameraUtil.RATIO_UNKNOWN;
+ protected int mOrientation = 0;
private boolean mOverlaysDisabled;
private final List<View> mDisabledViews = new ArrayList<>();
@@ -47,6 +50,7 @@ public abstract class BaseUI {
mCameraControls = (CameraControls) mRootView.findViewById(R.id.camera_controls);
mCaptureOverlay = (CaptureAnimationOverlay) mRootView.findViewById(R.id.capture_overlay);
mPreviewCover = mRootView.findViewById(R.id.preview_cover);
+ mRecordingTime = (RecordingTime) mRootView.findViewById(R.id.recording_time);
Point size = new Point();
mActivity.getWindowManager().getDefaultDisplay().getRealSize(size);
@@ -200,4 +204,40 @@ public abstract class BaseUI {
}
}
}
+
+ public void setOrientation(int orientation, boolean animation) {
+ mOrientation = orientation;
+
+ if (mCameraControls != null) {
+ mCameraControls.setOrientation(orientation, animation);
+ }
+ if (mRecordingTime != null) {
+ mRecordingTime.setOrientation(orientation);
+ }
+ }
+
+ public void startRecordingTimer(int frameRate, long frameInterval, long durationMs) {
+ if (mRecordingTime != null) {
+ mRecordingTime.start(frameRate, frameInterval, durationMs);
+ }
+ }
+
+ public void stopRecordingTimer() {
+ if (mRecordingTime != null) {
+ mRecordingTime.stop();
+ }
+ }
+
+ public long getRecordingTime() {
+ if (mRecordingTime != null) {
+ return mRecordingTime.getTime();
+ }
+ return -1;
+ }
+
+ public void showTimeLapseUI(boolean enable) {
+ if (mRecordingTime != null) {
+ mRecordingTime.showTimeLapse(enable);
+ }
+ }
}
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 0fade10..8aea9cd 100644
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -62,7 +62,6 @@ import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
-import android.os.SystemClock;
import android.provider.MediaStore;
import android.util.Log;
import android.util.Range;
@@ -75,17 +74,14 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
-import com.android.camera.exif.ExifInterface;
-import com.android.camera.Exif;
-import com.android.camera.imageprocessor.filter.ImageFilter;
-import com.android.camera.imageprocessor.PostProcessor;
-import com.android.camera.imageprocessor.FrameProcessor;
import com.android.camera.PhotoModule.NamedImages;
import com.android.camera.PhotoModule.NamedImages.NamedEntity;
+import com.android.camera.exif.ExifInterface;
+import com.android.camera.imageprocessor.FrameProcessor;
+import com.android.camera.imageprocessor.PostProcessor;
+import com.android.camera.imageprocessor.filter.ImageFilter;
import com.android.camera.imageprocessor.filter.SharpshooterFilter;
-import com.android.camera.imageprocessor.filter.StillmoreFilter;
import com.android.camera.ui.CountDownView;
-import com.android.camera.ui.focus.FocusRing;
import com.android.camera.ui.ModuleSwitcher;
import com.android.camera.ui.RotateTextToast;
import com.android.camera.ui.TrackingFocusRenderer;
@@ -102,7 +98,6 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Comparator;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
@@ -112,7 +107,8 @@ import java.util.concurrent.TimeUnit;
public class CaptureModule implements CameraModule, PhotoController,
MediaSaveService.Listener, ClearSightImageProcessor.Callback,
SettingsManager.Listener, LocationManager.Listener,
- CountDownView.OnCountDownFinishedListener {
+ CountDownView.OnCountDownFinishedListener,
+ PauseButton.OnPauseButtonListener {
public static final int DUAL_MODE = 0;
public static final int BAYER_MODE = 1;
public static final int MONO_MODE = 2;
@@ -274,13 +270,9 @@ public class CaptureModule implements CameraModule, PhotoController,
private int mTimeBetweenTimeLapseFrameCaptureMs = 0;
private boolean mCaptureTimeLapse = false;
private CamcorderProfile mProfile;
- private static final int UPDATE_RECORD_TIME = 5;
private ContentValues mCurrentVideoValues;
private String mVideoFilename;
private boolean mMediaRecorderPausing = false;
- private long mRecordingStartTime;
- private long mRecordingTotalTime;
- private boolean mRecordingTimeCountsDown = false;
private ImageReader mVideoSnapshotImageReader;
private Range mHighSpeedFPSRange;
private boolean mHighSpeedCapture = false;
@@ -2386,16 +2378,15 @@ public class CaptureModule implements CameraModule, PhotoController,
}
mMediaRecorder.start();
mUI.getFocusRing().stopFocusAnimations();
- mUI.resetPauseButton();
- mRecordingTotalTime = 0L;
- mRecordingStartTime = SystemClock.uptimeMillis();
mUI.showRecordingUI(true);
- updateRecordingTime();
+ mUI.startRecordingTimer(mProfile.videoFrameRate,
+ mTimeBetweenTimeLapseFrameCaptureMs, mMaxVideoDurationInMs);
}
@Override
public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {
Toast.makeText(mActivity, "Video Failed", Toast.LENGTH_SHORT).show();
+ mUI.stopRecordingTimer();
}
}, null);
} else {
@@ -2426,11 +2417,9 @@ public class CaptureModule implements CameraModule, PhotoController,
}
mMediaRecorder.start();
mUI.getFocusRing().stopFocusAnimations();
- mUI.resetPauseButton();
- mRecordingTotalTime = 0L;
- mRecordingStartTime = SystemClock.uptimeMillis();
mUI.showRecordingUI(true);
- updateRecordingTime();
+ mUI.startRecordingTimer(mProfile.videoFrameRate,
+ mTimeBetweenTimeLapseFrameCaptureMs, mMaxVideoDurationInMs);
}
@Override
@@ -2511,89 +2500,20 @@ public class CaptureModule implements CameraModule, PhotoController,
}
}
- private long getTimeLapseVideoLength(long deltaMs) {
- // For better approximation calculate fractional number of frames captured.
- // This will update the video time at a higher resolution.
- double numberOfFrames = (double) deltaMs / mTimeBetweenTimeLapseFrameCaptureMs;
- return (long) (numberOfFrames / mProfile.videoFrameRate * 1000);
- }
-
- private void updateRecordingTime() {
- if (!mIsRecordingVideo) {
- return;
- }
- if (mMediaRecorderPausing) {
- return;
- }
-
- long now = SystemClock.uptimeMillis();
- long delta = now - mRecordingStartTime + mRecordingTotalTime;
-
- // Starting a minute before reaching the max duration
- // limit, we'll countdown the remaining time instead.
- boolean countdownRemainingTime = (mMaxVideoDurationInMs != 0
- && delta >= mMaxVideoDurationInMs - 60000);
-
- long deltaAdjusted = delta;
- if (countdownRemainingTime) {
- deltaAdjusted = Math.max(0, mMaxVideoDurationInMs - deltaAdjusted) + 999;
- }
- String text;
-
- long targetNextUpdateDelay;
- if (!mCaptureTimeLapse) {
- text = CameraUtil.millisecondToTimeString(deltaAdjusted, false);
- targetNextUpdateDelay = 1000;
- } else {
- // The length of time lapse video is different from the length
- // of the actual wall clock time elapsed. Display the video length
- // only in format hh:mm:ss.dd, where dd are the centi seconds.
- text = CameraUtil.millisecondToTimeString(getTimeLapseVideoLength(delta), true);
- targetNextUpdateDelay = mTimeBetweenTimeLapseFrameCaptureMs;
- }
-
- mUI.setRecordingTime(text);
-
- if (mRecordingTimeCountsDown != countdownRemainingTime) {
- // Avoid setting the color on every update, do it only
- // when it needs changing.
- mRecordingTimeCountsDown = countdownRemainingTime;
-
- int color = mActivity.getResources().getColor(countdownRemainingTime
- ? R.color.recording_time_remaining_text
- : R.color.recording_time_elapsed_text);
-
- mUI.setRecordingTimeTextColor(color);
- }
-
- long actualNextUpdateDelay = targetNextUpdateDelay - (delta % targetNextUpdateDelay);
- mHandler.sendEmptyMessageDelayed(
- UPDATE_RECORD_TIME, actualNextUpdateDelay);
- }
-
- private void pauseVideoRecording() {
+ @Override
+ public void onButtonPause() {
Log.v(TAG, "pauseVideoRecording");
mMediaRecorderPausing = true;
- mRecordingTotalTime += SystemClock.uptimeMillis() - mRecordingStartTime;
mMediaRecorder.pause();
}
- private void resumeVideoRecording() {
+ @Override
+ public void onButtonContinue() {
Log.v(TAG, "resumeVideoRecording");
mMediaRecorderPausing = false;
- mRecordingStartTime = SystemClock.uptimeMillis();
- updateRecordingTime();
mMediaRecorder.start();
}
- public void onButtonPause() {
- pauseVideoRecording();
- }
-
- public void onButtonContinue() {
- resumeVideoRecording();
- }
-
private void stopRecordingVideo(int cameraId) {
Log.d(TAG, "stopRecordingVideo " + cameraId);
@@ -2606,6 +2526,7 @@ public class CaptureModule implements CameraModule, PhotoController,
saveVideo();
mUI.showRecordingUI(false);
+ mUI.stopRecordingTimer();
mIsRecordingVideo = false;
boolean changed = mUI.setPreviewSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());
if (changed) {
@@ -3580,12 +3501,7 @@ public class CaptureModule implements CameraModule, PhotoController,
}
@Override
public void handleMessage(Message msg) {
- switch (msg.what) {
- case UPDATE_RECORD_TIME: {
- updateRecordingTime();
- break;
- }
- }
+
}
}
diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java
index debd180..e1f6dea 100644
--- a/src/com/android/camera/CaptureUI.java
+++ b/src/com/android/camera/CaptureUI.java
@@ -63,7 +63,6 @@ import com.android.camera.ui.CountDownView;
import com.android.camera.ui.focus.FocusRing;
import com.android.camera.ui.ListMenu;
import com.android.camera.ui.ListSubMenu;
-import com.android.camera.ui.ModuleSwitcher;
import com.android.camera.ui.PieRenderer;
import com.android.camera.ui.RenderOverlay;
import com.android.camera.ui.RotateImageView;
@@ -224,11 +223,6 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen
private View mFilterModeSwitcher;
private View mSceneModeSwitcher;
private View mFrontBackSwitcher;
- private TextView mRecordingTimeView;
- private LinearLayout mLabelsLinearLayout;
- private View mTimeLapseLabel;
- private RotateLayout mRecordingTimeRect;
- private PauseButton mPauseButton;
private RotateImageView mMuteButton;
int mPreviewWidth;
@@ -304,12 +298,7 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen
mMenuButton = mRootView.findViewById(R.id.menu);
- mRecordingTimeView = (TextView) mRootView.findViewById(R.id.recording_time);
- mRecordingTimeRect = (RotateLayout) mRootView.findViewById(R.id.recording_time_rect);
- mTimeLapseLabel = mRootView.findViewById(R.id.time_lapse_label);
- mLabelsLinearLayout = (LinearLayout) mRootView.findViewById(R.id.labels);
- mPauseButton = (PauseButton) mRootView.findViewById(R.id.video_pause);
- mPauseButton.setOnPauseButtonListener(this);
+ mRecordingTime.setPauseListener(this);
mMuteButton = (RotateImageView)mRootView.findViewById(R.id.mute_button);
mMuteButton.setVisibility(View.VISIBLE);
@@ -353,8 +342,6 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen
mGestures.setRenderOverlay(mRenderOverlay);
mRenderOverlay.requestLayout();
-
- ((ViewGroup)mRootView).removeView(mRecordingTimeRect);
}
public void onCameraOpened(List<Integer> cameraIds) {
@@ -507,24 +494,14 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen
});
}
- public void showTimeLapseUI(boolean enable) {
- if (mTimeLapseLabel != null) {
- mTimeLapseLabel.setVisibility(enable ? View.VISIBLE : View.GONE);
- }
- }
-
public void showRecordingUI(boolean recording) {
mMenuButton.setVisibility(recording ? View.GONE : View.VISIBLE);
if (recording) {
mVideoButton.setImageResource(R.drawable.shutter_button_video_stop);
- hideSwitcher();
- mRecordingTimeView.setText("");
- ((ViewGroup)mRootView).addView(mRecordingTimeRect);
mMuteButton.setVisibility(View.VISIBLE);
} else {
mVideoButton.setImageResource(R.drawable.btn_new_shutter_video);
- showSwitcher();
- ((ViewGroup)mRootView).removeView(mRecordingTimeRect);
+ stopRecordingTimer();
mMuteButton.setVisibility(View.INVISIBLE);
}
}
@@ -1116,11 +1093,6 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen
if (mFrontBackSwitcher != null) mFrontBackSwitcher.setVisibility(status);
if (mSceneModeSwitcher != null) mSceneModeSwitcher.setVisibility(status);
if (mFilterModeSwitcher != null) mFilterModeSwitcher.setVisibility(status);
- if (hide) {
- mCameraControls.hideSwitcher();
- } else {
- mCameraControls.showSwitcher();
- }
}
public boolean isCameraControlsAnimating() {
@@ -1399,9 +1371,9 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen
setOrientation(mOrientation, true);
}
+ @Override
public void setOrientation(int orientation, boolean animation) {
- mOrientation = orientation;
- mCameraControls.setOrientation(orientation, animation);
+ super.setOrientation(orientation, animation);
if (mMenuLayout != null)
mMenuLayout.setOrientation(orientation, animation);
if (mSubMenuLayout != null)
@@ -1417,15 +1389,7 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen
}
}
}
- if (mRecordingTimeRect != null) {
- if (orientation == 180) {
- mRecordingTimeRect.setOrientation(0, false);
- mRecordingTimeView.setRotation(180);
- } else {
- mRecordingTimeView.setRotation(0);
- mRecordingTimeRect.setOrientation(orientation, false);
- }
- }
+
if (mFaceView != null) {
mFaceView.setDisplayRotation(orientation);
}
@@ -1498,31 +1462,13 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen
mShutterButton.setPressed(true);
}
- public void setRecordingTime(String text) {
- mRecordingTimeView.setText(text);
- }
-
- public void setRecordingTimeTextColor(int color) {
- mRecordingTimeView.setTextColor(color);
- }
-
- public void resetPauseButton() {
- mRecordingTimeView.setCompoundDrawablesWithIntrinsicBounds(
- R.drawable.ic_recording_indicator, 0, 0, 0);
- mPauseButton.setPaused(false);
- }
-
@Override
public void onButtonPause() {
- mRecordingTimeView.setCompoundDrawablesWithIntrinsicBounds(
- R.drawable.ic_pausing_indicator, 0, 0, 0);
mModule.onButtonPause();
}
@Override
public void onButtonContinue() {
- mRecordingTimeView.setCompoundDrawablesWithIntrinsicBounds(
- R.drawable.ic_recording_indicator, 0, 0, 0);
mModule.onButtonContinue();
}
diff --git a/src/com/android/camera/PauseButton.java b/src/com/android/camera/PauseButton.java
index a785050..c74b119 100644
--- a/src/com/android/camera/PauseButton.java
+++ b/src/com/android/camera/PauseButton.java
@@ -43,8 +43,8 @@ import android.util.Log;
public class PauseButton extends ImageView {
public interface OnPauseButtonListener {
- void onButtonPause();
- void onButtonContinue();
+ public void onButtonPause();
+ public void onButtonContinue();
}
public PauseButton(Context context, AttributeSet attrs) {
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 1e019a6..f71eb31 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -1191,9 +1191,9 @@ public class PhotoUI extends BaseUI implements PieListener,
mCameraControls.updateRemainingPhotos(remaining);
}
+ @Override
public void setOrientation(int orientation, boolean animation) {
- mOrientation = orientation;
- mCameraControls.setOrientation(orientation, animation);
+ super.setOrientation(orientation, animation);
if (mMenuHelp != null)
mMenuHelp.setOrientation(orientation, animation);
if (mMenuLayout != null)
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 43fc7c5..049ce0a 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -585,7 +585,6 @@ public class VideoModule implements CameraModule,
mQuickCapture = mActivity.getIntent().getBooleanExtra(EXTRA_QUICK_CAPTURE, false);
mLocationManager = new LocationManager(mActivity, this);
- mUI.setOrientationIndicator(0, false);
setDisplayOrientation();
mUI.showTimeLapseUI(mCaptureTimeLapse);
@@ -1272,9 +1271,6 @@ public class VideoModule implements CameraModule,
mUI.updateOnScreenIndicators(mParameters, mPreferences);
mUI.setSwitcherIndex();
- // From onResume
- mUI.setOrientationIndicator(0, false);
-
UsageStatistics.onContentViewChanged(
UsageStatistics.COMPONENT_CAMERA, "VideoModule");
mHandler.post(new Runnable(){
@@ -2266,9 +2262,7 @@ public class VideoModule implements CameraModule,
if (!mIsVideoCaptureIntent) {
mUI.enableCameraControls(true);
}
- // The orientation was fixed during video recording. Now make it
- // reflect the device orientation as video recording is stopped.
- mUI.setOrientationIndicator(0, true);
+
keepScreenOnAwhile();
if (shouldAddToMediaStoreNow && !fail) {
if (mVideoFileDescriptor == null) {
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index a21b327..4679908 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -16,19 +16,14 @@
package com.android.camera;
-import java.util.List;
-
-import org.codeaurora.snapcam.R;
-
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Color;
-import android.graphics.Point;
import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.hardware.Camera;
-import android.hardware.Camera.Parameters;
import android.hardware.Camera.Face;
+import android.hardware.Camera.Parameters;
import android.util.Log;
import android.view.Gravity;
import android.view.MotionEvent;
@@ -45,29 +40,27 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
-import android.widget.TextView;
-import android.view.View.OnLayoutChangeListener;
import com.android.camera.CameraManager.CameraProxy;
import com.android.camera.CameraPreference.OnPreferenceChangedListener;
import com.android.camera.PhotoUI.SurfaceTextureSizeChangedListener;
import com.android.camera.ui.AbstractSettingPopup;
-import com.android.camera.ui.CameraControls;
import com.android.camera.ui.CameraRootView;
import com.android.camera.ui.FaceView;
import com.android.camera.ui.ListSubMenu;
-import com.android.camera.ui.ModuleSwitcher;
import com.android.camera.ui.PieRenderer;
-import com.android.camera.ui.RecordingTime;
import com.android.camera.ui.RenderOverlay;
-import com.android.camera.ui.ReversibleLinearLayout;
-import com.android.camera.ui.RotateLayout;
import com.android.camera.ui.RotateImageView;
+import com.android.camera.ui.RotateLayout;
import com.android.camera.ui.RotateTextToast;
import com.android.camera.ui.ZoomRenderer;
import com.android.camera.ui.focus.FocusRing;
import com.android.camera.util.CameraUtil;
+import org.codeaurora.snapcam.R;
+
+import java.util.List;
+
public class VideoUI extends BaseUI implements PieRenderer.PieListener,
PreviewGestures.SingleTapListener,
CameraRootView.MyDisplayListener,
@@ -85,8 +78,6 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
private View mReviewDoneButton;
private View mReviewPlayButton;
private ShutterButton mShutterButton;
- private RecordingTime mRecordingTime;
- private LinearLayout mLabelsLinearLayout;
private RenderOverlay mRenderOverlay;
private PieRenderer mPieRenderer;
private VideoMenu mVideoMenu;
@@ -237,7 +228,8 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
initializeMiscControls();
initializeControlByIntent();
- initializeRecordingTime();
+
+ mRecordingTime.setPauseListener(this);
ViewStub faceViewStub = (ViewStub) mRootView
.findViewById(R.id.face_view_stub);
@@ -269,7 +261,7 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
});
if (mController.isVideoCaptureIntent()) {
- mCameraControls.hideSwitcher();
+ hideSwitcher();
mActivity.getLayoutInflater().inflate(R.layout.review_module_control,
(ViewGroup) mCameraControls);
// Cannot use RotateImageView for "done" and "cancel" button because
@@ -493,18 +485,6 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
}
}
- public void setOrientationIndicator(int orientation, boolean animation) {
- // We change the orientation of the linearlayout only for phone UI
- // because when in portrait the width is not enough.
- if (mLabelsLinearLayout != null) {
- if (((orientation / 90) & 1) == 0) {
- mLabelsLinearLayout.setOrientation(LinearLayout.VERTICAL);
- } else {
- mLabelsLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
- }
- }
- }
-
public SurfaceHolder getSurfaceHolder() {
return mSurfaceHolder;
}
@@ -592,15 +572,6 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
mReviewImage = (ImageView) mRootView.findViewById(R.id.review_image);
mShutterButton.requestFocus();
mShutterButton.enableTouch(true);
-
- // The R.id.labels can only be found in phone layout.
- // That is, mLabelsLinearLayout should be null in tablet layout.
- mLabelsLinearLayout = (LinearLayout) mRootView.findViewById(R.id.labels);
- }
-
- private void initializeRecordingTime() {
- mRecordingTime = (RecordingTime) mRootView.findViewById(R.id.recording_time);
- mRecordingTime.setPauseListener(this);
}
public void updateOnScreenIndicators(Parameters param, ComboPreferences prefs) {
@@ -628,10 +599,6 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
layoutPreview((float)ratio);
}
- public void showTimeLapseUI(boolean enable) {
- mRecordingTime.showTimeLapse(enable);
- }
-
public void dismissPopup(boolean topLevelOnly) {
// In review mode, we do not want to bring up the camera UI
if (mController.isInReviewMode()) return;
@@ -867,28 +834,16 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
mOnScreenIndicators.setVisibility(recording ? View.GONE : View.VISIBLE);
if (recording) {
mShutterButton.setImageResource(R.drawable.shutter_button_video_stop);
- mCameraControls.hideSwitcher();
+ hideSwitcher();
} else {
mShutterButton.setImageResource(R.drawable.btn_new_shutter_video);
if (!mController.isVideoCaptureIntent()) {
- mCameraControls.showSwitcher();
+ showSwitcher();
}
stopRecordingTimer();
}
}
- public void startRecordingTimer(int frameRate, long frameInterval, long durationMs) {
- mRecordingTime.start(frameRate, frameInterval, durationMs);
- }
-
- public void stopRecordingTimer() {
- mRecordingTime.stop();
- }
-
- public long getRecordingTime() {
- return mRecordingTime.getTime();
- }
-
public void hideUIwhileRecording() {
mCameraControls.setMenuAndSwitcherEnabled(false);
}
@@ -1064,16 +1019,16 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
mVideoMenu.setPreference(key, value);
}
+ @Override
public void setOrientation(int orientation, boolean animation) {
- mCameraControls.setOrientation(orientation, animation);
- if (mMenuLayout != null)
+ super.setOrientation(orientation, animation);
+ if (mMenuLayout != null) {
mMenuLayout.setOrientation(orientation, animation);
- if (mSubMenuLayout != null)
+ }
+ if (mSubMenuLayout != null) {
mSubMenuLayout.setOrientation(orientation, animation);
-
- if (mRecordingTime != null) {
- mRecordingTime.setOrientation(orientation);
}
+
if (mPreviewMenuLayout != null) {
ViewGroup vg = (ViewGroup) mPreviewMenuLayout.getChildAt(0);
if (vg != null)