B4A Library [B4X] [XUI] AS CalendarAdvanced 📅 - OneRow/FiveRow Calendar - Expand and Collapse [Payware]

Hey all, after almost a week of work and much frustration, I am proud to share with you a calendar view.
The view is inspired on the calendar view in the outlook app.

This library is not free, because, it cost a lot of time and gray hair to create such views.
Donations from 8€ are valid. (You can donate any amount you want :))
Please write CalendarAdvanced in the order description, thanks.

Thanks for your understanding. :)
  1. Donate
  2. I will send you an e-mail with the code to decrypt the .zip file
  3. Done
NEW Special Days
IMG_5041.jpg

NEW AppointmentType1
IMG_5012.jpg

AppointmentType1,AppointmentType2,AppointmentType3
1618912554091.png
1618912567441.png
1618912577470.png

Collapsed
IMG_3868.jpg

Expanded
IMG_3787.jpg

seamless transition between the two modes
ezgif.com-gif-maker.gif

You can display up to 6 rows
1650315651331.png

You can disable the Expandable to use the view in only one mode, then the bottom drag bar is not visible.

B4J is currently not supported, but will be in the near future.
B4J is now supported.
B4j: jXUI,jDateUtils,jReflection,xCustomListView,ASViewPager
B4a: XUi,DateUtils,Reflection,xCustomListView,ASViewPager
B4i: iXUI,iDateUtils,xCustomListView,ASViewPager,GestureRecognizer
Make sure you are using ASViewPager V1.24+
On B4I you need GestureRecognizer Download the .bas file in the attachment No longer needed since 3.01+
Examples:
change body month names and header week names:
ASCalendarAdvanced1.WeekNameShort = ASCalendarAdvanced1.CreateASCalendarAdvanced_WeekNameShort("Mon","Tue","Wed","Thu","Fri","Sat","Sun")
ASCalendarAdvanced1.MonthNameShort = ASCalendarAdvanced1.CreateASCalendarAdvanced_MonthNameShort("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec")
ASCalendarAdvanced1.UpdateBody 'Update all body items to the new style/text
ASCalendarAdvanced1.UpdateHeader 'Update all header items to the new style/text
Call this in B4XPage_Created or on Form Load and call this after you change something on the body, but only once at runtime
B4X:
'Call this to Build the calendar, unfortunately this is needed, otherwise runtime errors will occur
'Call this after you set all properties you want
ASCalendarAdvanced1.CreateCalendar
Mark all Sundays as a SpecialDay:
Sub ASCalendarAdvanced1_VisibleRangeChanged(StartDate As Long,EndDate As Long)
    Dim sundays As List = ASCalendarAdvanced1.GetDaysBetween2Dates(StartDate,EndDate, 1)
    For Each s As Long In sundays
        ASCalendarAdvanced1.AddSpecialDay(s,xui.Color_ARGB(255,221, 95, 96),"official_holiday")
    Next
    ASCalendarAdvanced1.CommitSpecialDays
End Sub

