Hide reply info in threads if the replied to post is directly above it

We use a decoration line to draw connections between threads, meaning we
don't necessarily need to mark which post replies to whom all the time.

Doing that saves us a bit of space. :)
This commit is contained in:
fruye 2023-02-27 09:35:27 +01:00
parent f59c6d316c
commit 68f1652d25
3 changed files with 9 additions and 2 deletions

View File

@ -418,7 +418,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
private void setReplyInfo(StatusViewData.Concrete status) {
@Nullable String replyToAccountAcct = status.getInReplyToAccountAcct();
if (replyToAccountAcct == null) {
if (replyToAccountAcct == null || status.getHideReplyInfo()) {
replyInfo.setVisibility(View.GONE);
return;
}

View File

@ -223,6 +223,12 @@ class ViewThreadFragment :
0
)
}
uiState.statusViewData.forEachIndexed { index, current ->
val above = uiState.statusViewData.getOrNull(index - 1) ?: return@forEachIndexed
if (above.id == current.status.inReplyToId && !current.isDetailed)
current.hideReplyInfo = true
}
}
revealButtonState = uiState.revealButton

View File

@ -44,7 +44,8 @@ sealed class StatusViewData {
* @return Whether the post is collapsed or fully expanded.
*/
val isCollapsed: Boolean,
val isDetailed: Boolean = false
val isDetailed: Boolean = false,
var hideReplyInfo: Boolean = false,
) : StatusViewData() {
override val id: String
get() = status.id