material-calendar-view
material-calendar-view copied to clipboard
Bug: onLongClick
trafficstars
Long Press on March 29, 2018 selects March 1 , 2018 due to the following code.
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(firstDayOfWeek);
calendar.setTime(calendar.getTime());
calendar.set(Calendar.DAY_OF_MONTH, Integer.valueOf(dayOfMonthText.getText().toString()));
markDateAsSelected(calendar.getTime());
You are setting the time from the same instance you are getting the time which is pretty useless.
I think you meant to use calendar.setTime(this.calendar.getTime());
Better yet, refactor the code to use member variable naming so this wouldn't happen.