ASCalendarAdvanced
Author: Alexander Stolte
Version: 3.00

  • ASCalendarAdvanced
    • Events:
      • HeightChanged (Height As Float)
      • SelectedDateChanged (Date As Long)
      • TouchDown
      • TouchUp
      • VisibleRangeChange (StartDate As Long, EndDate As Long)
      • VisibleRangeChanged (StartDate As Long, EndDate As Long)
    • Fields:
      • AppointmentType1BottomAppointmentTyp2Top As Boolean
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • AddAppointmentType1 (date As Long, color As Int) As String
      • AddAppointmentType2 (date As Long, color As Int, text As String, text_color As Int) As String
      • AddAppointmentType3 (start_date As Long, end_date As Long, color As Int) As String
      • AddSpecialDay (date As Long, color As Int, identifier As String) As String
        Adds a new special day - call CommitSpecialDays if youre done with adding
        color - Text Color
        value - e.g. "official_holiday", "birthday","Vacation"
      • Back2CurrentDate As String
        Slides Back or Forward to the Current Date
      • Base_Resize (Width As Double, Height As Double) As String
      • Class_Globals As String
      • Close As String
      • CommitSpecialDays As String
        Commits all new visible special dates
      • CommitStyleChanges As String
        a simple Base_Resize, but all visible items ar updated
      • CreateASCalendarAdvanced_AppointmentType1 (date As Long, color As Int) As ASCalendarAdvanced_AppointmentType1
        simple dot under date
      • CreateASCalendarAdvanced_AppointmentType2 (date As Long, color As Int, text As String, text_color As Int) As ASCalendarAdvanced_AppointmentType2
        short text above date
      • CreateASCalendarAdvanced_AppointmentType2_ItemProperties (xfont As B4XFont, height As Float, padding As Float, corner_radius As Float) As ASCalendarAdvanced_AppointmentType2_ItemProperties
      • CreateASCalendarAdvanced_AppointmentType3 (start_date As Long, end_date As Long, color As Int) As ASCalendarAdvanced_AppointmentType3
      • CreateASCalendarAdvanced_AppointmentType3_ItemProperties (height As Float, alpha_color As Int, corner_radius As Float) As ASCalendarAdvanced_AppointmentType3_ItemProperties
        alpha_color - value between 0 - 255, its the aplha for the range appointments
      • CreateASCalendarAdvanced_BodyTextProperties (TextColor As Int, TextFont As B4XFont, TextAlignment_Vertical As String, TextAlignment_Horizontal As String) As ASCalendarAdvanced_BodyTextProperties
      • CreateASCalendarAdvanced_ExtraInfosTextProperties (TextColor As Int, TextFont As B4XFont, TextAlignment_Vertical As String, TextAlignment_Horizontal As String) As ASCalendarAdvanced_ExtraInfosTextProperties
      • CreateASCalendarAdvanced_HeaderTextProperties (TextColor As Int, TextFont As B4XFont, TextAlignment_Vertical As String, TextAlignment_Horizontal As String) As ASCalendarAdvanced_HeaderTextProperties
      • CreateASCalendarAdvanced_MonthNameShort (January As String, February As String, March As String, April As String, May As String, June As String, July As String, August As String, September As String, October As String, November As String, December As String) As ASCalendarAdvanced_MonthNameShort
      • CreateASCalendarAdvanced_SpecialDay (date As Long, color As Int, identifier As String) As ASCalendarAdvanced_SpecialDay
      • CreateASCalendarAdvanced_WeekNameShort (Monday As String, Tuesday As String, Wednesday As String, Thursday As String, Friday As String, Saturday As String, Sunday As String) As ASCalendarAdvanced_WeekNameShort
      • CreateCalendar
        call this function only once
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • Expand As String
      • getAppointmentType2_ItemPropertiest As ASCalendarAdvanced_AppointmentType2_ItemProperties
      • getAppointmentType3_ItemPropertiest As ASCalendarAdvanced_AppointmentType3_ItemProperties
      • getBodyTextProperties As ASCalendarAdvanced_BodyTextProperties
        Call UpdateBody if you change the properties
      • getBottomHeight As Float
        gets or sets the height of the drag-panel on the bottom, to expand or collapse the view
        Default 15dip
      • GetDaysBetween2Dates (StartDate As Long, EndDate As Long, RequiredDayOfWeek As Int) As List
        RequiredDayOfWeek - week starts at 1=sunday,2=monday...
        Call it if you are done adding new special days, makes this way makes the performance better
      • GetExpandedViewHeight As Float
        gets the view height of the expanded view height
      • getExtraInfosTextProperties As ASCalendarAdvanced_ExtraInfosTextProperties
      • getHeaderPanel As B4XView
      • getHeaderTextProperties As ASCalendarAdvanced_HeaderTextProperties
        Call UpdateHeader if you change the properties
      • getMonthNameShort As ASCalendarAdvanced_MonthNameShort
      • getSelectedDate As Long
        gets or sets the selected date
      • GetSpecialDayAt (date As Long) As ASCalendarAdvanced_SpecialDay
        Gets a ASCalendarAdvanced_SpecialDay object on a date if exists
      • getStartDate As Long
        Set this date before you call CreateCalendar
      • getVisibleDateRange As Map
        Public Sub CommitViewPager
        xASVP_Horizontal.Base_Resize(mBase.wi
        End Sub
        gets the current visible date range as map
        <code>Dim tmp_m As Map = ASCalendarAdvanced1.VisibleDateRange
        Log("StartDate: " & DateUtils.TicksToString(tmp_m.Get("StartDate")))
        Log("EndDate: " & DateUtils.TicksToString(tmp_m.Get("EndDate")))</code>
      • getWeekNameShort As ASCalendarAdvanced_WeekNameShort
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Month2WeekKeepSelectedWeekVisible (keep As Boolean) As String
        If you switch from MonthView to WeekView then the selected day keeps visible
        Default: True
      • NextWeek As String
        Scrolls to the next week or month it depends on the expanded state
      • PreviousWeek As String
        Scrolls to the previous week or month it depends on the expanded state
      • RemoveAppointmentType1 (date As Long) As String
        if there are multiple AppointmentType1 on the date, then all of them will be removed
      • RemoveAppointmentType2 (date As Long) As String
        removes AppointmentType2 on that day
        call CommitStyleChanges if youre done with removing
      • RemoveOneAppointmentType1 (date As Long) As String
        if there are multiple AppointmentType1 on the date, then one of them will be removed
        call CommitStyleChanges if youre done with removing
      • RemoveSpecialDay (date As Long) As String
        Removes a special day - call CommitSpecialDays if youre done with adding
      • Reset (ApType1 As Boolean, ApType2 As Boolean, ApType3 As Boolean, SpecialDays As Boolean) As String
        removes all appointments or special days. Set to "True" to control what should be reset
        call CommitStyleChanges if youre resetting the SpecialDays
      • Scroll2Date (Date As Long)
        Slides Back or Forward to a special date
      • setAppointmentType2_ItemPropertiest (ItemProperties As ASCalendarAdvanced_AppointmentType2_ItemProperties) As String
      • setAppointmentType3_ItemPropertiest (ItemProperties As ASCalendarAdvanced_AppointmentType3_ItemProperties) As String
      • setBodyColor (Color As Int) As String
        sets the body color
        the complete calendar is rebuilt at the action
      • setBodyTextProperties (BodyTextProperties As ASCalendarAdvanced_BodyTextProperties) As String
      • setBottomColor (Color As Int) As String
        sets the bottom color
      • setBottomHeight (height As Float) As String
        gets or sets the height of the drag-panel on the bottom, to expand or collapse the view
        Default 15dip
        call CommitStyleChanges if you change the value
      • setExtraInfosTextProperties (ExtraInfosTextProperties As ASCalendarAdvanced_ExtraInfosTextProperties) As String
      • setExtraItemGap (gap As Float) As String
        sets the ExtraItemGab - is to prevent the font from covering the month number
        Default 6dip
        call CommitStyleChanges if you change the value
      • setFirstDayOfWeek (number As Int) As String
        1-7 - set this before you call CreateCalendar
        Friday = 1
        Thursday = 2
        Wednesday = 3
        Tuesday = 4
        Monday = 5
        Sunday = 6
        Saturday = 7
      • setHeaderColor (Color As Int) As String
        sets the Header Color
      • setHeaderTextProperties (HeaderTextProperties As ASCalendarAdvanced_HeaderTextProperties) As String
      • setKeepSelectedDate (keep As Boolean) As String
        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
      • setLimit2Forward (OnlyFuture As Boolean) As String
        Limit the calendar to the current time period and the future
        Default: False
      • SetLimitRange (StartMonth As Long, EndMonth As Long) As String
        Limit the calendar to a certain range of months
        Set one of them to 0 if you dont want a limit
      • setMonthNameShort (MonthNameShort As ASCalendarAdvanced_MonthNameShort) As String
      • setOtherMonthBackgroundColor (Color As Int) As String
        sets the background color of the other month when 2 months are displayed in one
        the complete calendar is rebuilt at the action
      • setSelectedDate (date As Long) As String
        gets or sets the selected date
      • setShowFirstWeekOfMonthInFirstRow (show As Boolean) As String
        if the calendar is expanded, then the 1st week of the month will be in the 1st row
      • setShowOtherMonths (show As Boolean) As String
        Only in MonthView - set it to False if you dont show the days from the next or previous month
        Default: True
      • setStartDate (date As Long) As String
        Set this date before you call CreateCalendar
      • setWeekNameShort (WeekNameShort As ASCalendarAdvanced_WeekNameShort) As String
      • SpecialDayExists (date As Long) As Boolean
        Returns True if a special day is already added to a date
      • UpdateAll As String
        UpdateBody and UpdateHeader in one
      • UpdateBody As String
      • UpdateHeader As String
    • Properties:
      • AppointmentType2_ItemPropertiest As ASCalendarAdvanced_AppointmentType2_ItemProperties
      • AppointmentType3_ItemPropertiest As ASCalendarAdvanced_AppointmentType3_ItemProperties
      • BodyColor
        sets the body color
        the complete calendar is rebuilt at the action
      • BodyTextProperties As ASCalendarAdvanced_BodyTextProperties
        Call UpdateBody if you change the properties
      • BottomColor
        sets the bottom color
      • BottomHeight As Float
        gets or sets the height of the drag-panel on the bottom, to expand or collapse the view
        Default 15dip
      • ExtraInfosTextProperties As ASCalendarAdvanced_ExtraInfosTextProperties
      • ExtraItemGap
        sets the ExtraItemGab - is to prevent the font from covering the month number
        Default 6dip
        call CommitStyleChanges if you change the value
      • FirstDayOfWeek
        1-7 - set this before you call CreateCalendar
        Friday = 1
        Thursday = 2
        Wednesday = 3
        Tuesday = 4
        Monday = 5
        Sunday = 6
        Saturday = 7
      • HeaderColor
        sets the Header Color
      • HeaderPanel As B4XView [read only]
      • HeaderTextProperties As ASCalendarAdvanced_HeaderTextProperties
        Call UpdateHeader if you change the properties
      • 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
      • Limit2Forward
        Limit the calendar to the current time period and the future
        Default: False
      • MonthNameShort As ASCalendarAdvanced_MonthNameShort
      • OtherMonthBackgroundColor
        sets the background color of the other month when 2 months are displayed in one
        the complete calendar is rebuilt at the action
      • SelectedDate As Long
        gets or sets the selected date
      • ShowFirstWeekOfMonthInFirstRow
        if the calendar is expanded, then the 1st week of the month will be in the 1st row
      • ShowOtherMonths
        Only in MonthView - set it to False if you dont show the days from the next or previous month
        Default: True
      • StartDate As Long
        Set this date before you call CreateCalendar
      • VisibleDateRange As Map [read only]
        Public Sub CommitViewPager
        xASVP_Horizontal.Base_Resize(mBase.wi
        End Sub
        gets the current visible date range as map
        <code>Dim tmp_m As Map = ASCalendarAdvanced1.VisibleDateRange
        Log("StartDate: " & DateUtils.TicksToString(tmp_m.Get("StartDate")))
        Log("EndDate: " & DateUtils.TicksToString(tmp_m.Get("EndDate")))</code>
      • WeekNameShort As ASCalendarAdvanced_WeekNameShort
  • ASCalendarAdvanced_AppointmentType1
    • Fields:
      • color As Int
      • date As Long
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASCalendarAdvanced_AppointmentType2
    • Fields:
      • color As Int
      • date As Long
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • text As String
      • text_color As Int
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASCalendarAdvanced_AppointmentType2_ItemProperties
    • Fields:
      • corner_radius As Float
      • height As Float
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • padding As Float
      • xfont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASCalendarAdvanced_AppointmentType3
    • Fields:
      • color As Int
      • end_date As Long
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • start_date As Long
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASCalendarAdvanced_AppointmentType3_ItemProperties
    • Fields:
      • alpha_color As Int
      • corner_radius As Float
      • height As Float
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASCalendarAdvanced_BodyTextProperties
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • TextAlignment_Horizontal As String
      • TextAlignment_Vertical As String
      • TextColor As Int
      • TextFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASCalendarAdvanced_ExtraInfosTextProperties
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • TextAlignment_Horizontal As String
      • TextAlignment_Vertical As String
      • TextColor As Int
      • TextFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASCalendarAdvanced_HeaderTextProperties
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • TextAlignment_Horizontal As String
      • TextAlignment_Vertical As String
      • TextColor As Int
      • TextFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASCalendarAdvanced_MonthNameShort
    • Fields:
      • April As String
      • August As String
      • December As String
      • February As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • January As String
      • July As String
      • June As String
      • March As String
      • May As String
      • November As String
      • October As String
      • September As String
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASCalendarAdvanced_SpecialDay
    • Fields:
      • color As Int
      • date As Long
      • identifier As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASCalendarAdvanced_WeekNameShort
    • Fields:
      • Friday As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Monday As String
      • Saturday As String
      • Sunday As String
      • Thursday As String
      • Tuesday As String
      • Wednesday As String
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • WeekCounter
  • Vertical Swipe
  • MultiSelect
  • HideOtherMonths
  • Scroll2NextMonthIfClickOnNextMonth
  • AppointmentType1 - automatically display a + symbol when too many have been added
  • AppointmentType2 - support of multiple in one day e.g. for symbols
If you have features or something is still missing, let me know.
Changelog
  • 1.00
    • Release
  • 1.01
    • BugFixes
    • Add set ShowFirstWeekOfMonthInFirstRow - if the calendar is expanded, then the 1st week of the month will be in the 1st row - set this to true before you call "CreateCalendar"
  • 1.02
    • Add get VisibleDateRange- gets the current visible date range as map
    • BugFixes if ShowFirstWeekOfMonthInFirstRow is True
  • 1.03
    • Many BugFixes
    • ShowFirstWeekOfMonthInFirstRow is now fully implemented
  • 1.04
    • B4J Support
      • DoubleClick on Bottom to Expand or Collapse
        • Depend on Expandable
    • Add Designer Property ShowFirstWeekOfMonthInFirstRow - if the calendar is expanded then the 1st week of the month will be in the 1st row
  • 1.05 (read more about this update)
    • Important BugFixes if the view is expanded
    • Add AppointmentType1 - dots under a date
      • Add SetAppointmentType1 - adds an appointment to a date
      • IMG_5012.jpg
  • 1.06
    • BugFix
  • 1.07 (read more about this update)
    • SetAppointmentType1 renamed to AddAppointmentType1
    • BugFix on VisibleRangeChanged
    • Add GetDaysBetween2Dates - Returns a list of dates at a special day in a week e.g. all sundays between 2 dates
    • Add AddSpecialDay - Adds a new special day
      • IMG_5041.jpg
      • Add CommitSpecialDays - Commits all new visible special dates
      • Add SpecialDayExists - Returns True if a special day is already added to a date
      • Add GetSpecialDayAt - Gets a ASCalendarAdvanced_SpecialDay object on a date if exists
      • Add RemoveSpecialDay - Removes a special day
  • 2.00 (read more about this update)
    • BugFixes
    • Expand with fingers is now smooth
    • Add AppointmentType2 - Text Label above date
      • Add AddAppointmentType2 - adds an appointment to a date
    • Add AppointmentType3 - mark a range between 2 dates
      • Add AddAppointmentType3 - adds an range appointment between 2 dates
    • Add set and get AppointmentType2_ItemPropertiest - change the properties to customize AppointmentType2 look and feel e.g. corner_radius or padding
    • Add set and get AppointmentType3_ItemPropertiest - change the properties to customize AppointmentType3 look and feel e.g. corner_radius or aplha color
    • Add get and set BottomHeight - gets or sets the height of the drag-panel on the bottom, to expand or collapse the view
    • Add CommitStyleChanges - a simple Base_Resize, but all visible items ar updated
    • Add Event TouchDown - fires if the user touch the expand panel
    • Add Event TouchUp - fires if the user release the expand panel
    • Add Function GetExpandedViewHeight - gets the view height of the expanded view height
    • Add RemoveOneAppointmentType1 - if there are multiple AppointmentType1 on the date, then one of them will be removed
    • Add RemoveAppointmentType1 - if there are multiple AppointmentType1 on the date, then all of them will be removed
    • Add RemoveAppointmentType2 - removes AppointmentType2 on that day
    • Add Reset - removes all appointments or special days. Set to "True" to control what should be reset
    • Add set ExtraItemGap - is to prevent the font from covering the month number
  • 2.01 (read more about this update)
    • BugFix - Back2CurrentDay the current day panel has covered the day label
    • BugFix - AppointmentType3
    • Add get HeaderPanel - gets the header panel (code example)
    • Add set and get SelectedDate - gets or sets the selected date
    • BugFix - Removing Appointments
  • 2.02
    • BugFix
  • 2.04
    • Base_Resize is now public
    • Intern Function IIF renamed to iif2
  • 2.05 (read more about this update)
    • 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
  • 2.06 (read more about this update)
    • 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
  • 2.07
    • BugFix B4A and B4J HeightChanged event is now firing
  • 2.08
    • Intern Function iif2 removed and the core iif is now used
      • B4A V11+ - B4J V9.10+ - B4I V7.50+
    • B4I better perfomance on Page Change with ASViewPager V1.18+
    • B4I better perfomance on Expand and Collapse with finger and with the functions
    • BugFixes
  • 2.10 (read more about this update)
    • New Event VisibleRangeChange - is triggered before the new page is completely visible.
    • Add SetLimitRange - Limit the calendar to a certain range of months
      • Set one of them to 0 if you dont want a limit
  • 2.11 (read more about this update)
    • Designer Property "Expanded" a better handling of the view
      • If True the full height is used to display the view expanded
      • IF False the full height is used to display the view collapsed
      • Old Handling:
        • If True the full height is used to display the view collapsed and from the body height the expanded heihgt was calculated
    • Designer Property "BodyItemHeightInPercentage" Removed
      • was a poor indicator of how big the header is
    • Add Desinger Property "HeaderHeight" - Determines the size of the header. The larger the number the less space the items have in the body
    • Add Designer Property "KeepSelectedDate"
    • Add Designer Porperty "BottomHeight" - the height of the drag-panel on the bottom, to expand or collapse the view
    • Add Designer Property "ShowOtherMonths" - Only in MonthView - set it to False if you dont show the days from the next or previous month
    • Add Expand - Expands the view
    • Add Close - Collsaps the view
    • B4J BugFixes
  • 2.12
    • Add set HeaderColor
    • Add set BodyColor - the complete calendar is rebuilt at the action
    • Add set BottomColor
    • Add set OtherMonthBackgroundColor - the complete calendar is rebuilt at the action
  • 2.13
    • BugFix - The event "VisibleRangeChange" was not triggered when creating the calendar
  • 2.14
    • Add AppointmentType1BottomAppointmentTyp2Top - If false then AppointmentType1 is on Top and Type2 is on the bottom
  • 2.15
    • Add set Limit2Forward - Limit the calendar to the current time period and the future - set it to true before CreateCalendar
    • Add 2 property descriptions for better understanding
  • 2.16
    • Add PastDaysTextColor to BodyTextProperties - The text color for days that lie in the past - standard value is -1 (All days have the same color)
  • 2.17
    • Add KeepAppointmentsVisibleOnSelect - if True, then the appointments are visible if you select the day - Default: False
    • BugFixes
  • 2.18
    • Removes log messages that should not be there
  • 2.19
    • Add Designer Property FirstDayOfWeek
    • VisibleRangeChange and VisibleRangeChanged are now also triggered when you expand the calendar
    • BugFixes
  • 2.20
    • BugFixes
    • Add TextAlignment_Horizontal property to AppointmentType2_ItemProperties - LEFT,RIGHT,CENTER
      • Default: CENTER
  • 2.21 (read more about this update)
    • CrashFix - UpdateBody
    • Add CurrentDateProperties - you can now customize the current date
      • TextColor -TextFont -IndicatorColor -IndicatorCornerRadius -IndicatorHeight
    • Add SelectedDateProperties - you can now customize the selected date indicator
      • IndicatorColor -IndicatorCornerRadius -IndicatorHeight
    • Add AppointmentType1_ItemProperties
      • Height
        • Default: 5dip
      • Padding
        • Default: 0dip
  • 2.22
    • Add set CurrentDayBehindAppointments - if False then the current day indicator is before the appointments_type3
      • Default: True
    • The Selected Day Indicator is now always in front
  • 2.23
    • VisibleRangeChange and VisibleRangeChanged are now also triggered when you close the calendar
    • Add get Expanded - Checks if the calendar is expanded or collapsed
    • AppointmentType1 and 2 are now always in front
  • 3.00
    • The View now uses the LazyLoading technique
    • ASViewPager V1.30+ is required
    • BugFixes
  • 3.01
    • B4I The GestureRecognizer is no longer needed
  • 3.02
    • Add Designer Property WeekRowCount - You can now display 6 rows in a month
      • Default: 5
      • Its locked to 5 and 6
  • 3.03
    • Property ShowFirstWeekOfMonthInFirstRow removed
      • First week of month is always in the first row
    • BugFixes
  • 3.04
    • Add Refresh - Applies all changes and displays them
      • do the same as CommitStyleChanges
    • Call Refresh after you add one or some "AddAppointmentType1"
    • Minor Adjustments
  • 3.05
    • B4J only - Add Designer Property MouseHoverFeedback
      • Default: True
  • 3.06
    • BugFixes
  • 3.07
    • BugFixes
Have Fun :)
 

Attachments

  • GestureRecognizer.bas
    11.2 KB · Views: 315
  • 2.10 Backup ASCalendarAdvanced.zip
    14.3 KB · Views: 242
  • Example AS CalendarAdvanced.zip
    12.7 KB · Views: 333
  • 2.23 Backup ASCalendarAdvanced.zip
    16.7 KB · Views: 46
  • 3.02 Backup ASCalendarAdvanced.zip
    18 KB · Views: 30
  • ASCalendarAdvanced.zip
    18.3 KB · Views: 33
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
If you set SetDateTimeLocale(GetPreferredLanguage) before you call CreateCalendar then no error occurs.
But why, i dont know.
This line is affected then:
B4X:
Log(DateUtils.SetDate(DateTime.GetYear(ticks),DateTime.GetMonth(ticks),DateTime.GetDayOfMonth(ticks)))
But this has nothing to do with the view, because if I add this line after I set the locale with your code, then it also crashes outside of the view.
It looks like you have to set "SetDateTimeLocale" directly to app start so that no error occurs.

B4X:
SetDateTimeLocale(GetPreferredLanguage)
Log(DateUtils.SetDate(DateTime.GetYear(DateTime.Now),DateTime.GetMonth(DateTime.Now),DateTime.GetDayOfMonth(DateTime.Now)))'crash outside of the view'
DateTime.DateFormat = "EEEE dd MMMM"
Label1.Text = DateTime.Date(DateTime.Now)
'SetDateTimeLocale("EN-en")

Yes, work without problem.
But out of curiosity, i also noticed that if you insert it at the end and insert a sleep (100) it works.
When debugging, it appears that before closing, (AsCalendar.Close) continues to execute the line of code for one more time
B4X:
Return DateUtils.SetDate(DateTime.GetYear(ticks),DateTime.GetMonth(ticks),DateTime.GetDayOfMonth(ticks))
and finding the changed format fails.
In fact, inserting a Sleep(100) after AsCalendar.Close there is no error
B4X:
....
ASCalendarAdvanced1.Close

Sleep(100)

SetDateTimeLocale(GetPreferredLanguage)
DateTime.DateFormat = "EEEE dd MMMM"
Label1.Text = DateTime.Date(DateTime.Now)
 

wimpie3

Well-Known Member
Licensed User
Longtime User
I've discovered two bugs which are visible in the demo code.

1. The calendar starts in week mode with Sunday indicated in red. Pull down the calendar to put it in month mode and the same Sunday is still red, while the other Sundays are white. Move the calendar to the next month and return to the previous month. Now all Sundays are red.

2. Pull down the calendar to put it in month mode. Slide calendar to the left to show January. Slide back. Shows February. Perfect! Now slide back to the left to show January and click on the button "Back to current date". You will return to February but for a short moment, the two last rows will be shown as weeks from March. After a second, the calendar will change the layout and one of those two rows will be removed.
 
Last edited:

wimpie3

Well-Known Member
Licensed User
Longtime User
Another bug? Setting BodyColor or OtherMonthBackgroundColor or setOtherMonthBackgroundColor in B4XPage_Created results in
B4X:
java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0

Also, this:
B4X:
ASCalendarAdvanced1.AddAppointmentType3(DateUtils.AddPeriod(DateTime.Now,p),xui.Color_ARGB(255,45, 136, 121),xui.Color_Magenta)
seems to be an allowed syntax? I'm not passing through an end date. This results in a weird visual behaviour (left side of the magenta color is rounded, right side is rectangular).

It also seems to be impossible to change the corner radius of Appointment type 3. This:
B4X:
ASCalendarAdvanced1.AppointmentType3_ItemPropertiest.corner_radius=20dip
does not change anything?

Request: is it possible to add a horizontal alignment property for the labels in AppointmentType2 (left/center/right)?
 
Last edited:

Alexander Stolte

Expert
Licensed User
Update
  • 2.20
    • BugFixes
    • Add TextAlignment_Horizontal property to AppointmentType2_ItemProperties - LEFT,RIGHT,CENTER
      • Default: CENTER
Setting BodyColor or OtherMonthBackgroundColor or setOtherMonthBackgroundColor in B4XPage_Created results in
B4X:
java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
Had not checked internally if the calendar was already built, thus it tried to update the visual area that was not yet built.
seems to be an allowed syntax? I'm not passing through an end date. This results in a weird visual behaviour (left side of the magenta color is rounded, right side is rectangular).
A date is a "Long" datatype and a color an "Int", apparently he had no problem with the color, because it was a valid date.

does not change anything?
try it now.

Request: is it possible to add a horizontal alignment property for the labels in AppointmentType2 (left/center/right)?
added
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Thank you, very cool you are so quick in adapting the code! I hope you don't mind the bug reports 😉
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Only makes the product better ;)
In that case, here is some new material :)

