Giter VIP home page Giter VIP logo

android-week-view's People

Contributors

alamkanak avatar bwaim avatar cs8898 avatar entropitor avatar eyedev42 avatar fefelten avatar glennschmidt avatar jhoobergs avatar kimpark89 avatar m4droid avatar mauker1 avatar menthuss avatar psamim avatar raplider avatar reminv avatar sapuseven avatar se7kn8 avatar shuirna avatar subbuboyapati avatar thellmund 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

android-week-view's Issues

horizontalFlingEnabled does nothing

Setting horizontalFlingEnabled to false has no effect. Regardless of what you set, you can still fling the view. My understanding is that this setting would prevent you from scrolling multiple screens at once, but still allow you to scroll on screen at a time.

Screen rotation - WeekView goes to today

EDIT: Look at comments because there is a real bug.
When you rotate your device WeekView goes to today. Is there an option to prevent WeekView from this? Should I do it manually? In my opinion it is a bug and it shouldn't goes to today automatically.

Steps to reproduce:

  1. Scroll to any date other than today.
  2. Rotate your device.
  3. Date has changed to today.

Allow use of jsr310 types in API

Currently the builders use Calendar instances, which are not great to work with. I can see that internally they immediately convert to jsr310 objects. If you could expose those objects on the builder it would be helpful for cleaning up my APIs. Ditto providing a month change listener that takes those types.

MonthLoader requests wrong month

When MonthChangeListener.onMonthChange is called, it appears to be receiving the wrong startDate and endDate (they are for the next month).

The error is in MonthLoader.onLoad.

        final int year = periodIndex / 12;
        final int month = periodIndex % 12 + 1;

        final Calendar startDate = DateUtils.withTimeAtStartOfDay(today());
        startDate.set(Calendar.YEAR, year);
        startDate.set(Calendar.MONTH, month);
        startDate.set(Calendar.DAY_OF_MONTH, 1);

        final int maxDays = startDate.getActualMaximum(Calendar.DAY_OF_MONTH);

        final Calendar endDate = DateUtils.withTimeAtEndOfDay(today());
        endDate.set(Calendar.YEAR, year);
        endDate.set(Calendar.MONTH, month);
        endDate.set(Calendar.DAY_OF_MONTH, maxDays);

        final List<WeekViewDisplayable<T>> displayableItems =
                onMonthChangeListener.onMonthChange(startDate, endDate);

It is my understanding that startDate.set(Calendar.Month, month) is 0 indexed, so final int month = periodIndex % 12 + 1; should actually be final int month = periodIndex % 12;.

Daylight saving time - bug, one hour is missing and one is duplicated

Hello!
Firstly, thank you @thellmund for maintaining this library.

I found a bug connected with daylight saving time change.
31.03.2019 Poland changed time to DST (from 02:00 to 03:00) and I observed that time column contains two 03:00 hours. If system clock is set to 31.03.2019 all days have this bug:
image

I would be very grateful if you could fix it.

Problem with processing the date from Calendar

Hi,
It looks like there is some problem with the goToDate() function from the WeekView class. The point is that the function after receiving the date as Calendar type does not go to it.
For example:
It is the date 9/05/2019. I would like to go to the date 29/08/2021. After calling the goToDate() method, only the day changes. The year does not change at all, and the month only when it precedes or is next after the current month. In the case of May, the month can be changed only for April and June, and for no other. My guess is that this bug is on the library side. If you can find and fix it, that's great. If you need a more detailed description, I can prepare a simple application that illustrates this problem :)

Snap to first day of week

Hello,
is there some way I can get the WeekView to snap to the first day of the week when scrolling horizontally?
It should look like a paged view with one week per page.

goToDate() don't scroll to specific date

weekView.setDateTimeInterpreter(new DateTimeInterpreter() {
@OverRide
public String interpretDate(Calendar date) {
SimpleDateFormat weekdayNameFormat = new SimpleDateFormat("EEE", Locale.getDefault());
String weekday = weekdayNameFormat.format(date.getTime());
SimpleDateFormat format = new SimpleDateFormat(" d/MMM", Locale.getDefault());

            return weekday.toUpperCase() + format.format(date.getTime());
        }

        @Override
        public String interpretTime(int hour) {
            if (hour == 24) hour = 0;
            if (hour == 0) hour = 0;
            return hour + ":00";
        }
    });

    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(dateSelected);

    weekView.goToDate(calendar);

