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

Mise en place d'un background dynamique passé depuis le JS.

This commit is contained in:
Christophe BOUCAUT
2014-11-28 17:12:17 +01:00
parent 5cfd38154e
commit d698df4c3f
4 changed files with 81 additions and 19 deletions
+18 -3
View File
@@ -18,6 +18,7 @@ import java.io.IOException;
import android.content.Intent;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;
public class CameraLauncher extends CordovaPlugin {
@@ -35,9 +36,23 @@ public class CameraLauncher extends CordovaPlugin {
Intent intent = new Intent(this.cordova.getActivity(), CameraActivity.class);
Bundle imgBackgroundBase64 = new Bundle();
imgBackgroundBase64.putString("imgBackgroundBase64", args.getString(0));
intent.putExtras(imgBackgroundBase64);
byte[] imgBackgroundBase64;
try {
imgBackgroundBase64 = Base64.decode(args.getString(0), Base64.NO_WRAP);
} catch (IllegalArgumentException e) {
this.callbackContext.error(
generateError(
CameraLauncher.RESULT_ERROR,
"Error decode base64 picture."
)
);
return false;
}
Bundle imgBackground = new Bundle();
imgBackground.putByteArray("imgBackgroundBase64", imgBackgroundBase64);
intent.putExtras(imgBackground);
cordova.startActivityForResult((CordovaPlugin) this, intent, CameraLauncher.REQUEST_CODE);