Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit 78f3201

Browse files
committed
Accessibility Scanner fixes
- Update to mdc beta01 which solves Scanner reporting MaterialCardView as unsopported - Added content descriptions to FAB - Increased touch target size of BottomAppBar nav title area - Increased touch target size of Navigation Drawer profile avatar icon - Increased touch target size of icons and EditTexts - Added content description to recipient chip scroll view Bug: 142789996 Change-Id: Ida98b628373d6da8a6ea98bd4a4eda2a4c706747
1 parent e577afe commit 78f3201

File tree

13 files changed

+82
-70
lines changed

13 files changed

+82
-70
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ dependencies {
6565
implementation "com.github.bumptech.glide:glide:4.9.0"
6666

6767
// Material Components
68-
implementation 'com.google.android.material:material:1.1.0-alpha07'
68+
implementation 'com.google.android.material:material:1.1.0-beta01'
6969

7070
// Testing
7171
testImplementation 'junit:junit:4.12'

app/src/main/java/com/materialstudies/reply/ui/MainActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ class MainActivity : AppCompatActivity(),
165165
state = intArrayOf(android.R.attr.state_activated)
166166
}
167167
bottomAppBar.replaceMenu(menuRes)
168+
fab.contentDescription = getString(R.string.fab_compose_email_content_description)
168169
bottomAppBarTitle.visibility = View.VISIBLE
169170
bottomAppBar.performShow()
170171
fab.show()
@@ -175,6 +176,7 @@ class MainActivity : AppCompatActivity(),
175176
binding.run {
176177
(fab.drawable as AnimatedVectorDrawable).start()
177178
bottomAppBar.replaceMenu(menuRes)
179+
fab.contentDescription = getString(R.string.fab_reply_email_content_description)
178180
bottomAppBarTitle.visibility = View.INVISIBLE
179181
bottomAppBar.performShow()
180182
fab.show()

app/src/main/java/com/materialstudies/reply/ui/nav/BottomNavDrawerFragment.kt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,16 @@ class BottomNavDrawerFragment :
112112
elevation = resources.getDimension(R.dimen.plane_16)
113113
shadowCompatibilityMode = MaterialShapeDrawable.SHADOW_COMPAT_MODE_NEVER
114114
initializeElevationOverlay(requireContext())
115-
shapeAppearanceModel.topEdge = SemiCircleEdgeCutoutTreatment(
116-
resources.getDimension(R.dimen.keyline_3),
117-
resources.getDimension(R.dimen.keyline_5),
118-
0F,
119-
resources.getDimension(R.dimen.navigation_drawer_profile_image_size)
120-
)
115+
shapeAppearanceModel = shapeAppearanceModel.toBuilder()
116+
.setTopEdge(
117+
SemiCircleEdgeCutoutTreatment(
118+
resources.getDimension(R.dimen.keyline_3),
119+
resources.getDimension(R.dimen.keyline_5),
120+
0F,
121+
resources.getDimension(R.dimen.navigation_drawer_profile_image_size_padded)
122+
)
123+
)
124+
.build()
121125
}
122126
}
123127

app/src/main/java/com/materialstudies/reply/util/BindingAdapter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import com.materialstudies.reply.R
5353
fun Spinner.bindPopupElevationOverlay(popupElevationOverlay: Float) {
5454
setPopupBackgroundDrawable(ColorDrawable(
5555
ElevationOverlayProvider(context)
56-
.getSurfaceColorWithOverlayIfNeeded(popupElevationOverlay)
56+
.compositeOverlayWithThemeSurfaceColorIfNeeded(popupElevationOverlay)
5757
))
5858
}
5959

app/src/main/res/drawable/bottom_app_bar_title_foreground.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
<ripple
1616
xmlns:android="http://schemas.android.com/apk/res/android"
1717
android:color="?attr/colorControlHighlight">
18-
<item android:id="@android:id/mask">
18+
<item android:id="@android:id/mask"
19+
android:gravity="center_vertical"
20+
android:height="40dp">
1921
<shape android:shape="rectangle">
2022
<corners android:radius="@dimen/reply_small_component_corner_radius"/>
2123
<solid android:color="#fff"/>

