applikeysolutions / cosmocalendar Goto Github PK
View Code? Open in Web Editor NEW📅 CosmoCalendar is a fully customizable calendar with a wide variety of features and displaying modes.
Home Page: https://applikeysolutions.com
License: MIT License
📅 CosmoCalendar is a fully customizable calendar with a wide variety of features and displaying modes.
Home Page: https://applikeysolutions.com
License: MIT License
Hello Applikey Team,
@AppliKey First of all, thank you to make a customizable library for range selection of the calendar.
I want to need a help on a particular day with some price [especally another TextView for that] you can see a screenshot : Link. Need help!
I appreciate your wonderful library.
Thanks.
1.in CircleAnimationTextView canvas.drawCircle()may has a wrong height
2.can you add some delegate of before current can not choosed
3. CircleAnimationTextView in wrong call when qucik click
Add posibility mark days how to special days, for fix holidays in calendar, chistmas...
My suggestion...
Simple method:
setHolidayDays...
holydayDayTextColor
disabledHolidayDayTextColor (priority color, if don't set, get disabledDayTextColor)
Other case
In the future you may want to support seasons, so you can see if you are selecting a high season day, low ...
seasonDays , seasonColor , seasonColorDisable (optional)
//High Season
Set<Long> seasonHighDaysSet = new HashSet<>();
calendarView.setSeasonDays(seasonHighDaysSet,Color.Green);
calendarView.setSeasonDays(seasonHighDaysSet,Color.Green,Color.LightGreen);
//Low season
Set<Long> seasonLowDaysSet = new HashSet<>();
calendarView.setSeasonDays(seasonLowDaysSet ,Color.Blue);
calendarView.setSeasonDays(seasonLowDaysSet ,Color.Blue,Color.LightBllue);
//Winter season
Set<Long> seasonWinterDaysSet = new HashSet<>();
calendarView.setSeasonDays(seasonWinterDaysSet ,Color.Orange);
calendarView.setSeasonDays(seasonWinterDaysSet ,Color.Blue,Color.LightOrange);
...
seasonColorDisable (priority color, if don't set, get disabledDayTextColor)
When put this view inside BottomSheetFragment with any ScrollView(NestedScrollView etc), Calendar shows few second later and click actions also delayed. When the click action triggered after few seconds later calendar jumped to another year and shows overlapped views.
How i can select range date from code?
how to set listener when calendar on click ?
Hii ApplikeySolutions thank for this beautiful calendar first,
i'm want to show multiple connected days in range selectionType and sometime i have only one day to show selected on calendar view is there any way i show multiple range with multiple selection on calendar
Hello good sir,
I hope i'm not being rude but if I am please forgive me,
I wonder if you can update the sample code?
I'm having a difficult time to try and replicate the result as shown in your demo images.
Some difficulties that I'm currently facing:
I'd say this is a pretty cool looking calendar and I'm hoping to understand more about using them. Any help is much appreciated. I'll make a separate individual question and link to this one later.
I'm looking a way to highlight some days (with a little dot below the number) like the march 2nd or 10th on this picture. Great lib !
for example, today is November 28, 2017, will be the date of the arrow marked today, I just click on a date in radio mode, then, on November 3, 2017 will also be marked as the current date, mean there will be two current date, however, the problem is not inevitable
Hi, i want to know if exists a way to disable a period and not a single day.
With Set solution it's not comfortable to select a period.
Regards
Hi, I have a problem that is not so clear that click events can't get the full date.
I used OnMonthChangeListener but could only get the monthName. Is there anyway i could get the date or even just the year when changing months or years? Thanks
stupid me.. found it.. thanks anyway
Please help me how can i change day cell layout in this library, is it possible to change or not?
I often have the use case to select not only a date or range, but also a start date with time to end date with time. Or even on a single day to select start and end time.
So it's very often a combination between date (calendar, single day or range) and time (start and end time).
Maybe you could find a good solution to combine this calendar with time.
How can we detect month change? Is there any listener?
how can i disable all Sunday and 15-10-2017?
The ability to add multiple sets of connected days is a really useful feature - thanks for adding.
Unfortunately I am experiencing a performance issue as this method is blocking the UI thread. If I add 14 connected days it is noticeable and if I scale this up to 100 days it blocks for around 5 seconds. The bottleneck is being caused by this method...
@Override public void updateConnectedCalanderDays(ConnectedDays connectedDaysSet) throws Exception { calendarView.addConnectedDays(connectedDaysSet); }
As this method updates the GUI, i want to be able to call it in my onPostExecute method of Async task and ideally need it to work on the main UI thread. I did try to wrap in a background thread out of curiosity but it throws an index out of bounds exception.
Can you recommend an approach that would allow me to efficiently update the calendar with large numbers of connected days?
how supprot RTL
Hi This demo is not stable. It is crashing every where whenever I click on any element.
Please look into it.
Did anyone come across this problem?
Like bolding, the text of selected date is also bolding a random date without the circle. I think the recycler view is having a spread over issue. Can someone help me with this
after using selectionmanager on calenderview date selected animation is not displaying.
Hi,
this library is great. It's possible to drag the FIRST_RANGE_DAY or END_RANGE_DAY to extend or reduce the selected days?
Hi team,
On Android O (8.0.0), the calendar can not load date from January 2019 (Samsung S8 device).
Can u help to check?
Thanks
Is there any way to disable past dates ?
Can we set range for no of months displayed in the calendar (current month to next year current month)?
When we apply margin/padding to the view in selectionType = "range", selection path is not working properly like it's shifted towards bottom and goes outside of start and end date selection circle from bottom only
so can you provide any suggestion or solution regarding this ?
find this attached image
also can please tell how to manage min date and max date selection
hello i try to create the calendarview without inserting it in my layout view
this is my code
calendarView = new CalendarView(mAct);
calendarView.setCalendarOrientation(OrientationHelper.HORIZONTAL);
calendarView.setSelectionType(SelectionType.SINGLE);
calendarView.setFirstDayOfWeek(1);
calendarView.setSelectedDayBackgroundColor(Color.parseColor("#000000"));
calendarView.setShowDaysOfWeekTitle(true);
then add an event on image button
AddButton.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
new CalendarDialog(mContext, new OnDaysSelectionListener() {
@Override
public void onDaysSelected(List<Day> selectedDays) {
Log.d(TAG,"FONCTION onDaysSelected DATA " );
int size_date = selectedDays.size();
Log.d(TAG,"FONCTION size_date : "+size_date );
for(int idate=0; idate < size_date; idate++ ) {
String date_value = selectedDays.get(idate).toString();
Log.d(TAG,"date_value : "+date_value );
String date_mysql = transform_date (date_value);
Log.d(TAG,"date_mysql : "+date_mysql );
tv_1.setText(date_mysql);
}
}
}).show();
}
});
but i have the following error :
ava.lang.NullPointerException: Attempt to invoke virtual method 'int com.applikeysolutions.cosmocalendar.settings.SettingsManager.getCalendarOrientation()' on a null object reference
01-10 17:31:39.244 6297-6297/com.careit W/System.err: at com.applikeysolutions.cosmocalendar.view.CalendarView.setDaysOfWeekTitles(CalendarView.java:251)
01-10 17:31:39.244 6297-6297/com.careit W/System.err: at com.applikeysolutions.cosmocalendar.view.CalendarView.init(CalendarView.java:234)
01-10 17:31:39.245 6297-6297/com.careit W/System.err: at com.applikeysolutions.cosmocalendar.view.CalendarView.(CalendarView.java:105)
01-10 17:31:39.245 6297-6297/com.careit W/System.err:
Hi,
Thanks for putting together this very useful library.
I encountered this error when rapidly scrolling through months with the calendar in horizontal configuration and the selection type set to multiple. To be honest this was more of a stress test, but i ended up with this exception...
java.util.ConcurrentModificationException · Raw ArrayList.java:573java.util.ArrayList$ArrayListIterator.next CalendarView.java:573com.applikeysolutions.cosmocalendar.view.CalendarView.getSelectedDays CalendarView.java:628com.applikeysolutions.cosmocalendar.view.CalendarView.onDaySelected MultipleSelectionManager.java:38com.applikeysolutions.cosmocalendar.selection.MultipleSelectionManager.toggleDay DayDelegate.java:38com.applikeysolutions.cosmocalendar.view.delegate.DayDelegate$1.onClick View.java:5226android.view.View.performClick View.java:21266android.view.View$PerformClick.run Handler.java:739android.os.Handler.handleCallback Handler.java:95android.os.Handler.dispatchMessage Looper.java:168android.os.Looper.loop ActivityThread.java:5845android.app.ActivityThread.main Method.java:-2java.lang.reflect.Method.invoke ZygoteInit.java:797com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run ZygoteInit.java:687com.android.internal.os.ZygoteInit.main
There is also noticeable lag when scrolling quickly through the months - i wondered if it's possible to set a limit on how far in the future/past the user is able to scroll? For example, can I limit the calendar to scroll no further than 1 year in the future?
Many thanks in advance
You can not select any date from the last row, Even calendar keeps moving downwards or upwards automatically when you try to view the last row.Please fix this issue asap. I have to use this library.
@leonardo2204
Flow goes like below:
The issue is that once the day is disabled , it is always disabled for the whole lifecycle.
Hi, i have a problem when trying to set weekend days. Doesn't matter what days or how many days I add into the hashSet, nothing will change
hello
by default we can select one or more days, how can i limit to a single day ?
thanks
Is there a way to disable click on CalendarView?
day=Mon Dec 04 00:26:26 GMT+06:30 2017 to 2017-12-4 bro
I want to add default date ranges when I open the calendar, example from January 15 to January 25.
Hi,
I have a webservice that need to get a list of dates. I need to parse those dates and show them in the selected state in the calendarview. But I didn't find any method that sets a day in the selected state without clicking on the day.
So far I've tried the following,
public class ShiftSelectionManager extends BaseCriteriaSelectionManager {
private Context context;
private Set<Day> days = new HashSet<>();
CustomDelegate delegate;
static Day selectedDay;
public ShiftSelectionManager(Context context, CustomDelegate delegate, OnDaySelectedListener onDaySelectedListener) {
this.context = context;
this.onDaySelectedListener = onDaySelectedListener;
this.delegate = delegate;
}
@Override
public void toggleDay(@NonNull Day day) {
this.selectedDay =day;
Calendar cal = day.getCalendar();
Log.v("CAL", cal.getTime()+"");
if (cal.getTime().equals(new Date()) || cal.getTime().before(new Date())) {
Utils.customAlert(context, "Oops!", "You cannot choose a shift that is today or in the past shifts.", null);
}else{
if (days.contains(day)) {
((ScheduleCalendarActivity)context).lnrCalendarSheet.setVisibility(View.VISIBLE);
} else {
((ScheduleCalendarActivity)context).lnrCalendarSheet.setVisibility(View.GONE);
Intent intent = new Intent(context, SelectShiftActivity.class);
SelectShiftActivity.delegate = delegate;
intent.putExtra("Calendar", cal);
context.startActivity(intent);
}
}
}
@Override
public boolean isDaySelected(@NonNull Day day) {
return days.contains(day);
}
@Override
public void clearSelections() {
days.clear();
}
public void removeDay(Day day) {
days.remove(day);
//((ScheduleCalendarActivity)context).calendar.update();
//onDaySelectedListener.onDaySelected();
}
//Add single day
public void addDay(){
days.add(selectedDay);
isDaySelected(selectedDay);
}
public void addAllDays(Set<Day> days){
this.days = days;
}
}
And on my activity I did the following,
//Setup the Calendar View
void setupCalendar() {
calendar.setCalendarOrientation(OrientationHelper.HORIZONTAL);
calendar.setSelectionType(SelectionType.MULTIPLE);
calendar.setSelectedDayBackgroundColor(Color.parseColor(Theme.PRIMARYCOLOR));
calendar.setSelectionManager(new ShiftSelectionManager(this, myDelegate, new OnDaySelectedListener() {
@Override
public void onDaySelected() {
}
}));
}
//Get Date From API
void setupSchedule() {
AppPrefs prefs = new AppPrefs(this);
Map<String, String> map= new HashMap<>();
map.put("Authorization","Bearer "+prefs.getStringFromKey(Sharedkey.accessTokenKey));
ApiRequests.HttpGetShiftList(this,map,"/v11/shift/get/myshift", new IHttpListener() {
@Override
public void OnSuccess(Object obj) {
try {
JSONObject feedObj = new JSONObject((String) obj);
JSONArray feedObjJSONArray = feedObj.getJSONArray("shift");
for (int i = 0; i < feedObjJSONArray.length(); i++) {
JSONObject singleFeedObj = feedObjJSONArray.getJSONObject(i);
Schedule schedule = new Gson().fromJson(singleFeedObj.toString(), Schedule.class);
myShiftList.add(schedule);
daySet.add(new Day(Utils.toFormattedDate(schedule.getDateOfShift())));
}
if (calendar.getSelectionManager() instanceof ShiftSelectionManager) {
((ShiftSelectionManager) calendar.getSelectionManager()).addAllDays(daySet);
}
calendar.update();
} catch (Exception e) {
}
}
@Override
public void OnError(String error) {
}
});
}
Hi. Thanks for beautiful calendar. I use it some apps. and now need for persian calendar. can this calendar show just persian calendar
When I choose range day, end range always return one day after start range
this is my code :
CalendarDialog cal = new CalendarDialog(getActivity());
cal.setOnDaysSelectionListener(new OnDaysSelectionListener() {
@OverRide
public void onDaysSelected(List selectedDays) {
if (selectedDays.size()>0) {
checkin_date = selectedDays.get(0).getCalendar().getTime();
checkin_string_date = formatMonth.format(checkin_date)+"/"+formatDay.format(checkin_date)+"/"+formatYear.format(checkin_date);
tanggalin.setText(ExtradateFormatForMonth.format(checkin_date));
if (selectedDays.size()>1)
{
checkout_date = selectedDays.get(1).getCalendar().getTime();
checkout_string_date = formatMonth.format(checkout_date)+"/"+formatDay.format(checkout_date)+"/"+formatYear.format(checkout_date);
tanggalout.setText(ExtradateFormatForMonth.format(checkout_date));
}
}
}
});
cal.show();
cal.setSelectionType(SelectionType.RANGE);
Hi,
Is it possible to select a day in the calendar programmatically? So I want to do something like calendar.SelectDate(date);
and that it then selects the date in the calendar visually.
Thanks!
maybe we could:
.setMinimumDate(CalendarDay.from(2018, 10, 1))
.setMaximumDate(CalendarDay.from(2018, 5, 5))
thanks
How to disable months after a particular range like before march 2018 or after june 2018 ?
I want to set different background colors of the selected days. How can I do it?
our project must support api 14 devices, this can't work!!!!!compile error!!!!!
@leonardo2204 Hello there, First I real appreciate for your work. This library is awesome.
I'm trying to implement this one to my project. I don't know why the circle animation background is not full fill the height. This is how it look like.
I was tried to look at this method and customize them, but no luck
public static int getDisplayWidth(Context context) {
return ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth();
}
private void setDaysAccordingToSet(Set<Long> days, DayFlag dayFlag) {
if (days != null && !days.isEmpty()) {
for (Month month : months) {
for (Day day : month.getDays()) {
switch (dayFlag) {
case WEEKEND:
day.setWeekend(days.contains(day.getCalendar().get(Calendar.DAY_OF_WEEK)));
break;
case DISABLED:
day.setDisabled(CalendarUtils.isDayInSet(day, days));
break;
case FROM_CONNECTED_CALENDAR:
day.setFromConnectedCalendar(CalendarUtils.isDayInSet(day, days));
break;
}
}
}
notifyDataSetChanged();
}
}
you probably should cast day.getCalendar().get(Calendar.DAY_OF_WEEK) to long or switch to Set because Calendar.get(Calendar.DAY_OF_WEEK) returns int and your check is not always correct
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.