mirror of
https://github.com/status-im/react-native-image-crop-picker.git
synced 2025-02-22 10:28:23 +00:00
(android) remove dependency on support-annotations
This commit is contained in:
parent
b47232befa
commit
c44ce340e0
@ -18,5 +18,4 @@ dependencies {
|
||||
compile 'com.facebook.react:react-native:+'
|
||||
compile 'com.yalantis:ucrop:2.2.0-native'
|
||||
compile 'id.zelory:compressor:2.1.0'
|
||||
compile 'com.android.support:support-annotations:26.0.1'
|
||||
}
|
||||
|
@ -4,22 +4,20 @@ import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import id.zelory.compressor.Compressor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import id.zelory.compressor.Compressor;
|
||||
|
||||
/**
|
||||
* Created by ipusic on 12/27/16.
|
||||
*/
|
||||
|
||||
public class Compression {
|
||||
class Compression {
|
||||
|
||||
public File compressImage(final Activity activity, final ReadableMap options, final String originalImagePath) throws IOException {
|
||||
File compressImage(final Activity activity, final ReadableMap options, final String originalImagePath) throws IOException {
|
||||
Integer maxWidth = options.hasKey("compressImageMaxWidth") ? options.getInt("compressImageMaxWidth") : null;
|
||||
Integer maxHeight = options.hasKey("compressImageMaxHeight") ? options.getInt("compressImageMaxHeight") : null;
|
||||
Double quality = options.hasKey("compressImageQuality") ? options.getDouble("compressImageQuality") : null;
|
||||
@ -65,7 +63,7 @@ public class Compression {
|
||||
.compressToFile(image, compressedFileName);
|
||||
}
|
||||
|
||||
public synchronized void compressVideo(final Activity activity, final ReadableMap options, final String originalVideo, final String compressedVideo, final Promise promise) {
|
||||
synchronized void compressVideo(final Activity activity, final ReadableMap options, final String originalVideo, final String compressedVideo, final Promise promise) {
|
||||
// todo: video compression
|
||||
// failed attempt 1: ffmpeg => slow and licensing issues
|
||||
promise.resolve(originalVideo);
|
||||
|
@ -13,9 +13,9 @@ import java.util.List;
|
||||
|
||||
import static android.media.ExifInterface.*;
|
||||
|
||||
public class ExifExtractor {
|
||||
class ExifExtractor {
|
||||
|
||||
public static WritableMap extract(String path) throws IOException {
|
||||
static WritableMap extract(String path) throws IOException {
|
||||
WritableMap exifData = new WritableNativeMap();
|
||||
|
||||
List<String> attributes = getBasicAttributes();
|
||||
|
@ -1,18 +1,18 @@
|
||||
package com.reactnative.ivpusic.imagepicker;
|
||||
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.MediaStore;
|
||||
import android.content.ContentUris;
|
||||
import android.os.Environment;
|
||||
import android.support.annotation.RequiresApi;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class RealPathUtil {
|
||||
public static String getRealPathFromURI(final Context context, final Uri uri) {
|
||||
class RealPathUtil {
|
||||
static String getRealPathFromURI(final Context context, final Uri uri) {
|
||||
|
||||
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
|
||||
|
||||
@ -101,8 +101,8 @@ public class RealPathUtil {
|
||||
* @param selectionArgs (Optional) Selection arguments used in the query.
|
||||
* @return The value of the _data column, which is typically a file path.
|
||||
*/
|
||||
public static String getDataColumn(Context context, Uri uri, String selection,
|
||||
String[] selectionArgs) {
|
||||
private static String getDataColumn(Context context, Uri uri, String selection,
|
||||
String[] selectionArgs) {
|
||||
|
||||
Cursor cursor = null;
|
||||
final String column = "_data";
|
||||
@ -129,7 +129,7 @@ public class RealPathUtil {
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is ExternalStorageProvider.
|
||||
*/
|
||||
public static boolean isExternalStorageDocument(Uri uri) {
|
||||
private static boolean isExternalStorageDocument(Uri uri) {
|
||||
return "com.android.externalstorage.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ public class RealPathUtil {
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is DownloadsProvider.
|
||||
*/
|
||||
public static boolean isDownloadsDocument(Uri uri) {
|
||||
private static boolean isDownloadsDocument(Uri uri) {
|
||||
return "com.android.providers.downloads.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ public class RealPathUtil {
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is MediaProvider.
|
||||
*/
|
||||
public static boolean isMediaDocument(Uri uri) {
|
||||
private static boolean isMediaDocument(Uri uri) {
|
||||
return "com.android.providers.media.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
@ -153,12 +153,11 @@ public class RealPathUtil {
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is Google Photos.
|
||||
*/
|
||||
public static boolean isGooglePhotosUri(Uri uri) {
|
||||
private static boolean isGooglePhotosUri(Uri uri) {
|
||||
return "com.google.android.apps.photos.content".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.KITKAT)
|
||||
public static String getPathToNonPrimaryVolume(Context context, String tag) {
|
||||
private static String getPathToNonPrimaryVolume(Context context, String tag) {
|
||||
File[] volumes = context.getExternalCacheDirs();
|
||||
if (volumes != null) {
|
||||
for (File volume : volumes) {
|
||||
|
@ -13,7 +13,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* Created by ipusic on 12/28/16.
|
||||
*/
|
||||
|
||||
public class ResultCollector {
|
||||
class ResultCollector {
|
||||
private Promise promise;
|
||||
private int waitCount;
|
||||
private boolean multiple;
|
||||
@ -21,7 +21,7 @@ public class ResultCollector {
|
||||
private WritableArray arrayResult;
|
||||
private boolean resultSent = false;
|
||||
|
||||
public ResultCollector(Promise promise, boolean multiple) {
|
||||
ResultCollector(Promise promise, boolean multiple) {
|
||||
this.promise = promise;
|
||||
this.multiple = multiple;
|
||||
|
||||
@ -32,12 +32,12 @@ public class ResultCollector {
|
||||
|
||||
// if user has provided "multiple" option, we will wait for X number of result to come,
|
||||
// and also return result as an array
|
||||
public void setWaitCount(int waitCount) {
|
||||
void setWaitCount(int waitCount) {
|
||||
this.waitCount = waitCount;
|
||||
this.waitCounter = new AtomicInteger(0);
|
||||
}
|
||||
|
||||
public synchronized void notifySuccess(WritableMap result) {
|
||||
synchronized void notifySuccess(WritableMap result) {
|
||||
if (resultSent) {
|
||||
Log.w("image-crop-picker", "Skipping result, already sent...");
|
||||
}
|
||||
@ -56,7 +56,7 @@ public class ResultCollector {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void notifyProblem(String code, String message) {
|
||||
synchronized void notifyProblem(String code, String message) {
|
||||
if (resultSent) {
|
||||
Log.w("image-crop-picker", "Skipping result, already sent...");
|
||||
}
|
||||
@ -66,7 +66,7 @@ public class ResultCollector {
|
||||
resultSent = true;
|
||||
}
|
||||
|
||||
public synchronized void notifyProblem(String code, Throwable throwable) {
|
||||
synchronized void notifyProblem(String code, Throwable throwable) {
|
||||
if (resultSent) {
|
||||
Log.w("image-crop-picker", "Skipping result, already sent...");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-image-crop-picker",
|
||||
"version": "0.18.0",
|
||||
"version": "0.18.1",
|
||||
"description": "Select single or multiple images, with cropping option",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user