Skip to content

Commit 2312ec2

Browse files
committed
fix alignment of author name and date when image is gone
1 parent 95f48c1 commit 2312ec2

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentRepliesFragment.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,13 @@ protected Supplier<View> getListHeaderSupplier() {
8585

8686
// load the author avatar
8787
PicassoHelper.loadAvatar(item.getUploaderAvatars()).into(binding.authorAvatar);
88-
binding.authorAvatar.setVisibility(ImageStrategy.shouldLoadImages()
89-
? View.VISIBLE : View.GONE);
88+
if (ImageStrategy.shouldLoadImages()) {
89+
binding.authorAvatar.setVisibility(View.VISIBLE);
90+
} else {
91+
binding.authorAvatar.setVisibility(View.GONE);
92+
((ConstraintLayout.LayoutParams) binding.authorName.getLayoutParams())
93+
.setMarginStart(DeviceUtils.dpToPx(16, requireContext()));
94+
}
9095

9196
// setup author name and comment date
9297
binding.authorName.setText(item.getUploaderName());

app/src/main/res/layout/comment_replies_header.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,28 @@
2424
android:layout_height="wrap_content"
2525
android:layout_marginStart="8dp"
2626
android:layout_marginEnd="8dp"
27+
android:layout_marginTop="16dp"
2728
android:ellipsize="end"
2829
android:lines="1"
2930
android:textAppearance="?android:attr/textAppearanceLarge"
3031
android:textSize="16sp"
3132
app:layout_constraintBottom_toTopOf="@+id/uploadDate"
3233
app:layout_constraintEnd_toStartOf="@+id/thumbsUpImage"
3334
app:layout_constraintStart_toEndOf="@+id/authorAvatar"
34-
app:layout_constraintTop_toTopOf="@+id/authorAvatar"
35+
app:layout_constraintTop_toTopOf="parent"
3536
tools:text="@tools:sample/lorem/random" />
3637

3738
<org.schabi.newpipe.views.NewPipeTextView
3839
android:id="@+id/uploadDate"
3940
android:layout_width="0dp"
4041
android:layout_height="wrap_content"
41-
android:layout_marginStart="8dp"
4242
android:layout_marginEnd="8dp"
4343
android:ellipsize="end"
4444
android:lines="1"
4545
android:textAppearance="?android:attr/textAppearanceSmall"
4646
android:textSize="14sp"
47-
app:layout_constraintBottom_toBottomOf="@+id/authorAvatar"
4847
app:layout_constraintEnd_toStartOf="@+id/thumbsUpImage"
49-
app:layout_constraintStart_toEndOf="@+id/authorAvatar"
48+
app:layout_constraintStart_toStartOf="@+id/authorName"
5049
app:layout_constraintTop_toBottomOf="@+id/authorName"
5150
tools:text="5 months ago" />
5251

0 commit comments

Comments
 (0)