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:
parent
f59c6d316c
commit
68f1652d25
|
@ -418,7 +418,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
private void setReplyInfo(StatusViewData.Concrete status) {
|
private void setReplyInfo(StatusViewData.Concrete status) {
|
||||||
@Nullable String replyToAccountAcct = status.getInReplyToAccountAcct();
|
@Nullable String replyToAccountAcct = status.getInReplyToAccountAcct();
|
||||||
if (replyToAccountAcct == null) {
|
if (replyToAccountAcct == null || status.getHideReplyInfo()) {
|
||||||
replyInfo.setVisibility(View.GONE);
|
replyInfo.setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,12 @@ class ViewThreadFragment :
|
||||||
0
|
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
|
revealButtonState = uiState.revealButton
|
||||||
|
|
|
@ -44,7 +44,8 @@ sealed class StatusViewData {
|
||||||
* @return Whether the post is collapsed or fully expanded.
|
* @return Whether the post is collapsed or fully expanded.
|
||||||
*/
|
*/
|
||||||
val isCollapsed: Boolean,
|
val isCollapsed: Boolean,
|
||||||
val isDetailed: Boolean = false
|
val isDetailed: Boolean = false,
|
||||||
|
var hideReplyInfo: Boolean = false,
|
||||||
) : StatusViewData() {
|
) : StatusViewData() {
|
||||||
override val id: String
|
override val id: String
|
||||||
get() = status.id
|
get() = status.id
|
||||||
|
|
Loading…
Reference in New Issue