What is wrong? It is not scrolling do dateSelected, can you help me?

Remove truncation of event title

If the event title is longer than the event chip, it is currently truncated. As space is precious in a calendar view, not truncating the title seems like a better option.

Scroll detection not working correctly anymore

config.drawingConfig.currentOrigin.x % config.totalDayWidth != 0f isn't correct anymore

One of both values gets wrong calculated

also the horizontal fling seems to missplace the entitys

Cloned events do not have their data property set

When the library clones and modifies WeekViewEvent objects for events that span multiple days, the cloned event will not have it's data property set. When the user then taps the event, the library will throw an exception.

The following function is responsible for this:

List<WeekViewEvent> splitWeekViewEvents() {

    if (!isSameDay(clonedEndTime)) {
        clonedEndTime = (Calendar) startTime.clone();
        clonedEndTime.set(Calendar.HOUR_OF_DAY, 23);
        clonedEndTime.set(Calendar.MINUTE, 59);

        WeekViewEvent<T> event1 = new WeekViewEvent<>(id, title, startTime, clonedEndTime, location, isAllDay);
        event1.setColor(color);
        events.add(event1);

        // Add other days.
        Calendar otherDay = (Calendar) startTime.clone();
        otherDay.add(Calendar.DATE, 1);

        while (!DateUtils.isSameDay(otherDay, this.endTime)) {
            Calendar overDay = (Calendar) otherDay.clone();
            overDay.set(Calendar.HOUR_OF_DAY, 0);
            overDay.set(Calendar.MINUTE, 0);

            Calendar endOfOverDay = (Calendar) overDay.clone();
            endOfOverDay.set(Calendar.HOUR_OF_DAY, 23);
            endOfOverDay.set(Calendar.MINUTE, 59);

            WeekViewEvent<T> eventMore = new WeekViewEvent<>(id, title, overDay, endOfOverDay, location, isAllDay);
            eventMore.setColor(color);
            events.add(eventMore);

            // Add next day.
            otherDay.add(Calendar.DATE, 1);
        }

        // Add last day.
        Calendar startTime = (Calendar) this.endTime.clone();
        startTime.set(Calendar.HOUR_OF_DAY, 0);
        startTime.set(Calendar.MINUTE, 0);

        WeekViewEvent<T> event2 = new WeekViewEvent<>(id, title, startTime, this.endTime, location, isAllDay);
        event2.setColor(color);
        events.add(event2);
    } else {
        events.add(this);
    }

    return events;
}

Specifically, this way of cloning WeekViewEvents causes null values for the data property: WeekViewEvent<T> eventMore = new WeekViewEvent<>(id, title, overDay, endOfOverDay, location, isAllDay);

Can easily be reproduced by modifying one of the events in the sample project to span multiple days and then tapping on the event.

Color of WeekView event

Do you know how to set the color of a single event (rectangle in the timeline) on the XML side? It is possible to implement this on the Kotlin side, but I would rather do it on the XML layout side. I think that may be 'defaultEventColor', but it doesn't work.

Custom font

Can I change the font of all the textviews?

Header style

Can I get this style in the texts of the header?

cal

Custom event chip

Can I create custom event chip ? Like in listview, I create the view which will be in list !

notifyDataSetChanged() isn't working on latest version

I was thinking that notifyDataSetChanged() notify WeekView that it should invoke onMonthChange method but... no. I'm updating my events List and calling notifyDataSetChanged() but it does nothing, onMonthChange() which should load events isn't called. Should I invoke onMonthChange() manually when I want to update events?
This method is working fine on last release version but not in latest commit(s).

notifyDataSetChanged() not working

I am trying to add an event programatically, but I dont get to refresh the calendar. This is my code:

override fun onMonthChange(startDate: Calendar, endDate: Calendar): List<WeekViewDisplayable> {

    events = mDatabase!!.getEventsInRange(startDate, endDate)
    return events!!

}

