B4A Library AttitudeView

A basic wrap for this Github project. Will add some additional setters to the java project (such as changing colors, etc) should someone have a use for this.

I am using the PhoneOrientation part of the Phone library to drive the view.

1.png


Sample Code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aAttitudeView
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #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 av1 As AttitudeView
    Dim PO As PhoneOrientation
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")

End Sub

Sub Activity_Resume
   
    PO.StartListening("PO")

End Sub

Sub Activity_Pause (UserClosed As Boolean)
   
    PO.StopListening

End Sub

Sub PO_OrientationChanged(Azimuth As Float, Pitch As Float, Roll As Float)
    av1.Pitch = Pitch
    av1.Roll = Roll
End Sub

Library (I have not tested all the methods):

AttitudeView
Author:
Github: Andres Rengifo, Wrapped by: Johan Schoeman
Version: 1
  • AttitudeView
    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)
    Properties:
    • Background As Drawable
    • BackgroundColor As Int [write only]
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • LineColor As Int [write only]
    • MarkerColor As Int [write only]
    • Parent As Object [read only]
    • Pitch As Float
    • RangeDegrees As Float [write only]
    • Roll As Float
    • ShowMarker As Boolean [write only]
    • Tag As Object
    • TextColor As Int [write only]
    • TextSize As Int [write only]
    • Top As Int
    • Visible As Boolean
    • Width As Int
 

Attachments

  • b4aAttitudeView.zip
    8.1 KB · Views: 284
  • AttitudeViewLibFiles.zip
    9.2 KB · Views: 284
Top