Skip to content

Commit

Permalink
[DatePicker] Prevent empty views at the end of a month to receive key…
Browse files Browse the repository at this point in the history
… events

PiperOrigin-RevId: 640991014
  • Loading branch information
paulfthomas authored and pekingme committed Jun 11, 2024
1 parent 7eb2d06 commit 86a3b35
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
if (!result) {
return false;
}
if (getSelectedItemPosition() == INVALID_POSITION
|| getSelectedItemPosition() >= getAdapter().firstPositionInMonth()) {
int selectedPosition = getSelectedItemPosition();
if (selectedPosition == INVALID_POSITION
|| (selectedPosition >= getAdapter().firstPositionInMonth()
&& selectedPosition <= getAdapter().lastPositionInMonth())) {
return true;
}
if (KeyEvent.KEYCODE_DPAD_UP == keyCode) {
Expand Down

0 comments on commit 86a3b35

Please sign in to comment.