From ab4f981955f0cdb1799726fa23ccffdb694b9a34 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Mon, 17 Jun 2019 13:14:44 +0200 Subject: [PATCH] fix conversation avatars (#1324) --- .../tusky/adapter/StatusBaseViewHolder.java | 2 +- .../conversation/ConversationViewHolder.java | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java index 00f33683..6e409138 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java @@ -93,7 +93,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder { private final NumberFormat numberFormat = NumberFormat.getNumberInstance(); - private int avatarRadius48dp; + protected int avatarRadius48dp; private int avatarRadius36dp; private int avatarRadius24dp; diff --git a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationViewHolder.java index dc34f77e..2acf5e86 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationViewHolder.java @@ -16,6 +16,7 @@ package com.keylesspalace.tusky.components.conversation; import android.content.Context; +import android.preference.PreferenceManager; import android.text.InputFilter; import android.text.TextUtils; import android.view.View; @@ -23,11 +24,11 @@ import android.widget.ImageView; import android.widget.TextView; import android.widget.ToggleButton; -import com.bumptech.glide.Glide; import com.keylesspalace.tusky.R; import com.keylesspalace.tusky.adapter.StatusBaseViewHolder; import com.keylesspalace.tusky.entity.Attachment; import com.keylesspalace.tusky.interfaces.StatusActionListener; +import com.keylesspalace.tusky.util.ImageLoadingHelper; import com.keylesspalace.tusky.util.SmartLengthInputFilter; import java.util.List; @@ -44,6 +45,7 @@ public class ConversationViewHolder extends StatusBaseViewHolder { private StatusActionListener listener; private boolean mediaPreviewEnabled; + private boolean animateAvatars; ConversationViewHolder(View itemView, StatusActionListener listener, @@ -56,6 +58,8 @@ public class ConversationViewHolder extends StatusBaseViewHolder { this.listener = listener; this.mediaPreviewEnabled = mediaPreviewEnabled; + + this.animateAvatars = PreferenceManager.getDefaultSharedPreferences(itemView.getContext()).getBoolean("animateGifAvatars", false); } @Override @@ -124,9 +128,7 @@ public class ConversationViewHolder extends StatusBaseViewHolder { for(int i=0; i < avatars.length; i++) { ImageView avatarView = avatars[i]; if(i < accounts.size()) { - Glide.with(avatarView) - .load(accounts.get(i).getAvatar()) - .into(avatarView); + ImageLoadingHelper.loadAvatar(accounts.get(i).getAvatar(), avatarView, avatarRadius48dp, animateAvatars); avatarView.setVisibility(View.VISIBLE); } else { avatarView.setVisibility(View.GONE);