Add bot indicator overlay to avatars (#1173)
* Add bot indicator overlay to avatars * Add bot overlay to account list in search view * Add preference for bot avatar overlay
This commit is contained in:
parent
63e4c1d4e0
commit
391cd12974
13 changed files with 115 additions and 34 deletions
|
|
@ -17,6 +17,7 @@ package com.keylesspalace.tusky.adapter;
|
|||
|
||||
import android.content.Context;
|
||||
import android.text.InputFilter;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
|
@ -36,35 +37,28 @@ public class StatusViewHolder extends StatusBaseViewHolder {
|
|||
private static final InputFilter[] COLLAPSE_INPUT_FILTER = new InputFilter[]{SmartLengthInputFilter.INSTANCE};
|
||||
private static final InputFilter[] NO_INPUT_FILTER = new InputFilter[0];
|
||||
|
||||
private ImageView avatarReblog;
|
||||
private TextView rebloggedBar;
|
||||
private ToggleButton contentCollapseButton;
|
||||
|
||||
StatusViewHolder(View itemView, boolean useAbsoluteTime) {
|
||||
super(itemView, useAbsoluteTime);
|
||||
avatarReblog = itemView.findViewById(R.id.status_avatar_reblog);
|
||||
rebloggedBar = itemView.findViewById(R.id.status_reblogged);
|
||||
contentCollapseButton = itemView.findViewById(R.id.button_toggle_content);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAvatar(String url, @Nullable String rebloggedUrl) {
|
||||
super.setAvatar(url, rebloggedUrl);
|
||||
|
||||
protected void setAvatar(String url, @Nullable String rebloggedUrl, boolean isBot) {
|
||||
super.setAvatar(url, rebloggedUrl, isBot);
|
||||
Context context = avatar.getContext();
|
||||
boolean hasReblog = rebloggedUrl != null && !rebloggedUrl.isEmpty();
|
||||
int padding = hasReblog ? Utils.dpToPx(context, 12) : 0;
|
||||
|
||||
avatar.setPaddingRelative(0, 0, padding, padding);
|
||||
|
||||
if (hasReblog) {
|
||||
avatarReblog.setVisibility(View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(rebloggedUrl)) {
|
||||
int padding = Utils.dpToPx(context, 12);
|
||||
avatar.setPaddingRelative(0, 0, padding, padding);
|
||||
avatarInset.setVisibility(View.VISIBLE);
|
||||
Picasso.with(context)
|
||||
.load(rebloggedUrl)
|
||||
.placeholder(R.drawable.avatar_default)
|
||||
.into(avatarReblog);
|
||||
} else {
|
||||
avatarReblog.setVisibility(View.GONE);
|
||||
.into(avatarInset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue