Merge remote-tracking branch 'upstream/main'

This commit is contained in:
adbenitez
2025-10-09 15:39:22 +02:00
5 changed files with 0 additions and 146 deletions
-1
View File
@@ -234,7 +234,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'
@@ -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));
@@ -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<WebPDecoder, Drawable> {
@Nullable
@Override
public Resource<Drawable> transcode(@NonNull Resource<WebPDecoder> toTranscode, @NonNull Options options) {
final WebPDrawable webPDrawable = new WebPDrawable(toTranscode.get());
webPDrawable.setAutoPlay(true);
return new DrawableResource<Drawable>(webPDrawable) {
@NonNull
@Override
public Class<Drawable> getResourceClass() {
return Drawable.class;
}
@Override
public int getSize() {
return webPDrawable.getMemorySize();
}
@Override
public void recycle() {
webPDrawable.stop();
}
@Override
public void initialize() {
super.initialize();
}
};
}
}
@@ -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<InputStream, WebPDecoder> {
@Override
public boolean handles(@NonNull InputStream source, @NonNull Options options) {
return WebPParser.isAWebP(new StreamReader(source));
}
@Nullable
@Override
public Resource<WebPDecoder> 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<WebPDecoder> {
private final WebPDecoder decoder;
private final int size;
WebPDecoderResource(WebPDecoder decoder, int size) {
this.decoder = decoder;
this.size = size;
}
@NonNull
@Override
public Class<WebPDecoder> 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();
}
}
}
@@ -16,7 +16,6 @@ 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 com.caverock.androidsvg.SVG;
@@ -26,8 +25,6 @@ import org.thoughtcrime.securesms.glide.lottie.LottieDecoder;
import org.thoughtcrime.securesms.glide.lottie.LottieDrawableTranscoder;
import org.thoughtcrime.securesms.glide.svg.SvgDecoder;
import org.thoughtcrime.securesms.glide.svg.SvgDrawableTranscoder;
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;
@@ -64,10 +61,6 @@ public class SignalGlideModule extends AppGlideModule {
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());
registry
.register(LottieComposition.class, LottieDrawable.class, new LottieDrawableTranscoder())
.append(InputStream.class, LottieComposition.class, new LottieDecoder());