Giter Club home page Giter Club logo

flexiblecalendar's People

Contributors

gitter-badger avatar haliquim avatar p-v avatar pedrofsn avatar twig 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

flexiblecalendar's Issues

Disable day selection

Is there a way to disable touch selection for days? I want to enable selected state only for specific days

Event dot not show for today date and on day selected.

I am showing green dot for the event. But for the today date event dot is not showing.
Also when I select some date. then white background will display on date and dot disappear.

I want to know how to show event dot for the selected date and today date.

Can't use "for"on calendarView.setEventDataProvider

When I try to use the " for " to put in several days with events , does not work.
For example:

calendarView.setEventDataProvider(new FlexibleCalendarView.EventDataProvider() {
@OverRide
public List<? extends Event> getEventsForTheDay(int year, int month, int day) {
return getEventColorList(year, month, day);
}

        private List<? extends Event> getEventColorList(int year, int month, int day) {
            int sdf;
           do {
                int joka = 0;
                for (int jbf = 0; jbf < m_parts.size(); jbf++) {
                    if (datameio.getTime().after(m_parts.get(jbf).getDataInicio()) && datameio.getTime().before(m_parts.get(jbf).getDataFim()) || datameio.getTime().equals(m_parts.get(jbf).getDataInicio()) && datameio.getTime().before(m_parts.get(jbf).getDataFim()) || datameio.getTime().after(m_parts.get(jbf).getDataInicio()) && datameio.getTime().equals(m_parts.get(jbf).getDataFim())) {
                        joka++;
                    }
                }
                List<CalendarEvent> eventColors = new ArrayList<>();
                int ano = datameio.get(Calendar.YEAR);
                int mes =datameio.get(Calendar.MONTH);
                int dia =datameio.get(Calendar.DAY_OF_MONTH);
                if (year ==ano && month == mes && day ==dia ) {
                   for (int i = 0; i < joka; i++) {
                    eventColors.add(new CalendarEvent(android.R.color.holo_purple));
                    }

                    return eventColors;
            }
            datameio.add(Calendar.DATE, 1);
        } while (datameio.before(datamaistarde));

            return null;

        }
    });

android.content.res.Resources$NotFoundException: Resource ID #0x0

I suggest replacing this line:
eventPaint.setColor(getContext().getResources().getColor(e.getColor()));
with
eventPaint.setColor(ContextCompat.getColor(getContext(), e.getColor()));

Can you fix it?

E/AndroidRuntime: FATAL EXCEPTION: main
                  android.content.res.Resources$NotFoundException: Resource ID #0x0
                      at android.content.res.Resources.getValue(Resources.java:1233)
                      at android.content.res.Resources.getColor(Resources.java:887)
                      at com.p_v.flexiblecalendar.view.CircularEventCellView.setEvents(CircularEventCellView.java:109)
                      at com.p_v.flexiblecalendar.FlexibleCalendarGridAdapter.drawDateCell(FlexibleCalendarGridAdapter.java:144)
                      at com.p_v.flexiblecalendar.FlexibleCalendarGridAdapter.getView(FlexibleCalendarGridAdapter.java:133)
                      at android.widget.AbsListView.obtainView(AbsListView.java:2344)
                      at android.widget.GridView.makeAndAddView(GridView.java:1433)
                      at android.widget.GridView.makeRow(GridView.java:361)
                      at android.widget.GridView.fillDown(GridView.java:302)
                      at android.widget.GridView.fillFromTop(GridView.java:437)
                      at android.widget.GridView.layoutChildren(GridView.java:1276)
                      at android.widget.AbsListView.onLayout(AbsListView.java:2148)
                      at android.view.View.layout(View.java:15596)
                      at android.view.ViewGroup.layout(ViewGroup.java:4966)
                      at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
                      at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
                      at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
                      at android.view.View.layout(View.java:15596)
                      at android.view.ViewGroup.layout(ViewGroup.java:4966)
                      at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1695)
                      at android.view.View.layout(View.java:15596)
                      at android.view.ViewGroup.layout(ViewGroup.java:4966)
                      at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
                      at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
                      at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
                      at android.view.View.layout(View.java:15596)
                      at android.view.ViewGroup.layout(ViewGroup.java:4966)
                      at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
                      at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
                      at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
                      at android.view.View.layout(View.java:15596)
                      at android.view.ViewGroup.layout(ViewGroup.java:4966)
                      at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:122)
                      at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
                      at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1192)
                      at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:814)
                      at android.view.View.layout(View.java:15596)
                      at android.view.ViewGroup.layout(ViewGroup.java:4966)
                      at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1187)
                      at android.view.View.layout(View.java:15596)
                      at android.view.ViewGroup.layout(ViewGroup.java:4966)
                      at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
                      at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
                      at android.view.View.layout(View.java:15596)
                      at android.view.ViewGroup.layout(ViewGroup.java:4966)
                      at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
                      at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
                      at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
                      at android.view.View.layout(View.java:15596)
                      at android.view.ViewGroup.layout(ViewGroup.java:4966)
                      at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
                      at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
                      at android.view.View.layout(View.java:15596)
                      at android.view.ViewGroup.layout(ViewGroup.java:4966)
                      at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
                      at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
                      at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
                      at android.view.View.layout(View.java:15596)
                      at android.view.ViewGroup.layout(ViewGroup.java:4966)
                      at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
                    at android.widget.FrameLayout.onLa

