/** * Attempts to restore accessibility focus to a given date. No-op if * {@code day} is {@code null}. * * @param day The date that should receive accessibility focus * @return {@code true} if focus was restored */ private boolean restoreAccessibilityFocus(CalendarDay day) { if (day == null) { return false; } final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child instanceof MonthView) { if (((MonthView) child).restoreAccessibilityFocus(day)) { return true; } } } return false; }
/** * Attempts to return the date that has accessibility focus. * * @return The date that has accessibility focus, or {@code null} if no date * has focus. */ private CalendarDay findAccessibilityFocus() { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child instanceof MonthView) { final CalendarDay focus = ((MonthView) child).getAccessibilityFocus(); if (focus != null) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) { // Clear focus to avoid ListView bug in Jelly Bean MR1. ((MonthView) child).clearAccessibilityFocus(); } return focus; } } } return null; }
/** * Attempts to restore accessibility focus to a given date. No-op if * {@code day} is {@code null}. * * @param day The date that should receive accessibility focus * @return {@code true} if focus was restored */ private boolean restoreAccessibilityFocus(CalendarDay day) { if (day == null) { return false; } final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child instanceof MonthView) { if (((MonthView) child).restoreAccessibilityFocus(day)) { return true; } } } return false; }
/** * Attempts to return the date that has accessibility focus. * * @return The date that has accessibility focus, or {@code null} if no date * has focus. */ private CalendarDay findAccessibilityFocus() { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child instanceof MonthView) { final CalendarDay focus = ((MonthView) child).getAccessibilityFocus(); if (focus != null) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) { // Clear focus to avoid ListView bug in Jelly Bean MR1. ((MonthView) child).clearAccessibilityFocus(); } return focus; } } } return null; }