mirror of
https://gitee.com/shuto/customCamera.git
synced 2026-05-02 00:07:24 +08:00
Ajout des options JS pour :
+ Activer / desactiver le switch de camera. + Choisir une camera par défaut.
This commit is contained in:
@@ -87,6 +87,9 @@ public class CameraLauncher extends CordovaPlugin {
|
||||
intent.putExtra("defaultFlash", args.getInt(8));
|
||||
intent.putExtra("switchFlash", args.getBoolean(9));
|
||||
|
||||
intent.putExtra("defaultCamera", args.getInt(10));
|
||||
intent.putExtra("switchCamera", args.getBoolean(11));
|
||||
|
||||
cordova.startActivityForResult((CordovaPlugin) this, intent,
|
||||
CameraLauncher.REQUEST_CODE);
|
||||
|
||||
|
||||
@@ -68,6 +68,9 @@ public class CameraActivity extends Activity {
|
||||
public static final int FLASH_DISABLE = 0;
|
||||
public static final int FLASH_ENABLE = 1;
|
||||
public static final int FLASH_AUTO = 2;
|
||||
|
||||
public static final int CAMERA_BACK = 0;
|
||||
public static final int CAMERA_FRONT = 1;
|
||||
|
||||
/**
|
||||
* To get camera resource or stop this activity.
|
||||
@@ -75,7 +78,12 @@ public class CameraActivity extends Activity {
|
||||
* @return boolean
|
||||
*/
|
||||
protected boolean initCameraResource() {
|
||||
int defaultCamera = ManagerCamera.determinePositionBackCamera();
|
||||
int defaultCamera;
|
||||
if (this.getIntent().getIntExtra("defaultCamera", CameraActivity.CAMERA_BACK) == CameraActivity.CAMERA_FRONT) {
|
||||
defaultCamera = ManagerCamera.determinePositionFrontCamera();
|
||||
} else {
|
||||
defaultCamera = ManagerCamera.determinePositionBackCamera();
|
||||
}
|
||||
customCamera = ManagerCamera.getCameraInstance(defaultCamera);
|
||||
|
||||
if (customCamera == null) {
|
||||
@@ -115,6 +123,11 @@ public class CameraActivity extends Activity {
|
||||
ImageButton flash = (ImageButton)findViewById(R.id.flash);
|
||||
flash.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (!this.getIntent().getBooleanExtra("switchCamera", true)) {
|
||||
ImageButton switchCamera = (ImageButton)findViewById(R.id.switchCamera);
|
||||
switchCamera.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
// The opacity bar
|
||||
SeekBar switchOpacity = (SeekBar) findViewById(R.id.switchOpacity);
|
||||
|
||||
Reference in New Issue
Block a user