From adcf92ea6858014b3cf2b53d3c963ac6483298cb Mon Sep 17 00:00:00 2001 From: Andries Smit Date: Tue, 19 Apr 2022 10:36:10 +0200 Subject: [PATCH] chore: fix layout lint warning --- .../activities/QuickWizardListActivity.kt | 4 ++++ .../res/layout/activity_historybrowse.xml | 2 +- .../main/res/layout/activity_setupwizard.xml | 1 + .../layout/activity_smscommunicator_otp.xml | 2 ++ app/src/main/res/layout/bgsource_item.xml | 1 + .../layout/configbuilder_single_category.xml | 9 +++++--- .../layout/configbuilder_single_plugin.xml | 9 ++++++-- app/src/main/res/layout/dialog_carbs.xml | 5 ++++- app/src/main/res/layout/dialog_insulin.xml | 13 ++++++------ app/src/main/res/layout/dialog_loop.xml | 9 ++++---- .../main/res/layout/dialog_profileswitch.xml | 5 +++-- app/src/main/res/layout/dialog_tempbasal.xml | 3 ++- app/src/main/res/layout/dialog_wizard.xml | 12 ++++++----- .../res/layout/objectives_exam_fragment.xml | 16 +++++++------- app/src/main/res/layout/objectives_item.xml | 7 ++++--- .../overview_editquickwizard_dialog.xml | 21 ++++++++++--------- .../res/layout/overview_graphs_layout.xml | 1 - .../layout/overview_quickwizardlist_item.xml | 7 ++++--- .../layout/overview_statuslights_layout.xml | 11 +++++++--- app/src/main/res/values/strings.xml | 9 ++++++++ 20 files changed, 93 insertions(+), 54 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt index 128f6c6613..5c1ffc8c27 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt @@ -76,6 +76,10 @@ class QuickWizardListActivity : DaggerAppCompatActivityWithResult(), OnStartDrag else -> R.drawable.ic_smartphone } ) + holder.binding.device.contentDescription = when (quickWizard[position].device()) { + QuickWizardEntry.DEVICE_WATCH -> rh.gs(R.string.a11y_only_on_watch) + else -> rh.gs(R.string.a11y_only_on_phone) + } } holder.binding.root.setOnClickListener { if (actionHelper.isNoAction) { diff --git a/app/src/main/res/layout/activity_historybrowse.xml b/app/src/main/res/layout/activity_historybrowse.xml index f3792b7e91..2cbd13c683 100644 --- a/app/src/main/res/layout/activity_historybrowse.xml +++ b/app/src/main/res/layout/activity_historybrowse.xml @@ -59,7 +59,7 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" - android:text="24" /> + tools:text="24" /> diff --git a/app/src/main/res/layout/activity_setupwizard.xml b/app/src/main/res/layout/activity_setupwizard.xml index 24403b64a3..a60004b8f8 100644 --- a/app/src/main/res/layout/activity_setupwizard.xml +++ b/app/src/main/res/layout/activity_setupwizard.xml @@ -20,6 +20,7 @@ android:layout_marginTop="16dp" android:layout_weight="1" android:background="@android:color/transparent" + android:importantForAccessibility="no" android:onClick="exitPressed" app:srcCompat="@drawable/ic_exit_to_app" /> diff --git a/app/src/main/res/layout/activity_smscommunicator_otp.xml b/app/src/main/res/layout/activity_smscommunicator_otp.xml index 99d1e3b68f..3b3db7dce2 100644 --- a/app/src/main/res/layout/activity_smscommunicator_otp.xml +++ b/app/src/main/res/layout/activity_smscommunicator_otp.xml @@ -35,6 +35,7 @@ android:id="@+id/otp_provisioning" android:layout_width="fill_parent" android:layout_height="wrap_content" + android:contentDescription="@string/a11y_otp_qr_code" android:layout_marginTop="10dp" android:scaleType="center" /> @@ -72,6 +73,7 @@ android:layout_width="140sp" android:layout_height="wrap_content" android:hint="@string/smscommunicator_code_verify_hint" + android:importantForAutofill="no" android:inputType="number" android:maxLength="12" android:textAlignment="center" diff --git a/app/src/main/res/layout/bgsource_item.xml b/app/src/main/res/layout/bgsource_item.xml index 5d3e8595c6..261b3c0475 100644 --- a/app/src/main/res/layout/bgsource_item.xml +++ b/app/src/main/res/layout/bgsource_item.xml @@ -3,6 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/tools" + xmlns:tools="http://schemas.android.com/tools" style="@style/Widget.MaterialComponents.CardView" android:id="@+id/bg_card" android:layout_width="match_parent" diff --git a/app/src/main/res/layout/configbuilder_single_category.xml b/app/src/main/res/layout/configbuilder_single_category.xml index 2f6177b593..8d653c61bc 100644 --- a/app/src/main/res/layout/configbuilder_single_category.xml +++ b/app/src/main/res/layout/configbuilder_single_category.xml @@ -36,8 +36,10 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="4dp" - app:tint="?android:attr/colorAccent" - app:srcCompat="@drawable/ic_visibility" /> + android:importantForAccessibility="no" + app:srcCompat="@drawable/ic_visibility" + app:tint="?android:attr/colorAccent" /> + - \ No newline at end of file + + diff --git a/app/src/main/res/layout/configbuilder_single_plugin.xml b/app/src/main/res/layout/configbuilder_single_plugin.xml index d48ef40a5f..397c755aba 100644 --- a/app/src/main/res/layout/configbuilder_single_plugin.xml +++ b/app/src/main/res/layout/configbuilder_single_plugin.xml @@ -38,7 +38,8 @@ android:layout_width="36dp" android:layout_height="36dp" android:layout_gravity="center_vertical" - android:layout_marginEnd="8dp" /> + android:layout_marginEnd="8dp" + android:importantForAccessibility="no" /> @@ -70,6 +72,7 @@ android:layout_height="wrap_content" android:textSize="12sp" tools:text="A super exquisite plugin description" /> + @@ -80,6 +83,7 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" + android:contentDescription="@string/a11y_open_settings" android:background="?attr/selectableItemBackgroundBorderless" app:srcCompat="@drawable/ic_settings" /> @@ -88,4 +92,5 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:saveEnabled="false" /> - \ No newline at end of file + + diff --git a/app/src/main/res/layout/dialog_carbs.xml b/app/src/main/res/layout/dialog_carbs.xml index e8b9e70bf6..71b771bb15 100644 --- a/app/src/main/res/layout/dialog_carbs.xml +++ b/app/src/main/res/layout/dialog_carbs.xml @@ -75,6 +75,7 @@ + + tools:text="+0.5" /> + tools:text="+1.0" /> + tools:text="+2.0" /> diff --git a/app/src/main/res/layout/dialog_loop.xml b/app/src/main/res/layout/dialog_loop.xml index e8024e8552..9884790f74 100644 --- a/app/src/main/res/layout/dialog_loop.xml +++ b/app/src/main/res/layout/dialog_loop.xml @@ -182,7 +182,7 @@ android:id="@+id/overview_resume" style="?android:attr/buttonStyle" android:layout_width="wrap_content" - android:layout_height="fill_parent" + android:layout_height="0dp" android:layout_gravity="center" android:layout_marginEnd="-4dp" android:layout_weight="0.5" @@ -291,7 +291,7 @@ android:id="@+id/overview_reconnect" style="?android:attr/buttonStyle" android:layout_width="wrap_content" - android:layout_height="wrap_content" + android:layout_height="0dp" android:layout_gravity="center" android:layout_marginEnd="-4dp" android:layout_weight="0.5" @@ -396,7 +396,7 @@ android:id="@+id/cancel" style="@style/OkCancelButton.Text" android:layout_width="fill_parent" - android:layout_height="wrap_content" + android:layout_height="0dp" android:layout_marginEnd="8dp" android:layout_weight="1" android:text="@string/cancel" @@ -404,4 +404,5 @@ android:textAlignment="textEnd" /> - \ No newline at end of file + + diff --git a/app/src/main/res/layout/dialog_profileswitch.xml b/app/src/main/res/layout/dialog_profileswitch.xml index e6985c6e85..95e2cf4f9c 100644 --- a/app/src/main/res/layout/dialog_profileswitch.xml +++ b/app/src/main/res/layout/dialog_profileswitch.xml @@ -151,7 +151,8 @@ android:paddingStart="5dp" android:paddingEnd="5dp" android:text="%" - android:textAppearance="?android:attr/textAppearanceSmall" /> + android:textAppearance="?android:attr/textAppearanceSmall" + tools:ignore="HardcodedText" /> @@ -210,7 +211,7 @@ + android:textAppearance="?android:attr/textAppearanceSmall" + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/dialog_wizard.xml b/app/src/main/res/layout/dialog_wizard.xml index 7ce4846a4d..9064fe76d2 100644 --- a/app/src/main/res/layout/dialog_wizard.xml +++ b/app/src/main/res/layout/dialog_wizard.xml @@ -48,8 +48,8 @@ + android:paddingStart="0dp" + android:paddingEnd="5dp"> + android:textStyle="bold" + tools:ignore="HardcodedText" /> @@ -347,7 +348,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:checked="false" - android:contentDescription="set carb timer alarm" + android:contentDescription="@string/a11y_set_carb_timer" android:drawableEnd="@drawable/ic_access_alarm_24dp" android:layoutDirection="rtl" android:padding="2dp" /> @@ -384,7 +385,8 @@ android:layout_marginEnd="5dp" android:layout_weight="0.5" android:hint="@string/profile" - android:paddingStart="7dp"> + android:paddingStart="7dp" + android:paddingEnd="0dp"> @@ -76,10 +76,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" - android:text="Question" android:textAppearance="@style/TextAppearance.AppCompat.Medium" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/exam_name" /> + app:layout_constraintTop_toBottomOf="@id/exam_name" + tools:text="Question" /> + app:layout_constraintTop_toTopOf="parent" + tools:text="Name" /> + app:layout_constraintTop_toBottomOf="@+id/exam_hints" + tools:text="Disabled until:" /> diff --git a/app/src/main/res/layout/objectives_item.xml b/app/src/main/res/layout/objectives_item.xml index 07e05be638..9083300a3c 100644 --- a/app/src/main/res/layout/objectives_item.xml +++ b/app/src/main/res/layout/objectives_item.xml @@ -95,7 +95,7 @@ android:id="@+id/requestcode" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="Request code: XXXXX" /> + tools:text="Request code: XXXXX" /> + android:inputType="text" + tools:hint="XXXXXXXXXX" + android:importantForAutofill="no" /> + android:textAppearance="@style/TextAppearance.AppCompat.Medium" + tools:text="08:20pm" /> + android:textAppearance="@style/TextAppearance.AppCompat.Medium" + tools:ignore="HardcodedText" /> + android:textAppearance="@style/TextAppearance.AppCompat.Medium" + tools:text="08:20pm" /> @@ -123,17 +124,17 @@ + android:text="@string/device_all" /> + android:text="@string/device_phone" /> + android:text="@string/device_watch" /> @@ -366,9 +367,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" + android:importantForAutofill="no" android:inputType="number" - android:maxLength="3" - android:paddingStart="10dp" /> + android:maxLength="3"/> diff --git a/app/src/main/res/layout/overview_quickwizardlist_item.xml b/app/src/main/res/layout/overview_quickwizardlist_item.xml index 56824188e9..594721d43e 100644 --- a/app/src/main/res/layout/overview_quickwizardlist_item.xml +++ b/app/src/main/res/layout/overview_quickwizardlist_item.xml @@ -2,7 +2,6 @@ @@ -81,14 +81,15 @@ android:adjustViewBounds="false" android:cropToPadding="false" android:scaleType="fitStart" - app:srcCompat="@drawable/ic_smartphone" - tools:ignore="RtlSymmetry" /> + android:contentDescription="@string/a11y_only_on_phone" + app:srcCompat="@drawable/ic_smartphone" /> diff --git a/app/src/main/res/layout/overview_statuslights_layout.xml b/app/src/main/res/layout/overview_statuslights_layout.xml index c49e01b0c7..546409aa7e 100644 --- a/app/src/main/res/layout/overview_statuslights_layout.xml +++ b/app/src/main/res/layout/overview_statuslights_layout.xml @@ -9,14 +9,16 @@ android:layout_marginBottom="3dp" android:orientation="horizontal" android:paddingTop="4dp" - android:paddingBottom="4dp"> + android:paddingBottom="4dp" + android:baselineAligned="false"> + android:gravity="center_horizontal" + tools:ignore="UseCompoundDrawables"> @@ -73,7 +76,8 @@ android:layout_height="fill_parent" android:layout_weight="1" android:focusable="true" - android:gravity="center_horizontal"> + android:gravity="center_horizontal" + tools:ignore="UseCompoundDrawables"> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a8f8bf0efd..12e9f6b607 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1212,4 +1212,13 @@ Hide loop records AndroidAPS widget Configure opacity + QR Code for setup one time password + open settings + set carb timer alarm + All + Phone + Watch + only on watch + only on phone + drag and drop handle