Fix avatars not properly displayed in accounts list
This commit is contained in:
parent
63eba70517
commit
9a88cd30f0
|
@ -1,7 +1,8 @@
|
|||
Fixed:
|
||||
- An issue with animated avatars in menu
|
||||
- An issue with avatars in accounts list
|
||||
- An issue with banana.dog instance
|
||||
- An issue with sensitive media when there were already a video preview
|
||||
- Crashes with polls
|
||||
- Crashes with polls on some instances
|
||||
- Crashes with Pixelfed
|
||||
- Some other issues.
|
|
@ -1315,42 +1315,66 @@ public class Helper {
|
|||
continue;
|
||||
final MenuItem item = currentSubmenu.add("@" + account.getAcct());
|
||||
item.setIcon(R.drawable.ic_person);
|
||||
String url = account.getAvatar();
|
||||
final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean disableGif = sharedpreferences.getBoolean(SET_DISABLE_GIF, false);
|
||||
String url = !disableGif ? account.getAvatar() : account.getAvatar_static();
|
||||
if (url.startsWith("/")) {
|
||||
url = "https://" + account.getInstance() + account.getAvatar();
|
||||
}
|
||||
if (!url.equals("null"))
|
||||
Glide.with(navigationView.getContext())
|
||||
.asDrawable()
|
||||
.load(account.getAvatar())
|
||||
.into(new CustomTarget<Drawable>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
|
||||
item.setIcon(resource);
|
||||
}
|
||||
if( isValidContextForGlide(activity)) {
|
||||
if (!url.equals("null")) {
|
||||
if( url.contains(".gif")) {
|
||||
Glide.with(navigationView.getContext())
|
||||
.asGif()
|
||||
.load(url)
|
||||
.into(new CustomTarget<GifDrawable>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull GifDrawable resource, Transition<? super GifDrawable> transition) {
|
||||
item.setIcon(resource);
|
||||
item.getIcon().setColorFilter(0xFFFFFFFF, PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
else
|
||||
Glide.with(navigationView.getContext())
|
||||
.asBitmap()
|
||||
.load(R.drawable.missing_peertube)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
||||
item.setIcon(new BitmapDrawable(activity.getResources(), resource));
|
||||
item.getIcon().setColorFilter(0xFFFFFFFF, PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
Glide.with(navigationView.getContext())
|
||||
.asDrawable()
|
||||
.load(url)
|
||||
.into(new CustomTarget<Drawable>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
|
||||
item.setIcon(resource);
|
||||
item.getIcon().setColorFilter(0xFFFFFFFF, PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
Glide.with(navigationView.getContext())
|
||||
.asBitmap()
|
||||
.load(R.drawable.missing_peertube)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
||||
item.setIcon(new BitmapDrawable(activity.getResources(), resource));
|
||||
item.getIcon().setColorFilter(0xFFFFFFFF, PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
item.setOnMenuItemClickListener(item1 -> {
|
||||
if (!activity.isFinishing()) {
|
||||
menuAccountsOpened = false;
|
||||
|
|
Loading…
Reference in New Issue