app/src/main/res/layout/account_item_layout.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
android:id="@+id/account_profile_image_view"
4040
android:layout_width="@dimen/navigation_drawer_profile_image_size"
4141
android:layout_height="@dimen/navigation_drawer_profile_image_size"
42+
android:padding="@dimen/keyline_3"
4243
app:layout_constraintStart_toStartOf="parent"
4344
app:layout_constraintTop_toTopOf="parent"
4445
app:layout_constraintBottom_toBottomOf="parent"

app/src/main/res/layout/activity_main.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@
5353
<LinearLayout
5454
android:id="@+id/bottom_app_bar_content_container"
5555
android:layout_width="wrap_content"
56-
android:layout_height="40dp"
57-
android:layout_marginTop="@dimen/keyline_3"
58-
android:layout_marginBottom="@dimen/keyline_3"
59-
android:minHeight="@dimen/reply_small_component_corner_radius"
60-
android:orientation="horizontal"
56+
android:layout_height="@dimen/min_touch_target_size"
57+
android:layout_marginVertical="@dimen/keyline_2"
6158
android:paddingHorizontal="@dimen/keyline_2"
59+
android:orientation="horizontal"
6260
android:gravity="center_vertical"
6361
android:foreground="@drawable/bottom_app_bar_title_foreground">
6462

@@ -99,7 +97,8 @@
9997
android:layout_width="wrap_content"
10098
android:layout_height="wrap_content"
10199
app:layout_anchor="@id/bottom_app_bar"
102-
app:srcCompat="@drawable/avd_edit_reply" />
100+
app:srcCompat="@drawable/avd_edit_reply"
101+
android:contentDescription="@string/fab_compose_email_content_description"/>
103102

104103
</androidx.coordinatorlayout.widget.CoordinatorLayout>
105104

app/src/main/res/layout/fragment_bottom_nav_drawer.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@
6161
android:id="@+id/profile_image_view"
6262
android:layout_width="@dimen/navigation_drawer_profile_image_size"
6363
android:layout_height="@dimen/navigation_drawer_profile_image_size"
64-
android:layout_marginTop="@dimen/keyline_3"
64+
android:padding="@dimen/keyline_3"
6565
android:layout_gravity="center|top"
66-
android:foreground="?attr/selectableItemBackground"
66+
android:foreground="?attr/actionBarItemBackground"
6767
android:contentDescription="@string/bottom_nav_drawer_profile_image_content_desc"
6868
app:glideSrc="@{currentUserAccount.avatar}"
6969
app:glideCenterCrop="@{true}"

app/src/main/res/layout/fragment_compose.xml

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -41,46 +41,45 @@
4141
android:layout_height="wrap_content"
4242
android:layout_marginTop="@dimen/keyline_4">
4343

44-
<ImageView
44+
<ImageButton
4545
android:id="@+id/close_icon"
4646
android:layout_width="wrap_content"
4747
android:layout_height="wrap_content"
48-
app:layout_constraintBottom_toBottomOf="@+id/subject_edit_text"
4948
app:layout_constraintStart_toStartOf="parent"
50-
app:layout_constraintTop_toTopOf="@+id/subject_edit_text"
51-
android:layout_marginStart="@dimen/keyline_4"
52-
android:padding="@dimen/keyline_2"
49+
app:layout_constraintTop_toTopOf="parent"
50+
android:padding="@dimen/min_icon_target_padding"
51+
android:layout_marginStart="@dimen/keyline_3"
5352
android:contentDescription="@string/compose_close_content_desc"
54-
android:background="?attr/selectableItemBackgroundBorderless"
53+
android:background="?attr/actionBarItemBackground"
5554
app:srcCompat="@drawable/ic_close"
5655
app:tint="@color/color_on_surface_emphasis_disabled" />
5756

