mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Improve organization of glide packages.
Generic image processing classes were scattered alongside Signal-specific Glide code across multiple packages: `org.signal.glide`, `org.thoughtcrime.securesms.glide` and `org.thoughtcrime.securesms.mms`. This change provides a clearer separation of concerns: - `org.signal.glide` contains generic image loading components - `org.thoughtcrime.securesms.glide` contains Signal-specific Glide integrations - Feature-specific loaders are moved to their respective domain packages (e.g. `.badges`, `.contacts`)
This commit is contained in:
committed by
Jeffrey Starke
parent
cc43add7af
commit
47508495ed
@@ -1,34 +0,0 @@
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.request.target.BitmapImageViewTarget;
|
||||
|
||||
import org.signal.core.util.concurrent.SettableFuture;
|
||||
|
||||
public class GlideBitmapListeningTarget extends BitmapImageViewTarget {
|
||||
|
||||
private final SettableFuture<Boolean> loaded;
|
||||
|
||||
public GlideBitmapListeningTarget(@NonNull ImageView view, @NonNull SettableFuture<Boolean> loaded) {
|
||||
super(view);
|
||||
this.loaded = loaded;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setResource(@Nullable Bitmap resource) {
|
||||
super.setResource(resource);
|
||||
loaded.set(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
super.onLoadFailed(errorDrawable);
|
||||
loaded.set(true);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.request.target.DrawableImageViewTarget;
|
||||
|
||||
import org.signal.core.util.concurrent.SettableFuture;
|
||||
import org.signal.core.util.logging.Log;
|
||||
|
||||
public class GlideDrawableListeningTarget extends DrawableImageViewTarget {
|
||||
|
||||
private static final String TAG = Log.tag(GlideDrawableListeningTarget.class);
|
||||
|
||||
private final SettableFuture<Boolean> loaded;
|
||||
|
||||
public GlideDrawableListeningTarget(@NonNull ImageView view, @NonNull SettableFuture<Boolean> loaded) {
|
||||
super(view);
|
||||
this.loaded = loaded;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setResource(@Nullable Drawable resource) {
|
||||
if (resource == null) {
|
||||
Log.d(TAG, "Loaded null resource");
|
||||
} else {
|
||||
Log.d(TAG, "Loaded resource of w " + resource.getIntrinsicWidth() + " by h " + resource.getIntrinsicHeight());
|
||||
}
|
||||
|
||||
super.setResource(resource);
|
||||
loaded.set(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
super.onLoadFailed(errorDrawable);
|
||||
loaded.set(true);
|
||||
}
|
||||
}
|
||||
@@ -39,13 +39,15 @@ import com.bumptech.glide.request.RequestOptions;
|
||||
import org.signal.core.util.concurrent.ListenableFuture;
|
||||
import org.signal.core.util.concurrent.SettableFuture;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.signal.glide.transforms.SignalDownsampleStrategy;
|
||||
import org.signal.glide.load.SignalDownsampleStrategy;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
|
||||
import org.thoughtcrime.securesms.blurhash.BlurHash;
|
||||
import org.thoughtcrime.securesms.components.transfercontrols.TransferControlView;
|
||||
import org.thoughtcrime.securesms.database.AttachmentTable;
|
||||
import org.thoughtcrime.securesms.glide.targets.GlideBitmapListeningTarget;
|
||||
import org.thoughtcrime.securesms.glide.targets.GlideDrawableListeningTarget;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.mms.DecryptableUri;
|
||||
import org.thoughtcrime.securesms.mms.ImageSlide;
|
||||
|
||||
Reference in New Issue
Block a user