My events do not get populated until I select a date in the calendar

even if i call flexibleCalendarView.selectDate() function, the events are show only after user interaction. I have a predefined list of events which should populate as soon as the calendar is created. I see you have done that in calendar 3 but I can't seem to make it work.

         calendarView.setEventDataProvider(new FlexibleCalendarView.EventDataProvider() {
            @Override
            public List<? extends Event> getEventsForTheDay(int year, int month, int day) {
                for (int i = 0; i < size; i++)
                {
                    if(i<presentList.size()) {
                        if (year == 2016 && month == 9 && day == presentList.get(i)) {
                            List<CustomEvent> colorLst1 = new ArrayList<>();
                            colorLst1.add(new CustomEvent(R.color.present));
                            return colorLst1;
                        }
                    }
                    if(i<absentList.size())
                    {
                        if (year == 2016 && month == 9 && day == absentList.get(i)) {
                            List<CustomEvent> colorLst1 = new ArrayList<>();
                            colorLst1.add(new CustomEvent(R.color.absent));
                            return colorLst1;
                        }}
                    if(i<sickList.size()) {
                        if (year == 2016 && month == 9 && day == sickList.get(i)) {
                            List<CustomEvent> colorLst1 = new ArrayList<>();
                            colorLst1.add(new CustomEvent(R.color.sick));
                            return colorLst1;
                        }
                    }
                }
                return null;
            }
        });

Events are not displaying until I click a date

Or maybe it's the FlexibleCalendar#refresh() not working?

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.1.1'
    compile 'com.p_v:flexiblecalendar:1.2.1'
}
private Map<Date,List<CustomEvent>> eventMap = new HashMap<>();

viewHolder.calendar.setEventDataProvider(new FlexibleCalendarView.EventDataProvider() {
            @Override
            public List<? extends Event> getEventsForTheDay(int year, int month, int day) {
                return getEvents(year, month, day);
            }
        });

public List<CustomEvent> getEvents(int year, int month, int day){
        cal.set(Calendar.YEAR, year);
        cal.set(Calendar.MONTH, month);
        cal.set(Calendar.DAY_OF_MONTH, day);

        return eventMap.get(cal.getTime());
    }

@Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
        Log.e(LOG_TAG, "onLoadFinished");
        switch (loader.getId()) {
            case CALENDAR_EVENT_LOADER:
                if (data != null && data.moveToFirst()) {
                    do {
                        String mainActivity = data.getString(COL_MAIN_ACTIVITY_TITLE);
                        String activity = data.getString(COL_ACTIVITY_TITLE);
                        String categoryName = data.getString(COL_CATEGORY_NAME);
                        String fieldContent = data.getString(COL_FIELD_CONTENT);

                        try {
                            Date date = DateFormat.getDateInstance().parse(fieldContent);

                            CustomEvent event = new CustomEvent(mainActivity, activity, categoryName, date, android.R.color.holo_blue_bright);

                            // Update eventMap with new event
                            List<CustomEvent> events = eventMap.get(date);
                            if (events == null) {
                                events = new ArrayList<>();
                                eventMap.put(date, events);
                            }
                            events.add(event);

                        } catch (ParseException e) {
                            e.printStackTrace();
                        }
                    } while (data.moveToNext());
                    Log.e(LOG_TAG, "refresh");
                    viewHolder.calendar.refresh();
                    viewHolder.calendar.refreshDrawableState();
                }
                break;
            default:
                break;
        }
    }

Code is in a Fragment and i'm using a LoaderManager.

Can you help me?

the view doesnt refresh in API 23 android studio 2.0

after i update my android studio and change
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
when i use calendarview.refresh() it doesnt update the view. the events not appear in the calendar neither in the examples of the git.

Add a Monday start calendar

Add an option to set the calendar week to start on Monday instead of Sunday. I have managed how to do that but you can do it better.

Overlap current day

Is there any way to overlap current day selection by user day selection?

For example, the current day is the 8th of March and selected day is the 10th of March:
image

And there selected day is the 8th of March too, but it's not visible:
image

I think that selected day is more important than current.

ScrollView Problem

When I add FlexibleCalendarView inside a ScrollView the calendar has problem showing correctly
problem

1st day of month is selected by default

Hi.
Nice library.
My problem is, the 1 day of month is shown selected by default and this occurs when the month is changed. I am not able to disable this. I dont want the 1st day of month to be shown selected. Am I missing something?

Also, I wish to have multiple date selections, for that purpose i added a clicklistener to getCellView but the clicklistener is not working.

Go to today function

Maybe add a function that instead to go to current month, another that goes to the current day.

SetEventDataProvider

calendarView.setEventDataProvider(new FlexibleCalendarView.EventDataProvider() {
@OverRide
public List<?extends CustomEvent> getEventsForTheDay(int ye, int mo, int da)
{

            Log.e("Month", "" + mo);
            Log.e("Year", "" + ye);

            return null;
        }
    });

This run more than 500 times..

Enhancement

Better, If you could add date range selection to this.

Drawing issues on getWeekdayCellView() method

I inflate each of my WeekdayCellView with a layout like is shown in the code.

@Override
public BaseCellView getWeekdayCellView(int position, View convertView, ViewGroup parent) {
    BaseCellView cellView = (BaseCellView) convertView;

    if (cellView == null) {
        LayoutInflater inflater = LayoutInflater.from(MaterialFullCalendar.this);
        cellView = (BaseCellView) inflater.inflate(R.layout.fullcalendar_weekday_cell, null);
    }

    return cellView;
}

But when I run my app, the layout isn't filled correctly and some pixels are skipped. Notice that in the image below, the above blue is part of the Toolbar and just below I have my FlexibleCalendarwidget.

drawing-issue

drawing-issue-2

Disable scroll

Hi. I can't set the calendar to specific month and year to display and disable scrolling. E.g. I want to display just one month without change it. How can I do that?

Grey Out past dates ?

Grey out or disable all the previous dates. Is there a way to do this ?

One way to do this : Add all the dates to an event and change the background, but this is not the optimal way!

Any idea otherwise?

SELECTED_TODAY does not set both states correctly

            case BaseCellView.TODAY:
                cellView.addState(BaseCellView.STATE_TODAY);
                break;
            case BaseCellView.SELECTED_TODAY:
            case BaseCellView.SELECTED:
                cellView.addState(BaseCellView.STATE_SELECTED);
                break;

