kizitonwose / calendar Goto Github PK
View Code? Open in Web Editor NEWA highly customizable calendar view and compose library for Android.
License: MIT License
A highly customizable calendar view and compose library for Android.
License: MIT License
Hi,
did anyone encounter duplicate dates 27 October on iOS12.4?
Thanks for any insights;
j.
Dear @kizitonwose
Your library is great which is very easy to custom.
Please help me provide an example using Coordinatorlayout collapse Calendarview
Thank you!
Hi Kizito!
First of all awesome lib! Kudos for it!
At the moment I'm consuming the CalendarView from an Android Java project.
For testing how stable the lib behave under certain scenarios I enabled Don't keep activities in Developer Options. After playing around, bringing the calendar view back and forth between foreground and background this exception arises:
kotlin.TypeCastException: null cannot be cast to non-null type com.kizitonwose.calendarview.ui.MonthViewHolder at com.kizitonwose.calendarview.ui.CalendarAdapter.notifyMonthScrollListenerIfNeeded(CalendarAdapter.kt:196) at com.kizitonwose.calendarview.ui.CalendarAdapter$onAttachedToRecyclerView$1.run(CalendarAdapter.kt:52) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Any idea how to fix this?
Thanks in advance!
Federico
Reproduce:
<com.kizitonwose.calendarview.CalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cv_dayViewResource="@layout/item_calendar_day_layout"
app:cv_orientation="horizontal"
app:cv_scrollMode="paged"
app:cv_hasBoundaries="false"
app:cv_monthHeaderResource="@layout/item_month_header"
app:cv_maxRowCount="6"/>
inner class MonthHeader : MonthHeaderFooterBinder<MonthViewContainer> {
override fun bind(container: MonthViewContainer, month: CalendarMonth) {
container.setName(month)
}
override fun create(view: View): MonthViewContainer = MonthViewContainer(view)
}
CalendarMonth always the same.
Whay is not dispay 31
val firstMonth = currentMonth.minusMonths(10) val lastMonth = currentMonth.plusMonths(10) val firstDayOfWeek = DayOfWeek.MONDAY calendarView.setup(firstMonth, lastMonth, firstDayOfWeek) calendarView.inDateStyle = InDateStyle.ALL_MONTHS calendarView.maxRowCount = 5 calendarView.hasBoundaries = true
Hi,
Would you consider making the CalendarView class open to allow developers to extend from it?
A use case would be to override onMeasureLayout to do something further.
Regards.
I've recently added the Chucker library to my app and got this build error:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> More than one file was found with OS independent path 'META-INF/library_release.kotlin_module'
It turns out that both CalendarView and Chucker are creating the same META-INF/library_release.kotlin_module
file:
I've opened an issue on Chucker with more details about the error and some solutions: ChuckerTeam/chucker#134
While there is a way to fix this, it would be nice that to fix the issue on the library itself, which would avoid having every user apply the same fix :)
Hi, thank's for great lib. However, I faced the issue: crash when first open a fragment with calendar view. It happened once, and I think the problem is in using unsafe (!!) call.
kotlin.KotlinNullPointerException
at com.kizitonwose.calendarview.ui.MonthViewHolder.bindMonth(MonthViewHolder.kt:39)
at com.kizitonwose.calendarview.ui.CalendarAdapter.onBindViewHolder(CalendarAdapter.kt:144)
at com.kizitonwose.calendarview.ui.CalendarAdapter.onBindViewHolder(CalendarAdapter.kt:27)
at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7033)
at com.kizitonwose.calendarview.ui.CalendarAdapter.onBindViewHolder(CalendarAdapter.kt:135)
at com.kizitonwose.calendarview.ui.CalendarAdapter.onBindViewHolder(CalendarAdapter.kt:27)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7075)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5991)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6258)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6097)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6093)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1627)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4115)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3832)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4385)
at android.view.View.layout(View.java:20715)
at android.view.ViewGroup.layout(ViewGroup.java:6202)
at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1915)
at android.view.View.layout(View.java:20715)
at android.view.ViewGroup.layout(ViewGroup.java:6202)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:20715)
at android.view.ViewGroup.layout(ViewGroup.java:6202)
at androidx.appcompat.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:444)
Hi @kizitonwose, awesome library!
Do you know if I can easily centre a date into the calendar view.
Using scrollTo date method the selected date is on top so this isn't working for my case.
Thanks
Hi
I want to be able to drag start date and end date. Is there any way to achieve this?
Thanks
I have played with the sample app from Github and want to try to use the library in my own app. However, attempts at creating a minimal app fail. I suspect instructions are missing from the instructions on Github.
Please provide a complete worked example.
I did this:
1 In Android Studio, File > New > New Project and selected "Empty Activity"
2 Built and ran this successfully.
3 Added the two entries to the two build.gradle files described in readme.MD (version 0.1.2)
4 Sync fails with this:
ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.1.0-beta01] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:5:5-19:19 to override.
5 I added the suggestion to AndroidManifest.xml - now get "ERROR: Manifest merger failed with multiple errors, see logs"
I note the sample app mainfest file includes: tools:ignore="GoogleAppIndexingWarning"
But this does not fix the problem.
Some (relevant?) discussion here? material-components/material-components-android#193
Steps to reproduce the issue:
After that the app should crash with the following stacktrace:
08-22 21:08:42.318 32144-32144/com.kizitonwose.calendarviewsample E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.kizitonwose.calendarviewsample, PID: 32144
java.lang.IndexOutOfBoundsException: Invalid index 42, size is 16
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.get(ArrayList.java:308)
at com.kizitonwose.calendarview.CalendarView.updateAdapterMonthConfig(CalendarView.kt:412)
at com.kizitonwose.calendarview.CalendarView.updateAdapterMonthConfig$default(CalendarView.kt:406)
at com.kizitonwose.calendarview.CalendarView.setHasBoundaries(CalendarView.kt:197)
at com.kizitonwose.calendarviewsample.Example1Fragment$onViewCreated$4$$special$$inlined$doOnStart$1.onAnimationStart(Animator.kt:122)
at android.animation.ValueAnimator.notifyStartListeners(ValueAnimator.java:1048)
at android.animation.ValueAnimator.start(ValueAnimator.java:1110)
at android.animation.ValueAnimator.start(ValueAnimator.java:1117)
at com.kizitonwose.calendarviewsample.Example1Fragment$onViewCreated$4.onCheckedChanged(Example1Fragment.kt:192)
at android.widget.CompoundButton.setChecked(CompoundButton.java:161)
at android.widget.CompoundButton.toggle(CompoundButton.java:120)
at android.widget.CompoundButton.performClick(CompoundButton.java:125)
at android.view.View$PerformClick.run(View.java:21297)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
It seems that the issue was introduced by this commit. Looks like changes made to the adapter data are not always immediately reflected by calendarLayoutManager.findFirstVisibleItemPosition()
.
Hello i want to make padding from top android bottom less, how i can do it ?
is that possible ?
Was trying the Example 3 of the demo app and realized that the continuos selection mode doesn't allow for the same day selection for start and end. If the same day is selected only the start date is set. If I click it again, nothing happens.
This does come handy in some use cases, like booking roundtrips transport tickets for the same day.
I see the following error intermiitently as I start an activity which creates and renders a calendar. I have seen Index:7 as well as 14, but no other numbers. I am using v0.2.0
I create and render a calendar, then request data from a database and when it arrives I call the calendar's setup() again (different months to display), and paint the day cells again depending on the data. If I add a short delay c. 200ms before making the database call then the fault does not occur, so I am guessing the second setup() is messing with the first.
So I guess the questions are:
(1) What is causing the crash and can it be stopped?
(2) Is it OK to call setup() twice, or is there a better way to change the first and last month values dynamically?
(3) Is there a "onCalendarReady()" callback, or similar, which I can wait for before making my second setup() call? use to make changes?
Error log:
java.lang.IndexOutOfBoundsException: Index: 14, Size: 4
at java.util.ArrayList.get(ArrayList.java:411)
at com.kizitonwose.calendarview.ui.CalendarAdapter.notifyMonthScrollListenerIfNeeded(CalendarAdapter.kt:171)
at com.kizitonwose.calendarview.ui.CalendarAdapter$notifyMonthScrollListenerIfNeeded$1.onAnimationsFinished(CalendarAdapter.kt:165)
at androidx.recyclerview.widget.RecyclerView$ItemAnimator.dispatchAnimationsFinished(RecyclerView.java:13257)
at androidx.recyclerview.widget.DefaultItemAnimator.dispatchFinishedWhenDone(DefaultItemAnimator.java:551)
at androidx.recyclerview.widget.DefaultItemAnimator$5.onAnimationEnd(DefaultItemAnimator.java:249)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1142)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1149)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1309)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
at android.animation.AnimationHandler.-wrap2(AnimationHandler.java)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:905)
at android.view.Choreographer.doCallbacks(Choreographer.java:709)
at android.view.Choreographer.doFrame(Choreographer.java:641)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:893)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:208)
at android.app.ActivityThread.main(ActivityThread.java:6304)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
I was using material-calendar view. Looked at your library to use simple calendar with max date, min date and marking of dates.
After looking at sample app example 1 its lots of code to do a simple thing.(lot of boilerplate).
May be it's better if you could provide simple method (in library API) to setup a calendar with simpler syntax.
I know this is a bit of a stretch. But can this library work with joda-android?
For example, if I'm in June, it has 6th row, and it shows, but once I move to July which only has 5 rows, and come back to June, June still only shows 5 rows, and final June days are obviously missing.
Is there possible to disable scrolling? and can scroll only programmatically (smoothScrollToMonth() or scrollToMonth())
Hi, I started by including your Example 5 into my project, but as part of another vertical RecyclerView. Anyways, the calendar shows up fine, but I have 2 weird issues:
Month scroll listener gets invoked with one month earlier than shown on the calendar (e.g. calendar shows June days, but it says May on top). I'm using paged calendar, and this is invoked when I page it with finger.
When I use buttons (next & previous) to move the calendar, it starts skipping months, but it's mostly skipping into past 1 or 2 months. So for e.g., If I go back from June to May, it ends up showing April.. But if I go forward from June to July, it ends up showing June again (because it skips one month back again).
Do you have any idea what this might be? Otherwise, library is great and very customizable. Thanks!
I need it to develop persian application!
I can't see any functionality to add days of the week to the calendar view. Is this something I have to implement manually via the Month Header? Thanks.
This is not critical and not an issue for me currently, but if I set margins on a Calendar, start and end in my case, the whole CalendarView blinks every time I click on a day.
In my vertical scrolling calendar (similar to example2) I would like to have sticky headers. I've tried using this solution making a custom RecyclerView.ItemDecoration but, with "CalendarAdapter" being internal and not using the "viewType" parameter, I find it really difficult to make it work . Do you have any suggestions in how to implement such a thing? Internal or external to the library I could implement it myself, I'm just seeking some advice.
Hi,
firstDayOfWeek paramater doesn't work. I try few things:
cvCalendarView.setup(currentMonth, lastMonth, DayOfWeek.MONDAY);
cvCalendarView.setup(currentMonth, lastMonth, DayOfWeek.of(1));
DayOfWeek firstDayOfWeek = WeekFields.of(DayOfWeek.MONDAY, 7).getFirstDayOfWeek();
cvCalendarView.setup(currentMonth, lastMonth, firstDayOfWeek);
Thank you for this great library! :)
Steps to reproduce the issue in the sample app:
Example7Fragment.kt
and increase the date range between startMonth
and endMonth
in the setup(..)
method to 10 years (for old and low-end devices even 3-5 years is enough).Expected behavior: the app should become unresponsive for several seconds. The greater the date range, the longer the freeze. The lag is more noticeable on old and low end devices.
Here is an example of how it looks: https://drive.google.com/open?id=10ge9IzonM8EYDdw4Y4oDSc761WrC308l
It seems that the problem only takes place when CalendarView.hasBoundaries
is set to false. So after some dumb tests with measuring execution time inside MonthConfig.generateUnboundedMonths(..)
I've discovered that the freezes are caused by removeAll()
calls on each iteration of this loop at line 109.
It looks like that the problem is that remove operations for this type of collection take O(n) time and allDay
list may contain significant amount of items when the date range is long enough.
Here is a small fix that uses Iterable.chunked(..)
to split the allDays
list and seems to solve the issue.
I can make a pull request if you want to.
Love this library and I'm making a lot of cool progress with it.
At the moment there are few methods to notify changes:
notifyDayChanged(), notifyMonthChanged() , notifyCalendarChanged() ...
It would be nice to have a method which does this for a range of days or a group of days within a month or group of days in the calendar.
I have this Java code (in an AppCompatActivity class) and a layout file which works fine in a simple example, but fails when I try to add the CalendarView to a larger existing app:
CalendarView cv;
cv = findViewById(R.id.calendarView);
// then initialise the CalendarView
and a layout file with this:
<com.kizitonwose.calendarview.CalendarView
android:id="@+id/calendarView"
... />
I have an error in the java file "Type parameter T has incompatible upper bounds : View and CalendarView"
Explicitly casting: CalendarView calendarView = (CalendarView) findViewById(R.id.calendarView);
the error becomes "Inconvertable types: cannot cast 'android.view.View' to 'com.kizitonwose.calendarview.CalendarView'
It seems that somehow the CalendarView entity in the layout file is being treated as something else.
Interestingly, I cannot refactor/rename "@+id/calendarView" as the Refactor operation is greyed out. (I can refactor it if I change the XML to <CalendarView...) - is this a clue? Does it imply that the layout file is not being properly processed?
If I right-click on R.id.calendarView and click "Go to Declaration" I am correctly taken to the layout file. I appear to have added the library dependency correctly to build.gradle. No amount of cleaning or invalidating of caches have effects. I deleted the .gradle, build and app/build directories - no change.
What is happening and how do I fix it?
I'm currently displaying 6 monhts in a vertical calendar similar to example 2. In my project the bottom month is the most recent one and the top month is 6 months ago. Everything is fine. But I need more than 6 months and I should get the data from a web service.
So I set up this listener:
calendarView.addOnScrollListener(object : RecyclerView.OnScrollListener() { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { calendarView.findFirstVisibleMonth()?.let { if (startMonth == it.yearMonth) { lastMonthReachedListener?.invoke(it.yearMonth) } } } })
which should detect when the top month is reached, trigger the listener and download the data for the next 6 months, then display them.
The problem is every time I setup the CalendarView to change the startMonth, the view gets scrolled to the new months at the start, instead of remaing at the current position, so the listener gets called again and loops like that.
when calling the setup method as reccomended ("You can call this any time") is it possible to mantain position? Or maybe you have some other ideas...
Thank you very much for this library. It is very useful.This is a request for a further development, and/or suggestions for how I might try to make the development myself.
My application monitors medication adherence. I issue reminders to take medication and I record when the user takes their medication. I display information about when medication is taken, or missed. So your calendar is useful for this. But a different view would be good.
Adherence is best displayed graphically, so stakeholders can see at a glance when and whether the user took their medication, over (say) a month. Figure 5 at this paper shows the idea: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3403197/pdf/bcp0073-0691.pdf - a version of my own app looks like this: https://www.dropbox.com/s/dyvdxjozmh3jwdb/Screenshot_20190625-220402_Medication%20Monitor.jpg?dl=0
So the ideal would be a CalendarView that has days of the month (1...31) on the X axis and time of the day (00:00- 23:59) on the Y axis. The actual time that medication was taken would be displayed as a dot at the correct X/Y position. Colour-coding can show status (e.g. taken on time, taken at the wrong time, not taken etc).
I would think that the existing library could be adapted reasonably well:
days would be displayed as cells arranged in a 31x1 array instead of a 7x6 array.
the calendar views (one per month) can scroll left and right as happens at present.
The day of week legend (MON, TUE, WED...) might need to be replaced by days (1...31) or perhaps week numbers (across 7 days).
each day cell (narrow and long) needs to be painted with data: background colour to indicate status and small shapes (circles, squares) rendered to indicate the actual data point. One approach might be to divide each day cell into 24, 48 or 96 divisions that correspond to 60, 30 or 15 minute time slots. Each sub-cell could have different background colours and different drawable shapes painted to indicate data points. Or perhaps horizontal bands of colour and drawable items could be placed programmatically: looking at the sample app Example 5, I see the "@+id/exFiveDayFlightTop" and "@+id/exFiveDayFlightBottom" views might be positioned differently by changing the layout_marginBottom parameter.
There might need to be a provision to add vertical (1 pixel) dividers to divide each week (7 days).
Perhaps the horizontal scale could be for 1 week rather than one month.
What do you think? What might need to be changed? Does the "week view" facility already provide this facility, if we can display 31 days instead of 7?
Steps to reproduce in the sample app:
screenOrientation
attribute from the app's Manifest for the main Activity.The app should crash with this error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.kizitonwose.calendarviewsample, PID: 10788
kotlin.TypeCastException: null cannot be cast to non-null type com.kizitonwose.calendarview.ui.MonthViewHolder
at com.kizitonwose.calendarview.ui.CalendarLayoutManager$scrollToDay$1.run(CalendarLayoutManager.kt:51)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Apparently, this
We already scrolled to this position so findViewHolder should not return null.
is not really true ๐. I assume it has something to do with restarting the activity, though I don't see why or how. Probably something to do with the fact that WeekMode doesn't really have MonthViewClass (or whatever it's called) and there isn't a proper check there.
I've found out that it happens inconsistently - you have to scroll by quite a bit, but some times (I think) less than other times. Oh and it happens when scrolling to the left, too.
Hello,
First of all thanks for such a useful library. Could you tell me how to provide months' names in other languages to the calendar view?
Hi,
Thanks for the great library.
I'm looking for a feature of settings specific days as disabled and not selectable on the CalendarView
. These disabled days should also stop range selection if they are inside this range.
Is this something possible for the library? I noticed the library is mostly focused on the UI customisation but just wanted to check with you.
Thanks.
After following the guidelines, it's throwing an error:
> Task :app:compileDebugKotlin
e: /Users/admin/Documents/bakbak/android/sootra/app/src/main/java/co/barfi/ui/fragmentcontainer/FragmentContainerActivity.kt: (62, 49): Type mismatch: inferred type is FragmentContainerActivity but LifecycleOwner was expected
e: /Users/admin/Documents/bakbak/android/sootra/app/src/main/java/co/barfi/ui/loginscreen/LoginActivity.kt: (98, 44): Type mismatch: inferred type is LoginActivity but LifecycleOwner was expected
e: /Users/admin/Documents/bakbak/android/sootra/app/src/main/java/co/barfi/ui/loginscreen/LoginActivity.kt: (122, 45): Type mismatch: inferred type is LoginActivity but LifecycleOwner was expected
e: /Users/admin/Documents/bakbak/android/sootra/app/src/main/java/co/barfi/ui/splash/SplashActivity.kt: (85, 55): Type mismatch: inferred type is SplashActivity but LifecycleOwner was expected
e: /Users/admin/Documents/bakbak/android/sootra/app/src/main/java/co/barfi/ui/splash/SplashActivity.kt: (117, 57): Type mismatch: inferred type is SplashActivity but LifecycleOwner was expected
> Task :app:compileDebugKotlin FAILED
@kizitonwose I'm stuck with the following situacion...
On one hand I need to disable the horizontal scrolling on the calendar as shown on here: #13 and do it programatically.
But at the same time I need to be able to tap/click on days of the calendar (by setting a click listener on the DayViewContainer view):
view.setOnClickListener(new View.OnClickListener()...
The problem is that by disabling the scroll I'm intercepting the Action.MOVE used by the taps as well, therefore onInterceptTouchEvent is swallowing the event, hence not allowing it to reach the defined view click listener.
So to sum up I need to disable the swiping of the calendar but allowing taps of each of days of the calendar...
Any suggestion?
Thanks in advance,
Federico
Hi @kizitonwose . I was testing the calendar with S7 Edge but had a hard time clicking on each day. There are certain day that needs to be clicked hard or lightly. Are there any issues raised like this with using Edge?
Hi,
I'm using the latest version (0.2.0) of the library and facing some performance issues when loading the view for the first time.
In my application, the view sits inside a tab in BottomNavigationView, so the first time I visit the tab it takes up to one second to load the fragment with the view.
I tried to add another tab with Example5Fragment from your sample app and faced the same slowness issue.
Can you try to figure out the problem?
Thanks in advance.
Hi,
your lib seems to fit my needs , but it's all in kotlin. My app is still full java and there is no plan to migrate to kotlin any time soon.
Can i still use it ?
I'm stuck at the initialisation , i don't know how (and if i can/should) convert this parts to java :
class DayViewContainer(view: View) : ViewContainer(view) {
val textView = view.calendarDayText
// Without the kotlin android extensions plugin
// val textView = view.findViewById<TextView>(R.id.calendarDayText)
}
This seems to be ok :
class DayViewContainer extends ViewContainer {
DayViewContainer(View view) {
super(view);
TextView textView = view.findViewById(R.id.calendarDayText)
}
}
But i'm kind of lost here
calendarView.dayBinder = object : DayBinder<DayViewContainer> {
// Called only when a new container is needed.
override fun create(view: View) = DayViewContainer(view)
// Called every time we need to reuse a container.
override fun bind(container: DayViewContainer, day: CalendarDay) {
container.textView.text = day.date.dayOfMonth.toString()
}
}
Thanks
I'm running into a problem regarding selecting indates/outdates.
Using CalendarView.notifyDayChanged()
I can show an indate/outdate as selected. Combining this with notifyDateChanged()
when an indate/outdate is selected and you scroll to it's month, it is selected there as well.
The problem lies when you select a day in this month (ie. not an indate/outdate), if that date exists as an indate/outdate in another month, when you scroll to it, it won't be selected and there doesn't seem to be a way to do it.
I can think of getting this to work if when selecting any date, I call notifyDayChanged()
with all 3 owners, but that would require the ability to instantiate new CalendarDay objects with the same LocalDate
but different owners.
Is there an alternative way of doing this?,
thanks.
Hi,
I'm working on a calendar that will require inDates and outDates to be selectable.
I've noticed that when notifyDateChanged is called it will only rebind the day view container of the date in it's own month. This means that if I click on an inDate or outDate it's container won't update.
Could something be added to allow inDates and outDates to also be rebound?
Is it possible to have a strict date range selection i.e. from 8th October 2019 until 8th October 2020 (one year sharp) Meaning that the dates after 8th October 2020 are not selectable. The same goes with the dates before 8th October 2019
What is the best way to achieve the above with the current setup. (I am looking at Example4 from the sample app.)
Do you think this could be a potential feature implemented by the library?
how can i set values for minimum and maximum values.
there is a method "setup" in which i can set minimum date but what about maximum date ?
Please help.
Hi @kizitonwose , is it possible to do this? If not, can I make the header's background transparent? This is what I'm trying to achieve.
Hello,
is there any JAVA example?
Thanks
Do you plan on support infinite scrolling? Since I see setup method does take in first month last month param, will you provide a method to setup the views without first month and last month? Thanks!
I am looking for help resolving a duplicate class error.
Having got the library working in a trivial app I tried to add it to a larger project. I get this error:
Duplicate class androidx.concurrent.futures.DirectExecutor found in modules
concurrent-futures-1.0.0-beta01.jar (androidx.concurrent:concurrent-futures:1.0.0-beta01) and
futures-1.0.0-alpha01.jar (androidx.concurrent:futures:1.0.0-alpha01)
I am a newbie here, but looks like CalendarView uses the -beta01 library and the -alpha01 library is used by WorkManager:
https://developer.android.com/jetpack/androidx/releases/work
I had been using 'android.arch.work:work-runtime:1.0.0-alpha09' and it looks like if I change to 'android.arch.work:work-runtime:1.0.1' the duplicate class problem goes away, but the API seems significantly different and I would have to make big changes. Can I stay with 1.0.0-alpha09?
I see this: https://medium.com/mindorks/avoiding-conflicts-in-android-gradle-dependencies-28e4200ca235
but it is a bit over my head. Suggestions for working around this?
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.