Skip to content

Instantly share code, notes, and snippets.

@CMingTseng
Created October 21, 2016 14:06
Show Gist options
  • Save CMingTseng/36bf1ebaac957037e5c6196070b2d944 to your computer and use it in GitHub Desktop.
Save CMingTseng/36bf1ebaac957037e5c6196070b2d944 to your computer and use it in GitHub Desktop.
mageRequest imageRequest = ImageRequestBuilder
.newBuilderWithSource(mImageCaptureUri)
.setAutoRotateEnabled(true)
.build();
ImagePipeline imagePipeline = Fresco.getImagePipeline();
final DataSource<CloseableReference<CloseableImage>>
dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
dataSource.subscribe(new BaseBitmapDataSubscriber() {
@Override
public void onNewResultImpl(@Nullable Bitmap bitmap) {
if (dataSource.isFinished() && bitmap != null){
Log.d("Bitmap","has come");
bmp = Bitmap.createBitmap(bitmap);
dataSource.close();
}
}
@Override
public void onFailureImpl(DataSource dataSource) {
if (dataSource != null) {
dataSource.close();
}
}
}, CallerThreadExecutor.getInstance());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment