B4A Library CoupleCalendar

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, Feb 2, 2019.

  1. DonManfred

    DonManfred Expert Licensed User

    This is a wrap for this Github project.

    CoupleCalendar
    <link>...|http://www.b4x.com</link>
    Author: yuyakaido (Github)/DonManfred (Wrapper)
    Version: 0.1
    • CCEvent
      • Functions:
        • Initialize (EventName As String)
        • IsInitialized As Boolean
        • setDurationType
      • Properties:
        • DurationType As com.yuyakaido.android.couplescalendar.model.DurationType [read only]
        • EndAt As Long
        • EndAtDateTime As Long [read only]
        • EventColor As Int
        • EventDays As java.util.List [read only]
        • EventType As com.yuyakaido.android.couplescalendar.model.EventType
        • LinePosition As com.yuyakaido.android.couplescalendar.model.LinePosition
        • RecurrenceRule As String
        • StartAt As java.util.Date
    • CouplesCalendarView
      • Events:
        • onDateClick (date As Long)
        • onMonthChange (date As Long)
      • Functions:
        • BringToFront
        • DesignerCreateView (base As Panel, lw As Label, props As Map)
        • Initialize (EventName As String)
        • Invalidate
        • Invalidate2 (arg0 As android.graphics.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 android.graphics.Bitmap) As BitmapDrawable
        • 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)
      • Properties:
        • Background As android.graphics.drawable.Drawable
        • Color As Int [write only]
        • Enabled As Boolean
        • ETNormal As com.yuyakaido.android.couplescalendar.model.EventType [read only]
        • ETRecurring As com.yuyakaido.android.couplescalendar.model.EventType [read only]
        • ETTransient As com.yuyakaido.android.couplescalendar.model.EventType [read only]
        • Events As List [write only]
        • Height As Int
        • Left As Int
        • LinePositionLower As com.yuyakaido.android.couplescalendar.model.LinePosition [read only]
        • LinePositionUpper As com.yuyakaido.android.couplescalendar.model.LinePosition [read only]
        • Padding As Int()
        • Parent As Object [read only]
        • Tag As Object
        • Theme As com.yuyakaido.android.couplescalendar.model.Theme
        • ThemeBlue As com.yuyakaido.android.couplescalendar.model.Theme [read only]
        • ThemeGREEN As com.yuyakaido.android.couplescalendar.model.Theme [read only]
        • ThemeLIGHT_BLUE As com.yuyakaido.android.couplescalendar.model.Theme [read only]
        • ThemeNAVY_BLUE As com.yuyakaido.android.couplescalendar.model.Theme [read only]
        • ThemeORANGE As com.yuyakaido.android.couplescalendar.model.Theme [read only]
        • ThemePINK As com.yuyakaido.android.couplescalendar.model.Theme [read only]
        • ThemePURPLE As com.yuyakaido.android.couplescalendar.model.Theme [read only]
        • ThemeRED As com.yuyakaido.android.couplescalendar.model.Theme [read only]
        • ThemeTIFFANY_BLUE As com.yuyakaido.android.couplescalendar.model.Theme [read only]
        • ThemeYELLOW As com.yuyakaido.android.couplescalendar.model.Theme [read only]
        • Top As Int
        • Visible As Boolean
        • Width As Int

    Code:
    Dim evList As List
        evList.Initialize

        
    Dim event As CCEvent
        
    event.Initialize("")
        
    Dim startAt As Long = DateTime.DateTimeParse("01/12/2019","08:00:00")
        
    Dim endAt As Long = DateTime.DateTimeParse("01/14/2019","08:30:00")
        
    event.setDurationType
        
    event.StartAt = startAt
        
    event.EndAt = endAt
        
    event.EventColor = Colors.Blue
        
    event.LinePosition = ccv1.LinePositionUpper
        evList.Add(
    event)

        
    Dim event As CCEvent
        
    event.Initialize("")
        
    Dim startAt As Long = DateTime.DateTimeParse("02/01/2019","00:00:00")
        
    Dim endAt As Long = DateTime.DateTimeParse("02/01/2019","23:59:59")
        
    event.setDurationType
        
    event.StartAt = startAt
        
    event.EndAt = endAt
        
    event.EventColor = Colors.Black
        
    event.LinePosition = ccv1.LinePositionUpper
        evList.Add(
    event)

        
    Dim event As CCEvent
        
    event.Initialize("")
        
    Dim startAt As Long = DateTime.DateTimeParse("02/02/2019","00:00:00")
        
    Dim endAt As Long = DateTime.DateTimeParse("02/02/2019","22:00:00")
        
    event.setDurationType
        
    event.StartAt = startAt
        
    event.EndAt = endAt
        
    event.EventColor = Colors.Magenta
        
    event.LinePosition = ccv1.LinePositionUpper
        evList.Add(
    event)

        
    Dim event As CCEvent
        
    event.Initialize("")
        
    Dim startAt As Long = DateTime.DateTimeParse("02/18/2019","00:00:00")
        
    Dim endAt As Long = DateTime.DateTimeParse("02/22/2019","00:00:00")
        
    event.setDurationType
        
    event.StartAt = startAt
        
    event.EndAt = endAt
        
    event.EventColor = Colors.Red
        
    event.LinePosition = ccv1.LinePositionLower
        evList.Add(
    event)

        ccv1.Events = evList
        ccv1.Theme = ccv1.ThemeGREEN
    results in
    WhatsApp Image 2019-02-02 at 08.19.15.jpeg
     

    Attached Files:

    Last edited: Feb 3, 2019
  2. Harris

    Harris Well-Known Member Licensed User

    Cool...
    I thought from the name - it was a calendar - for couples (like man and wife, girlfriend, etc...).
    It would sync their engagements, share each others calendar... Silly me.
    What's in a name?
     
    Sasuke Sama likes this.
  3. DonManfred

    DonManfred Expert Licensed User

    Ask the github author :D

    I just took the name given...
    I guess couples here are more than one event on a day (visible). maybe... Dont know ;-)
     
    Peter Simpson and Harris like this.
  4. Harris

    Harris Well-Known Member Licensed User

    and you claim you can't readily understand / interpret english...
    Could easily fool me, brother... Can't imagine what my statement would translate into your language.
    You guys are amazing - compared to us low lifes on the North American continent.
    Peace.
     
  5. DonManfred

    DonManfred Expert Licensed User

    Did i bother you in some kind? Or did i misinterpret this now?

    If i did bother you in some way; it was not my intention.



    I usually do not give much interpretion in a name of a java class. I just take it

    so i write a CouplesCalendarViewwrapper which is the wrap for the original.
    And in this case, the libraryname is just taken from the githubs project main class
     
  6. Harris

    Harris Well-Known Member Licensed User

    I said BROTHER- not BOTHER. So similar spelling - yet different meanings entirely (the problem with english).

    Brother is what we say for: my close friend - part of my immediate family - someone who is near and dear to me.
    It is often used as a slang term we use (here) to imply love and respect among men.
    I think it may have originated from the African/American culture here in North America (which many of us have adopted).

    Women may use a different term to imply the same thing.

    Sorry for hi-jacking your thread here, I couldn't resist.
    Oh, the language barrier... With all of the translate technology - it still fails from time to time...

    Hey, we learn something new everyday (hopefully).
     
  7. DonManfred

    DonManfred Expert Licensed User

    and i did understand it correctly. I just was irritate about the

    i interpreted it to be something that i said the wrong somehow.
    Sorry, i guess this is the result of being english not my native language and sometimes i do not understand correctly or wrong.

    Peace :)
     
    Harris likes this.
  8. Harris

    Harris Well-Known Member Licensed User

    You say I know nothing Mr. Fawlty - but I learn - I learn!!!!!

    My tag line... We all learn... hopefully everyday.
     
  9. Sasuke Sama

    Sasuke Sama Active Member Licensed User

    me too XD
     
  10. Pencil3

    Pencil3 Member Licensed User

    Tried the example (CoupleCalendarEx.zip) and recieve the below error:

    ERROR: resource directory '..\res.couplescalendar' does not exist
     
  11. DonManfred

    DonManfred Expert Licensed User

    Extract the zip to your project folder so that the folder in the zip (res.Couplecalendar) is in your projectfolder.
     

    Attached Files:

  12. Adson Figueiredo Lima

    Adson Figueiredo Lima New Member Licensed User

    Good night,
    This error is occurring with the date 10/20/2019.



    java.lang.RuntimeException: An error occured while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:304)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:818)
    Caused by: java.lang.IllegalArgumentException: Illegal instant due to time zone offset transition: 2019-10-20T03:00:00.000
    at org.joda.time.chrono.ZonedChronology.localToUTC(ZonedChronology.java:143)
    at org.joda.time.chrono.ZonedChronology.getDateTimeMillis(ZonedChronology.java:119)
    at org.joda.time.chrono.AssembledChronology.getDateTimeMillis(AssembledChronology.java:133)
    at org.joda.time.base.BaseDateTime.<init>(BaseDateTime.java:254)
    at org.joda.time.base.BaseDateTime.<init>(BaseDateTime.java:195)
    at org.joda.time.DateTime.<init>(DateTime.java:460)
    at com.yuyakaido.android.couplescalendar.util.CalendarUtils.getMidnight(CalendarUtils.java:46)
    at com.yuyakaido.android.couplescalendar.model.InternalEvent.getEventDays(InternalEvent.java:118)
    at com.yuyakaido.android.couplescalendar.util.EventCache.createCacheIn(EventCache.java:84)
    at com.yuyakaido.android.couplescalendar.util.EventCache.createDefaultCache(EventCache.java:110)
    at com.yuyakaido.android.couplescalendar.util.EventCache.init(EventCache.java:45)
    at com.yuyakaido.android.couplescalendar.ui.CouplesCalendarView$2.doInBackground(CouplesCalendarView.java:154)
    at com.yuyakaido.android.couplescalendar.ui.CouplesCalendarView$2.doInBackground(CouplesCalendarView.java:151)
    at android.os.AsyncTask$2.call(AsyncTask.java:292)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    ... 4 more
    ** Activity (app) Pause, UserClosed = true **
     
  13. Ian Garton

    Ian Garton Member Licensed User

    Where do I get:
    Code:
    #AdditionalJar: joda-time-2.1.jar
     
  14. Pencil3

    Pencil3 Member Licensed User

    I am running into the below error with AndroidX and B4A 9.50 when trying to use the CoupleCalendarEx.zip. The library is jetified and I have the following files in my external libs folder:
    CoupleCalendar.androidx
    CoupleCalendar
    CoupleCalendar.xml

    *** Service (starter) Create ***
    ** Service (starter) Start **
    ** Activity (main) Create, isFirst = true **
    Error occurred on line: 36 (Main)
    java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at b4a.example.calendar.main._activity_create(main.java:387)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at b4a.example.calendar.main.afterFirstLayout(main.java:104)
    at b4a.example.calendar.main.access$000(main.java:17)
    at b4a.example.calendar.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
    Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    ... 18 more
    Caused by: android.view.InflateException: Binary XML file line #18 in b4a.example.calendar:layout/view_couples_calendar: Binary XML file line #18 in b4a.example.calendar:layout/view_couples_calendar: Error inflating class android.support.v4.view.ViewPager
    Caused by: android.view.InflateException: Binary XML file line #18 in b4a.example.calendar:layout/view_couples_calendar: Error inflating class android.support.v4.view.ViewPager
    Caused by: java.lang.ClassNotFoundException: android.support.v4.view.ViewPager
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:454)
    at android.view.LayoutInflater.createView(LayoutInflater.java:815)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
    at android.view.View.inflate(View.java:25757)
    at com.yuyakaido.android.couplescalendar.ui.CouplesCalendarView.initialize(CouplesCalendarView.java:72)
    at com.yuyakaido.android.couplescalendar.ui.CouplesCalendarView.<init>(CouplesCalendarView.java:68)
    at com.yuyakaido.android.couplescalendar.ui.CouplesCalendarView.<init>(CouplesCalendarView.java:63)
    at com.yuyakaido.android.couplescalendar.ui.CouplesCalendarView.<init>(CouplesCalendarView.java:59)
    at de.donmanfred.CouplesCalendarViewwrapper._initialize(CouplesCalendarViewwrapper.java:74)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at b4a.example.calendar.main._activity_create(main.java:387)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at b4a.example.calendar.main.afterFirstLayout(main
    Message longer than Log limit (4000). Message was truncated.
    ** Activity (main) Resume **
     
  15. DonManfred

    DonManfred Expert Licensed User

    The Lib does not work with AndroidX without rewriting the githubproject.
     
  16. Johan Schoeman

    Johan Schoeman Expert Licensed User

    If you change the xml code in view_couples_calendar.xml to.....

    Code:
    <?xml version="1.0" encoding="utf-8"?>

    <LinearLayout
        xmlns:android=
    "http://schemas.android.com/apk/res/android"
        android:orientation=
    "vertical"
        android:layout_width=
    "match_parent"
        android:layout_height=
    "match_parent"
        android:background=
    "@color/cc_while">

        <GridView
            android:
    id="@+id/view_couples_calendar_day_of_week_grid_view"
            android:layout_width=
    "match_parent"
            android:layout_height=
    "wrap_content"
            android:listSelector=
    "@android:color/transparent"
            android:numColumns=
    "7">
        </GridView>

        <androidx.viewpager.widget.ViewPager
            android:
    id="@+id/view_couples_calendar_view_pager"
            android:layout_width=
    "match_parent"
            android:layout_height=
    "wrap_content">
        </androidx.viewpager.widget.ViewPager>

    </LinearLayout>
    .....then it should work. Look for view_couples_calendar.xml in the res.Couplescalendar/layout folder of @DonManfred's B4A sample project.

    I have tested in with targetSDK = 28 on an Android 9 (Samsung S10) device and it is working just fine after I have made the above changes to the xml file and ran the Jetifier. Using B4A v9.50
     

    Attached Files:

    Last edited: Nov 10, 2019
  17. Pencil3

    Pencil3 Member Licensed User

    I can confirm it works for me also. Thank you so much for posting a solution!

     
    Johan Schoeman and f0raster0 like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice