diff --git a/src/android/CameraLauncher.java b/src/android/CameraLauncher.java
index f995f9d..5db8d89 100644
--- a/src/android/CameraLauncher.java
+++ b/src/android/CameraLauncher.java
@@ -52,6 +52,8 @@ public class CameraLauncher extends CordovaPlugin {
}
intent.putExtra("miniature", args.getBoolean(1));
+ intent.putExtra("cameraBackgroundColor", args.getString(2));
+ intent.putExtra("cameraBackgroundColorPressed", args.getString(3));
cordova.startActivityForResult((CordovaPlugin) this, intent, CameraLauncher.REQUEST_CODE);
diff --git a/src/android/customCamera/res/drawable-hdpi/accept.png b/src/android/customCamera/res/drawable-hdpi/accept.png
new file mode 100644
index 0000000..2132a9b
Binary files /dev/null and b/src/android/customCamera/res/drawable-hdpi/accept.png differ
diff --git a/src/android/customCamera/res/drawable-hdpi/capture.png b/src/android/customCamera/res/drawable-hdpi/capture.png
new file mode 100644
index 0000000..814864c
Binary files /dev/null and b/src/android/customCamera/res/drawable-hdpi/capture.png differ
diff --git a/src/android/customCamera/res/drawable-hdpi/capture2.png b/src/android/customCamera/res/drawable-hdpi/capture2.png
new file mode 100644
index 0000000..f79bed6
Binary files /dev/null and b/src/android/customCamera/res/drawable-hdpi/capture2.png differ
diff --git a/src/android/customCamera/res/drawable-hdpi/colorise.jpg b/src/android/customCamera/res/drawable-hdpi/colorise.jpg
deleted file mode 100644
index 6002eaf..0000000
Binary files a/src/android/customCamera/res/drawable-hdpi/colorise.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-hdpi/couthenans.jpg b/src/android/customCamera/res/drawable-hdpi/couthenans.jpg
deleted file mode 100644
index 6f297aa..0000000
Binary files a/src/android/customCamera/res/drawable-hdpi/couthenans.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-hdpi/delete.png b/src/android/customCamera/res/drawable-hdpi/delete.png
new file mode 100644
index 0000000..cea182e
Binary files /dev/null and b/src/android/customCamera/res/drawable-hdpi/delete.png differ
diff --git a/src/android/customCamera/res/drawable-hdpi/hericourt.jpg b/src/android/customCamera/res/drawable-hdpi/hericourt.jpg
deleted file mode 100644
index d8cd591..0000000
Binary files a/src/android/customCamera/res/drawable-hdpi/hericourt.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-hdpi/ic_launcher.png b/src/android/customCamera/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 288b665..0000000
Binary files a/src/android/customCamera/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-hdpi/labs.png b/src/android/customCamera/res/drawable-hdpi/labs.png
deleted file mode 100644
index e4fada3..0000000
Binary files a/src/android/customCamera/res/drawable-hdpi/labs.png and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-hdpi/normal.jpg b/src/android/customCamera/res/drawable-hdpi/normal.jpg
deleted file mode 100644
index 8e97385..0000000
Binary files a/src/android/customCamera/res/drawable-hdpi/normal.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-hdpi/paysage.jpg b/src/android/customCamera/res/drawable-hdpi/paysage.jpg
deleted file mode 100644
index 1b9ff16..0000000
Binary files a/src/android/customCamera/res/drawable-hdpi/paysage.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-hdpi/round_button.xml b/src/android/customCamera/res/drawable-hdpi/round_button.xml
new file mode 100644
index 0000000..78ecfb2
--- /dev/null
+++ b/src/android/customCamera/res/drawable-hdpi/round_button.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/android/customCamera/res/drawable-ldpi/round_button.xml b/src/android/customCamera/res/drawable-ldpi/round_button.xml
new file mode 100644
index 0000000..78ecfb2
--- /dev/null
+++ b/src/android/customCamera/res/drawable-ldpi/round_button.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/android/customCamera/res/drawable-mdpi/colorise.jpg b/src/android/customCamera/res/drawable-mdpi/colorise.jpg
deleted file mode 100644
index 6002eaf..0000000
Binary files a/src/android/customCamera/res/drawable-mdpi/colorise.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-mdpi/couthenans.jpg b/src/android/customCamera/res/drawable-mdpi/couthenans.jpg
deleted file mode 100644
index 6f297aa..0000000
Binary files a/src/android/customCamera/res/drawable-mdpi/couthenans.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-mdpi/hericourt.jpg b/src/android/customCamera/res/drawable-mdpi/hericourt.jpg
deleted file mode 100644
index d8cd591..0000000
Binary files a/src/android/customCamera/res/drawable-mdpi/hericourt.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-mdpi/ic_launcher.png b/src/android/customCamera/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 6ae570b..0000000
Binary files a/src/android/customCamera/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-mdpi/labs.png b/src/android/customCamera/res/drawable-mdpi/labs.png
deleted file mode 100644
index e4fada3..0000000
Binary files a/src/android/customCamera/res/drawable-mdpi/labs.png and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-mdpi/normal.jpg b/src/android/customCamera/res/drawable-mdpi/normal.jpg
deleted file mode 100644
index 8e97385..0000000
Binary files a/src/android/customCamera/res/drawable-mdpi/normal.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-mdpi/paysage.jpg b/src/android/customCamera/res/drawable-mdpi/paysage.jpg
deleted file mode 100644
index 1b9ff16..0000000
Binary files a/src/android/customCamera/res/drawable-mdpi/paysage.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-mdpi/round_button.xml b/src/android/customCamera/res/drawable-mdpi/round_button.xml
new file mode 100644
index 0000000..78ecfb2
--- /dev/null
+++ b/src/android/customCamera/res/drawable-mdpi/round_button.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/android/customCamera/res/drawable-xhdpi/colorise.jpg b/src/android/customCamera/res/drawable-xhdpi/colorise.jpg
deleted file mode 100644
index 6002eaf..0000000
Binary files a/src/android/customCamera/res/drawable-xhdpi/colorise.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xhdpi/couthenans.jpg b/src/android/customCamera/res/drawable-xhdpi/couthenans.jpg
deleted file mode 100644
index 6f297aa..0000000
Binary files a/src/android/customCamera/res/drawable-xhdpi/couthenans.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xhdpi/hericourt.jpg b/src/android/customCamera/res/drawable-xhdpi/hericourt.jpg
deleted file mode 100644
index d8cd591..0000000
Binary files a/src/android/customCamera/res/drawable-xhdpi/hericourt.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xhdpi/ic_launcher.png b/src/android/customCamera/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index d4fb7cd..0000000
Binary files a/src/android/customCamera/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xhdpi/labs.png b/src/android/customCamera/res/drawable-xhdpi/labs.png
deleted file mode 100644
index e4fada3..0000000
Binary files a/src/android/customCamera/res/drawable-xhdpi/labs.png and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xhdpi/normal.jpg b/src/android/customCamera/res/drawable-xhdpi/normal.jpg
deleted file mode 100644
index 8e97385..0000000
Binary files a/src/android/customCamera/res/drawable-xhdpi/normal.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xhdpi/paysage.jpg b/src/android/customCamera/res/drawable-xhdpi/paysage.jpg
deleted file mode 100644
index 1b9ff16..0000000
Binary files a/src/android/customCamera/res/drawable-xhdpi/paysage.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xhdpi/round_button.xml b/src/android/customCamera/res/drawable-xhdpi/round_button.xml
new file mode 100644
index 0000000..78ecfb2
--- /dev/null
+++ b/src/android/customCamera/res/drawable-xhdpi/round_button.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/android/customCamera/res/drawable-xxhdpi/colorise.jpg b/src/android/customCamera/res/drawable-xxhdpi/colorise.jpg
deleted file mode 100644
index 6002eaf..0000000
Binary files a/src/android/customCamera/res/drawable-xxhdpi/colorise.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xxhdpi/couthenans.jpg b/src/android/customCamera/res/drawable-xxhdpi/couthenans.jpg
deleted file mode 100644
index 6f297aa..0000000
Binary files a/src/android/customCamera/res/drawable-xxhdpi/couthenans.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xxhdpi/hericourt.jpg b/src/android/customCamera/res/drawable-xxhdpi/hericourt.jpg
deleted file mode 100644
index d8cd591..0000000
Binary files a/src/android/customCamera/res/drawable-xxhdpi/hericourt.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xxhdpi/ic_launcher.png b/src/android/customCamera/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index 85a6081..0000000
Binary files a/src/android/customCamera/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xxhdpi/labs.png b/src/android/customCamera/res/drawable-xxhdpi/labs.png
deleted file mode 100644
index e4fada3..0000000
Binary files a/src/android/customCamera/res/drawable-xxhdpi/labs.png and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xxhdpi/normal.jpg b/src/android/customCamera/res/drawable-xxhdpi/normal.jpg
deleted file mode 100644
index 8e97385..0000000
Binary files a/src/android/customCamera/res/drawable-xxhdpi/normal.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xxhdpi/paysage.jpg b/src/android/customCamera/res/drawable-xxhdpi/paysage.jpg
deleted file mode 100644
index 1b9ff16..0000000
Binary files a/src/android/customCamera/res/drawable-xxhdpi/paysage.jpg and /dev/null differ
diff --git a/src/android/customCamera/res/drawable-xxhdpi/round_button.xml b/src/android/customCamera/res/drawable-xxhdpi/round_button.xml
new file mode 100644
index 0000000..78ecfb2
--- /dev/null
+++ b/src/android/customCamera/res/drawable-xxhdpi/round_button.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/android/customCamera/res/drawable-xxxhdpi/custom_opacity_bar.xml b/src/android/customCamera/res/drawable-xxxhdpi/custom_opacity_bar.xml
new file mode 100644
index 0000000..4a86a09
--- /dev/null
+++ b/src/android/customCamera/res/drawable-xxxhdpi/custom_opacity_bar.xml
@@ -0,0 +1,37 @@
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/android/customCamera/res/drawable-xxxhdpi/round_button.xml b/src/android/customCamera/res/drawable-xxxhdpi/round_button.xml
new file mode 100644
index 0000000..78ecfb2
--- /dev/null
+++ b/src/android/customCamera/res/drawable-xxxhdpi/round_button.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/android/customCamera/res/drawable-xxxhdpi/thumb.xml b/src/android/customCamera/res/drawable-xxxhdpi/thumb.xml
new file mode 100644
index 0000000..5c01649
--- /dev/null
+++ b/src/android/customCamera/res/drawable-xxxhdpi/thumb.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/android/customCamera/res/layout/activity_camera_view.xml b/src/android/customCamera/res/layout/activity_camera_view.xml
index 92cd692..63a50ee 100644
--- a/src/android/customCamera/res/layout/activity_camera_view.xml
+++ b/src/android/customCamera/res/layout/activity_camera_view.xml
@@ -38,14 +38,13 @@
android:layout_weight="0.2"
android:onClick="buttonMiniature"
android:text="@string/miniature" />
-
-
+ android:background="@drawable/round_button"
+ android:src="@drawable/capture2" />
-
+ android:src="@drawable/accept"
+ android:background="@android:color/transparent" />
-
+ android:src="@drawable/delete"
+ android:background="@android:color/transparent" />
+
diff --git a/src/android/customCamera/res/values/strings.xml b/src/android/customCamera/res/values/strings.xml
index b9fad09..c6947f0 100644
--- a/src/android/customCamera/res/values/strings.xml
+++ b/src/android/customCamera/res/values/strings.xml
@@ -1,6 +1,5 @@
-
TestCustomCamera
Hello world!
Settings
@@ -11,7 +10,7 @@
Miniature
Photo
Ceci est le bouton permettant d\'afficher une miniature
- Il s\'agit de l\'image de fond de l\'appareil photo
- Accepter Photo
- Refuser Photo
+ Il s\'agit de l\'image de fond de l\'appareil photo
+ Accepter Photo
+ Refuser Photo
diff --git a/src/android/customCamera/src/org/geneanet/customcamera/CameraActivity.java b/src/android/customCamera/src/org/geneanet/customcamera/CameraActivity.java
index dd6993e..4bc2761 100644
--- a/src/android/customCamera/src/org/geneanet/customcamera/CameraActivity.java
+++ b/src/android/customCamera/src/org/geneanet/customcamera/CameraActivity.java
@@ -7,7 +7,9 @@ import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
+import android.graphics.Color;
import android.graphics.Matrix;
+import android.graphics.drawable.GradientDrawable;
import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.PictureCallback;
@@ -26,6 +28,7 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
+import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
@@ -118,6 +121,51 @@ public class CameraActivity extends Activity {
Button miniature = (Button) findViewById(R.id.miniature);
miniature.setVisibility(View.INVISIBLE);
}
+
+ ImageButton imgIcon = (ImageButton)findViewById(R.id.capture);
+ final Activity currentActivity = this;
+
+ this.setCameraBackgroundColor(this.getIntent().getStringExtra("cameraBackgroundColor"));
+
+ imgIcon.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent event) {
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ ((CameraActivity) currentActivity).setCameraBackgroundColor(
+ currentActivity.getIntent().getStringExtra("cameraBackgroundColorPressed"));
+ break;
+ case MotionEvent.ACTION_UP:
+ view.performClick();
+ ((CameraActivity) currentActivity).setCameraBackgroundColor(
+ currentActivity.getIntent().getStringExtra("cameraBackgroundColor"));
+ ((CameraActivity) currentActivity).takePhoto();
+ break;
+ default:
+ break;
+ }
+ return true;
+ }
+ });
+ }
+
+ /**
+ * Set the background color of the camera button.
+ * @param color The color of the background.
+ */
+ protected void setCameraBackgroundColor(String color) {
+ ImageButton imgIcon = (ImageButton)findViewById(R.id.capture);
+ GradientDrawable backgroundGradient = (GradientDrawable)imgIcon.getBackground();
+ if (color.length() > 0) {
+ try {
+ int cameraBackgroundColor = Color.parseColor(color);
+ backgroundGradient.setColor(cameraBackgroundColor);
+ } catch (IllegalArgumentException e) {
+ backgroundGradient.setColor(Color.TRANSPARENT);
+ }
+ } else {
+ backgroundGradient.setColor(Color.TRANSPARENT);
+ }
}
/** Method onStart. Handle the zoom level seekBar and the camera orientation. */
@@ -415,7 +463,7 @@ public class CameraActivity extends Activity {
*/
public void displayAcceptDeclineButtons() {
LinearLayout keepPhoto = (LinearLayout) findViewById(R.id.keepPhoto);
- Button photo = (Button) findViewById(R.id.capture);
+ ImageButton photo = (ImageButton) findViewById(R.id.capture);
SeekBar zoomLevel = (SeekBar) findViewById(R.id.zoomLevel);
Button miniature = (Button) findViewById(R.id.miniature);
ImageView background = (ImageView) findViewById(R.id.background);
@@ -477,9 +525,8 @@ public class CameraActivity extends Activity {
/**
* Method to take picture.
- * @param view Current view.
*/
- public void takePhoto(View view) {
+ public void takePhoto() {
// Handles the moment where picture is taken
ShutterCallback shutterCallback = new ShutterCallback() {
public void onShutter() {
@@ -504,7 +551,7 @@ public class CameraActivity extends Activity {
BitmapFactory.Options opt;
opt = new BitmapFactory.Options();
- // Temp storage to use for decoding
+ // Temporarily storage to use for decoding
opt.inTempStorage = new byte[16 * 1024];
Camera.Parameters paramsCamera = customCamera.getParameters();
Size size = paramsCamera.getPictureSize();
diff --git a/www/customCamera.js b/www/customCamera.js
index 12a4ee1..bc4a4eb 100644
--- a/www/customCamera.js
+++ b/www/customCamera.js
@@ -17,7 +17,10 @@ var customCameraExport = function() {
customCameraExport.prototype.startCamera = function(options, successFct, failFct) {
var defaultOptions = {
imgBackgroundBase64: null, // background picture in base64.
- miniature: true // active or disable the miniature function.
+ miniature: true, // active or disable the miniature function.
+ cameraBackgroundColor: "#e26760", // color of the camera button.
+ cameraBackgroundColorPressed: "#dc453d" // color of the pressed camera button.
+ // To get supported color formats, go to see method parseColor : http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String)
};
for (var nameOption in defaultOptions) {
@@ -41,7 +44,9 @@ customCameraExport.prototype.startCamera = function(options, successFct, failFct
"startCamera",
[
options.imgBackgroundBase64,
- options.miniature
+ options.miniature,
+ options.cameraBackgroundColor,
+ options.cameraBackgroundColorPressed
]
);
};