Fix hiding/showing preview cards for sensitive statuses (#2600)
* Update comment on StatusViewData.isCollapsible * Fix hiding/showing preview cards for sensitive statuses. Fixes #2565 * Fix typo
This commit is contained in:
parent
3ca8a0b549
commit
8551785389
5 changed files with 18 additions and 11 deletions
|
@ -1046,6 +1046,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
actionable.getPoll() == null &&
|
||||
card != null &&
|
||||
!TextUtils.isEmpty(card.getUrl()) &&
|
||||
(!actionable.getSensitive() || status.isExpanded()) &&
|
||||
(!status.isCollapsible() || !status.isCollapsed())) {
|
||||
cardView.setVisibility(View.VISIBLE);
|
||||
cardTitle.setText(card.getTitle());
|
||||
|
|
|
@ -103,20 +103,26 @@ class StatusDetailedViewHolder extends StatusBaseViewHolder {
|
|||
@NonNull final StatusActionListener listener,
|
||||
@NonNull StatusDisplayOptions statusDisplayOptions,
|
||||
@Nullable Object payloads) {
|
||||
super.setupWithStatus(status, listener, statusDisplayOptions, payloads);
|
||||
setupCard(status, CardViewMode.FULL_WIDTH, statusDisplayOptions, listener); // Always show card for detailed status
|
||||
// We never collapse statuses in the detail view
|
||||
StatusViewData.Concrete uncollapsedStatus = (status.isCollapsible() && status.isCollapsed()) ?
|
||||
status.copyWithCollapsed(false) :
|
||||
status;
|
||||
|
||||
super.setupWithStatus(uncollapsedStatus, listener, statusDisplayOptions, payloads);
|
||||
setupCard(uncollapsedStatus, CardViewMode.FULL_WIDTH, statusDisplayOptions, listener); // Always show card for detailed status
|
||||
if (payloads == null) {
|
||||
Status actionable = uncollapsedStatus.getActionable();
|
||||
|
||||
if (!statusDisplayOptions.hideStats()) {
|
||||
setReblogAndFavCount(status.getActionable().getReblogsCount(),
|
||||
status.getActionable().getFavouritesCount(), listener);
|
||||
setReblogAndFavCount(actionable.getReblogsCount(),
|
||||
actionable.getFavouritesCount(), listener);
|
||||
} else {
|
||||
hideQuantitativeStats();
|
||||
}
|
||||
|
||||
setApplication(status.getActionable().getApplication());
|
||||
setApplication(actionable.getApplication());
|
||||
|
||||
setStatusVisibility(status.getActionable().getVisibility());
|
||||
setStatusVisibility(actionable.getVisibility());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -538,7 +538,7 @@ public class NotificationsFragment extends SFragment implements
|
|||
|
||||
@Override
|
||||
public void onContentCollapsedChange(boolean isCollapsed, int position) {
|
||||
updateViewDataAt(position, (vd) -> vd.copyWIthCollapsed(isCollapsed));
|
||||
updateViewDataAt(position, (vd) -> vd.copyWithCollapsed(isCollapsed));
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -387,7 +387,7 @@ public final class ViewThreadFragment extends SFragment implements
|
|||
public void onContentCollapsedChange(boolean isCollapsed, int position) {
|
||||
adapter.setItem(
|
||||
position,
|
||||
statuses.getPairedItem(position).copyWIthCollapsed(isCollapsed),
|
||||
statuses.getPairedItem(position).copyWithCollapsed(isCollapsed),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ sealed class StatusViewData {
|
|||
get() = status.id
|
||||
|
||||
/**
|
||||
* Specifies whether the content of this post is allowed to be collapsed or if it should show
|
||||
* all content regardless.
|
||||
* Specifies whether the content of this post is long enough to be automatically
|
||||
* collapsed or if it should show all content regardless.
|
||||
*
|
||||
* @return Whether the post is collapsible or never collapsed.
|
||||
*/
|
||||
|
@ -106,7 +106,7 @@ sealed class StatusViewData {
|
|||
}
|
||||
|
||||
/** Helper for Java */
|
||||
fun copyWIthCollapsed(isCollapsed: Boolean): Concrete {
|
||||
fun copyWithCollapsed(isCollapsed: Boolean): Concrete {
|
||||
return copy(isCollapsed = isCollapsed)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue