It warps this Github project. Posting the following:
1. B4A project demonstrating CollapseCalendarView
2. The Java code - change/amend it to your liking
3. B4A library files (CollapseCalendarViewLibFiles.zip) - extract the zip file and copy the files to your additional library folder
4. commons-lang3-3.4.zip - extract the zip file and copy the files to your additional library folder
5. joda-time-2.0.zip - extract the zip file and copy the files to your additional library folder
You also need android-support-v4.jar. You can download it from here:
(https://www.dropbox.com/s/qmggn0wm5a6bqa9/android-support-v4.jar?dl=0)
Take note of the files in the Objects/res/blabla.... folders in case you start a new project. The property of these files should be set to READ ONLY
Once you have set up the calendar you can Click on the left / right arrows to go to the next / previous month.
Default calendar view:
Clicking on the right arrow:
Fling the view up/down with your finger to get a week view.
Week view:
Sample Code:
The library as it stands at present:
CollapseCalendarView
Author: Github: Blaz Solar, Wrapped by: Johan Schoeman
Version: 1
1. B4A project demonstrating CollapseCalendarView
2. The Java code - change/amend it to your liking
3. B4A library files (CollapseCalendarViewLibFiles.zip) - extract the zip file and copy the files to your additional library folder
4. commons-lang3-3.4.zip - extract the zip file and copy the files to your additional library folder
5. joda-time-2.0.zip - extract the zip file and copy the files to your additional library folder
You also need android-support-v4.jar. You can download it from here:
(https://www.dropbox.com/s/qmggn0wm5a6bqa9/android-support-v4.jar?dl=0)
Take note of the files in the Objects/res/blabla.... folders in case you start a new project. The property of these files should be set to READ ONLY
Once you have set up the calendar you can Click on the left / right arrows to go to the next / previous month.
Default calendar view:
Clicking on the right arrow:
Fling the view up/down with your finger to get a week view.
Week view:
Sample Code:
B4X:
#Region Project Attributes
#ApplicationLabel: CollapseCalendarView
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private ccv1 As CollapseCalendarView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
ccv1.Initialize("ccv1", 2, 1)
Activity.AddView(ccv1, 2%x, 5%y, 96%x, 70%y)
ccv1.DayNameColor = Colors.yellow
ccv1.DayNameTextSize = 15
ccv1.TitleTextColor = Colors.Green
ccv1.TitleTextSize = 20
End Sub
Sub Activity_Resume
Log("resume " & ccv1.SelectedDate)
' ccv1.minusMonths = 3 'use these two calls together to set the number of months forward/backwards from the present date
' ccv1.plusMonths = 3
' ccv1.minusYears = 1 'use these two calls together to set the number of years forward/backwards from the present date
' ccv1.plusYears = 2
'ccv1.setminusMonthsPlusYears(3,1) 'use this call to set the number of months backwards and the number of years forward from the present date
ccv1.setminusYearsPlusMonths(1, 5) 'use this call to set the number of years backwards and the number of months forward from the present date
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ccv1_date_selected(mydate As String)
Log("mydate = " & mydate)
End Sub
The library as it stands at present:
CollapseCalendarView
Author: Github: Blaz Solar, Wrapped by: Johan Schoeman
Version: 1
- CollapseCalendarView
Events:- date_selected (date As String)
- ba As BA
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Initialize (EventName As String, minusyears As Int, plusyears As Int)
Initialize with the name of the Event that will be raised when a date is clicked,
the number of years backwards from the present date (0, 1, 2, 3......), and
the number of years forward from the present date (0, 1, 2, 3......) - Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- setminusMonthsPlusYears (minusmonths As Int, plusyears As Int)
Set the number of months back and the number of years forward from the present date
This is the range that the calendar will display - setminusYearsPlusMonths (minusyears As Int, plusmonths As Int)
Set the number of years back and the number of months forward from the present date
This is the range that the calendar will display
- Background As Drawable
- Color As Int [write only]
- DayNameColor As Int [write only]
Set the color of the Day names - DayNameTextSize As Int [write only]
Set the size of the Day names - Enabled As Boolean
- Height As Int
- Left As Int
- MaxDate As String [read only]
Returns the maximum date that the calendar has been set to - MinDate As String [read only]
Returns the minimum date that the calendar has been set to - Parent As Object [read only]
- SelectedDate As String [read only]
Returns the date that has been clicked on - Tag As Object
- TitleTextColor As Int [write only]
Set the color of the Title Text (i.e the Month/Year and the Week Number) - TitleTextSize As Int [write only]
Set the size of the Title Text (i.e the Month/Year and the Week Number) - Top As Int
- Visible As Boolean
- Width As Int
- minusMonths As Int [write only]
Set the number of months backwards from the present date
This method should be used with "plusMonths = x" where x = 0, 1, 2, 3, .....
The range that the calendar will display will be from (present date - minusmonths) to (present date + plusmonths) - minusYears As Int [write only]
Set the number of years backwards from the present date
This method should be used with "plusYears = x" where x = 0, 1, 2, 3, .....
The range that the calendar will display will be from (present date - minusyears) to (present date + plusyears) - plusMonths As Int [write only]
Set the number of months forward from the present date
This method should be used with "minusMonths = x" where x = 0, 1, 2, 3, .....
The range that the calendar will display will be from (present date - minusmonths) to (present date + plusmonths) - plusYears As Int [write only]
Set the number of years forward from the present date
This method should be used with "minusYears = x" where x = 0, 1, 2, 3, .....
The range that the calendar will display will be from (present date - minusyears) to (present date + plusyears)
Attachments
Last edited: