diff options
author | Steve Kondik <shade@chemlab.org> | 2013-08-28 14:21:49 +0800 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2015-09-20 20:02:05 +0300 |
commit | eaae37ffbc5c216e43540cf0a561a82384631796 (patch) | |
tree | ddd4b74389f85f85c874e77a876b114c669e1b74 /src/com/android/camera/VideoUI.java | |
parent | 58d454bd4ef24aa8e71bcb6ab3b4349902561256 (diff) | |
download | android_packages_apps_Snap-eaae37ffbc5c216e43540cf0a561a82384631796.tar.gz android_packages_apps_Snap-eaae37ffbc5c216e43540cf0a561a82384631796.tar.bz2 android_packages_apps_Snap-eaae37ffbc5c216e43540cf0a561a82384631796.zip |
camera: Touch focus support for camcorder
* Available when video snapshots are not supported.
* Original from CodeAurora Forum.
Sultanxda: Adapted to Snapdragon Camera
Change-Id: I232c178430db08e7366aa9f91b4926d07e7c225d
Diffstat (limited to 'src/com/android/camera/VideoUI.java')
-rw-r--r-- | src/com/android/camera/VideoUI.java | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java index daab24a40..2e1d300cc 100644 --- a/src/com/android/camera/VideoUI.java +++ b/src/com/android/camera/VideoUI.java @@ -42,11 +42,14 @@ 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.CameraPreference.OnPreferenceChangedListener; +import com.android.camera.FocusOverlayManager.FocusUI; import com.android.camera.ui.AbstractSettingPopup; import com.android.camera.ui.CameraControls; import com.android.camera.ui.CameraRootView; +import com.android.camera.ui.FocusIndicator; import com.android.camera.ui.ListSubMenu; import com.android.camera.ui.ModuleSwitcher; import com.android.camera.ui.PieRenderer; @@ -59,6 +62,7 @@ import com.android.camera.util.CameraUtil; public class VideoUI implements PieRenderer.PieListener, PreviewGestures.SingleTapListener, CameraRootView.MyDisplayListener, + FocusUI, SurfaceHolder.Callback, PauseButton.OnPauseButtonListener { private static final String TAG = "CAM_VideoUI"; @@ -332,7 +336,7 @@ public class VideoUI implements PieRenderer.PieListener, private void layoutPreview(float ratio) { FrameLayout.LayoutParams lp = null; - float scaledTextureWidth, scaledTextureHeight; + float scaledTextureWidth = 0.0f, scaledTextureHeight = 0.0f; int rotation = CameraUtil.getDisplayRotation(mActivity); if (mScreenRatio == CameraUtil.RATIO_16_9 && CameraUtil.determinCloseRatio(ratio) == CameraUtil.RATIO_4_3) { @@ -412,6 +416,11 @@ public class VideoUI implements PieRenderer.PieListener, mSurfaceView.setLayoutParams(lp); mSurfaceView.requestLayout(); } + + if (scaledTextureWidth > 0 && scaledTextureHeight > 0) { + mController.onScreenSizeChanged((int) scaledTextureWidth, + (int) scaledTextureHeight); + } } /** @@ -1131,4 +1140,48 @@ public class VideoUI implements PieRenderer.PieListener, public void adjustOrientation() { setOrientation(mOrientation, false); } + + // implement focusUI interface + private FocusIndicator getFocusIndicator() { + return mPieRenderer; + } + + @Override + public boolean hasFaces() { + return false; + } + + @Override + public void clearFocus() { + FocusIndicator indicator = getFocusIndicator(); + if (indicator != null) indicator.clear(); + } + + @Override + public void setFocusPosition(int x, int y) { + mPieRenderer.setFocus(x, y); + } + + @Override + public void onFocusStarted(){ + getFocusIndicator().showStart(); + } + + @Override + public void onFocusSucceeded(boolean timeOut) { + getFocusIndicator().showSuccess(timeOut); + } + + @Override + public void onFocusFailed(boolean timeOut) { + getFocusIndicator().showFail(timeOut); + } + + @Override + public void pauseFaceDetection() { + } + + @Override + public void resumeFaceDetection() { + } } |