B4A Library SecretTextView

The attached project wraps this Github project (it is also my 50th library posting). Posting the following:

1.B4A project
2. The Java Code
3. B4A library files. The library files include android-support-annotations.jar - copy all three files to your additional library folder.

Some sample code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: SecretTextView
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #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.
 
    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 stv1 As SecretTextView

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", 5000)
 
    stv1.Text = "This is a wrapper for https://github.com/matthewrkula/SecretTextView"
    stv1.TextSize = 30.0
    stv1.TextColor = Colors.Red
    stv1.Duration = 3000
 
End Sub

Sub Activity_Resume
 
    t.Enabled = True

End Sub

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

End Sub

Sub t_tick
 
    stv1.TextColor = Colors.ARGB(Rnd(200, 256), Rnd(150, 256), Rnd(150, 256), Rnd(150, 256))
    stv1.toggle
 
End Sub

1.png


2.png



SecretTextView
Author:
Johan Schoeman
Version: 1
  • SecretTextView
    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)
    • SetTextColorAnimated (arg0 As Int, arg1 As Int)
    • SetTextSizeAnimated (arg0 As Int, arg1 As Float)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • hide
    • show
    • toggle
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Duration As Int [write only]
    • Enabled As Boolean
    • Gravity As Int
    • Height As Int
    • IsVisible As Boolean [write only]
    • Left As Int
    • Tag As Object
    • Text As String
    • TextColor As Int
    • TextSize As Float
    • Top As Int
    • Typeface As Typeface
    • Visible As Boolean
    • Width As Int
 

Attachments

  • b4aSecretTextView.zip
    7.8 KB · Views: 253
  • SecretTextViewLibFiles.zip
    19.3 KB · Views: 263
  • TheJavaCode.zip
    34.8 KB · Views: 255

Daniel-White

Active Member
Licensed User
Longtime User
Hi johan, perhaps can you give me a light :) , I discovered something interesting. when I open a new project in B4A IDE, and only add this 2 libraries SecretTextView and the FusedLocationProvider

The Compiler say this. apparently we have the same class or jar file twice (I had been reading the forums about this type of errors), I did not really understand 100% where is the conlfict. I did not put any code in the IDE, only the two libraries for test.
something is doind a conflict. perhaps is in Library FusedLocationProvider.

Now why ? RequieresPermission ??

Thanks
Daniel White


Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/annotation/RequiresPermission;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:732)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:82)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:279)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
1 error; aborting
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi johan, perhaps can you give me a light :) , I discovered something interesting. when I open a new project in B4A IDE, and only add this 2 libraries SecretTextView and the FusedLocationProvider

The Compiler say this. apparently we have the same class or jar file twice (I had been reading the forums about this type of errors), I did not really understand 100% where is the conlfict. I did not put any code in the IDE, only the two libraries for test.
something is doind a conflict. perhaps is in Library FusedLocationProvider.

Now why ? RequieresPermission ??

Thanks
Daniel White


Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/annotation/RequiresPermission;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:732)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:82)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:279)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
1 error; aborting
I would suggest that once you have copied the 3 library files from the /Files folder of the B4A project to your additional library folder that you then delete them from the /Files folder. Also check if you don't perhaps have android-support-annotations.jar in your additional library folder as well as in the main B4A library folder. That might perhaps cause a conflict.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi johan, perhaps can you give me a light :) , I discovered something interesting. when I open a new project in B4A IDE, and only add this 2 libraries SecretTextView and the FusedLocationProvider

The Compiler say this. apparently we have the same class or jar file twice (I had been reading the forums about this type of errors), I did not really understand 100% where is the conlfict. I did not put any code in the IDE, only the two libraries for test.
something is doind a conflict. perhaps is in Library FusedLocationProvider.

Now why ? RequieresPermission ??

Thanks
Daniel White


Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/annotation/RequiresPermission;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:732)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:82)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:279)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
1 error; aborting
I have just started a new B4A project to test your observation. I have SecretTextView and FusedLocationProvider both enabled and I get no error whatsoever. Perhaps one of the experts on this subject can elaborate as to why you get the error.
 
Top