override fun onEmptyViewClicked(time: Calendar) {

   val hour = String.format(Locale.getDefault(), "%02d:%02d",
                            time.get(Calendar.HOUR_OF_DAY),
                            time.get(Calendar.MINUTE))

   val event = Event(System.currentTimeMillis(),
                    "Event: $hour",
                    time,
                    endTime,
                    "",
                    ContextCompat.getColor(context, R.color.colorPrimary),
                    false)

            events?.add(event)
            weekView?.notifyDataSetChanged()

}

Saved instance state overwrites layout parameters on config change

When I have a layout file with app:numberOfVisibleDays="1" for portrait and a second file with app:numberOfVisibleDays="7" for landscape, when I switch orientations on my device, the actual number of visible days remains whatever it was to begin with. Expected behavior is that for a given configuration, the xml is always used if it exists.

Stepping through the debugger it appears that the saved instance state is overwriting the value passed from xml.

Restoring instance state causes NPE

I have an activity (containing the week view) that quickly checks for authentication, and, if unauthenticated, pops another activity over the current one.

When the new activity pops and then closes, the calendar is put through a very quick save/restore state cycle before the viewState is completely initialized (i.e. before firstVisibleDay is set to anything).

onRestoreInstanceState needs to handle the case of a null firstVisibleDay. Other methods safely handle the null case for this property, which makes me think this was just a small oversight.

Presently, in this case, toCalendar throws a kotlin NPE. Using v3.4.2.

The event is repeated when adding a new event

Hi, I am trying to implement a function that adds a new event to the calendar. I redirect to a new layout page where I can input some information about the event. After finishing input data, I create a new apiEvent object and redirect back to the calendar page using putExtra(). Then I add this new event to the events in getEventsInRange of FakeEventsDatabase. But I always get 3 repeated events showing in the calendar view. Could you give me some suggestions about how to solve this?

Horizontally scrolling to next day initially shows blank page

I've noticed that this fork has an issue with showing the next page while scrolling to the next day. Having set the amount of visible days to 1, when I scroll to the next day, the next day page remains blank until scrolling has finished. I'm guessing this is happening because the next page isn't loaded in advance?

Android-Week-View in fragment

i use Android-Week-View in fragment. when Android-Week-View is initialized, setMonthChangeListener() is called three times。here is my code.
`@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment

    View view=inflater.inflate(R.layout.fragment_data, container, false);
    weekView=view.findViewById(R.id.weekView);
    if (weekView!=null){
        weekView.setMonthChangeListener(new MonthChangeListener<CalendarItem>() {
            @NotNull
            @Override
            public List<WeekViewDisplayable<CalendarItem>> onMonthChange(Calendar calendar, Calendar calendar1) {
              return DataUtil.getDataList();
            }

        });

    }


    System.out.println("+++++++++++++");
    weekView.setMinDate(DateUtil.getNowDate());
    System.out.println(DateUtil.getNowDate().getTime());
    weekView.setMaxDate(DateUtil.getAfterDate(5));
    System.out.println(DateUtil.getAfterDate(5).getTime());
    weekView.setEventTextColor(Color.BLACK);
    return view;
}`

Empty space with columnGap

If calendar has column gap value, the empty space is not visible in last day.
Screenshot_20190508-093700
Is this a bug or can empty space be displayed?

Scroll listener

It's possible detect when Weekview is scrolling and when the scroll has finished?

I want load the events when the day changes. And I want prevent multiple calls with fast scroll

Simple one week view

Hi.
After days of surfing, I found your code.
What I want is really simple. I want to show a weekly plan in a week view. The plan only changes every year so there is no need to show other dates. Also, events will be added from database and the user should not be able to add a new event.
Can you help me with this?

ColumnGap not clicking in blank space

When I give dp to columnGap, I can not click on the right blank space to create a new event. This is a bug or not?

This functionality is very useful to create events at the same time, but it can not be used

ConstraintActivity ArrayIndexOutOfBoundsException

When sliding the "hight" seekbar far to the left the App will crash
The ConstraintActicity was Introduced in #24

Probably com.alamkanak.weekview.BackgroundGridDrawer.createHourLines(BackgroundGridDrawer.kt:25)

