/*
* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein is
* confidential and proprietary to MediaTek Inc. and/or its licensors. Without
* the prior written permission of MediaTek inc. and/or its licensors, any
* reproduction, modification, use or disclosure of MediaTek Software, and
* information contained herein, in whole or in part, shall be strictly
* prohibited.
*
* MediaTek Inc. (C) 2016. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
* ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
* RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
* INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
* TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
* RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
* OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
* SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
* RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
* ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
* RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
* MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
* CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek
* Software") have been modified by MediaTek Inc. All revisions are subject to
* any receiver's applicable license agreements with MediaTek Inc.
*/
package com.mediatek.camera.ui;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.provider.MediaStore;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.OrientationEventListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.mediatek.camera.R;
import com.mediatek.camera.common.IAppUi;
import com.mediatek.camera.common.IAppUiListener.ISurfaceStatusListener;
import com.mediatek.camera.common.IAppUiListener.OnGestureListener;
import com.mediatek.camera.common.IAppUiListener.OnModeChangeListener;
import com.mediatek.camera.common.IAppUiListener.OnPreviewAreaChangedListener;
import com.mediatek.camera.common.IAppUiListener.OnPreviewTouchedListener;
import com.mediatek.camera.common.IAppUiListener.OnShutterButtonListener;
import com.mediatek.camera.common.IAppUiListener.OnThumbnailClickedListener;
import com.mediatek.camera.common.app.IApp;
import com.mediatek.camera.common.debug.LogHelper;
import com.mediatek.camera.common.debug.LogUtil;
import com.mediatek.camera.common.mode.IReviewUI;
import com.mediatek.camera.common.mode.photo.intent.IIntentPhotoUi;
import com.mediatek.camera.common.mode.video.videoui.IVideoUI;
import com.mediatek.camera.common.setting.ICameraSettingView;
import com.mediatek.camera.common.utils.CameraUtil;
import com.mediatek.camera.common.widget.PreviewFrameLayout;
import com.mediatek.camera.common.widget.RotateLayout;
import com.mediatek.camera.gesture.GestureManager;
import com.mediatek.camera.ui.modepicker.ModePickerManager;
import com.mediatek.camera.ui.modepicker.ModeProvider;
import com.mediatek.camera.ui.photo.IntentPhotoUi;
import com.mediatek.camera.ui.preview.PreviewManager;
import com.mediatek.camera.ui.shutter.ShutterButtonManager;
import com.mediatek.camera.ui.video.VideoUI;
import java.util.ArrayList;
import java.util.List;
/**
* CameraAppUI centralizes control of views shared across modules. Whereas module
* specific views will be handled in each Module UI. For example, we can now
* bring the flash animation and capture animation up from each module to app
* level, as these animations are largely the same for all modules.
*
* This class also serves to disambiguate touch events. It recognizes all the
* swipe gestures that happen on the preview by attaching a touch listener to
* a full-screen view on top of preview TextureView. Since CameraAppUI has knowledge
* of how swipe from each direction should be handled, it can then redirect these
* events to appropriate recipient views.
*/
public class CameraAppUI implements IAppUi {
private static final LogUtil.Tag TAG = new LogUtil.Tag(CameraAppUI.class.getSimpleName());
private final IApp mApp;
private GestureManager mGestureManager;
private ShutterButtonManager mShutterManager;
private ThumbnailViewManager mThumbnailViewManager;
private PreviewManager mPreviewManager;
private ModePickerManager mModePickerManager;
private QuickSwitcherManager mQuickSwitcherManager;
private IndicatorViewManager mIndicatorViewManager;
private SettingFragment mSettingFragment;
private EffectViewManager mEffectViewManager;
private OnScreenHintManager mOnScreenHintManager;
private AnimationManager mAnimationManager;
private final List<IViewManager> mViewManagers;
private OnModeChangeListener mModeChangeListener;
private ViewGroup mSavingDialog;
private String mCurrentModeName;
private String mCurrentCameraId = "0";
private String mCurrentModeType;
private ModeProvider mModeProvider;
private Handler mConfigUIHandler = new ConfigUIHandler();
private static final int APPLY_ALL_UI_VISIBILITY = 0;
private static final int APPLY_ALL_UI_ENABLED = 1;
private static final int SET_UI_VISIBILITY = 2;
private static final int SET_UI_ENABLED = 3;
private final OnOrientationChangeListenerImpl mOrientationChangeListener;
/**
* Constructor of cameraAppUi.
* @param app The {@link IApp} implementer.
*/
public CameraAppUI(IApp app) {
mApp = app;
mOrientationChangeListener = new OnOrientationChangeListenerImpl();
mViewManagers = new ArrayList<>();
}
/**
* Called when activity's onCreate() is invoked.
*/
public void onCreate() {
ViewGroup rootView = (ViewGroup) mApp.getActivity()
.findViewById(R.id.app_ui_root);
ViewGroup parentView = (ViewGroup) mApp.getActivity().getLayoutInflater()
.inflate(R.layout.camera_ui_root, rootView, true);
View appUI = parentView.findViewById(R.id.camera_ui_root);
if (CameraUtil.isHasNavigationBar(mApp.getActivity())) {
//get navigation bar height.
int navigationBarHeight = CameraUtil.getNavigationBarHeight(mApp.getActivity());
//set root view bottom margin to let the UI above the navigation bar.
FrameLayout.LayoutParams params =
(FrameLayout.LayoutParams) appUI.getLayoutParams();
if (CameraUtil.isTablet()) {
int displayRotation = CameraUtil.getDisplayRotation(mApp.getActivity());
LogHelper.d(TAG, " onCreate dis
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Camera2_拉伸、旋转、预览、成像.zip (10个子文件)
Camera2
feature
setting
facedetection
src
com
mediatek
camera
feature
setting
facedetection
FaceViewCtrl.java 16KB
common
src
com
mediatek
camera
common
mode
video
recorder
recorder
NormalRecorder.java 8KB
VideoHelper.java 28KB
utils
BitmapCreator.java 26KB
host
src
com
mediatek
camera
CameraActivity.java 24KB
ui
preview
PreviewTextureView.java 7KB
TextureViewController.java 16KB
PreviewManager.java 12KB
CameraAppUI.java 47KB
AndroidManifest.xml 8KB
共 10 条
- 1
资源评论
ItJavawfc
- 粉丝: 536
- 资源: 164
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功