9
0
mirror of https://gitee.com/shuto/customCamera.git synced 2026-05-02 00:07:24 +08:00

Implémentation du flash dans le plugin JS.

This commit is contained in:
Christophe BOUCAUT
2015-02-03 11:52:29 +01:00
parent c713f3bab6
commit b927ad5158
3 changed files with 24 additions and 4 deletions
+3
View File
@@ -84,6 +84,9 @@ public class CameraLauncher extends CordovaPlugin {
intent.putExtra("opacity", args.getBoolean(7));
intent.putExtra("startOrientation", this.cordova.getActivity().getResources().getConfiguration().orientation);
intent.putExtra("defaultFlash", args.getInt(8));
intent.putExtra("switchFlash", args.getBoolean(9));
cordova.startActivityForResult((CordovaPlugin) this, intent,
CameraLauncher.REQUEST_CODE);
@@ -109,6 +109,11 @@ public class CameraActivity extends Activity {
Button miniature = (Button) findViewById(R.id.miniature);
miniature.setVisibility(View.INVISIBLE);
}
if (!this.getIntent().getBooleanExtra("switchFlash", true)) {
ImageButton flash = (ImageButton)findViewById(R.id.flash);
flash.setVisibility(View.INVISIBLE);
}
// The opacity bar
SeekBar switchOpacity = (SeekBar) findViewById(R.id.switchOpacity);
@@ -193,6 +198,8 @@ public class CameraActivity extends Activity {
return;
}
stateFlash = this.getIntent().getIntExtra("defaultFlash", CameraActivity.FLASH_DISABLE);
updateStateFlash(stateFlash);
int orientation = 0;
@@ -733,9 +740,13 @@ public class CameraActivity extends Activity {
*/
public void declinePhoto(View view) {
ImageButton imgIcon = (ImageButton)findViewById(R.id.capture);
ImageButton flash = (ImageButton)findViewById(R.id.flash);
imgIcon.setEnabled(true);
flash.setVisibility(View.VISIBLE);
if (hasFlash()) {
ImageButton flash = (ImageButton)findViewById(R.id.flash);
flash.setVisibility(View.VISIBLE);
}
Camera.Parameters params = customCamera.getParameters();
params.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
customCamera.setParameters(params);