2019-02-13 23:42:51.647 14250-14250/com.alamkanak.weekview E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.alamkanak.weekview, PID: 14250
    java.lang.ArrayIndexOutOfBoundsException: length=32; index=32
        at com.alamkanak.weekview.BackgroundGridDrawer.drawHourLines(BackgroundGridDrawer.kt:78)
        at com.alamkanak.weekview.BackgroundGridDrawer.drawGrid(BackgroundGridDrawer.kt:40)
        at com.alamkanak.weekview.BackgroundGridDrawer.draw(BackgroundGridDrawer.kt:21)
        at com.alamkanak.weekview.WeekView.onDraw(WeekView.java:151)
        at android.view.View.draw(View.java:20366)
        at android.view.View.updateDisplayListIfDirty(View.java:19241)
        at android.view.View.draw(View.java:20094)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
        at android.support.constraint.ConstraintLayout.dispatchDraw(ConstraintLayout.java:2023)
        at android.view.View.updateDisplayListIfDirty(View.java:19232)
        at android.view.View.draw(View.java:20094)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
        at android.view.View.updateDisplayListIfDirty(View.java:19232)
        at android.view.View.draw(View.java:20094)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
        at android.view.View.updateDisplayListIfDirty(View.java:19232)
        at android.view.View.draw(View.java:20094)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
        at android.view.View.updateDisplayListIfDirty(View.java:19232)
        at android.view.View.draw(View.java:20094)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
        at android.view.View.updateDisplayListIfDirty(View.java:19232)
        at android.view.View.draw(View.java:20094)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
        at android.view.View.draw(View.java:20369)
        at com.android.internal.policy.DecorView.draw(DecorView.java:781)
        at android.view.View.updateDisplayListIfDirty(View.java:19241)
        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:690)
        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:696)
        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:805)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:3515)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3312)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2681)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1633)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7786)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1004)
        at android.view.Choreographer.doCallbacks(Choreographer.java:816)
        at android.view.Choreographer.doFrame(Choreographer.java:751)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:990)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6863)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

OnePlus 5T
Android Pie 9

How flexible is this lib?

I have a question about this lib.

I'm working on an app that has a calendar feature, but instead of working on a "weekly fashion", it's supposed to display day by day, but here's the catch: It's supposed to do that for multiple people.

So instead of having the days of the week on the columns, I would have to display user names and pictures, and each row would correspond to their daily schedules.

Is is possible to use this lib on this scenario? Or is it too tied to displaying only the days of the week?

RTL support

Thanks for being responsive on my other issues.

I'm trying to use this in a big corporate app that'll require RTL support. I'm not an expert on RTL for calendars, but I'm thinking that it should obey the system's locale in that regard in two specific ways that are immediately visible.

First, in an RTL locale I'd expect the time label column to show up at the start of the layout (so the right). Second, I'd expect the individual events' labels to appear start-aligned.

I'm not sure if RTL should mess with the directionality of the dates on scrolling... but something else to think about.

WeekView can't be rendered.

Currently, when including the WeekView in a layout, it can not be rendered by AndroidStudio (in the layout preview) and throws a ClassNotFoundException. This is because it uses classes from com.jakewharton.threetenabp. To make these classes available for the layout preview, it would help to change the type of this dependency from implementation to api, but I don't know if it's the best way.

Full day event draws the rectangle for only one line while its content overflows into the next line

The full day event has a rectangle which can have only a single line of data inside, however if it has data which cannot be fit into one line, it draws the text in the next line which is out of the
bounds of the drawn rectangle
In this screenshot, the full title of the event is "Women's day ramp walk planning"
the title overflows the drawn bounds of the rectangle.
Same case when there is a location which cannot be fit into the line
Screenshot_20190411-111508

Updating the latest code on Jitpack

Could you update the notifyDataSetChanged on your jitpack so I can continue to use your library. Thank You, really love what you have done with the library.

Display event location under title if enough space

The event location is currently displayed right after the event title. Instead (or maybe as another option?), it should be possible to display it below the event title, provided that there is enough space.

Text color event

Hello,

can each event have a different color? I have seen that it can in the develop branch. Can it be done in the master branch? If can not master, you can make a merge of the 2 branches and include this functionality?

How can I include the develop branch in Gradle?

Thank you

New API documentation ?

This library has changed API (in 3.0) but the documentation of new API isn't anywhere.
From what I found, this seems to be most actively maintained. As such, documentation of any level (thorough or simple list of API methods) would be very helpful.

Allow limiting the time range

Allow to limit the time range that is displayed in WeekView. For instance, one might wish to display only the hours between 10am and 8pm.

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.