Android Example Analog24hClock - Post #12

Discussion in 'Tutorials & Examples' started by Johan Schoeman, Jul 7, 2015.

  1. Johan Schoeman

    Johan Schoeman Expert Licensed User

    It wraps a tiny bit of this - just enough to show the clock. Thought it looked quite nifty...Have done nothing special to it other than painting the hands and the face a bit...:) Lib files are all in the /files folder - copy them to your additional libraries folder. Also posting the Java code - do with it as you like.

    Edit - see post #2


    pic1.png
     

    Attached Files:

    Last edited: Jul 9, 2015
  2. Johan Schoeman

    Johan Schoeman Expert Licensed User

    Have wrapped some additional functionality of this Github project (although working it is not yet where it should be). Nevertheless, it would be interesting to know if it correctly shows the day/night time (sunrise/sunset) of where you are at present. Please post some pics of your display and if you don't mind state where you are and also if it represents your approximate sunrise/sunset times.

    Library files (2 x Jar and 1 x Xml) are in the /files folder of the attached B4A project. Copy them to your additional libraries folder. You might have to enable the GPS of your device to get a current location in case you have been on the move. Else it will use your last known location.
    The pic posted herewith is a very good representation of the sunrise/sunset times of where I am at present (i.e Durban, South Africa).


    pic2.png

    As it stands at present:

    analog24hclock
    Version:
    1
    • Analog24HClock
      Fields:
      • ba As BA
      Methods:
      • BringToFront
      • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
      • Initialize (EventName As String)
      • 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)
      • setUsePassiveLocation
      Properties:
      • Background As Drawable
      • Color As Int [write only]
      • Enabled As Boolean
      • Height As Int
      • LargeFace As Boolean [write only]
        True = large face will be used
        False = small face will be used
      • Left As Int
      • Location As Location [write only]
      • OverlayNightColor As Int [write only]
      • OverlaySunColor As Int [write only]
      • Scale As Float [write only]
      • ShadeAlpha As Int [write only]
      • ShowSeconds As Boolean [write only]
        When set, the minute hand will move slightly based on the current number
        of seconds. If false, the minute hand will snap to the minute ticks.
        Note: there is no second hand, this only affects the minute hand.
      • Tag As Object
      • Time As Long [write only]
        Set the time (pass long milliseconds value of B4A's DateTime.Now)
      • Top As Int
      • Visible As Boolean
      • Width As Int
     

    Attached Files:

    Last edited: Jul 9, 2015
    imbault, MarcoRome and DonManfred like this.
  3. DonManfred

    DonManfred Expert Licensed User

  4. Johan Schoeman

    Johan Schoeman Expert Licensed User

    Is this representative of Germany sunrise/sunset at present @DonManfred? If so, when do you guys sleep? :)
     
  5. DonManfred

    DonManfred Expert Licensed User

    I would say yes

    Edit: Yes, approx.
     
    Johan Schoeman likes this.
  6. Johan Schoeman

    Johan Schoeman Expert Licensed User

    Actually a very interesting pic that you have posted. Does it tell us that where you are the sun is at its highest position above the horizon just before 14h00 (your local time)?
     
    Last edited: Jul 9, 2015
  7. MarcoRome

    MarcoRome Expert Licensed User

    Why you put this in Android Example and not in Library ??
    Anyway great ;)
    Good job
     
    Johan Schoeman likes this.
  8. Johan Schoeman

    Johan Schoeman Expert Licensed User

    Still working on it @MarcoRome.
    And I have a good teacher ;)
     
    DonManfred and MarcoRome like this.
  9. DonManfred

    DonManfred Expert Licensed User

    Yes. Approx. it fit´s
     
    Johan Schoeman likes this.
  10. DonManfred

    DonManfred Expert Licensed User

    I´ll have a look at work on the SunSet/SunRise methods i use in my MySQL Database and let you know what it outputs... It is based on geographical location. I found this sometime in the deeps of the internet....
     
  11. DonManfred

    DonManfred Expert Licensed User

  12. Johan Schoeman

    Johan Schoeman Expert Licensed User

    Getting there. The attached project adds the following:
    1. Display the current date (month and day)
    2. Add (reading from daytime towards night time on the clock or from lighter shade of grey to darker shade of grey) the civil, nautical, and astronomical twilights for the last known location of your device. You can read up about it here. The total black + shaded area covers sunset to sunrise.

    New library files (2 x Jar and 1 x XML) are in the /files folder of the attached B4A project. Copy them to your additional library folder.

    It seems that the jsuntimes-1.0.stripped library that this project also makes use of is indeed correct in drawing the different shaded/dark areas as far as their start/end times are concerned for last known locations of a device...;)



    pic3.png
     

    Attached Files:

    Last edited: Jul 12, 2015
    MarcoRome, Harris and DonManfred like this.
  13. Daniel-White

    Daniel-White Active Member Licensed User

    Hi Johan, From Venezuela, it is correct :)
    upload_2015-12-18_12-5-8.png
     
    Johan Schoeman likes this.
  14. robertyoungs

    robertyoungs Member Licensed User

    Hi Johan, from UK - doesn't appear to have rendered properly?

    EDIT - works fine now and accurate - Apologies - helps if I turn on Location services!


    This is the V3, and the libs from that zip, running on a Nexus 7

    Love what you've done!
    Screenshot_2016-04-28-09-30-41.png
     
    Last edited: Apr 28, 2016
    Johan Schoeman likes this.
Loading...