1. in the demo code, when you try to put the calendar in month mode by inserting
B4X:
ASCalendarAdvanced1.expand

right after
B4X:
ASCalendarAdvanced1.Updateall

I get a crash:

B4X:
Error occurred on line: 382 (ASViewPager)
java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0

2. it seems that the parameter setExtraItemGap is not doing anything at all. No matter what value I put there, nothing changes on the calendar.

New request 1: if I'm correct, the color/radius of the circle on TODAYs date cannot be modified (or perhaps I'm overlooking something?). What I'd like to do is to disable the indicator (I'm okay with using a transparent color if that's easier for you) and to show today's day number with a BOLD text property.

New request 2: add the possibility to play with the spacing between two rows. As you can see on the screenshot, the round bullets from the appointments are glued against the green color from the next week. Would be cool if some optional spacing could be inserted there.

1644480350728.png
 
Last edited:

Alexander Stolte

Expert
Licensed User
2. it seems that the parameter setExtraItemGap is not doing anything at all. No matter what value I put there, nothing changes on the calendar.
Read the function descriptions.
"'sets the ExtraItemGab - is to prevent the font from covering the month number
'Default 6dip
'call CommitStyleChanges if you change the value"

6dip
1644518692885.png

20dip
1644518706365.png
 

Alexander Stolte

