/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.android.camera;
import com.android.camera.ui.CameraPicker;
import com.android.camera.ui.IndicatorControlContainer;
import com.android.camera.ui.IndicatorControlWheelContainer;
import com.android.camera.ui.Rotatable;
import com.android.camera.ui.RotateImageView;
import com.android.camera.ui.RotateLayout;
import com.android.camera.ui.SharePopup;
import com.android.camera.ui.ZoomControl;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.PictureCallback;
import android.hardware.Camera.Size;
import android.location.Location;
import android.media.CamcorderProfile;
import android.media.CameraProfile;
import android.media.MediaRecorder;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.os.SystemClock;
import android.provider.MediaStore;
import android.provider.MediaStore.Video;
import android.util.Log;
import android.view.GestureDetector;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.MotionEvent;
import android.view.OrientationEventListener;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import android.filterpacks.videosink.MediaRecorderStopException;
/**
* The Camcorder activity.
*/
public class VideoCamera extends ActivityBase
implements CameraPreference.OnPreferenceChangedListener,
ShutterButton.OnShutterButtonListener, SurfaceHolder.Callback,
MediaRecorder.OnErrorListener, MediaRecorder.OnInfoListener,
ModePicker.OnModeChangeListener, View.OnTouchListener,
EffectsRecorder.EffectsListener {
private static final String TAG = "videocamera";
private static final int CHECK_DISPLAY_ROTATION = 3;
private static final int CLEAR_SCREEN_DELAY = 4;
private static final int UPDATE_RECORD_TIME = 5;
private static final int ENABLE_SHUTTER_BUTTON = 6;
private static final int SCREEN_DELAY = 2 * 60 * 1000;
// The brightness settings used when it is set to automatic in the system.
// The reason why it is set to 0.7 is just because 1.0 is too bright.
private static final float DEFAULT_CAMERA_BRIGHTNESS = 0.7f;
private static final boolean SWITCH_CAMERA = true;
private static final boolean SWITCH_VIDEO = false;
private static final long SHUTTER_BUTTON_TIMEOUT = 500L; // 500ms
private static final int[] TIME_LAPSE_VIDEO_QUALITY = {
CamcorderProfile.QUALITY_TIME_LAPSE_1080P,
CamcorderProfile.QUALITY_TIME_LAPSE_720P,
CamcorderProfile.QUALITY_TIME_LAPSE_480P,
CamcorderProfile.QUALITY_TIME_LAPSE_CIF,
1007, /* TODO: replace it with QUALITY_TIME_LAPSE_QVGA if public. */
CamcorderProfile.QUALITY_TIME_LAPSE_QCIF};
private static final int[] VIDEO_QUALITY = {
CamcorderProfile.QUALITY_1080P,
CamcorderProfile.QUALITY_720P,
CamcorderProfile.QUALITY_480P,
CamcorderProfile.QUALITY_CIF,
7, /* TODO: replace it with CamcorderProfile.QUALITY_QVGA */
CamcorderProfile.QUALITY_QCIF};
/**
* An unpublished intent flag requesting to start recording straight away
* and return as soon as recording is stopped.
* TODO: consider publishing by moving into MediaStore.
*/
private static final String EXTRA_QUICK_CAPTURE =
"android.intent.extra.quickCapture";
private boolean mSnapshotInProgress = false;
private static final String EFFECT_BG_FROM_GALLERY = "gallery";
private final CameraErrorCallback mErrorCallback = new CameraErrorCallback();
private ComboPreferences mPreferences;
private PreferenceGroup mPreferenceGroup;
private View mPreviewPanel; // The container of PreviewFrameLayout.
private PreviewFrameLayout mPreviewFrameLayout;
private SurfaceHolder mSurfaceHolder = null;
private IndicatorControlContainer mIndicatorControlContainer;
private int mSurfaceWidth;
private int mSurfaceHeight;
private View mReviewControl;
private Toast mNoShareToast;
// An review image having same size as preview. It is displayed when
// recording is stopped in capture intent.
private ImageView mReviewImage;
// A popup window that contains a bigger thumbnail and a list of apps to share.
private SharePopup mSharePopup;
// The bitmap of the last captured video thumbnail and the URI of the
// original video.
private Thumbnail mThumbnail;
// An imageview showing showing the last captured picture thumbnail.
private RotateImageView mThumbnailView;
private Rotatable mReviewCancelButton;
private Rotatable mReviewDoneButton;
private Rotatable mReviewPlayButton;
private ModePicker mModePicker;
private ShutterButton mShutterButton;
private TextView mRecordingTimeView;
private RotateLayout mBgLearningMessageRotater;
private View mBgLearningMessageFrame;
private LinearLayout mLabelsLinearLayout;
private boolean mIsVideoCaptureIntent;
private boolean mQuickCapture;
private boolean mOpenCameraFail = false;
private boolean mCameraDisabled = false;
private long mStorageSpace;
private MediaRecorder mMediaRecorder;
private EffectsRecorder mEffectsRecorder;
private int mEffectType = EffectsRecorder.EFFECT_NONE;
private Object mEffectParameter = null;
private String mEffectUriFromGallery = null;
private String mPrefVideoEffectDefault;
private boolean mResetEffect = true;
public static final String RESET_EFFECT_EXTRA = "reset_effect";
private boolean mMediaRecorderRecording = false;
private long mRecordingStartTime;
private boolean mRecordingTimeCountsDown = false;
private RotateLayout mRecordingTimeRect;
private long mOnResumeTime;
// The video file that the hardware camera is about to record into
// (or is recording into.)
private String mVideoFilename;
private ParcelFileDescriptor mVideoFileDescriptor;
// The video file that has already been recorded, and that is being
// examined by the user.
private String mCurrentVideoFilename;
private Uri mCurrentVideoUri;
private ContentValues mCurrentVideoValues;
private CamcorderProfile mProfile;
// The video duration limit. 0 menas no limit.
private int mMaxVideoDurationInMs;
// Time Lapse parameters.
private boolean mCaptureTimeLapse = false;
// Default 0. If it is larger than 0, t
没有合适的资源?快使用搜索试试~ 我知道了~
Android自定义相机demo-手动触摸对焦、取景模式、拉近
共1182个文件
png:472个
class:305个
java:174个
4星 · 超过85%的资源 需积分: 50 658 下载量 13 浏览量
2015-04-29
15:26:59
上传
评论 11
收藏 10.27MB RAR 举报
温馨提示
Android自定义相机demo-手动触摸对焦、取景模式、白平衡、曝光补偿、闪关灯、分辨率设置、视频拍摄、拉近等功能。包含Android4.1原生相机所有功能。
资源推荐
资源详情
资源评论
收起资源包目录
Android自定义相机demo-手动触摸对焦、取景模式、拉近 (1182个子文件)
vp_motionmodel.c 12KB
VideoCamera.class 58KB
Camera.class 52KB
PanoramaActivity.class 30KB
BackDropperFilter.class 24KB
Filter.class 22KB
EffectsRecorder.class 22KB
Util.class 20KB
CameraSettings.class 16KB
FilterGraph.class 13KB
MediaSource.class 13KB
IndicatorControlWheel.class 12KB
TextGraphReader.class 12KB
FocusManager.class 12KB
MediaEncoderFilter.class 11KB
SharePopup.class 11KB
GLFrame.class 10KB
Thumbnail.class 10KB
CameraSource.class 10KB
FrameFormat.class 10KB
ShaderProgram.class 9KB
SyncRunner.class 7KB
R$drawable.class 7KB
IndicatorControl.class 7KB
NativeFrame.class 7KB
SurfaceTextureTarget.class 7KB
R$string.class 7KB
ModePicker.class 7KB
SurfaceTextureSource.class 7KB
MenuHelper.class 6KB
EffectSettingPopup.class 6KB
SecondLevelIndicatorControlBar.class 6KB
ComboPreferences.class 6KB
MosaicRendererSurfaceView$ConfigChooser.class 6KB
Frame.class 6KB
ZoomControl.class 6KB
IndicatorControlWheelContainer.class 6KB
ZoomControlWheel.class 6KB
IndicatorControlBarContainer.class 5KB
Camera$ImageSaver.class 5KB
RotateImageView.class 5KB
SerializedFrame.class 5KB
MosaicFrameProcessor.class 5KB
NativeProgram.class 5KB
ListPreference.class 5KB
MosaicRendererSurfaceView.class 5KB
Storage.class 5KB
AbstractIndicatorButton.class 5KB
FilterFunction.class 5KB
PreferenceInflater.class 5KB
GLEnvironment.class 5KB
CameraHolder.class 5KB
FilterFactory.class 5KB
InLineSettingKnob.class 5KB
CachedFrameManager.class 4KB
PanoProgressBar.class 4KB
AsyncRunner.class 4KB
SimpleFrame.class 4KB
OtherSettingsPopup.class 4KB
IndicatorButton.class 4KB
BasicSettingPopup.class 4KB
OnScreenHint.class 4KB
AsyncRunner$AsyncRunnerTask.class 4KB
R$id.class 4KB
FilterContext.class 4KB
FilterPort.class 4KB
GraphEnvironment.class 4KB
VertexFrame.class 4KB
FilterSurfaceView.class 4KB
FaceView.class 4KB
LocationManager.class 4KB
ZoomControlBar.class 4KB
Quad.class 3KB
IconListPreference.class 3KB
IndicatorControlBar.class 3KB
OutputPort.class 3KB
KeyValueMap.class 3KB
ActivityBase.class 3KB
NativeBuffer.class 3KB
Rectangle.class 3KB
ComboPreferences$MyEditor.class 3KB
ObjectFormat.class 3KB
FieldPort.class 3KB
EffectsRecorder$4.class 3KB
Camera$JpegPictureCallback.class 3KB
InputStreamSource.class 3KB
PatternScanner.class 3KB
Point.class 3KB
InLineSettingSwitch.class 3KB
SimpleFrameManager.class 3KB
EffectsRecorder$1.class 3KB
SoundPlayer.class 3KB
CallbackFilter.class 3KB
ObjectSource.class 3KB
GraphReader.class 2KB
MosaicRendererSurfaceViewRenderer.class 2KB
OtherSettingIndicatorButton.class 2KB
ShutterButton.class 2KB
InputPort.class 2KB
CameraPicker.class 2KB
共 1182 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
fengxiao1493
- 粉丝: 1
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页