Comments (5)
And also you can use for range selection like this :
calendarView.setSelectionManager(new RangeSelectionManager(new OnDaySelectedListener() {
@Override
public void onDaySelected() {
Log.e(" CALENDAR ", "========== setSelectionManager ==========");
Log.e(" CALENDAR ", "Selected Dates : " + calendarView.getSelectedDates().size());
if (calendarView.getSelectedDates().size() <= 0)
return;
Log.e(" CALENDAR ", "Selected Days : " + calendarView.getSelectedDays());
Log.e(" CALENDAR ", "Departure : DD MMM YYYY : " + formatDateToString(calendarView.getSelectedDays().get(0).getCalendar().getTime(), "dd MMM yyyy", ""));
Log.e(" CALENDAR ", " Return : DD MMM YYYY : " + formatDateToString(calendarView.getSelectedDays().get(calendarView.getSelectedDates().size() - 1).getCalendar().getTime(), "dd MMM yyyy", ""));
txt_departure_date.setText(formatDateToString(calendarView.getSelectedDays().get(0).getCalendar().getTime(), "dd MMM yyyy", ""));
txt_return_date.setText(formatDateToString(calendarView.getSelectedDays().get(calendarView.getSelectedDates().size() - 1).getCalendar().getTime(), "dd MMM yyyy", ""));
}
}));
from cosmocalendar.
selected date method is available.
use calendarview.getSelectedDates
which gives you a list of selected dates. based on your requirement you can access the list, first/last elements for start selected date and end selected date
from cosmocalendar.
For me, I used it as a layout not as dialog. So, I created a new MyCalendarView which extends this CosmoCalendar and then did override @OverRide
public void onDaySelected() {} and inside this method I used my own listener. Now it works. (btw, in my layout I used MyCalendarView)
from cosmocalendar.
You can use this, so that it works for you, your class puts this implements OnDaySelectedListener, it is going to put the @OverRide method
public void on DaySelected () {}, that's where you're going to implement what you want, and finally in the onCreate of the view you add this calendarView.setSelectionManager (new SingleSelectionManager (this));
from cosmocalendar.
@JaydipRadadiya
How can I change this into Kotlin?
I tried many different codes but it doesn't work.
calendar_view.selectionManager = object : RangeSelectionManager(OnDaySelectedListener { //... })
from cosmocalendar.
Related Issues (20)
- how disable or remove PREVIOUS dates ???
- Having trouble with changing weekdays in Kotlin
- Scroll issue when used in BottomSheetDialogFragment
- How to change current day text color
- Persian calendar
- How can i change to weekly view? HOT 4
- Can I change the starting week to Sunday? HOT 1
- Feature
- Modify color of the current day triangle?
- I want to mark few dates as selected and rest as disabled. How can i do this.
- Adding Marker in Calendar using Connected Days for events, task, note, etc. HOT 3
- New Version for Maven Central ?
- How to disable the month scroll? (Keep calendar limited to only current month)
- Abandoned repo. Avoid using.
- Select Start Date
- I want to set an initial value for a date in the calendar.
- Get rid off month outlines
- Wrong translation of the months
- Calendar displaying day wrong
- how to disable previous month button?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cosmocalendar.