Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DatePicker] icon is toggled #4486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ enum CalendarSelector {
private View monthNext;
private View yearFrame;
private View dayFrame;
private MaterialButton toggle;

@NonNull
public static <T> MaterialCalendar<T> newInstance(
Expand Down Expand Up @@ -234,7 +235,8 @@ public void onDayClick(long day) {
yearSelector.addItemDecoration(createItemDecoration());
}

if (root.findViewById(R.id.month_navigation_fragment_toggle) != null) {
toggle = root.findViewById(R.id.month_navigation_fragment_toggle);
if (toggle != null) {
addActionsToMonthNavigation(root, monthsPagerAdapter);
}

Expand Down Expand Up @@ -373,6 +375,7 @@ static int getDayHeight(@NonNull Context context) {
void setSelector(CalendarSelector selector) {
this.calendarSelector = selector;
if (selector == CalendarSelector.YEAR) {
toggle.setIconResource(R.drawable.material_ic_menu_arrow_up_black_24dp);
yearSelector
.getLayoutManager()
.scrollToPosition(
Expand All @@ -382,6 +385,7 @@ void setSelector(CalendarSelector selector) {
monthPrev.setVisibility(View.GONE);
monthNext.setVisibility(View.GONE);
} else if (selector == CalendarSelector.DAY) {
toggle.setIconResource(R.drawable.material_ic_menu_arrow_down_black_24dp);
yearFrame.setVisibility(View.GONE);
dayFrame.setVisibility(View.VISIBLE);
monthPrev.setVisibility(View.VISIBLE);
Expand Down