improve custom emoji support (#687)
This commit is contained in:
parent
72023ffc58
commit
335e9ca390
@ -9,6 +9,7 @@ import com.keylesspalace.tusky.R;
|
||||
import com.keylesspalace.tusky.entity.Account;
|
||||
import com.keylesspalace.tusky.interfaces.AccountActionListener;
|
||||
import com.keylesspalace.tusky.interfaces.LinkListener;
|
||||
import com.keylesspalace.tusky.util.CustomEmojiHelper;
|
||||
import com.pkmmte.view.CircularImageView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
@ -32,7 +33,8 @@ class AccountViewHolder extends RecyclerView.ViewHolder {
|
||||
String format = username.getContext().getString(R.string.status_username_format);
|
||||
String formattedUsername = String.format(format, account.getUsername());
|
||||
username.setText(formattedUsername);
|
||||
displayName.setText(account.getName());
|
||||
CharSequence emojifiedName = CustomEmojiHelper.emojifyString(account.getName(), account.getEmojis(), displayName);
|
||||
displayName.setText(emojifiedName);
|
||||
Context context = avatar.getContext();
|
||||
Picasso.with(context)
|
||||
.load(account.getAvatar())
|
||||
@ -41,20 +43,10 @@ class AccountViewHolder extends RecyclerView.ViewHolder {
|
||||
}
|
||||
|
||||
void setupActionListener(final AccountActionListener listener) {
|
||||
container.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.onViewAccount(accountId);
|
||||
}
|
||||
});
|
||||
container.setOnClickListener(v -> listener.onViewAccount(accountId));
|
||||
}
|
||||
|
||||
void setupLinkListener(final LinkListener listener) {
|
||||
container.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.onViewAccount(accountId);
|
||||
}
|
||||
});
|
||||
container.setOnClickListener(v -> listener.onViewAccount(accountId));
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
|
||||
package com.keylesspalace.tusky.adapter;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -25,6 +26,7 @@ import android.widget.TextView;
|
||||
import com.keylesspalace.tusky.R;
|
||||
import com.keylesspalace.tusky.entity.Account;
|
||||
import com.keylesspalace.tusky.interfaces.AccountActionListener;
|
||||
import com.keylesspalace.tusky.util.CustomEmojiHelper;
|
||||
import com.pkmmte.view.CircularImageView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
@ -36,8 +38,9 @@ public class BlocksAdapter extends AccountAdapter {
|
||||
super(accountActionListener);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
switch (viewType) {
|
||||
default:
|
||||
case VIEW_TYPE_BLOCKED_USER: {
|
||||
@ -54,11 +57,11 @@ public class BlocksAdapter extends AccountAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||
if (position < accountList.size()) {
|
||||
BlockedUserViewHolder holder = (BlockedUserViewHolder) viewHolder;
|
||||
holder.setupWithAccount(accountList.get(position));
|
||||
holder.setupActionListener(accountActionListener, true);
|
||||
holder.setupActionListener(accountActionListener);
|
||||
} else {
|
||||
FooterViewHolder holder = (FooterViewHolder) viewHolder;
|
||||
holder.setState(footerState);
|
||||
@ -91,7 +94,8 @@ public class BlocksAdapter extends AccountAdapter {
|
||||
|
||||
void setupWithAccount(Account account) {
|
||||
id = account.getId();
|
||||
displayName.setText(account.getName());
|
||||
CharSequence emojifiedName = CustomEmojiHelper.emojifyString(account.getName(), account.getEmojis(), displayName);
|
||||
displayName.setText(emojifiedName);
|
||||
String format = username.getContext().getString(R.string.status_username_format);
|
||||
String formattedUsername = String.format(format, account.getUsername());
|
||||
username.setText(formattedUsername);
|
||||
@ -101,22 +105,14 @@ public class BlocksAdapter extends AccountAdapter {
|
||||
.into(avatar);
|
||||
}
|
||||
|
||||
void setupActionListener(final AccountActionListener listener, final boolean blocked) {
|
||||
unblock.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onBlock(!blocked, id, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
avatar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.onViewAccount(id);
|
||||
void setupActionListener(final AccountActionListener listener) {
|
||||
unblock.setOnClickListener(v -> {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onBlock(false, id, position);
|
||||
}
|
||||
});
|
||||
avatar.setOnClickListener(v -> listener.onViewAccount(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
package com.keylesspalace.tusky.adapter;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -32,8 +33,9 @@ public class FollowAdapter extends AccountAdapter {
|
||||
super(accountActionListener);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
switch (viewType) {
|
||||
default:
|
||||
case VIEW_TYPE_ACCOUNT: {
|
||||
@ -50,7 +52,7 @@ public class FollowAdapter extends AccountAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||
if (position < accountList.size()) {
|
||||
AccountViewHolder holder = (AccountViewHolder) viewHolder;
|
||||
holder.setupWithAccount(accountList.get(position));
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
package com.keylesspalace.tusky.adapter;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -25,6 +26,7 @@ import android.widget.TextView;
|
||||
import com.keylesspalace.tusky.interfaces.AccountActionListener;
|
||||
import com.keylesspalace.tusky.R;
|
||||
import com.keylesspalace.tusky.entity.Account;
|
||||
import com.keylesspalace.tusky.util.CustomEmojiHelper;
|
||||
import com.pkmmte.view.CircularImageView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
@ -36,8 +38,9 @@ public class FollowRequestsAdapter extends AccountAdapter {
|
||||
super(accountActionListener);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
switch (viewType) {
|
||||
default:
|
||||
case VIEW_TYPE_FOLLOW_REQUEST: {
|
||||
@ -54,7 +57,7 @@ public class FollowRequestsAdapter extends AccountAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||
if (position < accountList.size()) {
|
||||
FollowRequestViewHolder holder = (FollowRequestViewHolder) viewHolder;
|
||||
holder.setupWithAccount(accountList.get(position));
|
||||
@ -93,7 +96,8 @@ public class FollowRequestsAdapter extends AccountAdapter {
|
||||
|
||||
void setupWithAccount(Account account) {
|
||||
id = account.getId();
|
||||
displayName.setText(account.getName());
|
||||
CharSequence emojifiedName = CustomEmojiHelper.emojifyString(account.getName(), account.getEmojis(), displayName);
|
||||
displayName.setText(emojifiedName);
|
||||
String format = username.getContext().getString(R.string.status_username_format);
|
||||
String formattedUsername = String.format(format, account.getUsername());
|
||||
username.setText(formattedUsername);
|
||||
@ -104,30 +108,19 @@ public class FollowRequestsAdapter extends AccountAdapter {
|
||||
}
|
||||
|
||||
void setupActionListener(final AccountActionListener listener) {
|
||||
accept.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onRespondToFollowRequest(true, id, position);
|
||||
}
|
||||
accept.setOnClickListener(v -> {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onRespondToFollowRequest(true, id, position);
|
||||
}
|
||||
});
|
||||
reject.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onRespondToFollowRequest(false, id, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
avatar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.onViewAccount(id);
|
||||
reject.setOnClickListener(v -> {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onRespondToFollowRequest(false, id, position);
|
||||
}
|
||||
});
|
||||
avatar.setOnClickListener(v -> listener.onViewAccount(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.keylesspalace.tusky.adapter;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -10,6 +11,7 @@ import android.widget.TextView;
|
||||
import com.keylesspalace.tusky.R;
|
||||
import com.keylesspalace.tusky.entity.Account;
|
||||
import com.keylesspalace.tusky.interfaces.AccountActionListener;
|
||||
import com.keylesspalace.tusky.util.CustomEmojiHelper;
|
||||
import com.pkmmte.view.CircularImageView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
@ -21,8 +23,9 @@ public class MutesAdapter extends AccountAdapter {
|
||||
super(accountActionListener);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
switch (viewType) {
|
||||
default:
|
||||
case VIEW_TYPE_MUTED_USER: {
|
||||
@ -39,11 +42,11 @@ public class MutesAdapter extends AccountAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||
if (position < accountList.size()) {
|
||||
MutedUserViewHolder holder = (MutedUserViewHolder) viewHolder;
|
||||
holder.setupWithAccount(accountList.get(position));
|
||||
holder.setupActionListener(accountActionListener, true, position);
|
||||
holder.setupActionListener(accountActionListener, position);
|
||||
} else {
|
||||
FooterViewHolder holder = (FooterViewHolder) viewHolder;
|
||||
holder.setState(footerState);
|
||||
@ -76,7 +79,8 @@ public class MutesAdapter extends AccountAdapter {
|
||||
|
||||
void setupWithAccount(Account account) {
|
||||
id = account.getId();
|
||||
displayName.setText(account.getName());
|
||||
CharSequence emojifiedName = CustomEmojiHelper.emojifyString(account.getName(), account.getEmojis(), displayName);
|
||||
displayName.setText(emojifiedName);
|
||||
String format = username.getContext().getString(R.string.status_username_format);
|
||||
String formattedUsername = String.format(format, account.getUsername());
|
||||
username.setText(formattedUsername);
|
||||
@ -86,20 +90,9 @@ public class MutesAdapter extends AccountAdapter {
|
||||
.into(avatar);
|
||||
}
|
||||
|
||||
void setupActionListener(final AccountActionListener listener, final boolean muted,
|
||||
final int position) {
|
||||
unmute.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.onMute(!muted, id, position);
|
||||
}
|
||||
});
|
||||
avatar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.onViewAccount(id);
|
||||
}
|
||||
});
|
||||
void setupActionListener(final AccountActionListener listener, final int position) {
|
||||
unmute.setOnClickListener(v -> listener.onMute(false, id, position));
|
||||
avatar.setOnClickListener(v -> listener.onViewAccount(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
|
||||
} else {
|
||||
holder.showNotificationContent(true);
|
||||
|
||||
holder.setDisplayName(statusViewData.getUserFullName());
|
||||
holder.setDisplayName(statusViewData.getUserFullName(), statusViewData.getAccountEmojis());
|
||||
holder.setUsername(statusViewData.getNickname());
|
||||
holder.setCreatedAt(statusViewData.getCreatedAt());
|
||||
|
||||
@ -352,8 +352,9 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
|
||||
|
||||
}
|
||||
|
||||
private void setDisplayName(String name) {
|
||||
displayName.setText(name);
|
||||
private void setDisplayName(String name, List<Emoji> emojis) {
|
||||
CharSequence emojifiedName = CustomEmojiHelper.emojifyString(name, emojis, displayName);
|
||||
displayName.setText(emojifiedName);
|
||||
}
|
||||
|
||||
private void setUsername(String name) {
|
||||
@ -489,7 +490,7 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
|
||||
Spanned content = statusViewData.getContent();
|
||||
List<Emoji> emojis = statusViewData.getEmojis();
|
||||
List<Emoji> emojis = statusViewData.getStatusEmojis();
|
||||
|
||||
Spanned emojifiedText = CustomEmojiHelper.emojifyText(content, emojis, statusContent);
|
||||
|
||||
@ -497,7 +498,7 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
|
||||
|
||||
|
||||
Spanned emojifiedContentWarning =
|
||||
CustomEmojiHelper.emojifyString(statusViewData.getSpoilerText(), statusViewData.getEmojis(), contentWarningDescriptionTextView);
|
||||
CustomEmojiHelper.emojifyString(statusViewData.getSpoilerText(), statusViewData.getStatusEmojis(), contentWarningDescriptionTextView);
|
||||
contentWarningDescriptionTextView.setText(emojifiedContentWarning);
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,9 @@ abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
protected abstract int getMediaPreviewHeight(Context context);
|
||||
|
||||
private void setDisplayName(String name) {
|
||||
displayName.setText(name);
|
||||
private void setDisplayName(String name, List<Emoji> customEmojis) {
|
||||
CharSequence emojifiedName = CustomEmojiHelper.emojifyString(name, customEmojis, displayName);
|
||||
displayName.setText(emojifiedName);
|
||||
}
|
||||
|
||||
private void setUsername(String name) {
|
||||
@ -399,19 +400,11 @@ abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
* bugs where other statuses in the list would be removed or added and cause the position
|
||||
* here to become outdated. So, getting the adapter position at the time the listener is
|
||||
* actually called is the appropriate solution. */
|
||||
avatar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.onViewAccount(accountId);
|
||||
}
|
||||
});
|
||||
replyButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onReply(position);
|
||||
}
|
||||
avatar.setOnClickListener(v -> listener.onViewAccount(accountId));
|
||||
replyButton.setOnClickListener(v -> {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onReply(position);
|
||||
}
|
||||
});
|
||||
reblogButton.setEventListener(new SparkEventListener() {
|
||||
@ -448,13 +441,10 @@ abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
public void onEventAnimationStart(ImageView button, boolean buttonState) {
|
||||
}
|
||||
});
|
||||
moreButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onMore(v, position);
|
||||
}
|
||||
moreButton.setOnClickListener(v -> {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onMore(v, position);
|
||||
}
|
||||
});
|
||||
/* Even though the content TextView is a child of the container, it won't respond to clicks
|
||||
@ -473,11 +463,11 @@ abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
void setupWithStatus(StatusViewData.Concrete status, final StatusActionListener listener,
|
||||
boolean mediaPreviewEnabled) {
|
||||
setDisplayName(status.getUserFullName());
|
||||
setDisplayName(status.getUserFullName(), status.getAccountEmojis());
|
||||
setUsername(status.getNickname());
|
||||
setCreatedAt(status.getCreatedAt());
|
||||
setIsReply(status.getInReplyToId() != null);
|
||||
setContent(status.getContent(), status.getMentions(), status.getEmojis(), listener);
|
||||
setContent(status.getContent(), status.getMentions(), status.getStatusEmojis(), listener);
|
||||
setAvatar(status.getAvatar(), status.getRebloggedAvatar());
|
||||
setReblogged(status.isReblogged());
|
||||
setFavourited(status.isFavourited());
|
||||
@ -488,7 +478,6 @@ abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
if (attachments.size() == 0) {
|
||||
hideSensitiveMediaWarning();
|
||||
// videoIndicator.setVisibility(View.GONE);
|
||||
}
|
||||
// Hide the unused label.
|
||||
mediaLabel.setVisibility(View.GONE);
|
||||
@ -500,7 +489,6 @@ abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
mediaPreview2.setVisibility(View.GONE);
|
||||
mediaPreview3.setVisibility(View.GONE);
|
||||
hideSensitiveMediaWarning();
|
||||
// videoIndicator.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
setupButtons(listener, status.getSenderId());
|
||||
@ -508,7 +496,7 @@ abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||
if (status.getSpoilerText() == null || status.getSpoilerText().isEmpty()) {
|
||||
hideSpoilerText();
|
||||
} else {
|
||||
setSpoilerText(status.getSpoilerText(), status.getEmojis(), status.isExpanded(), listener);
|
||||
setSpoilerText(status.getSpoilerText(), status.getStatusEmojis(), status.isExpanded(), listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class CustomEmojiHelper {
|
||||
* @param textView a reference to the textView the emojis will be shown in
|
||||
* @return the text with the shortcodes replaced by EmojiSpans
|
||||
*/
|
||||
public static Spanned emojifyText(Spanned text, List<Emoji> emojis, final TextView textView) {
|
||||
public static Spanned emojifyText(@NonNull Spanned text, @NonNull List<Emoji> emojis, @NonNull final TextView textView) {
|
||||
|
||||
if (!emojis.isEmpty()) {
|
||||
|
||||
@ -71,7 +71,7 @@ public class CustomEmojiHelper {
|
||||
return text;
|
||||
}
|
||||
|
||||
public static Spanned emojifyString(String string, List<Emoji> emojis, final TextView textView) {
|
||||
public static Spanned emojifyString(@NonNull String string, @NonNull List<Emoji> emojis, @NonNull final TextView textView) {
|
||||
return emojifyText(new SpannedString(string), emojis, textView);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,8 @@ public final class ViewDataUtils {
|
||||
.setSenderId(visibleStatus.getAccount().getId())
|
||||
.setRebloggingEnabled(visibleStatus.rebloggingAllowed())
|
||||
.setApplication(visibleStatus.getApplication())
|
||||
.setEmojis(visibleStatus.getEmojis())
|
||||
.setStatusEmojis(visibleStatus.getEmojis())
|
||||
.setAccountEmojis(visibleStatus.getAccount().getEmojis())
|
||||
.createStatusViewData();
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,8 @@ public abstract class StatusViewData {
|
||||
private final String senderId;
|
||||
private final boolean rebloggingEnabled;
|
||||
private final Status.Application application;
|
||||
private final List<Emoji> emojis;
|
||||
private final List<Emoji> statusEmojis;
|
||||
private final List<Emoji> accountEmojis;
|
||||
@Nullable
|
||||
private final Card card;
|
||||
|
||||
@ -86,7 +87,7 @@ public abstract class StatusViewData {
|
||||
boolean isShowingContent, String userFullName, String nickname, String avatar,
|
||||
Date createdAt, int reblogsCount, int favouritesCount, @Nullable String inReplyToId,
|
||||
@Nullable Status.Mention[] mentions, String senderId, boolean rebloggingEnabled,
|
||||
Status.Application application, List<Emoji> emojis, @Nullable Card card) {
|
||||
Status.Application application, List<Emoji> statusEmojis, List<Emoji> accountEmojis, @Nullable Card card) {
|
||||
this.id = id;
|
||||
this.content = content;
|
||||
this.reblogged = reblogged;
|
||||
@ -110,7 +111,8 @@ public abstract class StatusViewData {
|
||||
this.senderId = senderId;
|
||||
this.rebloggingEnabled = rebloggingEnabled;
|
||||
this.application = application;
|
||||
this.emojis = emojis;
|
||||
this.statusEmojis = statusEmojis;
|
||||
this.accountEmojis = accountEmojis;
|
||||
this.card = card;
|
||||
}
|
||||
|
||||
@ -211,8 +213,12 @@ public abstract class StatusViewData {
|
||||
return application;
|
||||
}
|
||||
|
||||
public List<Emoji> getEmojis() {
|
||||
return emojis;
|
||||
public List<Emoji> getStatusEmojis() {
|
||||
return statusEmojis;
|
||||
}
|
||||
|
||||
public List<Emoji> getAccountEmojis() {
|
||||
return accountEmojis;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -252,7 +258,8 @@ public abstract class StatusViewData {
|
||||
Arrays.equals(mentions, concrete.mentions) &&
|
||||
Objects.equals(senderId, concrete.senderId) &&
|
||||
Objects.equals(application, concrete.application) &&
|
||||
Objects.equals(emojis, concrete.emojis) &&
|
||||
Objects.equals(statusEmojis, concrete.statusEmojis) &&
|
||||
Objects.equals(accountEmojis, concrete.accountEmojis) &&
|
||||
Objects.equals(card, concrete.card);
|
||||
}
|
||||
}
|
||||
@ -324,7 +331,8 @@ public abstract class StatusViewData {
|
||||
private String senderId;
|
||||
private boolean rebloggingEnabled;
|
||||
private Status.Application application;
|
||||
private List<Emoji> emojis;
|
||||
private List<Emoji> statusEmojis;
|
||||
private List<Emoji> accountEmojis;
|
||||
private Card card;
|
||||
|
||||
public Builder() {
|
||||
@ -354,7 +362,8 @@ public abstract class StatusViewData {
|
||||
senderId = viewData.senderId;
|
||||
rebloggingEnabled = viewData.rebloggingEnabled;
|
||||
application = viewData.application;
|
||||
emojis = viewData.getEmojis();
|
||||
statusEmojis = viewData.getStatusEmojis();
|
||||
accountEmojis = viewData.getAccountEmojis();
|
||||
card = viewData.getCard();
|
||||
}
|
||||
|
||||
@ -473,8 +482,13 @@ public abstract class StatusViewData {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setEmojis(List<Emoji> emojis) {
|
||||
this.emojis = emojis;
|
||||
public Builder setStatusEmojis(List<Emoji> emojis) {
|
||||
this.statusEmojis = emojis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAccountEmojis(List<Emoji> emojis) {
|
||||
this.accountEmojis = emojis;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -484,14 +498,15 @@ public abstract class StatusViewData {
|
||||
}
|
||||
|
||||
public StatusViewData.Concrete createStatusViewData() {
|
||||
if (this.emojis == null) emojis = Collections.emptyList();
|
||||
if (this.statusEmojis == null) statusEmojis = Collections.emptyList();
|
||||
if (this.accountEmojis == null) accountEmojis = Collections.emptyList();
|
||||
if (this.createdAt == null) createdAt = new Date();
|
||||
|
||||
return new StatusViewData.Concrete(id, content, reblogged, favourited, spoilerText, visibility,
|
||||
attachments, rebloggedByUsername, rebloggedAvatar, isSensitive, isExpanded,
|
||||
isShowingContent, userFullName, nickname, avatar, createdAt, reblogsCount,
|
||||
favouritesCount, inReplyToId, mentions, senderId, rebloggingEnabled, application,
|
||||
emojis, card);
|
||||
statusEmojis, accountEmojis, card);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user