File tree Expand file tree Collapse file tree 1 file changed +8
-16
lines changed
lib/java/com/google/android/material/datepicker Expand file tree Collapse file tree 1 file changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -495,22 +495,14 @@ public void onClick(View view) {
495
495
}
496
496
});
497
497
498
- monthNext .setOnClickListener (
499
- new OnClickListener () {
500
- @ Override
501
- public void onClick (View view ) {
502
- int currentItem = getLayoutManager ().findFirstVisibleItemPosition ();
503
- setCurrentMonth (monthsPagerAdapter .getPageMonth (currentItem + 1 ));
504
- }
505
- });
506
- monthPrev .setOnClickListener (
507
- new OnClickListener () {
508
- @ Override
509
- public void onClick (View view ) {
510
- int currentItem = getLayoutManager ().findLastVisibleItemPosition ();
511
- setCurrentMonth (monthsPagerAdapter .getPageMonth (currentItem - 1 ));
512
- }
513
- });
498
+ monthNext .setOnClickListener (view -> {
499
+ Month currentMonth = getCurrentMonth ();
500
+ setCurrentMonth (currentMonth .monthsLater (1 ));
501
+ });
502
+ monthPrev .setOnClickListener (view -> {
503
+ Month currentMonth = getCurrentMonth ();
504
+ setCurrentMonth (currentMonth .monthsLater (-1 ));
505
+ });
514
506
515
507
int currentMonthPosition = monthsPagerAdapter .getPosition (current );
516
508
updateNavigationButtonsEnabled (currentMonthPosition );
You can’t perform that action at this time.
0 commit comments