mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Add a migration to generate thumbnails for existing quotes.
This commit is contained in:
@@ -45,7 +45,7 @@ public final class ImageCompressionUtil {
|
||||
}
|
||||
};
|
||||
|
||||
private ImageCompressionUtil () {}
|
||||
private ImageCompressionUtil() {}
|
||||
|
||||
/**
|
||||
* A result satisfying the provided constraints, or null if they could not be met.
|
||||
@@ -79,6 +79,22 @@ public final class ImageCompressionUtil {
|
||||
int maxDimension,
|
||||
@IntRange(from = 0, to = 100) int quality)
|
||||
throws BitmapDecodingException
|
||||
{
|
||||
return compress(context, contentType, targetContentType, glideModel, maxDimension, quality, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compresses the image to match the requested parameters.
|
||||
*/
|
||||
@WorkerThread
|
||||
public static @NonNull Result compress(@NonNull Context context,
|
||||
@Nullable String contentType,
|
||||
@Nullable String targetContentType,
|
||||
@NonNull Object glideModel,
|
||||
int maxDimension,
|
||||
@IntRange(from = 0, to = 100) int quality,
|
||||
boolean quiet)
|
||||
throws BitmapDecodingException
|
||||
{
|
||||
Bitmap scaledBitmap;
|
||||
|
||||
@@ -93,6 +109,10 @@ public final class ImageCompressionUtil {
|
||||
.submit(maxDimension, maxDimension)
|
||||
.get();
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
if (quiet) {
|
||||
throw new BitmapDecodingException(e);
|
||||
}
|
||||
|
||||
Log.w(TAG, "Verbose logging to try to give all possible debug information for Glide issues. Exceptions below may be duplicated.", e);
|
||||
if (e.getCause() instanceof GlideException) {
|
||||
List<Throwable> rootCauses = ((GlideException) e.getCause()).getRootCauses();
|
||||
|
||||
Reference in New Issue
Block a user