5857
<EditText
5958
android:id="@+id/subject_edit_text"
6059
android:layout_width="0dp"
6160
android:layout_height="wrap_content"
61+
android:minHeight="@dimen/min_touch_target_size"
62+
android:layout_marginHorizontal="@dimen/keyline_4"
63+
android:paddingVertical="@dimen/keyline_3"
6264
app:layout_constraintEnd_toStartOf="@+id/send_icon"
6365
app:layout_constraintStart_toEndOf="@id/close_icon"
6466
app:layout_constraintTop_toTopOf="parent"
65-
android:layout_marginStart="@dimen/keyline_4"
66-
android:layout_marginVertical="@dimen/keyline_3"
67-
android:padding="0dp"
6867
android:background="@android:color/transparent"
6968
android:hint="@string/compose_subject_hint"
7069
android:text="@{email.subject}"
70+
android:inputType="textEmailSubject"
7171
android:textAppearance="?attr/textAppearanceHeadline5" />
7272

73-
<ImageView
73+
<ImageButton
7474
android:id="@+id/send_icon"
7575
android:layout_width="wrap_content"
7676
android:layout_height="wrap_content"
77-
app:layout_constraintBottom_toBottomOf="@+id/subject_edit_text"
77+
android:padding="@dimen/min_icon_target_padding"
78+
android:layout_marginEnd="@dimen/keyline_3"
7879
app:layout_constraintEnd_toEndOf="parent"
79-
app:layout_constraintTop_toTopOf="@+id/subject_edit_text"
80-
android:layout_marginEnd="@dimen/keyline_4"
81-
android:padding="@dimen/keyline_2"
80+
app:layout_constraintTop_toTopOf="parent"
8281
android:contentDescription="@string/compose_send_content_desc"
83-
android:background="?attr/selectableItemBackgroundBorderless"
82+
android:background="?attr/actionBarItemBackground"
8483
android:clickable="true"
8584
app:srcCompat="@drawable/ic_twotone_send_primary" />
8685

@@ -91,7 +90,7 @@
9190
app:layout_constraintStart_toStartOf="parent"
9291
app:layout_constraintTop_toBottomOf="@+id/subject_edit_text"
9392
app:layout_constraintEnd_toEndOf="parent"
94-
android:layout_marginTop="@dimen/keyline_4"
93+
android:layout_marginTop="@dimen/keyline_3"
9594
android:layout_marginHorizontal="@dimen/keyline_4"
9695
android:background="@drawable/divider"
9796
android:backgroundTint="@color/color_on_surface_divider"/>
@@ -120,51 +119,45 @@
120119
android:background="@drawable/divider"
121120
android:backgroundTint="@color/color_on_surface_divider" />
122121

123-
<FrameLayout
124-
android:id="@+id/recipient_frame"
122+
<HorizontalScrollView
123+
android:id="@+id/recipient_scroll_view"
125124
android:layout_width="0dp"
126125
android:layout_height="wrap_content"
127126
app:layout_constraintEnd_toStartOf="@id/recipient_add_icon"
128127
app:layout_constraintStart_toStartOf="parent"
129128
app:layout_constraintTop_toBottomOf="@id/sender_divider"
130129
android:layout_marginTop="@dimen/keyline_3"
131-
android:layout_marginEnd="@dimen/keyline_4">
132-
133-
<HorizontalScrollView
134-
android:id="@+id/recipient_scroll_view"
135-
android:layout_width="match_parent"
130+
android:layout_marginEnd="@dimen/keyline_4"
131+
android:minHeight="48dp"
132+
android:paddingVertical="@dimen/keyline_1"
133+
android:clipToPadding="false"
134+
android:scrollbars="none"
135+
android:requiresFadingEdge="horizontal"
136+
android:fadingEdgeLength="@dimen/keyline_5"
137+
android:overScrollMode="never"
138+
android:contentDescription="@string/compose_recipient_group_content_desc">
139+
140+
<com.google.android.material.chip.ChipGroup
141+
android:id="@+id/recipient_chip_group"
142+
android:layout_width="wrap_content"
136143
android:layout_height="wrap_content"
137-
android:minHeight="48dp"
138-
android:paddingVertical="@dimen/keyline_1"
139-
android:clipToPadding="false"
144+
android:paddingStart="@dimen/keyline_4"
140145
android:scrollbars="none"
141-
android:requiresFadingEdge="horizontal"
142-
android:fadingEdgeLength="@dimen/keyline_5"
143-
android:overScrollMode="never">
144-
145-
<com.google.android.material.chip.ChipGroup
146-
android:id="@+id/recipient_chip_group"
147-
android:layout_width="wrap_content"
148-
android:layout_height="wrap_content"
149-
android:paddingStart="@dimen/keyline_4"
150-
android:scrollbars="none"
151-
app:singleLine="true" />
146+
app:singleLine="true" />
152147

