B4A Library PanelView

A wrap for this Github project. Posting

1. B4A project
2. B4A library files

Take note of the following in the B4A code (set your path correctly):
B4X:
'IMPORTANT!!!! YOU NEED TO SET THE FOLLOWING PATHS CORRECTLY FOR YOUR OWN COMPUTER!!!!!!!!!!!!!!!!!!
'THE BELOW PATH IS THE PATH FOR MY COMPUTER
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\v7\appcompat\res, android.support.v7.appcompat

#Extends: android.support.v7.app.AppCompatActivity

Take note of the B4A Manifest file:

B4X:
SetApplicationAttribute(android:theme, "@style/MyAppTheme")

Take note of the PanelViewRes and resource folders in the B4A project

I suggest that before you run the project you "clean" it with the B4A IDE (Tools ----> Clean project)

1.gif



Sample Code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: PanelView
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#AdditionalRes: ..\PanelViewRes
#AdditionalRes: ..\resource

'IMPORTANT!!!! YOU NEED TO SET THE FOLLOWING PATHS CORRECTLY FOR YOUR OWN COMPUTER!!!!!!!!!!!!!!!!!!
'THE BELOW PATH IS THE PATH FOR MY COMPUTER
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\v7\appcompat\res, android.support.v7.appcompat

#Extends: android.support.v7.app.AppCompatActivity

#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.
   
    Dim t As Timer

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 pv1 As PanelView
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")
   
    t.Initialize("t", 1000)
   
    pv1.Text = "Some Random Value"
    pv1.Percent = 0
    pv1.ArcValueColor = Colors.yellow
    pv1.ArcBlankColor = Colors.white
    pv1.ArcWidth = 40
    pv1.TextSize = 25
    pv1.PointerColor = Colors.Magenta
    pv1.TextColor = Colors.Cyan
   
End Sub

Sub Activity_Resume
   
    t.Enabled = True

End Sub

Sub Activity_Pause (UserClosed As Boolean)
   
    t.Enabled = False

End Sub

Sub t_tick
    Dim value As Int = Rnd(0,101)
    pv1.Percent = value
   
End Sub

Library:
PanelView
Author:
Github: githubwing, Wrapped by: Johan Schoeman
Version: 1.03
  • PanelView
    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:
    • ArcBlankColor As Int [write only]
    • ArcValueColor As Int [write only]
    • ArcWidth As Int [write only]
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Parent As Object [read only]
    • Percent As Int [write only]
    • PointerColor As Int [write only]
    • Tag As Object
    • Text As String [write only]
    • TextColor As Int [write only]
    • TextSize As Int [write only]
    • Top As Int
    • Visible As Boolean
    • Width As Int
 

Attachments

  • PanelViewLibFiles.zip
    7.3 KB · Views: 263
  • b4aPanelView.zip
    48.7 KB · Views: 267

rbghongade

Active Member
Licensed User
Longtime User
Dear Johan,
Do I have to download the github project and create the directory structure ?
 

Johan Schoeman

Expert
Licensed User
Longtime User
Dear Johan,
Do I have to download the github project and create the directory structure ?
Just explain what directory structure you are referring to...Do you mean this one?

#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
 

Johan Schoeman

Expert
Licensed User
Longtime User
Johan should really update to b4a 6 :D
The AdditionalRes is not needed with b4a 6 and the most-up-to-date AppCompat library.
I do have B4A V6 - but what about members that are not yet on B4A V6?
 

rbghongade

Active Member
Licensed User
Longtime User
Dear Johan,
I am not able to locate the ..extras\android\support\v7\appcompat\res folder. I installed the latest sdk for android , still not able to locate the folder. Hence I was asking whether to create the folder structure.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Dear Johan,
I am not able to locate the ..extras\android\support\v7\appcompat\res folder. I installed the latest sdk for android , still not able to locate the folder. Hence I was asking whether to create the folder structure.
Hi Rajesh, it should be in your Android SDK folder if you have selected the correct components to install.
 

DonManfred

Expert
Licensed User
Longtime User
I am not able to locate the ..extras\android\support\v7\appcompat\res folder. I installed the latest sdk for android , still not able to locate the folder. Hence I was asking whether to create the folder structure.
Google has changed some libs and put them in a maven repository in smaller pieces.
I Suggest to update b4a to 6+ and also update Appcompat lib to the latest version...
 

rbghongade

Active Member
Licensed User
Longtime User
Dear friends,
Thank you for your responses. I have a folder structure as follows:
D:\Android\sdk\extras\android\m2repository\com\android\support\appcompat-v7\23.0.0
Using B4A 6.0 and still not able to get the compilation done!
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
HI Rajesh

Download the new Appcompat lib files from this posing:

https://www.b4x.com/android/forum/t...compatible-with-older-android-versions.48423/

Then copy the Jar, the XML, and the aar files to your additional library folder.
Refresh your libs in the libs tab of the IDE and enable/select the Appcompat lib
Then comment out the line in my code that points to the AdditionalRes of the SDK tools
See if it then works.
 

rbghongade

Active Member
Licensed User
Longtime User
Dear Johan,
Thanks, it worked but had to copy android-support-v7-appcompat.jar and android-support-v4.jar to ..\B4A\Additional Libraries folder.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Dear Johan,
Thanks, it worked but had to copy android-support-v7-appcompat.jar and android-support-v4.jar to ..\B4A\Additional Libraries folder.
I have nothing working at present - one of those updates that just messed up everything....
 
Top