From 4ae80726a26a409a9958001f347605f4b11775c1 Mon Sep 17 00:00:00 2001 From: Janusz Leidgens Date: Thu, 27 Mar 2025 18:48:04 +0100 Subject: [PATCH] Fix rtlsymmetry lint warnings (#5024) This fixes #5001 - I added some symmetry in views where I thought it is appropriate. - Then I added some 0 paddings in views where the warning was a false positive. - I also moved paddings to another view in the hierarchy in some places. I think it makes the view more correct for the following textview to have a start and endpadding instead of the view before that to have only an end padding. In the end I recreated the baseline file. It seems that two issues that I did not work on where fixed previously that is why not only RtlSymmetry warnings are removed from the file. --------- Co-authored-by: Janusz Leidgens <> --- app/lint-baseline.xml | 257 ++++-------------- .../main/res/layout/activity_edit_profile.xml | 2 + app/src/main/res/layout/item_conversation.xml | 4 +- app/src/main/res/layout/item_follow.xml | 1 + .../res/layout/item_report_notification.xml | 1 + app/src/main/res/layout/item_status.xml | 3 +- .../res/layout/item_status_notification.xml | 1 + .../res/layout/item_unknown_notification.xml | 1 + .../main/res/layout/view_compose_schedule.xml | 2 + 9 files changed, 67 insertions(+), 205 deletions(-) diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml index fe77d2c8d..b4d6aa015 100644 --- a/app/lint-baseline.xml +++ b/app/lint-baseline.xml @@ -1,5 +1,5 @@ - + @@ -19,7 +19,7 @@ errorLine2=" ~~~~~~~~~~~"> @@ -53,14 +53,14 @@ + message="Overriding `@layout/exo_player_control_view` which is marked as private in androidx.media3:media3-ui:1.5.1. If deliberate, use tools:override="true", otherwise pick a different name."> @@ -230,7 +230,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -241,7 +241,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -252,7 +252,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -263,7 +263,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -384,7 +384,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -454,17 +454,6 @@ column="9"/> - - - - @@ -499,46 +488,20 @@ - - - - - - - - + id="ConvertToWebp" + message="One or more images in this project can be converted to the WebP format which typically results in smaller file sizes, even for lossless conversion"> + file="src/blue/res/mipmap-xxxhdpi/ic_launcher.png"/> + id="NegativeMargin" + message="Margin values should not be negative" + errorLine1=" android:layout_marginStart="-14dp"" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -708,146 +671,36 @@ - - - - + id="SetTextI18n" + message="Do not concatenate text displayed with `setText`. Use resource string with placeholders." + errorLine1=" cardMetadata.setText(providerName + metadataJoiner + TimestampUtils.getRelativeTimeSpanString(context, card.getPublishedAt().getTime(), System.currentTimeMillis()));" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + file="src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java" + line="1188" + column="42"/> + id="UnknownNullness" + message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations" + errorLine1=" protected TextView getStatusInfo() {" + errorLine2=" ~~~~~~~~"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + file="src/main/java/com/keylesspalace/tusky/adapter/StatusViewHolder.java" + line="149" + column="15"/> + id="UnknownNullness" + message="Should explicitly declare type here since implicit type does not specify nullness" + errorLine1="val hashtagPattern = Pattern.compile(HASHTAG_EXPRESSION, Pattern.CASE_INSENSITIVE or Pattern.MULTILINE)" + errorLine2=" ~~~~~~~~~~~~~~"> + file="src/main/java/com/keylesspalace/tusky/util/StringUtils.kt" + line="12" + column="5"/> diff --git a/app/src/main/res/layout/activity_edit_profile.xml b/app/src/main/res/layout/activity_edit_profile.xml index 77fc5b935..54057fdb4 100644 --- a/app/src/main/res/layout/activity_edit_profile.xml +++ b/app/src/main/res/layout/activity_edit_profile.xml @@ -117,6 +117,7 @@ android:layout_marginTop="30dp" android:layout_marginEnd="16dp" android:paddingStart="8dp" + android:paddingEnd="8dp" android:text="@string/lock_account_label" android:textSize="?attr/status_text_medium" /> @@ -127,6 +128,7 @@ android:layout_marginEnd="16dp" android:layout_marginBottom="24dp" android:paddingStart="40dp" + android:paddingEnd="0dp" android:text="@string/lock_account_label_description" android:textSize="?attr/status_text_small" /> diff --git a/app/src/main/res/layout/item_conversation.xml b/app/src/main/res/layout/item_conversation.xml index f43eecc6d..a88789a23 100644 --- a/app/src/main/res/layout/item_conversation.xml +++ b/app/src/main/res/layout/item_conversation.xml @@ -25,7 +25,6 @@ app:layout_constraintLeft_toRightOf="parent" app:layout_constraintRight_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent" - tools:ignore="RtlSymmetry" tools:text="ConnyDuck boosted" tools:visibility="visible" /> @@ -87,7 +86,6 @@ android:layout_marginTop="10dp" android:ellipsize="end" android:maxLines="1" - android:paddingEnd="@dimen/status_display_name_padding_end" android:textColor="?android:textColorPrimary" android:textSize="?attr/status_text_medium" android:textStyle="normal|bold" @@ -106,6 +104,8 @@ android:maxLines="1" android:textColor="?android:textColorSecondary" android:textSize="?attr/status_text_medium" + android:paddingStart="@dimen/status_display_name_padding_end" + android:paddingEnd="@dimen/status_display_name_padding_end" app:layout_constraintEnd_toStartOf="@id/status_meta_info" app:layout_constraintStart_toEndOf="@id/status_display_name" app:layout_constraintTop_toTopOf="@id/status_display_name" diff --git a/app/src/main/res/layout/item_follow.xml b/app/src/main/res/layout/item_follow.xml index 5fc2142a7..604b2c740 100644 --- a/app/src/main/res/layout/item_follow.xml +++ b/app/src/main/res/layout/item_follow.xml @@ -18,6 +18,7 @@ android:gravity="center_vertical" android:maxLines="1" android:paddingStart="28dp" + android:paddingEnd="0dp" android:textColor="?android:textColorTertiary" android:textSize="?attr/status_text_medium" app:drawableStartCompat="@drawable/ic_person_add_24dp" diff --git a/app/src/main/res/layout/item_report_notification.xml b/app/src/main/res/layout/item_report_notification.xml index fde968d48..341845354 100644 --- a/app/src/main/res/layout/item_report_notification.xml +++ b/app/src/main/res/layout/item_report_notification.xml @@ -20,6 +20,7 @@ android:gravity="center_vertical" android:maxLines="1" android:paddingStart="28dp" + android:paddingEnd="0dp" android:textColor="?android:textColorSecondary" android:textSize="?attr/status_text_medium" app:drawableStartCompat="@drawable/ic_flag_24dp" diff --git a/app/src/main/res/layout/item_status.xml b/app/src/main/res/layout/item_status.xml index 682a4388a..df0ad99e2 100644 --- a/app/src/main/res/layout/item_status.xml +++ b/app/src/main/res/layout/item_status.xml @@ -67,7 +67,6 @@ android:ellipsize="end" android:importantForAccessibility="no" android:maxLines="1" - android:paddingEnd="@dimen/status_display_name_padding_end" android:textColor="?android:textColorPrimary" android:textSize="?attr/status_text_medium" android:textStyle="normal|bold" @@ -85,6 +84,8 @@ android:ellipsize="end" android:importantForAccessibility="no" android:maxLines="1" + android:paddingEnd="@dimen/status_display_name_padding_end" + android:paddingStart="@dimen/status_display_name_padding_end" android:textColor="?android:textColorSecondary" android:textSize="?attr/status_text_medium" app:layout_constraintEnd_toStartOf="@id/status_meta_info" diff --git a/app/src/main/res/layout/item_status_notification.xml b/app/src/main/res/layout/item_status_notification.xml index 352ae40f8..ae1a712d4 100644 --- a/app/src/main/res/layout/item_status_notification.xml +++ b/app/src/main/res/layout/item_status_notification.xml @@ -20,6 +20,7 @@ android:gravity="center_vertical" android:maxLines="1" android:paddingStart="28dp" + android:paddingEnd="0dp" android:textColor="?android:textColorSecondary" android:textSize="?attr/status_text_medium" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/item_unknown_notification.xml b/app/src/main/res/layout/item_unknown_notification.xml index c44592ff3..0446165e1 100644 --- a/app/src/main/res/layout/item_unknown_notification.xml +++ b/app/src/main/res/layout/item_unknown_notification.xml @@ -19,6 +19,7 @@ android:paddingBottom="14dp"> android:gravity="center_vertical" android:maxLines="1" android:paddingStart="28dp" + android:paddingEnd="0dp" android:textColor="?android:textColorSecondary" android:textSize="?attr/status_text_medium" app:drawableStartCompat="@drawable/help_24dp" diff --git a/app/src/main/res/layout/view_compose_schedule.xml b/app/src/main/res/layout/view_compose_schedule.xml index eeddfd2ab..1d958cc87 100644 --- a/app/src/main/res/layout/view_compose_schedule.xml +++ b/app/src/main/res/layout/view_compose_schedule.xml @@ -19,6 +19,7 @@ android:layout_height="wrap_content" android:drawablePadding="4dp" android:paddingStart="4dp" + android:paddingEnd="4dp" android:paddingTop="4dp" android:paddingBottom="16dp" android:textColor="?android:textColorTertiary" @@ -36,6 +37,7 @@ android:layout_height="wrap_content" android:drawablePadding="4dp" android:paddingStart="4dp" + android:paddingEnd="4dp" android:paddingTop="4dp" android:paddingBottom="16dp" android:textColor="?android:textColorTertiary"