Fix bot icon indicator again (#1249)
* fix handling of bot indicator in timeline * write bot status into db cache * remove log
This commit is contained in:
parent
5fb566f818
commit
40d3eb8759
7 changed files with 46 additions and 37 deletions
|
|
@ -218,7 +218,34 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
}
|
||||
}
|
||||
|
||||
protected void setAvatar(String url, @Nullable String rebloggedUrl, boolean isBot) {
|
||||
private void setAvatar(String url, @Nullable String rebloggedUrl, boolean isBot) {
|
||||
|
||||
if(TextUtils.isEmpty(rebloggedUrl)) {
|
||||
avatar.setPaddingRelative(0, 0, 0, 0);
|
||||
|
||||
if(showBotOverlay && isBot) {
|
||||
avatarInset.setVisibility(View.VISIBLE);
|
||||
avatarInset.setBackgroundColor(0x50ffffff);
|
||||
Glide.with(avatarInset)
|
||||
.load(R.drawable.ic_bot_24dp)
|
||||
.into(avatarInset);
|
||||
|
||||
} else {
|
||||
avatarInset.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
} else {
|
||||
int padding = Utils.convertDpToPx(avatar.getContext(), 12);
|
||||
avatar.setPaddingRelative(0, 0, padding, padding);
|
||||
|
||||
avatarInset.setVisibility(View.VISIBLE);
|
||||
avatarInset.setBackground(null);
|
||||
Glide.with(avatarInset)
|
||||
.load(rebloggedUrl)
|
||||
.placeholder(R.drawable.avatar_default)
|
||||
.into(avatarInset);
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
avatar.setImageResource(R.drawable.avatar_default);
|
||||
} else {
|
||||
|
|
@ -228,14 +255,6 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
.into(avatar);
|
||||
}
|
||||
|
||||
if (showBotOverlay && isBot && TextUtils.isEmpty(rebloggedUrl)) {
|
||||
avatarInset.setVisibility(View.VISIBLE);
|
||||
avatarInset.setImageResource(R.drawable.ic_bot_24dp);
|
||||
avatarInset.setBackgroundColor(0x50ffffff);
|
||||
} else {
|
||||
avatarInset.setBackground(null);
|
||||
avatarInset.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setCreatedAt(@Nullable Date createdAt) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import android.view.View;
|
|||
import android.widget.TextView;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.keylesspalace.tusky.R;
|
||||
import com.keylesspalace.tusky.interfaces.StatusActionListener;
|
||||
import com.keylesspalace.tusky.util.SmartLengthInputFilter;
|
||||
|
|
@ -45,25 +44,6 @@ public class StatusViewHolder extends StatusBaseViewHolder {
|
|||
contentCollapseButton = itemView.findViewById(R.id.button_toggle_content);
|
||||
}
|
||||
|
||||
@Override
|
||||
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) {
|
||||
avatarInset.setVisibility(View.VISIBLE);
|
||||
Glide.with(context)
|
||||
.load(rebloggedUrl)
|
||||
.placeholder(R.drawable.avatar_default)
|
||||
.into(avatarInset);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMediaPreviewHeight(Context context) {
|
||||
return context.getResources().getDimensionPixelSize(R.dimen.status_media_preview_height);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue