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

Merge branch 'master' into feature-flash

This commit is contained in:
Christophe BOUCAUT
2015-02-02 14:16:11 +01:00
13 changed files with 187 additions and 23 deletions
+22 -7
View File
@@ -60,14 +60,29 @@ public class CameraLauncher extends CordovaPlugin {
TransferBigData.setImgBackgroundBase64(imgBackgroundBase64);
}
intent.putExtra("miniature", args.getBoolean(1));
intent.putExtra("saveInGallery", args.getBoolean(2));
intent.putExtra("cameraBackgroundColor", args.getString(3));
intent.putExtra("cameraBackgroundColorPressed", args.getString(4));
if (args.getInt(5) >= 0 && args.getInt(5) <= 100) {
intent.putExtra("quality", args.getInt(5));
if (args.getString(1) != "null") {
byte[] imgBackgroundBase64OtherOrientation;
try {
imgBackgroundBase64OtherOrientation = Base64
.decode(args.getString(1), Base64.NO_WRAP);
} catch (IllegalArgumentException e) {
this.callbackContext.error(generateError(CameraLauncher.RESULT_ERROR,
"Error decode base64 picture."));
return false;
}
TransferBigData.setImgBackgroundBase64OtherOrientation(imgBackgroundBase64OtherOrientation);
}
intent.putExtra("opacity", args.getBoolean(6));
intent.putExtra("miniature", args.getBoolean(2));
intent.putExtra("saveInGallery", args.getBoolean(3));
intent.putExtra("cameraBackgroundColor", args.getString(4));
intent.putExtra("cameraBackgroundColorPressed", args.getString(5));
if (args.getInt(6) >= 0 && args.getInt(6) <= 100) {
intent.putExtra("quality", args.getInt(6));
}
intent.putExtra("opacity", args.getBoolean(7));
intent.putExtra("startOrientation", this.cordova.getActivity().getResources().getConfiguration().orientation);
cordova.startActivityForResult((CordovaPlugin) this, intent,
CameraLauncher.REQUEST_CODE);
+5
View File
@@ -2,7 +2,12 @@
.project
.classpath
project.properties
ant.properties
build.xml
local.properties
proguard-project.txt
nbandroid/*
bin/*
gen/*
libs/*
@@ -1,14 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=Google Inc.:Google APIs:14
@@ -398,7 +398,16 @@ public class CameraActivity extends Activity {
/** To set background in the view. */
protected void setBackground() {
// Get the base64 picture for the background only if it's exist.
byte[] imgBackgroundBase64 = TransferBigData.getImgBackgroundBase64();
byte[] imgBackgroundBase64;
if (
TransferBigData.getImgBackgroundBase64OtherOrientation() == null ||
this.getIntent().getIntExtra("startOrientation", 1)
== this.getResources().getConfiguration().orientation
) {
imgBackgroundBase64 = TransferBigData.getImgBackgroundBase64();
} else {
imgBackgroundBase64 = TransferBigData.getImgBackgroundBase64OtherOrientation();
}
if (imgBackgroundBase64 != null) {
// Get picture.
Bitmap imgBackgroundBitmap = BitmapFactory.decodeByteArray(
@@ -5,6 +5,7 @@ package org.geneanet.customcamera;
*/
public class TransferBigData {
protected static byte[] imgBackgroundBase64 = null;
protected static byte[] imgBackgroundBase64OtherOrientation = null;
protected static byte[] imgTaken = null;
/**
@@ -25,6 +26,24 @@ public class TransferBigData {
TransferBigData.imgBackgroundBase64 = imgBackgroundBase64;
}
/**
* Get bytes to represent background picture for OtherOrientation.
*
* @return byte[]
*/
public static byte[] getImgBackgroundBase64OtherOrientation() {
return TransferBigData.imgBackgroundBase64OtherOrientation;
}
/**
* Set bytes to represent background picture for OtherOrientation.
*
* @param byte[] imgBackgroundBase64OtherOrientation
*/
public static void setImgBackgroundBase64OtherOrientation(byte[] imgBackgroundBase64OtherOrientation) {
TransferBigData.imgBackgroundBase64OtherOrientation = imgBackgroundBase64OtherOrientation;
}
/**
* Get bytes to represent picture taken.
*