fix avatar radius and alignment in NotificationsAdapter (#1437)

This commit is contained in:
Konrad Pozniak 2019-08-01 20:47:15 +02:00 committed by GitHub
parent 507cb81d6a
commit 70b3ce7487
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 22 deletions

View file

@ -328,7 +328,7 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
displayNameView.setText(emojifiedDisplayName); displayNameView.setText(emojifiedDisplayName);
int avatarRadius = avatar.getContext().getResources() int avatarRadius = avatar.getContext().getResources()
.getDimensionPixelSize(R.dimen.avatar_radius_24dp); .getDimensionPixelSize(R.dimen.avatar_radius_42dp);
ImageLoadingHelper.loadAvatar(account.getAvatar(), avatar, avatarRadius, animateAvatar); ImageLoadingHelper.loadAvatar(account.getAvatar(), avatar, avatarRadius, animateAvatar);
@ -508,7 +508,7 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
void setAvatars(@Nullable String statusAvatarUrl, @Nullable String notificationAvatarUrl) { void setAvatars(@Nullable String statusAvatarUrl, @Nullable String notificationAvatarUrl) {
int statusAvatarRadius = statusAvatar.getContext().getResources() int statusAvatarRadius = statusAvatar.getContext().getResources()
.getDimensionPixelSize(R.dimen.avatar_radius_48dp); .getDimensionPixelSize(R.dimen.avatar_radius_36dp);
ImageLoadingHelper.loadAvatar(statusAvatarUrl, ImageLoadingHelper.loadAvatar(statusAvatarUrl,
statusAvatar, statusAvatarRadius, animateAvatar); statusAvatar, statusAvatarRadius, animateAvatar);

View file

@ -1,67 +1,72 @@
<?xml version="1.0" encoding="utf-8"?><!-- <?xml version="1.0" encoding="utf-8"?>
* This is the for follow notifications, the layout for the follows/following listings on account <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
* pages are instead in item_account.xml. xmlns:app="http://schemas.android.com/apk/res-auto"
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="14dp" android:paddingLeft="14dp"
android:paddingRight="14dp"> android:paddingRight="14dp"
android:paddingBottom="10dp">
<androidx.emoji.widget.EmojiTextView <androidx.emoji.widget.EmojiTextView
android:id="@+id/notification_text" android:id="@+id/notification_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:drawablePadding="10dp"
android:drawableStart="@drawable/ic_person_add_24dp" android:drawableStart="@drawable/ic_person_add_24dp"
android:drawablePadding="10dp"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:paddingStart="28dp" android:paddingStart="28dp"
android:textColor="?android:textColorTertiary" android:textColor="?android:textColorTertiary"
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Someone followed you" /> tools:text="Someone followed you" />
<ImageView <ImageView
android:id="@+id/notification_avatar" android:id="@+id/notification_avatar"
android:layout_width="40dp" android:layout_width="42dp"
android:layout_height="40dp" android:layout_height="42dp"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_below="@+id/notification_text" android:layout_marginStart="6dp"
android:layout_marginEnd="14dp" android:layout_marginTop="6dp"
android:layout_marginStart="8dp"
android:contentDescription="@string/action_view_profile" android:contentDescription="@string/action_view_profile"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:textSize="?attr/status_text_medium" /> android:textSize="?attr/status_text_medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/notification_text"
tools:src="@drawable/avatar_default" />
<androidx.emoji.widget.EmojiTextView <androidx.emoji.widget.EmojiTextView
android:id="@+id/notification_display_name" android:id="@+id/notification_display_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/notification_text" android:layout_marginStart="14dp"
android:layout_toEndOf="@id/notification_avatar"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
android:textStyle="normal|bold" android:textStyle="normal|bold"
app:layout_constraintBottom_toTopOf="@id/notification_username"
app:layout_constraintStart_toEndOf="@id/notification_avatar"
app:layout_constraintTop_toTopOf="@id/notification_avatar"
tools:text="Test User" /> tools:text="Test User" />
<TextView <TextView
android:id="@+id/notification_username" android:id="@+id/notification_username"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/notification_display_name" android:layout_marginStart="14dp"
android:layout_toEndOf="@id/notification_avatar"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
app:layout_constraintBottom_toBottomOf="@id/notification_avatar"
app:layout_constraintStart_toEndOf="@id/notification_avatar"
app:layout_constraintTop_toBottomOf="@id/notification_display_name"
tools:text="\@testuser" /> tools:text="\@testuser" />
</RelativeLayout> </androidx.constraintlayout.widget.ConstraintLayout>