use of com.imagepicker.media.ImageConfig in project react-native-image-picker by marcshilling.
the class ImageConfigTest method testGetActualFile.
@Test
public void testGetActualFile() {
ImageConfig originalConfig = new ImageConfig(new File("original.txt"), null, 0, 0, 0, 0, false);
ImageConfig resizedConfig = originalConfig.withResizedFile(new File("resized.txt"));
assertEquals("For config which has got only original file", "original.txt", originalConfig.getActualFile().getName());
assertEquals("For config which has got resized file too", "resized.txt", resizedConfig.getActualFile().getName());
}
use of com.imagepicker.media.ImageConfig in project react-native-image-picker by marcshilling.
the class ImagePickerModule method showImagePicker.
@ReactMethod
public void showImagePicker(final ReadableMap options, final Callback callback) {
Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
responseHelper.invokeError(callback, "can't find current Activity");
return;
}
this.callback = callback;
this.options = options;
imageConfig = new ImageConfig(null, null, 0, 0, 100, 0, false);
final AlertDialog dialog = UI.chooseDialog(this, options, new UI.OnAction() {
@Override
public void onTakePhoto(@NonNull final ImagePickerModule module) {
if (module == null) {
return;
}
module.launchCamera();
}
@Override
public void onUseLibrary(@NonNull final ImagePickerModule module) {
if (module == null) {
return;
}
module.launchImageLibrary();
}
@Override
public void onCancel(@NonNull final ImagePickerModule module) {
if (module == null) {
return;
}
module.doOnCancel();
}
@Override
public void onCustomButton(@NonNull final ImagePickerModule module, @NonNull final String action) {
if (module == null) {
return;
}
module.invokeCustomButton(action);
}
});
dialog.show();
}
Aggregations