153-
</HorizontalScrollView>
148+
</HorizontalScrollView>
154149

155-
</FrameLayout>
156-
157-
<ImageView
150+
<ImageButton
158151
android:id="@+id/recipient_add_icon"
159152
android:layout_width="wrap_content"
160153
android:layout_height="wrap_content"
161154
app:layout_constraintEnd_toEndOf="parent"
162-
app:layout_constraintTop_toTopOf="@id/recipient_frame"
163-
app:layout_constraintBottom_toBottomOf="@id/recipient_frame"
164-
android:layout_marginEnd="@dimen/keyline_4"
165-
android:padding="@dimen/keyline_2"
155+
app:layout_constraintTop_toTopOf="@id/recipient_scroll_view"
156+
app:layout_constraintBottom_toBottomOf="@id/recipient_scroll_view"
157+
android:layout_marginEnd="@dimen/keyline_3"
158+
android:padding="@dimen/min_icon_target_padding"
166159
android:contentDescription="@string/compose_add_recipient_icon_content_desc"
167-
android:background="?attr/selectableItemBackgroundBorderless"
160+
android:background="?attr/actionBarItemBackground"
168161
android:clickable="true"
169162
app:tint="@color/color_on_surface_emphasis_disabled"
170163
app:srcCompat="@drawable/ic_twotone_add_circle_outline"/>
@@ -174,7 +167,7 @@
174167
android:layout_width="match_parent"
175168
android:layout_height="1dp"
176169
app:layout_constraintStart_toStartOf="parent"
177-
app:layout_constraintTop_toBottomOf="@+id/recipient_frame"
170+
app:layout_constraintTop_toBottomOf="@+id/recipient_scroll_view"
178171
app:layout_constraintEnd_toEndOf="parent"
179172
android:layout_marginTop="@dimen/keyline_3"
180173
android:layout_marginHorizontal="@dimen/keyline_4"
@@ -185,15 +178,18 @@
185178
android:id="@+id/body_text_view"
186179
android:layout_width="match_parent"
187180
android:layout_height="wrap_content"
181+
android:minHeight="250dp"
188182
app:layout_constraintStart_toStartOf="parent"
189183
app:layout_constraintTop_toBottomOf="@id/recipient_divider"
190184
app:layout_constraintEnd_toEndOf="parent"
191185
android:layout_marginTop="@dimen/keyline_4"
192186
android:layout_marginHorizontal="@dimen/keyline_4"
193-
android:padding="0dp"
187+
android:paddingBottom="@dimen/keyline_6"
188+
paddingBottomSystemWindowInsets="@{true}"
194189
android:background="@android:color/transparent"
195190
android:hint="@string/compose_body_hint"
196191
android:text="@{email.body}"
192+
android:gravity="top"
197193
android:textAppearance="?attr/textAppearanceBody1"
198194
app:lineHeight="24sp" />
199195

app/src/main/res/layout/fragment_email.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,17 @@
6161
android:textAppearance="?attr/textAppearanceHeadline3"
6262
tools:text="High school reunion" />
6363

64-
<ImageView
64+
<ImageButton
6565
android:id="@+id/navigation_icon"
66-
android:layout_width="0dp"
66+
android:layout_width="wrap_content"
6767
android:layout_height="wrap_content"
68+
android:padding="@dimen/keyline_4"
6869
android:layout_marginTop="@dimen/keyline_3"
6970
app:layout_constraintEnd_toEndOf="@+id/sender_profile_image_view"
7071
app:layout_constraintStart_toStartOf="@+id/sender_profile_image_view"
7172
app:layout_constraintTop_toTopOf="@+id/subject_text_view"
7273
android:alpha="?attr/emphasisMediumAlpha"
73-
android:background="?attr/selectableItemBackgroundBorderless"
74+
android:background="?attr/actionBarItemBackground"
7475
android:contentDescription="@string/navigate_back_icon_content_desc"
7576
app:srcCompat="@drawable/ic_arrow_down" />
7677

0 commit comments

Comments
 (0)