Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 1 | /* |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 2 | * Copyright (C) 2012 The Android Open Source Project |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.camera; |
| 18 | |
| 19 | import android.graphics.Bitmap; |
Angus Kong | 5f8c30e | 2014-03-06 17:15:08 -0800 | [diff] [blame] | 20 | import android.graphics.Point; |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 21 | import android.graphics.SurfaceTexture; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 22 | import android.hardware.Camera.Parameters; |
Doris Liu | f9e4f8f | 2013-12-04 18:04:22 -0800 | [diff] [blame] | 23 | import android.view.GestureDetector; |
Doris Liu | f9e4f8f | 2013-12-04 18:04:22 -0800 | [diff] [blame] | 24 | import android.view.MotionEvent; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 25 | import android.view.View; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 26 | import android.view.ViewGroup; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 27 | import android.widget.ImageView; |
| 28 | import android.widget.LinearLayout; |
| 29 | import android.widget.TextView; |
| 30 | |
Angus Kong | 5596b4c | 2014-03-11 16:27:30 -0700 | [diff] [blame] | 31 | import com.android.camera.debug.Log; |
Doris Liu | 38c6bc3 | 2014-01-16 18:03:18 -0800 | [diff] [blame] | 32 | import com.android.camera.ui.FocusOverlay; |
Doris Liu | f9e4f8f | 2013-12-04 18:04:22 -0800 | [diff] [blame] | 33 | import com.android.camera.ui.PreviewOverlay; |
Doris Liu | 06db742 | 2013-12-09 19:36:25 -0800 | [diff] [blame] | 34 | import com.android.camera.ui.PreviewStatusListener; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 35 | import com.android.camera.ui.RotateLayout; |
Doris Liu | 8dc878f | 2014-05-05 14:10:34 -0700 | [diff] [blame^] | 36 | import com.android.camera.widget.VideoRecordingHints; |
Sascha Haeberling | 8e963a5 | 2013-08-06 11:43:02 -0700 | [diff] [blame] | 37 | import com.android.camera2.R; |
Sascha Haeberling | 638e6f0 | 2013-09-18 14:28:51 -0700 | [diff] [blame] | 38 | |
| 39 | import java.util.List; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 40 | |
Erin Dahlgren | d8de077 | 2014-02-03 10:12:27 -0800 | [diff] [blame] | 41 | public class VideoUI implements PreviewStatusListener { |
Angus Kong | 5596b4c | 2014-03-11 16:27:30 -0700 | [diff] [blame] | 42 | private static final Log.Tag TAG = new Log.Tag("VideoUI"); |
Doris Liu | e038c16 | 2013-12-13 23:06:11 -0800 | [diff] [blame] | 43 | |
Doris Liu | 70da918 | 2013-12-17 18:41:15 -0800 | [diff] [blame] | 44 | private final static float UNSET = 0f; |
Doris Liu | f9e4f8f | 2013-12-04 18:04:22 -0800 | [diff] [blame] | 45 | private final PreviewOverlay mPreviewOverlay; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 46 | // module fields |
Sascha Haeberling | 67019c7 | 2013-12-14 01:08:38 -0800 | [diff] [blame] | 47 | private final CameraActivity mActivity; |
| 48 | private final View mRootView; |
Doris Liu | 38c6bc3 | 2014-01-16 18:03:18 -0800 | [diff] [blame] | 49 | private final FocusOverlay mFocusUI; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 50 | // An review image having same size as preview. It is displayed when |
| 51 | // recording is stopped in capture intent. |
| 52 | private ImageView mReviewImage; |
Doris Liu | 8dc878f | 2014-05-05 14:10:34 -0700 | [diff] [blame^] | 53 | private VideoRecordingHints mVideoHints; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 54 | private TextView mRecordingTimeView; |
| 55 | private LinearLayout mLabelsLinearLayout; |
| 56 | private View mTimeLapseLabel; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 57 | private RotateLayout mRecordingTimeRect; |
Doris Liu | fe6596c | 2013-10-08 11:03:37 -0700 | [diff] [blame] | 58 | private boolean mRecordingStarted = false; |
Sascha Haeberling | 67019c7 | 2013-12-14 01:08:38 -0800 | [diff] [blame] | 59 | private final VideoController mController; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 60 | private int mZoomMax; |
| 61 | private List<Integer> mZoomRatios; |
| 62 | |
Doris Liu | 70da918 | 2013-12-17 18:41:15 -0800 | [diff] [blame] | 63 | private float mAspectRatio = UNSET; |
Sascha Haeberling | 37f3611 | 2013-08-06 14:31:52 -0700 | [diff] [blame] | 64 | private final AnimationManager mAnimationManager; |
Doris Liu | e038c16 | 2013-12-13 23:06:11 -0800 | [diff] [blame] | 65 | |
Doris Liu | 4a010db | 2013-12-16 18:44:49 -0800 | [diff] [blame] | 66 | @Override |
| 67 | public void onPreviewLayoutChanged(View v, int left, int top, int right, |
| 68 | int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { |
Doris Liu | 70da918 | 2013-12-17 18:41:15 -0800 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public boolean shouldAutoAdjustTransformMatrixOnLayout() { |
| 73 | return true; |
| 74 | } |
| 75 | |
| 76 | @Override |
| 77 | public boolean shouldAutoAdjustBottomBar() { |
| 78 | return true; |
Doris Liu | 4a010db | 2013-12-16 18:44:49 -0800 | [diff] [blame] | 79 | } |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 80 | |
Doris Liu | 11ddd73 | 2014-01-07 10:52:11 -0800 | [diff] [blame] | 81 | @Override |
| 82 | public void onPreviewFlipped() { |
| 83 | mController.updateCameraOrientation(); |
| 84 | } |
| 85 | |
Doris Liu | 06db742 | 2013-12-09 19:36:25 -0800 | [diff] [blame] | 86 | private final GestureDetector.OnGestureListener mPreviewGestureListener |
| 87 | = new GestureDetector.SimpleOnGestureListener() { |
| 88 | @Override |
| 89 | public boolean onSingleTapUp(MotionEvent ev) { |
Doris Liu | d6487c9 | 2014-02-28 10:35:45 -0800 | [diff] [blame] | 90 | if (mVideoHints.getVisibility() == View.VISIBLE) { |
| 91 | mVideoHints.setVisibility(View.INVISIBLE); |
| 92 | } else { |
| 93 | mController.onSingleTapUp(null, (int) ev.getX(), (int) ev.getY()); |
| 94 | } |
Doris Liu | 06db742 | 2013-12-09 19:36:25 -0800 | [diff] [blame] | 95 | return true; |
| 96 | } |
| 97 | }; |
Doris Liu | 3a45c33 | 2013-10-15 19:10:28 -0700 | [diff] [blame] | 98 | |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 99 | public VideoUI(CameraActivity activity, VideoController controller, View parent) { |
| 100 | mActivity = activity; |
| 101 | mController = controller; |
| 102 | mRootView = parent; |
Doris Liu | f55f3c4 | 2013-11-20 00:24:46 -0800 | [diff] [blame] | 103 | ViewGroup moduleRoot = (ViewGroup) mRootView.findViewById(R.id.module_layout); |
| 104 | mActivity.getLayoutInflater().inflate(R.layout.video_module, |
Sascha Haeberling | 67019c7 | 2013-12-14 01:08:38 -0800 | [diff] [blame] | 105 | moduleRoot, true); |
Marco Nelissen | 0744e4a | 2013-11-22 01:47:37 +0000 | [diff] [blame] | 106 | |
Doris Liu | f9e4f8f | 2013-12-04 18:04:22 -0800 | [diff] [blame] | 107 | mPreviewOverlay = (PreviewOverlay) mRootView.findViewById(R.id.preview_overlay); |
Doris Liu | e038c16 | 2013-12-13 23:06:11 -0800 | [diff] [blame] | 108 | |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 109 | initializeMiscControls(); |
Sascha Haeberling | 37f3611 | 2013-08-06 14:31:52 -0700 | [diff] [blame] | 110 | mAnimationManager = new AnimationManager(); |
Doris Liu | 38c6bc3 | 2014-01-16 18:03:18 -0800 | [diff] [blame] | 111 | mFocusUI = (FocusOverlay) mRootView.findViewById(R.id.focus_overlay); |
Doris Liu | 8dc878f | 2014-05-05 14:10:34 -0700 | [diff] [blame^] | 112 | mVideoHints = (VideoRecordingHints) mRootView.findViewById(R.id.video_shooting_hints); |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 113 | } |
| 114 | |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 115 | public void setPreviewSize(int width, int height) { |
| 116 | if (width == 0 || height == 0) { |
| 117 | Log.w(TAG, "Preview size should not be 0."); |
| 118 | return; |
| 119 | } |
Doris Liu | e038c16 | 2013-12-13 23:06:11 -0800 | [diff] [blame] | 120 | float aspectRatio; |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 121 | if (width > height) { |
Doris Liu | e038c16 | 2013-12-13 23:06:11 -0800 | [diff] [blame] | 122 | aspectRatio = (float) width / height; |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 123 | } else { |
Doris Liu | e038c16 | 2013-12-13 23:06:11 -0800 | [diff] [blame] | 124 | aspectRatio = (float) height / width; |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 125 | } |
Doris Liu | e038c16 | 2013-12-13 23:06:11 -0800 | [diff] [blame] | 126 | setAspectRatio(aspectRatio); |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 127 | } |
| 128 | |
Doris Liu | a1ec04a | 2014-01-13 17:29:40 -0800 | [diff] [blame] | 129 | public FocusOverlayManager.FocusUI getFocusUI() { |
| 130 | return mFocusUI; |
| 131 | } |
| 132 | |
Sascha Haeberling | 37f3611 | 2013-08-06 14:31:52 -0700 | [diff] [blame] | 133 | /** |
| 134 | * Starts a flash animation |
| 135 | */ |
| 136 | public void animateFlash() { |
Doris Liu | 1dfe782 | 2013-12-12 00:02:08 -0800 | [diff] [blame] | 137 | mController.startPreCaptureAnimation(); |
Sascha Haeberling | 37f3611 | 2013-08-06 14:31:52 -0700 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | /** |
Sascha Haeberling | 37f3611 | 2013-08-06 14:31:52 -0700 | [diff] [blame] | 141 | * Cancels on-going animations |
| 142 | */ |
| 143 | public void cancelAnimations() { |
| 144 | mAnimationManager.cancelAnimations(); |
| 145 | } |
| 146 | |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 147 | public void setOrientationIndicator(int orientation, boolean animation) { |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 148 | // We change the orientation of the linearlayout only for phone UI |
| 149 | // because when in portrait the width is not enough. |
| 150 | if (mLabelsLinearLayout != null) { |
| 151 | if (((orientation / 90) & 1) == 0) { |
| 152 | mLabelsLinearLayout.setOrientation(LinearLayout.VERTICAL); |
| 153 | } else { |
| 154 | mLabelsLinearLayout.setOrientation(LinearLayout.HORIZONTAL); |
| 155 | } |
| 156 | } |
| 157 | mRecordingTimeRect.setOrientation(0, animation); |
| 158 | } |
| 159 | |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 160 | private void initializeMiscControls() { |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 161 | mReviewImage = (ImageView) mRootView.findViewById(R.id.review_image); |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 162 | mRecordingTimeView = (TextView) mRootView.findViewById(R.id.recording_time); |
| 163 | mRecordingTimeRect = (RotateLayout) mRootView.findViewById(R.id.recording_time_rect); |
| 164 | mTimeLapseLabel = mRootView.findViewById(R.id.time_lapse_label); |
| 165 | // The R.id.labels can only be found in phone layout. |
| 166 | // That is, mLabelsLinearLayout should be null in tablet layout. |
| 167 | mLabelsLinearLayout = (LinearLayout) mRootView.findViewById(R.id.labels); |
| 168 | } |
| 169 | |
Erin Dahlgren | bd3da26 | 2013-12-02 11:48:13 -0800 | [diff] [blame] | 170 | public void updateOnScreenIndicators(Parameters param) { |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 171 | } |
| 172 | |
Doris Liu | e038c16 | 2013-12-13 23:06:11 -0800 | [diff] [blame] | 173 | public void setAspectRatio(float ratio) { |
| 174 | if (ratio <= 0) { |
| 175 | return; |
| 176 | } |
| 177 | float aspectRatio = ratio > 1 ? ratio : 1 / ratio; |
| 178 | if (aspectRatio != mAspectRatio) { |
| 179 | mAspectRatio = aspectRatio; |
Doris Liu | 70da918 | 2013-12-17 18:41:15 -0800 | [diff] [blame] | 180 | mController.updatePreviewAspectRatio(mAspectRatio); |
Doris Liu | e038c16 | 2013-12-13 23:06:11 -0800 | [diff] [blame] | 181 | } |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | public void showTimeLapseUI(boolean enable) { |
| 185 | if (mTimeLapseLabel != null) { |
| 186 | mTimeLapseLabel.setVisibility(enable ? View.VISIBLE : View.GONE); |
| 187 | } |
| 188 | } |
| 189 | |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 190 | public void setSwipingEnabled(boolean enable) { |
| 191 | mActivity.setSwipingEnabled(enable); |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | public void showPreviewBorder(boolean enable) { |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 195 | // TODO: mPreviewFrameLayout.showBorder(enable); |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 196 | } |
| 197 | |
Doris Liu | fe6596c | 2013-10-08 11:03:37 -0700 | [diff] [blame] | 198 | public void showRecordingUI(boolean recording) { |
| 199 | mRecordingStarted = recording; |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 200 | if (recording) { |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 201 | mRecordingTimeView.setText(""); |
| 202 | mRecordingTimeView.setVisibility(View.VISIBLE); |
Alan Newberger | f271192 | 2014-03-26 11:28:50 -0700 | [diff] [blame] | 203 | mRecordingTimeView.announceForAccessibility( |
| 204 | mActivity.getResources().getString(R.string.video_recording_started)); |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 205 | } else { |
Alan Newberger | f271192 | 2014-03-26 11:28:50 -0700 | [diff] [blame] | 206 | mRecordingTimeView.announceForAccessibility( |
| 207 | mActivity.getResources().getString(R.string.video_recording_stopped)); |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 208 | mRecordingTimeView.setVisibility(View.GONE); |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 209 | } |
| 210 | } |
| 211 | |
| 212 | public void showReviewImage(Bitmap bitmap) { |
| 213 | mReviewImage.setImageBitmap(bitmap); |
| 214 | mReviewImage.setVisibility(View.VISIBLE); |
| 215 | } |
| 216 | |
| 217 | public void showReviewControls() { |
Erin Dahlgren | 4efa8b5 | 2013-12-17 18:31:35 -0800 | [diff] [blame] | 218 | mActivity.getCameraAppUI().transitionToIntentReviewLayout(); |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 219 | mReviewImage.setVisibility(View.VISIBLE); |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 220 | } |
| 221 | |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 222 | public void initializeZoom(Parameters param) { |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 223 | mZoomMax = param.getMaxZoom(); |
| 224 | mZoomRatios = param.getZoomRatios(); |
| 225 | // Currently we use immediate zoom for fast zooming to get better UX and |
| 226 | // there is no plan to take advantage of the smooth zoom. |
Doris Liu | f9e4f8f | 2013-12-04 18:04:22 -0800 | [diff] [blame] | 227 | // TODO: setup zoom through App UI. |
| 228 | mPreviewOverlay.setupZoom(mZoomMax, param.getZoom(), mZoomRatios, new ZoomChangeListener()); |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 229 | } |
| 230 | |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 231 | public void setRecordingTime(String text) { |
| 232 | mRecordingTimeView.setText(text); |
| 233 | } |
| 234 | |
| 235 | public void setRecordingTimeTextColor(int color) { |
| 236 | mRecordingTimeView.setTextColor(color); |
| 237 | } |
| 238 | |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 239 | public boolean isVisible() { |
Marco Nelissen | 0744e4a | 2013-11-22 01:47:37 +0000 | [diff] [blame] | 240 | return false; |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 241 | } |
| 242 | |
Doris Liu | 06db742 | 2013-12-09 19:36:25 -0800 | [diff] [blame] | 243 | @Override |
| 244 | public GestureDetector.OnGestureListener getGestureListener() { |
| 245 | return mPreviewGestureListener; |
| 246 | } |
| 247 | |
Erin Dahlgren | d8de077 | 2014-02-03 10:12:27 -0800 | [diff] [blame] | 248 | @Override |
| 249 | public View.OnTouchListener getTouchListener() { |
| 250 | return null; |
| 251 | } |
| 252 | |
Doris Liu | 38c6bc3 | 2014-01-16 18:03:18 -0800 | [diff] [blame] | 253 | /** |
| 254 | * Shows or hides focus UI. |
| 255 | * |
| 256 | * @param show shows focus UI when true, hides it otherwise |
| 257 | */ |
| 258 | public void showFocusUI(boolean show) { |
| 259 | if (mFocusUI != null) { |
| 260 | mFocusUI.setVisibility(show ? View.VISIBLE : View.INVISIBLE); |
| 261 | } |
| 262 | } |
| 263 | |
Doris Liu | d6487c9 | 2014-02-28 10:35:45 -0800 | [diff] [blame] | 264 | /** |
| 265 | * Shows or hides video recording hints. |
| 266 | * |
| 267 | * @param show shows video recording hints when true, hides it otherwise. |
| 268 | */ |
| 269 | public void showVideoRecordingHints(boolean show) { |
| 270 | mVideoHints.setVisibility(show ? View.VISIBLE : View.INVISIBLE); |
| 271 | } |
| 272 | |
Angus Kong | 5f8c30e | 2014-03-06 17:15:08 -0800 | [diff] [blame] | 273 | /** |
| 274 | * @return The size of the available preview area. |
| 275 | */ |
| 276 | public Point getPreviewScreenSize() { |
| 277 | return new Point(mRootView.getMeasuredWidth(), mRootView.getMeasuredHeight()); |
| 278 | } |
| 279 | |
Doris Liu | 8dc878f | 2014-05-05 14:10:34 -0700 | [diff] [blame^] | 280 | public void onOrientationChanged(int orientation) { |
| 281 | mVideoHints.onOrientationChanged(orientation); |
| 282 | } |
| 283 | |
Doris Liu | f9e4f8f | 2013-12-04 18:04:22 -0800 | [diff] [blame] | 284 | private class ZoomChangeListener implements PreviewOverlay.OnZoomChangedListener { |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 285 | @Override |
| 286 | public void onZoomValueChanged(int index) { |
Doris Liu | f9e4f8f | 2013-12-04 18:04:22 -0800 | [diff] [blame] | 287 | mController.onZoomChanged(index); |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | @Override |
| 291 | public void onZoomStart() { |
| 292 | } |
| 293 | |
| 294 | @Override |
| 295 | public void onZoomEnd() { |
| 296 | } |
| 297 | } |
Michael Kolb | 3bc96b2 | 2013-03-12 10:24:42 -0700 | [diff] [blame] | 298 | |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 299 | // SurfaceTexture callbacks |
Michael Kolb | 3bc96b2 | 2013-03-12 10:24:42 -0700 | [diff] [blame] | 300 | @Override |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 301 | public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { |
Angus Kong | 395ee2d | 2013-07-15 12:42:41 -0700 | [diff] [blame] | 302 | mController.onPreviewUIReady(); |
Michael Kolb | 3bc96b2 | 2013-03-12 10:24:42 -0700 | [diff] [blame] | 303 | } |
| 304 | |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 305 | @Override |
| 306 | public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { |
Angus Kong | 395ee2d | 2013-07-15 12:42:41 -0700 | [diff] [blame] | 307 | mController.onPreviewUIDestroyed(); |
Doris Liu | 6432cd6 | 2013-06-13 17:20:31 -0700 | [diff] [blame] | 308 | Log.d(TAG, "surfaceTexture is destroyed"); |
| 309 | return true; |
| 310 | } |
| 311 | |
| 312 | @Override |
| 313 | public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { |
| 314 | } |
| 315 | |
| 316 | @Override |
| 317 | public void onSurfaceTextureUpdated(SurfaceTexture surface) { |
| 318 | } |
Doris Liu | 6827ce2 | 2013-03-12 19:24:28 -0700 | [diff] [blame] | 319 | } |