material-calendar-view icon indicating copy to clipboard operation
material-calendar-view copied to clipboard

Bug: onLongClick

Open ankur2136 opened this issue 7 years ago • 0 comments
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.

ankur2136 avatar Feb 24 '18 01:02 ankur2136