fix conversation avatars (#1324)

This commit is contained in:
Konrad Pozniak 2019-06-17 13:14:44 +02:00 committed by GitHub
parent 5d04a7ccda
commit ab4f981955
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -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;

View file

@ -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);