forked from github/cordova-android
Fixing quality bug in Camera
This commit is contained in:
parent
8f18dae2c1
commit
b65a0b1bd6
@ -13,7 +13,7 @@ public class CameraLauncher {
|
|||||||
|
|
||||||
private WebView mAppView;
|
private WebView mAppView;
|
||||||
private DroidGap mGap;
|
private DroidGap mGap;
|
||||||
int quality;
|
int mQuality;
|
||||||
|
|
||||||
CameraLauncher(WebView view, DroidGap gap)
|
CameraLauncher(WebView view, DroidGap gap)
|
||||||
{
|
{
|
||||||
@ -23,7 +23,8 @@ public class CameraLauncher {
|
|||||||
|
|
||||||
public void takePicture(int quality)
|
public void takePicture(int quality)
|
||||||
{
|
{
|
||||||
mGap.startCamera(quality);
|
mQuality = quality;
|
||||||
|
mGap.startCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return Base64 Encoded String to Javascript */
|
/* Return Base64 Encoded String to Javascript */
|
||||||
@ -31,7 +32,7 @@ public class CameraLauncher {
|
|||||||
{
|
{
|
||||||
ByteArrayOutputStream jpeg_data = new ByteArrayOutputStream();
|
ByteArrayOutputStream jpeg_data = new ByteArrayOutputStream();
|
||||||
try {
|
try {
|
||||||
if (bitmap.compress(CompressFormat.JPEG, quality, jpeg_data))
|
if (bitmap.compress(CompressFormat.JPEG, mQuality, jpeg_data))
|
||||||
{
|
{
|
||||||
byte[] code = jpeg_data.toByteArray();
|
byte[] code = jpeg_data.toByteArray();
|
||||||
byte[] output = Base64.encodeBase64(code);
|
byte[] output = Base64.encodeBase64(code);
|
||||||
|
@ -350,7 +350,7 @@ public class DroidGap extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is required to start the camera activity! It has to come from the previous activity
|
// This is required to start the camera activity! It has to come from the previous activity
|
||||||
public void startCamera(int quality)
|
public void startCamera()
|
||||||
{
|
{
|
||||||
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
File photo = new File(Environment.getExternalStorageDirectory(), "Pic.jpg");
|
File photo = new File(Environment.getExternalStorageDirectory(), "Pic.jpg");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user