use of com.googlecode.gwtphonegap.client.file.FileReader in project gwtphonegap by dankurka.
the class CameraBrowserFileInput method getBase64.
private void getBase64(ReaderCallback<FileReader> callback) {
FileObjectJsImpl file = getFile(input.getElement());
FileReader reader = createReader();
reader.setOnLoadEndCallback(callback);
reader.readAsDataUrl(file);
}
use of com.googlecode.gwtphonegap.client.file.FileReader in project gwtphonegap by dankurka.
the class CameraBrowserFileInput method getPicture.
@Override
public CameraPopoverHandle getPicture(final PictureOptions options, final PictureCallback callback) {
if (!input.isAttached()) {
callback.onFailure("after #cleanUp(), this instance is no longer useful");
return popoverHandle;
}
@SuppressWarnings("unused") final ChangeHandler handler = new ChangeHandler() {
private final HandlerRegistration reg = input.addChangeHandler(this);
@Override
public void onChange(ChangeEvent event) {
reg.removeHandler();
if (options.getDestinationType() == PictureOptions.DESTINATION_TYPE_DATA_URL) {
getBase64(new ReaderCallback<FileReader>() {
@Override
public void onCallback(FileReader result) {
callback.onSuccess(result.getResult());
}
});
} else {
callback.onSuccess(getFileUri());
}
}
};
open(input.getElement());
return popoverHandle;
}
Aggregations