fix conversation avatars (#1324)
This commit is contained in:
parent
5d04a7ccda
commit
ab4f981955
|
@ -93,7 +93,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
private final NumberFormat numberFormat = NumberFormat.getNumberInstance();
|
private final NumberFormat numberFormat = NumberFormat.getNumberInstance();
|
||||||
|
|
||||||
private int avatarRadius48dp;
|
protected int avatarRadius48dp;
|
||||||
private int avatarRadius36dp;
|
private int avatarRadius36dp;
|
||||||
private int avatarRadius24dp;
|
private int avatarRadius24dp;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
package com.keylesspalace.tusky.components.conversation;
|
package com.keylesspalace.tusky.components.conversation;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -23,11 +24,11 @@ import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.ToggleButton;
|
import android.widget.ToggleButton;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
|
||||||
import com.keylesspalace.tusky.R;
|
import com.keylesspalace.tusky.R;
|
||||||
import com.keylesspalace.tusky.adapter.StatusBaseViewHolder;
|
import com.keylesspalace.tusky.adapter.StatusBaseViewHolder;
|
||||||
import com.keylesspalace.tusky.entity.Attachment;
|
import com.keylesspalace.tusky.entity.Attachment;
|
||||||
import com.keylesspalace.tusky.interfaces.StatusActionListener;
|
import com.keylesspalace.tusky.interfaces.StatusActionListener;
|
||||||
|
import com.keylesspalace.tusky.util.ImageLoadingHelper;
|
||||||
import com.keylesspalace.tusky.util.SmartLengthInputFilter;
|
import com.keylesspalace.tusky.util.SmartLengthInputFilter;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -44,6 +45,7 @@ public class ConversationViewHolder extends StatusBaseViewHolder {
|
||||||
|
|
||||||
private StatusActionListener listener;
|
private StatusActionListener listener;
|
||||||
private boolean mediaPreviewEnabled;
|
private boolean mediaPreviewEnabled;
|
||||||
|
private boolean animateAvatars;
|
||||||
|
|
||||||
ConversationViewHolder(View itemView,
|
ConversationViewHolder(View itemView,
|
||||||
StatusActionListener listener,
|
StatusActionListener listener,
|
||||||
|
@ -56,6 +58,8 @@ public class ConversationViewHolder extends StatusBaseViewHolder {
|
||||||
|
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
this.mediaPreviewEnabled = mediaPreviewEnabled;
|
this.mediaPreviewEnabled = mediaPreviewEnabled;
|
||||||
|
|
||||||
|
this.animateAvatars = PreferenceManager.getDefaultSharedPreferences(itemView.getContext()).getBoolean("animateGifAvatars", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -124,9 +128,7 @@ public class ConversationViewHolder extends StatusBaseViewHolder {
|
||||||
for(int i=0; i < avatars.length; i++) {
|
for(int i=0; i < avatars.length; i++) {
|
||||||
ImageView avatarView = avatars[i];
|
ImageView avatarView = avatars[i];
|
||||||
if(i < accounts.size()) {
|
if(i < accounts.size()) {
|
||||||
Glide.with(avatarView)
|
ImageLoadingHelper.loadAvatar(accounts.get(i).getAvatar(), avatarView, avatarRadius48dp, animateAvatars);
|
||||||
.load(accounts.get(i).getAvatar())
|
|
||||||
.into(avatarView);
|
|
||||||
avatarView.setVisibility(View.VISIBLE);
|
avatarView.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
avatarView.setVisibility(View.GONE);
|
avatarView.setVisibility(View.GONE);
|
||||||
|
|
Loading…
Reference in New Issue