mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Fix GIFs
This commit is contained in:
parent
bdb950373a
commit
e5d82b325d
@ -11,6 +11,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.request.FutureTarget;
|
||||
|
||||
import com.bumptech.glide.util.ByteBufferUtil;
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.attachments.UriAttachment;
|
||||
@ -158,8 +159,7 @@ public class LinkPreviewRepository implements InjectableType {
|
||||
SignalExecutors.UNBOUNDED.execute(() -> {
|
||||
try {
|
||||
GifDrawable gif = future.get();
|
||||
byte[] bytes = new byte[gif.getBuffer().remaining()];
|
||||
gif.getBuffer().get(bytes);
|
||||
byte[] bytes = ByteBufferUtil.toBytes(gif.getBuffer());
|
||||
Uri uri = BlobProvider.getInstance().forData(bytes).createForSingleSessionInMemory();
|
||||
Optional<Attachment> thumbnail = Optional.of(new UriAttachment(uri, uri, MediaUtil.IMAGE_GIF, AttachmentDatabase.TRANSFER_PROGRESS_DONE,
|
||||
bytes.length, gif.getIntrinsicWidth(), gif.getIntrinsicHeight(), null, null, false, false, null, null));
|
||||
|
Loading…
x
Reference in New Issue
Block a user