improve margin between post content and buttons (#4981)
[A user made me aware of the fact that we have varying spacing between post content and the buttons](https://mstdn.games/@Sven/114104502703573482), so I investigated 🧐 Indeed, there were some problems: - The trailing hashtags bar was sometimes visible, despite not showing any content. - The media container was visible despite showing no media - The buttons where layed out differently when showing a conversation This change fixes those problems and adds an additional 2dp space between buttons and contents because without these issues the buttons and the content are quite close otherwise.
This commit is contained in:
parent
bf4bf1b52a
commit
0be0aa66f8
5 changed files with 36 additions and 27 deletions
|
|
@ -97,7 +97,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
private final SparkButton favouriteButton;
|
||||
private final SparkButton bookmarkButton;
|
||||
private final ImageButton moreButton;
|
||||
private final ConstraintLayout mediaContainer;
|
||||
protected final ConstraintLayout mediaContainer;
|
||||
protected final MediaPreviewLayout mediaPreview;
|
||||
private final TextView sensitiveMediaWarning;
|
||||
private final View sensitiveMediaShow;
|
||||
|
|
@ -808,7 +808,11 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
setBookmarked(actionable.getBookmarked());
|
||||
List<Attachment> attachments = status.getAttachments();
|
||||
boolean sensitive = actionable.getSensitive();
|
||||
if (statusDisplayOptions.mediaPreviewEnabled() && hasPreviewableAttachment(attachments)) {
|
||||
if (attachments.isEmpty()) {
|
||||
mediaContainer.setVisibility(View.GONE);
|
||||
} else if (statusDisplayOptions.mediaPreviewEnabled() && hasPreviewableAttachment(attachments)) {
|
||||
mediaContainer.setVisibility(View.VISIBLE);
|
||||
|
||||
setMediaPreviews(attachments, sensitive, listener, status.isShowingContent(), statusDisplayOptions.useBlurhash());
|
||||
|
||||
if (attachments.isEmpty()) {
|
||||
|
|
@ -819,6 +823,8 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
mediaLabel.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
mediaContainer.setVisibility(View.VISIBLE);
|
||||
|
||||
setMediaLabel(attachments, sensitive, listener, status.isShowingContent());
|
||||
// Hide all unused views.
|
||||
mediaPreview.setVisibility(View.GONE);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.keylesspalace.tusky.R;
|
||||
|
|
@ -91,7 +90,11 @@ public class ConversationViewHolder extends StatusBaseViewHolder {
|
|||
setBookmarked(status.getBookmarked());
|
||||
List<Attachment> attachments = status.getAttachments();
|
||||
boolean sensitive = status.getSensitive();
|
||||
if (statusDisplayOptions.mediaPreviewEnabled() && hasPreviewableAttachment(attachments)) {
|
||||
if (attachments.isEmpty()) {
|
||||
mediaContainer.setVisibility(View.GONE);
|
||||
} else if (statusDisplayOptions.mediaPreviewEnabled() && hasPreviewableAttachment(attachments)) {
|
||||
mediaContainer.setVisibility(View.VISIBLE);
|
||||
|
||||
setMediaPreviews(attachments, sensitive, listener, statusViewData.isShowingContent(),
|
||||
statusDisplayOptions.useBlurhash());
|
||||
|
||||
|
|
@ -103,6 +106,8 @@ public class ConversationViewHolder extends StatusBaseViewHolder {
|
|||
mediaLabel.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
mediaContainer.setVisibility(View.VISIBLE);
|
||||
|
||||
setMediaLabel(attachments, sensitive, listener, statusViewData.isShowingContent());
|
||||
// Hide all unused views.
|
||||
mediaPreview.setVisibility(View.GONE);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ fun setClickableText(
|
|||
trailingHashtagView == null || tags.isNullOrEmpty() -> Pair(spannableContent.length, emptyList())
|
||||
else -> getTrailingHashtags(spannableContent)
|
||||
}
|
||||
val inlineHashtags = mutableListOf<CharSequence>()
|
||||
val inlineHashtags = mutableSetOf<CharSequence>()
|
||||
|
||||
view.text = spannableContent.apply {
|
||||
styleQuoteSpans(view)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue