A calendar made easy

PaulMeuris

Active Member
Licensed User
Check out the new version of Calendar notes in message #3 and/or #5!

tut2_001_01.png


In this new tutorial you can find out how easy it is to make a calendar app.
Once the app is running you can learn more on how to use a standard calendar class in a project.
In the fine tuning section the calendar class will then be compiled into a library.
You are invited to expand the project to build a year overview using the calendar library.
Have a look at: B4A-Calendar
Happy coding!
Paul
 
Last edited:

PaulMeuris

Active Member
Licensed User
View attachment 128855

In this new tutorial you can find out how easy it is to make a calendar app.
Once the app is running you can learn more on how to use a standard calendar class in a project.
In the fine tuning section the calendar class will then be compiled into a library.
You are invited to expand the project to build a year overview using the calendar library.
Have a look at: B4A-Calendar
Happy coding!
Paul
Check out the newly added chapter Calendar notes.
This assignment invites you to create an app using the calendar_library and code from the B4A-lists tutorial.
The changes to the calendar_library are described in the text.
If you finish the assignment successfully then you will have a personal appointment calendar!
Happy coding!
Paul
 

PaulMeuris

Active Member
Licensed User
You can download a new version of the Calendar_notes app.
1709455314125.png

This version should work on a device with Android version 14.
1709455502916.png

Tapping on a day opens a note dialog.
1709455670206.png
1709455782072.png

The notes are stored in text files.
1709455996974.png

The app works in landscape and portrait.
1709456353587.png
1709456413048.png

The app works fine when the user changes the font size and/or the screen zoom on the device.
1709456207888.png
1709456536084.png

The Today menu item scrolls the calendar to the current month and day (in red).
A few extracts from the source code:
Added permission in the Manifest:
AddPermission(android.permission.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)
Runtimepermissions:
Public folder As String
Public rp As RuntimePermissions
folder = rp.GetSafeDirDefaultExternal("")
Read or write a note text file:
Sub load_note(ticks As String) As String
    If File.Exists(folder,ticks & "_notes.txt") Then
        Return File.ReadString(folder,ticks & "_notes.txt")
    Else
        Return ""
    End If
End Sub
Sub save_note(ticks As String,note As String)
    File.Delete(folder,ticks & "_notes.txt")
    File.WriteString(folder,ticks & "_notes.txt",note)
End Sub
screen adjustments:
    Dim scale As Float = GetDeviceLayoutValues.Scale
    Dim screensize As Double = GetDeviceLayoutValues.ApproximateScreenSize
    Dim devwidth As Int = GetDeviceLayoutValues.Width/scale
    Dim devheight As Int = (GetDeviceLayoutValues.height/scale) - 40dip     ' title bar height not included
    If screensize > 8 Then
        Dim devwidth As Int = GetDeviceLayoutValues.Width
        Dim devheight As Int = GetDeviceLayoutValues.height - 80dip     ' title bar height not included
    End If
    Private boxwidth As Int = DipToCurrent(devwidth/7)
    Private boxheight As Int = DipToCurrent(devheight/8)
check if a note exists for the day:
                    If File.Exists(folder,DateUtils.SetDate(yr,mnth,daynumber) & "_notes.txt") Then
                        If daynumber = currentday And mnth = currentmonth And yr = currentyear Then
                            Private lbl As Label = set_label(daynumber,Colors.ARGB(100,255,165,0),"lblday")
                        Else
                            Private lbl As Label = set_label(daynumber,Colors.ARGB(100,255,255,0),"lblday")
                        End If
                    End If
And that's it. Try it out and let me know if you have some issue with it.
 

Attachments

  • calendar_notes_new.zip
    13.9 KB · Views: 8

Xfood

Expert
Licensed User
very nice congratulations, it would be very useful if you could choose the departure day of the week, and start from Monday,
it would be like this:
Monday Tuesday Wednesday Thursday Friday Saturday Sunday
 
Top