Skip to content

Commit 91e6a97

Browse files
Material Design Teamkendrickumstattd
authored andcommitted
[DatePicker][A11y] Replace the deprecated announcement API used for month navigation
PiperOrigin-RevId: 760547908
1 parent 7bd56f5 commit 91e6a97

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

lib/java/com/google/android/material/datepicker/MaterialCalendar.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -473,14 +473,6 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
473473
int currentMonthPosition = monthsPagerAdapter.getPosition(moveToMonth);
474474
updateNavigationButtonsEnabled(currentMonthPosition);
475475
}
476-
477-
@Override
478-
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
479-
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
480-
CharSequence announcementText = monthDropSelect.getText();
481-
recyclerView.announceForAccessibility(announcementText);
482-
}
483-
}
484476
});
485477

486478
monthDropSelect.setOnClickListener(

lib/java/com/google/android/material/datepicker/res/layout/mtrl_calendar_month_navigation.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,18 @@
3030
android:layout_weight="1">
3131

3232
<com.google.android.material.button.MaterialButton
33-
style="?attr/materialCalendarYearNavigationButton"
3433
android:id="@+id/month_navigation_fragment_toggle"
34+
style="?attr/materialCalendarYearNavigationButton"
3535
android:layout_width="wrap_content"
3636
android:layout_height="@dimen/mtrl_calendar_navigation_height"
3737
android:layout_gravity="start"
38+
android:accessibilityLiveRegion="polite"
3839
android:gravity="center_vertical|start"
3940
android:insetBottom="0dp"
4041
android:insetTop="0dp"
4142
app:icon="@drawable/material_ic_menu_arrow_down_black_24dp"
4243
app:iconGravity="textEnd"
43-
app:iconPadding="4dp"/>
44+
app:iconPadding="4dp" />
4445

4546
</FrameLayout>
4647

0 commit comments

Comments
 (0)