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

Need to show highlighted days only, not ranges #16

Open
Shaw007 opened this issue Jan 26, 2015 · 11 comments
Open

Need to show highlighted days only, not ranges #16

Shaw007 opened this issue Jan 26, 2015 · 11 comments

Comments

@Shaw007
Copy link

Shaw007 commented Jan 26, 2015

Hi,
I am trying to change your code to achieve something that I want but unfortunately things are not going in the right direction. I have an ArrayList and all i want is to highlight the calendar list dates based on the data in the list i.e I don't want any ranges. Can you please help me out..?

@eeVoskos
Copy link

+1

6 similar comments
@Shahroz16
Copy link

+1

@sunswy
Copy link

sunswy commented Jun 10, 2015

+1

@anirudh-24
Copy link

+1

@ameenmaheen
Copy link

+1

@Jalsoncc
Copy link

Jalsoncc commented Apr 4, 2016

+1

@buddhasaikia
Copy link

+1

@rugved-mahamune
Copy link

dayPickerView.setDateTime(new SimpleMonthAdapter.CalendarDay(startdate.getTime()));
dayPickerView.setDateTime(new SimpleMonthAdapter.CalendarDay(enddate.getTime()));
first is start date and second is end date. call in calendar activity.

@sweetie
Copy link

sweetie commented Jul 2, 2016

@rugved-mahamune not recognized method .setDateTime.

@rugved-mahamune
Copy link

public void setSelectedDateTime(CalendarDay calendarDay){
    if (selectedDays.getFirst() != null && selectedDays.getLast() == null)
    {
            selectedDays.setFirst(null);
            notifyDataSetChanged();
            return;
        }
        selectedDays.setLast(calendarDay);
        if(selectedDays.getLast().getDate().getTime() < selectedDays.getFirst().getDate().getTime()) {
            CalendarDay tmp = selectedDays.getFirst();
            selectedDays.setFirst(selectedDays.getLast());
            selectedDays.setLast(tmp);
        }
        if (selectedDays.getFirst().month < calendarDay.month)
        {
            for (int i = 0; i < selectedDays.getFirst().month - calendarDay.month - 1; ++i)
                mController.onDayOfMonthSelected(selectedDays.getFirst().year, selectedDays.getFirst().month + i, selectedDays.getFirst().day, selectedDays.getFirst().hourOfDay);
        }
        mController.onDaySelect(calendarDay, selectedDays, false);
        mController.onDateRangeSelected(selectedDays);
    }
    else if (selectedDays.getLast() != null)
    {
        selectedDays.setFirst(calendarDay);
        selectedDays.setLast(null);
        mController.onDaySelect(calendarDay, selectedDays, false);
    }
    else {
        selectedDays.setFirst(calendarDay);
        mController.onDaySelect(calendarDay, selectedDays, false);
    }
    notifyDataSetChanged();
}

Add the above function to SimpleMonthAdpter
and the below to DayPickerView
public void setDateTime(SimpleMonthAdapter.CalendarDay dateTime){
mAdapter.setSelectedDateTime(dateTime);
}
sorry I forgot I added these methods.. feel free to ask if any more bugs :)

@kumarbhubnesh
Copy link

kumarbhubnesh commented Dec 5, 2017

@rugved-mahamune Am Trying to do the same but there is extra bracket in your above method and no any method onDaySelect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests