Giter VIP home page Giter VIP logo

cosmocalendar's People

Contributors

applikey avatar leonardo2204 avatar ostapenko-yura avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cosmocalendar's Issues

Modification of day view with another TetxView, Need help!

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.

screenshot_20180921-152633

Some suggestions

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

Request feature: Mark special Days

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)

Very Slow in BottomSheetFragment

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.

Multiple Connected days

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

Sample Update & Usage Questions

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:

  1. How do I add Events in certain days like in demo images? Is it related to this 'Connected Days'? I noticed the dots under each day view in the demo but I'm not sure how to replicate that,
  2. What is the function of 'Connected Days', i read about it about marking a special day but i'm not sure how to properly use it and if it's the answer for my question 1,
  3. When selecting date (range/multiple) how do i hide the bottom window that are visible after date selection? can it be optional?
  4. How do I customize the title of the month like in demo images?

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.

Highlight specific days

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 !

There might be two current date icon

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

Disable period

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

date click event

Hi, I have a problem that is not so clear that click events can't get the full date.

How to get Date or Year when changing months

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

Suggestion/idea: combine this great calendar with time selection

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.

Performance Issue with 'updateConnectedCalanderDays'

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?

Demo is not stable

Hi This demo is not stable. It is crashing every where whenever I click on any element.
Please look into it.

Layout selection issue

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

device-2018-09-04-182756

create calendarview programmatically

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:

ConcurrentModificationException

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

Disable day within selected range

Should the user be allowed to select a range date, when within it, there is a disabled (or more than one) disabled day ?

For instance:
screenshot_1507162832

October 4th is disabled

I'd gladly drop a PR fixing it (if it's a bug)

Weekend days wont change

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

How can I select days in calendar without clicking on a date in the calender view?

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) {

            }
        });
    }
 

Persian calendar

Hi. Thanks for beautiful calendar. I use it some apps. and now need for persian calendar. can this calendar show just persian calendar

wrong end range in RANGE selection type

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);

Select date programmatically

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!

the circle animation background not full fill the height

@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.
24337651_1637292026291669_504787478_n
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();
    }

I think you should switch from Set<Long> to Set<Integer>

 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.