fix vertical alignments for UserItem

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-02-25 12:28:25 +01:00
parent 5c86629b53
commit 9d29cbf9cd
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B

View file

@ -281,9 +281,10 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
if (participant.statusMessage != null) {
holder.statusMessage.setText(participant.statusMessage);
alignUsernameVertical(holder, 0);
} else {
holder.statusMessage.setText("");
alignUsernameVertical(holder);
alignUsernameVertical(holder, 10);
}
if (participant.statusIcon != null && !participant.statusIcon.isEmpty()) {
@ -304,10 +305,10 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
}
}
private void alignUsernameVertical(UserItemViewHolder holder) {
private void alignUsernameVertical(UserItem.UserItemViewHolder holder, float densityPixelsFromTop) {
ConstraintLayout.LayoutParams layoutParams =
(ConstraintLayout.LayoutParams) holder.contactDisplayName.getLayoutParams();
layoutParams.topMargin = (int) DisplayUtils.convertDpToPixel(10, context);
layoutParams.topMargin = (int) DisplayUtils.convertDpToPixel(densityPixelsFromTop, context);
holder.contactDisplayName.setLayoutParams(layoutParams);
}