Expert
Licensed User
Update
  • 2.21
    • CrashFix - UpdateBody
    • Add CurrentDateProperties - you can now customize the current date
      • TextColor
      • TextFont
      • IndicatorColor
      • IndicatorCornerRadius
      • IndicatorHeight
    • Add SelectedDateProperties - you can now customize the selected date indicator
      • IndicatorColor
      • IndicatorCornerRadius
      • IndicatorHeight
    • Add AppointmentType1_ItemProperties
      • Height
        • Default: 5dip
      • Padding
        • Default: 0dip
CurrentDateProperties
Turn this:
1644522610416.png

Into this:
1644522625155.png

with:
B4X:
ASCalendarAdvanced1.CurrentDateProperties.TextFont = xui.CreateDefaultBoldFont(20)
ASCalendarAdvanced1.CurrentDateProperties.TextColor = xui.Color_Black
ASCalendarAdvanced1.CurrentDateProperties.IndicatorColor = xui.Color_ARGB(100,255,255,255)
ASCalendarAdvanced1.CurrentDateProperties.IndicatorCornerRadius = 5dip
ASCalendarAdvanced1.CommitStyleChanges
AppointmentType1_ItemPropertiest
Turn this:
1644522685976.png

Into this:
1644522740162.png

with:
B4X:
ASCalendarAdvanced1.AppointmentType1_ItemPropertiest.Padding = 10dip
ASCalendarAdvanced1.AppointmentType1_ItemPropertiest.Height = 7dip
 

Cebuvi

Active Member
Licensed User
Longtime User
Hello,

I have copied ASViewPager version 1.27 into the folder Additional Libraries and I get this error.


ASCalendar.jpg






Where is the problem?

Thanks.
 

Alexander Stolte

Expert
Licensed User
Where is the problem?
You need the ASViewPager.
 

Cebuvi

Active Member
Licensed User
Longtime User
I already have ASVewPager in Additional Libraries.

I have downloaded the AS Viewpager example and it works perfectly.
 
Top