mirror of
https://github.com/apache/cordova-android.git
synced 2026-05-11 00:00:05 +08:00
CB-3358: Change Commons-codec:base64 to Android:Base64
This commit is contained in:
@@ -26,7 +26,6 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.cordova.api.CallbackContext;
|
||||
import org.apache.cordova.api.CordovaPlugin;
|
||||
import org.apache.cordova.api.DataResource;
|
||||
@@ -48,6 +47,7 @@ import android.media.MediaScannerConnection.MediaScannerConnectionClient;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
@@ -778,7 +778,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
||||
try {
|
||||
if (bitmap.compress(CompressFormat.JPEG, mQuality, jpeg_data)) {
|
||||
byte[] code = jpeg_data.toByteArray();
|
||||
byte[] output = Base64.encodeBase64(code);
|
||||
byte[] output = Base64.encode(code, Base64.DEFAULT);
|
||||
String js_out = new String(output);
|
||||
this.callbackContext.success(js_out);
|
||||
js_out = null;
|
||||
|
||||
@@ -20,9 +20,9 @@ package org.apache.cordova;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.cordova.api.CallbackContext;
|
||||
import org.apache.cordova.api.CordovaPlugin;
|
||||
import org.apache.cordova.api.DataResource;
|
||||
@@ -912,7 +912,7 @@ public class FileUtils extends CordovaPlugin {
|
||||
break;
|
||||
default: // Base64.
|
||||
String contentType = dataResource.getMimeType();
|
||||
byte[] base64 = Base64.encodeBase64(bytes);
|
||||
byte[] base64 = Base64.encode(bytes, Base64.DEFAULT);
|
||||
String s = "data:" + contentType + ";base64," + new String(base64, "US-ASCII");
|
||||
result = new PluginResult(PluginResult.Status.OK, s);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user