mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-06-29 18:45:58 +01:00
Fix story preview thumbnails not rendering in contact picker.
This commit is contained in:
+1
-1
@@ -236,7 +236,7 @@ class MediaReviewFragment : Fragment(R.layout.v2_media_review_fragment), Schedul
|
||||
if (MediaUtil.isImageType(media.contentType) && editorData != null && editorData is ImageEditorFragment.Data) {
|
||||
val model = editorData.readModel()
|
||||
if (model != null) {
|
||||
ImageEditorFragment.renderToSingleUseBlob(requireContext(), model)
|
||||
ImageEditorFragment.renderToSingleSessionBlob(requireContext(), model)
|
||||
} else {
|
||||
media.uri
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ class TextStoryPostSendRepository {
|
||||
val outputStream = ByteArrayOutputStream()
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream)
|
||||
bitmap.recycle()
|
||||
BlobProvider.getInstance().forData(outputStream.toByteArray()).createForSingleUseInMemory()
|
||||
BlobProvider.getInstance().forData(outputStream.toByteArray()).createForSingleSessionInMemory()
|
||||
}.subscribeOn(Schedulers.computation())
|
||||
}
|
||||
|
||||
|
||||
@@ -819,6 +819,20 @@ public final class ImageEditorFragment extends Fragment implements ImageEditorHu
|
||||
.createForSingleUseInMemory();
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
public static @NonNull Uri renderToSingleSessionBlob(@NonNull Context context, @NonNull EditorModel editorModel) {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
Bitmap image = editorModel.render(context, new FontTypefaceProvider());
|
||||
|
||||
image.compress(Bitmap.CompressFormat.JPEG, 80, outputStream);
|
||||
image.recycle();
|
||||
|
||||
return BlobProvider.getInstance()
|
||||
.forData(outputStream.toByteArray())
|
||||
.withMimeType(MediaUtil.IMAGE_JPEG)
|
||||
.createForSingleSessionInMemory();
|
||||
}
|
||||
|
||||
private void onDrawingChanged(boolean stillTouching, boolean isUserEdit) {
|
||||
if (isUserEdit) {
|
||||
hasMadeAnEditThisSession = true;
|
||||
|
||||
Reference in New Issue
Block a user