From 6135813bff6d4b74a15e6db5d9b548c1f3fc4922 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Thu, 9 Oct 2025 14:08:08 +0200 Subject: [PATCH 1/2] don't set deprecated/unused stock strings --- src/main/java/org/thoughtcrime/securesms/connect/DcHelper.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/thoughtcrime/securesms/connect/DcHelper.java b/src/main/java/org/thoughtcrime/securesms/connect/DcHelper.java index 79ae61ee4..69d25b311 100644 --- a/src/main/java/org/thoughtcrime/securesms/connect/DcHelper.java +++ b/src/main/java/org/thoughtcrime/securesms/connect/DcHelper.java @@ -165,8 +165,6 @@ public class DcHelper { dcContext.setStockTranslation(72, context.getString(R.string.systemmsg_unknown_sender_for_chat)); dcContext.setStockTranslation(73, context.getString(R.string.systemmsg_subject_for_new_contact)); dcContext.setStockTranslation(74, context.getString(R.string.systemmsg_failed_sending_to)); - dcContext.setStockTranslation(82, context.getString(R.string.videochat_invitation)); - dcContext.setStockTranslation(83, context.getString(R.string.videochat_invitation_body)); dcContext.setStockTranslation(84, context.getString(R.string.configuration_failed_with_error)); dcContext.setStockTranslation(85, context.getString(R.string.devicemsg_bad_time)); dcContext.setStockTranslation(86, context.getString(R.string.devicemsg_update_reminder)); From da4d17aa14af01ce490b74c7e21af1e3ec71ad78 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Thu, 9 Oct 2025 14:22:51 +0200 Subject: [PATCH 2/2] remove dependency for awebp, it is supported by Android --- build.gradle | 1 - .../glide/webp/WebpDrawableTranscoder.java | 44 --------- .../securesms/glide/webp/WebpLoader.java | 92 ------------------- .../securesms/mms/SignalGlideModule.java | 7 -- 4 files changed, 144 deletions(-) delete mode 100644 src/main/java/org/thoughtcrime/securesms/glide/webp/WebpDrawableTranscoder.java delete mode 100644 src/main/java/org/thoughtcrime/securesms/glide/webp/WebpLoader.java diff --git a/build.gradle b/build.gradle index 67ac948db..f2d8d80c4 100644 --- a/build.gradle +++ b/build.gradle @@ -174,7 +174,6 @@ dependencies { implementation ('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false } // QR Code scanner implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.1' // used as JSON library implementation 'com.github.Baseflow:PhotoView:2.3.0' // does the zooming on photos / media - implementation 'com.github.penfeizhou.android.animation:awebp:3.0.5' // animated webp support. implementation 'com.caverock:androidsvg-aar:1.4' // SVG support. implementation 'com.github.bumptech.glide:glide:4.16.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0' diff --git a/src/main/java/org/thoughtcrime/securesms/glide/webp/WebpDrawableTranscoder.java b/src/main/java/org/thoughtcrime/securesms/glide/webp/WebpDrawableTranscoder.java deleted file mode 100644 index cac547b65..000000000 --- a/src/main/java/org/thoughtcrime/securesms/glide/webp/WebpDrawableTranscoder.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.thoughtcrime.securesms.glide.webp; - -import android.graphics.drawable.Drawable; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.bumptech.glide.load.Options; -import com.bumptech.glide.load.engine.Resource; -import com.bumptech.glide.load.resource.drawable.DrawableResource; -import com.bumptech.glide.load.resource.transcode.ResourceTranscoder; -import com.github.penfeizhou.animation.webp.WebPDrawable; -import com.github.penfeizhou.animation.webp.decode.WebPDecoder; - -public class WebpDrawableTranscoder implements ResourceTranscoder { - @Nullable - @Override - public Resource transcode(@NonNull Resource toTranscode, @NonNull Options options) { - final WebPDrawable webPDrawable = new WebPDrawable(toTranscode.get()); - webPDrawable.setAutoPlay(true); - return new DrawableResource(webPDrawable) { - @NonNull - @Override - public Class getResourceClass() { - return Drawable.class; - } - - @Override - public int getSize() { - return webPDrawable.getMemorySize(); - } - - @Override - public void recycle() { - webPDrawable.stop(); - } - - @Override - public void initialize() { - super.initialize(); - } - }; - } -} diff --git a/src/main/java/org/thoughtcrime/securesms/glide/webp/WebpLoader.java b/src/main/java/org/thoughtcrime/securesms/glide/webp/WebpLoader.java deleted file mode 100644 index eb04bca2c..000000000 --- a/src/main/java/org/thoughtcrime/securesms/glide/webp/WebpLoader.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.thoughtcrime.securesms.glide.webp; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.bumptech.glide.load.Options; -import com.bumptech.glide.load.ResourceDecoder; -import com.bumptech.glide.load.engine.Resource; -import com.github.penfeizhou.animation.io.StreamReader; -import com.github.penfeizhou.animation.loader.ByteBufferLoader; -import com.github.penfeizhou.animation.loader.Loader; -import com.github.penfeizhou.animation.webp.decode.WebPDecoder; -import com.github.penfeizhou.animation.webp.decode.WebPParser; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class WebpLoader implements ResourceDecoder { - - @Override - public boolean handles(@NonNull InputStream source, @NonNull Options options) { - return WebPParser.isAWebP(new StreamReader(source)); - } - - @Nullable - @Override - public Resource decode(@NonNull final InputStream source, int width, int height, @NonNull Options options) throws IOException { - byte[] data = inputStreamToBytes(source); - if (data == null) { - return null; - } - ByteBuffer byteBuffer = ByteBuffer.wrap(data); - Loader loader = new ByteBufferLoader() { - @Override - public ByteBuffer getByteBuffer() { - byteBuffer.position(0); - return byteBuffer; - } - }; - return new WebPDecoderResource(new WebPDecoder(loader, null), byteBuffer.limit()); - } - - private static byte[] inputStreamToBytes(InputStream is) { - final int bufferSize = 16384; - ByteArrayOutputStream buffer = new ByteArrayOutputStream(bufferSize); - try { - int nRead; - byte[] data = new byte[bufferSize]; - while ((nRead = is.read(data)) != -1) { - buffer.write(data, 0, nRead); - } - buffer.flush(); - } catch (IOException e) { - return null; - } - return buffer.toByteArray(); - } - - private static class WebPDecoderResource implements Resource { - private final WebPDecoder decoder; - private final int size; - - WebPDecoderResource(WebPDecoder decoder, int size) { - this.decoder = decoder; - this.size = size; - } - - @NonNull - @Override - public Class getResourceClass() { - return WebPDecoder.class; - } - - @NonNull - @Override - public WebPDecoder get() { - return this.decoder; - } - - @Override - public int getSize() { - return this.size; - } - - @Override - public void recycle() { - this.decoder.stop(); - } - } -} diff --git a/src/main/java/org/thoughtcrime/securesms/mms/SignalGlideModule.java b/src/main/java/org/thoughtcrime/securesms/mms/SignalGlideModule.java index 862c7c7fd..08d4fb354 100644 --- a/src/main/java/org/thoughtcrime/securesms/mms/SignalGlideModule.java +++ b/src/main/java/org/thoughtcrime/securesms/mms/SignalGlideModule.java @@ -12,12 +12,9 @@ import com.bumptech.glide.Registry; import com.bumptech.glide.annotation.GlideModule; import com.bumptech.glide.load.model.UnitModelLoader; import com.bumptech.glide.module.AppGlideModule; -import com.github.penfeizhou.animation.webp.decode.WebPDecoder; import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto; import org.thoughtcrime.securesms.glide.ContactPhotoLoader; -import org.thoughtcrime.securesms.glide.webp.WebpDrawableTranscoder; -import org.thoughtcrime.securesms.glide.webp.WebpLoader; import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri; import java.io.File; @@ -53,9 +50,5 @@ public class SignalGlideModule extends AppGlideModule { registry.append(ContactPhoto.class, InputStream.class, new ContactPhotoLoader.Factory(context)); registry.append(DecryptableUri.class, InputStream.class, new DecryptableStreamUriLoader.Factory(context)); //registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory()); - - registry - .prepend(InputStream.class, WebPDecoder.class, new WebpLoader()) - .register(WebPDecoder.class, Drawable.class, new WebpDrawableTranscoder()); } }