use of org.odk.collect.android.widgets.BaseImageWidget in project collect by opendatakit.
the class MediaLoadingTask method doInBackground.
@Override
protected File doInBackground(Uri... uris) {
FormController formController = Collect.getInstance().getFormController();
if (formController != null) {
File instanceFile = formController.getInstanceFile();
if (instanceFile != null) {
String extension = ContentUriHelper.getFileExtensionFromUri(uris[0]);
File newFile = FileUtils.createDestinationMediaFile(instanceFile.getParent(), extension);
FileUtils.saveAnswerFileFromUri(uris[0], newFile, Collect.getInstance());
QuestionWidget questionWidget = formEntryActivity.get().getWidgetWaitingForBinaryData();
// apply image conversion if the widget is an image widget
if (questionWidget instanceof BaseImageWidget) {
String imageSizeMode = settingsProvider.getUnprotectedSettings().getString(KEY_IMAGE_SIZE);
ImageConverter.execute(newFile.getPath(), questionWidget, formEntryActivity.get(), imageSizeMode);
}
return newFile;
}
}
return null;
}
Aggregations