Next month with less days than previous

There is a problem in OnMonthChangeListener when swiping left or right, if lateral month have less days then present the month returned is next (or previous).
See picture: now is Jan 29, swiping on February listener return March but days are 28.
Thanks.
collage

Events as color cell

Is it possible to have events shown as a different color cell? I mean, if you have standard blue cells for example, when you have an event, just paint the whole cell red.

Is it possible?

EDIT: I don't really need events, any way that makes possible to inflate each cell with a different layout based on the date will help.

Issues with new Android support lib v23.2.0

There's a few issues I'm having with the new support library. First is when i perform calendarView.goToCurrentDay(); I get this error

Process: PID: 27352 java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 10000, found: 402 Pager id: ffffffff Pager class: class com.p_v.flexiblecalendar.MonthViewPager Problematic adapter: class com.antonyt.infiniteviewpager.InfinitePagerAdapter

The other issue I'm having is with calendarView.refresh() which doesn't seem to be working anymore. It was working flawlessly until the new support lib broke the world ;) JK, any help or updates would be most gratefully appreciated!

To note as well when I page a few months to the right my events start to actually show in the calenderView. I'm not sure what to be looking for on this particular issue but I'm positive it's related to the new support library.

NPE when user clicks on date outside current month

http://imgur.com/a/d6uKs
When clicking on the bottom "5" before clicking on a date within the current month, the following NPE occurs.
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.p_v.flexiblecalendar.entity.SelectedDateItem.equals(java.lang.Object)' on a null object reference at com.p_v.flexiblecalendar.MonthViewPagerAdapter.refreshUserSelectedItem(MonthViewPagerAdapter.java:210) at com.p_v.flexiblecalendar.FlexibleCalendarView$MonthChangeListener.onPageSelected(FlexibleCalendarView.java:326) at android.support.v4.view.ViewPager.dispatchOnPageSelected(ViewPager.java:1939) at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:687) at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:671) at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:632) at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:624) at com.antonyt.infiniteviewpager.InfiniteViewPager.setCurrentItem(InfiniteViewPager.java:48)

Adding new types of "days"

Looking at your values.xml, I saw state_dates such as REGULAR, TODAY, SELECTED, OUTSIDE_MONTH, etc, I was hoping to add a few new ones (such as PUBLIC HOLIDAY, etc).

Would it be sufficient to:

  • Create my own declarable styles and add to CellState
  • Not quite sure where to link the EventDataProvider to the cell generation.
  • Check int cellType for CellState.PUBLIC_HOLIDAY during FlexibleCalendarView.CalendarView.getCellView() (or getWeekdayCellView()? I'm a little confused about the difference between the two)

Sorry if this has been asked before, but I was wondering what the most "correct" way of adding this would be.

Event is not visible when selected

We have event on date 6th, it will display event bullet but when we select 6th only background color will get displayed. Is there any method to show event on selected date?

1

2

SelectDate not working for past month

I'm trying to remember last selected date position of calendar which is working fine, but when user select date in previous month then next time when i try to set the same date calendar starts to malfunction.

wrap_content on FlexibleCalendarView

If the layout is:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <com.p_v.flexiblecalendar.FlexibleCalendarView
        android:id="@+id/flexibleCalendarView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/darker_gray"/>

    ...

</LinearLayout>

It looks like:

0

But if I wrap it into ScrollView:

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
            
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        
        <com.p_v.flexiblecalendar.FlexibleCalendarView
            android:id="@+id/flexibleCalendarView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/white"/>
        
        ...

    </LinearLayout>

</ScrollView>

It looks like:

1

How can I prevent this issue without setting absolute size in dp to FlexibleCalendarView?

Major Issue

is not worked.. called lot of times
calendarView.setEventDataProvider(new FlexibleCalendarView.EventDataProvider() {
@OverRide
public List<?extends CustomEvent> getEventsForTheDay(int ye, int mo, int da)
{

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.