mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
parent
5cb7b7a981
commit
f1cec5a2ca
@ -5,6 +5,7 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
@ -41,7 +42,13 @@ public class ContactPhotoFactory {
|
||||
return getContactPhoto(context, uri, name, targetSize);
|
||||
}
|
||||
|
||||
public static ContactPhoto getContactPhoto(Context context, Uri uri, String name, int targetSize) {
|
||||
public static ContactPhoto getContactPhoto(@NonNull Context context,
|
||||
@Nullable Uri uri,
|
||||
@Nullable String name,
|
||||
int targetSize)
|
||||
{
|
||||
if (uri == null) return getDefaultContactPhoto(name);
|
||||
|
||||
try {
|
||||
Bitmap bitmap = Glide.with(context)
|
||||
.load(new ContactPhotoUri(uri)).asBitmap()
|
||||
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.mms;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.model.GenericLoaderFactory;
|
||||
@ -41,9 +42,9 @@ public class ContactPhotoUriLoader implements StreamModelLoader<ContactPhotoUri>
|
||||
}
|
||||
|
||||
public static class ContactPhotoUri {
|
||||
public Uri uri;
|
||||
public @NonNull Uri uri;
|
||||
|
||||
public ContactPhotoUri(Uri uri) {
|
||||
public ContactPhotoUri(@NonNull Uri uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user