Status: Add 'reply to' indicators in posts
Co-Authored-By: fruye <fruye@unix.dog>
This commit is contained in:
parent
1906507ff7
commit
3240ed3a2c
|
@ -88,6 +88,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
private final TextView displayName;
|
||||
private final TextView username;
|
||||
private final ImageButton replyButton;
|
||||
private final TextView replyInfo;
|
||||
private final TextView replyCountLabel;
|
||||
private final SparkButton reblogButton;
|
||||
private final SparkButton favouriteButton;
|
||||
|
@ -141,6 +142,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
metaInfo = itemView.findViewById(R.id.status_meta_info);
|
||||
content = itemView.findViewById(R.id.status_content);
|
||||
avatar = itemView.findViewById(R.id.status_avatar);
|
||||
replyInfo = itemView.findViewById(R.id.reply_info);
|
||||
replyButton = itemView.findViewById(R.id.status_reply);
|
||||
replyCountLabel = itemView.findViewById(R.id.status_replies);
|
||||
reblogButton = itemView.findViewById(R.id.status_inset);
|
||||
|
@ -413,6 +415,17 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
replyCountLabel.setText((repliesCount > 1 ? replyCountLabel.getContext().getString(R.string.status_count_one_plus) : Integer.toString(repliesCount)));
|
||||
}
|
||||
|
||||
private void setReplyInfo(StatusViewData.Concrete status) {
|
||||
@Nullable String replyToAccountAcct = status.getInReplyToAccountAcct();
|
||||
if (replyToAccountAcct == null) {
|
||||
replyInfo.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
Context context = replyInfo.getContext();
|
||||
replyInfo.setText(context.getString(R.string.status_replied_to_format, replyToAccountAcct));
|
||||
replyInfo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void setReblogged(boolean reblogged) {
|
||||
reblogButton.setChecked(reblogged);
|
||||
}
|
||||
|
@ -794,6 +807,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
setUsername(status.getUsername());
|
||||
setMetaData(status, statusDisplayOptions, listener);
|
||||
setIsReply(actionable.getInReplyToId() != null);
|
||||
setReplyInfo(status);
|
||||
setReplyCount(actionable.getRepliesCount(), statusDisplayOptions.showStatsInline());
|
||||
setAvatar(actionable.getAccount().getAvatar(), status.getRebloggedAvatar(),
|
||||
actionable.getAccount().getBot(), statusDisplayOptions);
|
||||
|
|
|
@ -163,6 +163,7 @@ data class Status(
|
|||
|
||||
data class PleromaStatus(
|
||||
@SerializedName("emoji_reactions") val emojiReactions: List<EmojiReaction>?,
|
||||
@SerializedName("in_reply_to_account_acct") val inReplyToAccountAcct: String?,
|
||||
)
|
||||
|
||||
data class Mention(
|
||||
|
|
|
@ -77,6 +77,9 @@ sealed class StatusViewData {
|
|||
val rebloggingStatus: Status?
|
||||
get() = if (status.reblog != null) status else null
|
||||
|
||||
val inReplyToAccountAcct: String?
|
||||
get() = status.pleroma?.inReplyToAccountAcct
|
||||
|
||||
val emojiReactions: List<EmojiReaction>?
|
||||
get() = status.actionableStatus.pleroma?.emojiReactions
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="18dp"
|
||||
android:height="18dp"
|
||||
android:autoMirrored="true"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="?android:attr/textColorTertiary"
|
||||
android:pathData="M10,9V5l-7,7 7,7v-4.1c5,0 8.5,1.6 11,5.1 -1,-5 -4,-10 -11,-11z" />
|
||||
</vector>
|
|
@ -103,6 +103,22 @@
|
|||
app:layout_constraintTop_toTopOf="@id/status_display_name"
|
||||
tools:text="13:37" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reply_info"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:drawablePadding="6dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:textColorTertiary"
|
||||
android:textSize="?attr/status_text_medium"
|
||||
app:drawableStartCompat="@drawable/ic_reply_18dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/status_display_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/status_display_name"
|
||||
tools:text="Reply to a1batross" />
|
||||
|
||||
<com.keylesspalace.tusky.view.ClickableSpanTextView
|
||||
android:id="@+id/status_content_warning_description"
|
||||
android:layout_width="0dp"
|
||||
|
@ -116,7 +132,7 @@
|
|||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/status_display_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/status_display_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/reply_info"
|
||||
tools:text="content warning which is very long and it doesn't fit"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
|
|
@ -78,6 +78,22 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/status_display_name"
|
||||
tools:text="\@ConnyDuck\@mastodon.social" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reply_info"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:drawablePadding="6dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:textColorTertiary"
|
||||
android:textSize="?attr/status_text_medium"
|
||||
app:drawableStartCompat="@drawable/ic_reply_18dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/status_avatar"
|
||||
app:layout_constraintTop_toBottomOf="@id/status_avatar"
|
||||
tools:text="Reply to a1batross" />
|
||||
|
||||
<com.keylesspalace.tusky.view.ClickableSpanTextView
|
||||
android:id="@+id/status_content_warning_description"
|
||||
android:layout_width="0dp"
|
||||
|
@ -92,7 +108,7 @@
|
|||
android:textSize="?attr/status_text_large"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/status_avatar"
|
||||
app:layout_constraintTop_toBottomOf="@id/reply_info"
|
||||
tools:text="CW this is a long long long long long long long long content warning" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="status_replied_to_format">Reply to %s</string>
|
||||
<string name="pref_title_enable_big_emojis">Enable bigger custom emojis</string>
|
||||
|
||||
<string name="admin">Admin</string>
|
||||
|
|
Loading…
Reference in New Issue