本文整理汇总了Java中android.hardware.Camera.ShutterCallback类的典型用法代码示例。如果您正苦于以下问题:Java ShutterCallback类的具体用法?Java ShutterCallback怎么用?Java ShutterCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ShutterCallback类属于android.hardware.Camera包,在下文中一共展示了ShutterCallback类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: requestTakePicture
import android.hardware.Camera.ShutterCallback; //导入依赖的package包/类
public void requestTakePicture(
final ShutterCallback shutter,
final PictureCallback raw,
final PictureCallback postView,
final PictureCallback jpeg) {
post(new Runnable() {
@Override
public void run() {
try {
mCamera.takePicture(shutter, raw, postView, jpeg);
} catch (RuntimeException e) {
// TODO: output camera state and focus state for debugging.
Log.e(TAG, "take picture failed.");
throw e;
}
}
});
}
示例2: AutoFocusManager
import android.hardware.Camera.ShutterCallback; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public AutoFocusManager(final Context context, Camera camera,
final boolean canDisableSystemShutterSound) {
this.camera = camera;
this.executor = Executors.newSingleThreadScheduledExecutor();
this.focusAccelerationEventListener = new FocusAccelerationEventListener(
context, SensorManager.SENSOR_DELAY_GAME);
this.focusAmbientLightEventListener = new FocusAmbientLightEventListener(
context, SensorManager.SENSOR_DELAY_GAME);
String focusMode = this.camera.getParameters().getFocusMode();
this.must_call_auto_focus = Camera.Parameters.FOCUS_MODE_AUTO
.equals(focusMode)
|| Camera.Parameters.FOCUS_MODE_MACRO.equals(focusMode);
int[] soundRes = new int[0];
if (this.must_call_auto_focus) {
soundRes = Arrays.copyOf(soundRes, soundRes.length + 1);
soundRes[soundRes.length - 1] = R.raw.beep;
}
if (canDisableSystemShutterSound) {
soundRes = Arrays.copyOf(soundRes, soundRes.length + 1);
soundRes[soundRes.length - 1] = R.raw.shutter;
}
this.soundManager = new SoundManager(context, soundRes);
if (canDisableSystemShutterSound) {
this.shutterCallback = new ShutterCallback() {
@Override
public void onShutter() {
AutoFocusManager.this.soundManager.play(R.raw.shutter);
}
};
}
}
示例3: onCreate
import android.hardware.Camera.ShutterCallback; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int type = getArguments().getInt(CameraActivity.ARGS_TYPE);
String creatureName = getArguments().getString(CameraActivity.ARGS_NAME, null);
final String filePath;
MyCameraHost host;
switch(type){
case 1:
host = new CreatureCameraHost(getActivity(), creatureName);
filePath = CreatureCameraHost.getFilePath(creatureName).getPath();
break;
default:
throw new IllegalArgumentException("No camera host type declared. Use CameraActivity.ARGS_TYPE_... as argument");
}
ShutterCallback callback = new ShutterCallback() {
@Override
public void onShutter() {
Intent i = new Intent();
i.putExtra(CameraActivity.DATA_PATH, filePath);
mActivity.setResult(Activity.RESULT_OK, i);
mActivity.finish();
}
};
host.setShutterCallback(callback);
setHost(host);
setHasOptionsMenu(true);
}
示例4: onTakePicture
import android.hardware.Camera.ShutterCallback; //导入依赖的package包/类
public void onTakePicture(File file, onPictureSaveListener listener,ShutterCallback shutterCallback){
CameraEngine.setRotation(90);
mSaveTask = new SaveTask(mContext, file, listener);
CameraEngine.takePicture(shutterCallback, null, mPictureCallback);
}
示例5: getShutterCallback
import android.hardware.Camera.ShutterCallback; //导入依赖的package包/类
@Override
public ShutterCallback getShutterCallback() {
return null;
}
示例6: setShutterCallback
import android.hardware.Camera.ShutterCallback; //导入依赖的package包/类
public void setShutterCallback(ShutterCallback callback){
mCallback = callback;
}