From 040268e2d3f3bd70422e3679e8cc631c9f9666dc Mon Sep 17 00:00:00 2001 From: UlrichKu Date: Sat, 8 Apr 2023 16:55:32 +0200 Subject: [PATCH] 3492: Correctly shorten name in drawer and notifications (#3495) * #3492: Correctly shorten name in drawer and notifications * Trigger linter again * 3492: Use a flat ContraintLayout for everything --- .../com/keylesspalace/tusky/MainActivity.kt | 4 + .../StatusNotificationViewHolder.kt | 4 +- .../res/layout/item_status_notification.xml | 246 +++++++++--------- 3 files changed, 133 insertions(+), 121 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt index 0d8da3be..eeda8cb2 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt @@ -27,6 +27,7 @@ import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable import android.net.Uri import android.os.Bundle +import android.text.TextUtils import android.util.Log import android.view.KeyEvent import android.view.Menu @@ -463,6 +464,9 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje closeDrawerOnProfileListClick = true } + header.currentProfileName.maxLines = 1 + header.currentProfileName.ellipsize = TextUtils.TruncateAt.END + header.accountHeaderBackground.setColorFilter(getColor(R.color.headerBackgroundFilter)) header.accountHeaderBackground.setBackgroundColor(MaterialColors.getColor(header, R.attr.colorBackgroundAccent)) val animateAvatars = preferences.getBoolean("animateGifAvatars", false) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/notifications/StatusNotificationViewHolder.kt b/app/src/main/java/com/keylesspalace/tusky/components/notifications/StatusNotificationViewHolder.kt index 402f3872..0b1d8dca 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/notifications/StatusNotificationViewHolder.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/notifications/StatusNotificationViewHolder.kt @@ -137,7 +137,9 @@ internal class StatusNotificationViewHolder( } private fun showNotificationContent(show: Boolean) { - binding.statusNameBar.visibility = if (show) View.VISIBLE else View.GONE + binding.statusDisplayName.visibility = if (show) View.VISIBLE else View.GONE + binding.statusUsername.visibility = if (show) View.VISIBLE else View.GONE + binding.statusMetaInfo.visibility = if (show) View.VISIBLE else View.GONE binding.notificationContentWarningDescription.visibility = if (show) View.VISIBLE else View.GONE binding.notificationContentWarningButton.visibility = diff --git a/app/src/main/res/layout/item_status_notification.xml b/app/src/main/res/layout/item_status_notification.xml index d0342e2e..95d0661d 100644 --- a/app/src/main/res/layout/item_status_notification.xml +++ b/app/src/main/res/layout/item_status_notification.xml @@ -1,10 +1,10 @@ - @@ -12,7 +12,6 @@ android:id="@+id/notification_top_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentTop="true" android:layout_marginTop="8dp" android:layout_marginBottom="6dp" android:drawablePadding="10dp" @@ -22,130 +21,20 @@ android:paddingStart="28dp" android:textColor="?android:textColorSecondary" android:textSize="?attr/status_text_medium" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" tools:text="Someone favourited your status" /> - - - - - - - - - - - - -