B4A Library [B4X] [XUI] AS CalendarAdvanced đź“… - OneRow/FiveRow Calendar - Expand and Collapse

focus330

Member
Licensed User
Sorry but I didn't receive your email with the key. My payPal address is OK and they send me a confirm for the payment ( 8,00 USD ) Transaction ID: 6NM57452CS650662T
 

Lello1964

Well-Known Member
Licensed User
I have a problem using ScrollDate function.

I have this code :
B4X:
    dataAss.WeekNameShort = dataAss.CreateASCalendarAdvanced_WeekNameShort("Lun","Mar","Mer","Gio","Ven","Sab","Dom")
    dataAss.MonthNameShort = dataAss.CreateASCalendarAdvanced_MonthNameShort("Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic")
    dataAss.SelectedDate = dataPrevista
    dataAss.UpdateBody
    dataAss.UpdateHeader
    dataAss.ShowFirstWeekOfMonthInFirstRow = True
    dataAss.CreateCalendar
    dataAss.CreateASCalendarAdvanced_SpecialDay(dataPrevista, xui.Color_ARGB(255,221, 95, 96), "data1")
    dataAss.AddAppointmentType1(map.Get("dataPrevista"), xui.Color_ARGB(255,221, 95, 96))
'    dataAss.AddSpecialDay(map.Get("dataPrevista"), xui.Color_ARGB(255,221, 95, 96), "")
    dataAss.Scroll2Date(dataPrevista)
and have this error :

Errore nella linea: 326 (ASViewPager)
java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:458)
at anywheresoftware.b4a.objects.collections.List.Get(List.java:122)
at b4j.example.customlistview._replaceat(customlistview.java:914)
at b4j.example.ascalendaradvanced._addweekpanel(ascalendaradvanced.java:2380)
at b4j.example.ascalendaradvanced._scroll2date(ascalendaradvanced.java:883)
at b4j.example.b4xmainpage._clvassistenza_itemclick(b4xmainpage.java:17243)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at jdk.internal.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:504)
at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:467)
at b4j.example.customlistview$ResumableSub_PanelClickHandler.resume(customlistview.java:808)
at b4j.example.customlistview._panelclickhandler(customlistview.java:751)
at b4j.example.customlistview._panel_mouseclicked(customlistview.java:742)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:95)
at anywheresoftware.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:109)
at anywheresoftware.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:1)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics/javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3564)
at javafx.graphics/javafx.scene.Scene$ClickGenerator.access$8200(Scene.java:3492)
at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3860)
at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1200(Scene.java:3579)
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1849)
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2588)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:390)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
 

Lello1964

Well-Known Member
Licensed User
I'm using in B4J, i've ASViewPager V1.15 and ASCalendarAdvanced 2.04 , but have this error in :
dataAss.Scroll2Date(dataPrevista)

dataPrevista is defined as long and value is : 1642546800000

no error removing dataAss.Scroll2Date(dataPrevista)
 

Alexander Stolte

Expert
Licensed User
Update
  • 2.05
    • Add StartDate - Set here the date where you want to start - set this before you call CreateCalendar
    • Add FirstDayOfWeek - 1-7 - set this before you call CreateCalendar
StartDate
Use this instead of "Scroll2Date" to set a start date. Then the correct week/month is built directly, instead of first the current date and then the date what we want actually.
B4X:
Dim p As Period
p.Years = 3
ASCalendarAdvanced1.StartDate = DateUtils.AddPeriod(DateTime.Now,p)
ASCalendarAdvanced1.CreateCalendar
FirstDayOfWeek
Don't forget to adjust the WeekNameShort.
  • Friday = 1
  • Thursday = 2
  • Wednesday = 3
  • Tuesday = 4
  • Monday = 5
  • Sunday = 6
  • Saturday = 7
B4X:
ASCalendarAdvanced1.FirstDayOfWeek = 5'Monday
 

wimpie3

Well-Known Member
Licensed User
Thanks for the update, definitely looking forward to the planned features since I need several of them to continue working on my project!
 

Alexander Stolte

Expert
Licensed User
Update
  • 2.06
    • BugFix New Handling of other Months
      • not the whole next month is in a different color, but only the days that are not in the current month
    • Add KeepSelectedDate
      • Default: False
      • WeekView: The same week day is selected if you switch to the next week e.g. Monday 05.07.201-> Monday 12.07.2021
      • MonthView: The same date is selected if you switch to the next month e.g 22.07.2021-> 22.08.2021
    • Add Month2WeekKeepSelectedWeekVisible - If you switch from MonthView to WeekView then the selected day keeps visible
      • Default: True
    • Add ShowOtherMonths - Only in MonthView - set it to False if you dont show the days from the next or previous month
      • Default: True
KeepSelectedDate
KeepSelectedDate.gif

Month2WeekKeepSelectedWeekVisible
Month2WeekKeepSelectedWeekVisible.gif

ShowOtherMonths
If False
IMG_9305.jpg
 

wimpie3

Well-Known Member
Licensed User
Little remark concerning the animation in Month2WeekKeepSelectedWeekVisible

I see that in the example above the 8th of the month is selected. When you go from month view to the week view, the month view is animated out of the way, and only when the first week of the current month is visible, the 8th scrolls into view.

I'm sure you're going to say this is impossible, but in most calendars I've seen, the entire month calendar is moved upwards during the animation from month to week, and the currently selected week gets "stuck" where the week calendar should be.

It's hard to explain, let me find a demo for you. The way it is done now, in two movements (one animating the month and one animating the week to the correct date) is not feeling "right" IMHO.
 

Alexander Stolte

Expert
Licensed User
Look in the Outlook app, there the behavior is exactly the same. And its from Microsoft.

I'm sure you're going to say this is impossible
But the way the complete view is designed, it is not possible to do it any other way, the calendar only becomes small when the user releases the touch gesture and the view is small.

If I would rebuild the view already in the touch movement so that in the 1st line the current period is to be seen, then that looks even more stupid. The user can always go back while he is in the movement.
 

wimpie3

Well-Known Member
Licensed User
This is what I mean. Look at the 12th day. When you go from month to week mode, the week with the 12th day slides up with the rest of the month weeks, but once it has reached the top position, it stays "locked" to form the week calendar and the remaining weeks below scroll out of view. This animation is way smoother when compared to your "first month goes away and than the week slides in". But I'm not sure that is doable in your current setup... it's only a suggestion to make things look smoother. Not criticism!!



And here's another example that does the same (day 25 stays in focus when going to week mode):

 
Last edited:
Top