use of org.thoughtcrime.securesms.providers.PersistentBlobProvider in project Signal-Android by WhisperSystems.
the class ScribbleActivity method onSave.
@Override
public void onSave() {
ListenableFuture<Bitmap> future = scribbleView.getRenderedImage();
future.addListener(new ListenableFuture.Listener<Bitmap>() {
@Override
public void onSuccess(Bitmap result) {
PersistentBlobProvider provider = PersistentBlobProvider.getInstance(ScribbleActivity.this);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
result.compress(Bitmap.CompressFormat.JPEG, 80, baos);
byte[] data = baos.toByteArray();
baos = null;
result = null;
Uri uri = provider.create(masterSecret, data, ContentType.IMAGE_JPEG);
Intent intent = new Intent();
intent.setData(uri);
setResult(RESULT_OK, intent);
finish();
}
@Override
public void onFailure(ExecutionException e) {
Log.w(TAG, e);
}
});
}
Aggregations