B4A Library SD: Floating Button StandOut

(No WRAP, but B4A)
I've been in a new challenge. I reworked a little release published by @JordiCP. Find Here

He entered the Java code taken by GitHub (see https://github.com/henrychuangtw/Android-ChatHead) and wrapped it with "#IF JAVA" inside a B4A module.

With his permission I extended a bit of the B4A code and retouched the Java code (for that little I remember Java) and I realized one thing I longed for: A flying button that always stands out even on other Apps On the Desktop.

You can get the full version by making a donation..

SD_FloatingStandOut

Author:
Star-Dust
Version: 0.09
  • FloatingStandOut
    Code module
    Subs in this code module will be accessible from all modules.
    • Fields:
      • ActiveService As Boolean
      • ENABLEDROP As Boolean
      • EventClick As String
      • EventDoubleClick As String
      • EventLongClick As String
      • EventMove As String
      • HALF_STICK_TO_BORDER As Boolean
      • HeightImage As Int
      • NameFileImage As String
      • NotificationBody As String
      • NotificationTitle As String
      • PathImage As String
      • StartActivity_OnClick As Boolean
      • StartActivity_OnDoubleClick As Boolean
      • StartActivity_OnLongClick As Boolean
      • STICK_TO_BORDER As Boolean
      • StopFloating_OnClick As Boolean
      • StopFloating_OnDoubleClick As Boolean
      • StopFloating_OnLongClick As Boolean
      • WhiteCircle As Boolean
      • WidthImage As Int
      • X As Int
      • Y As Int
    • Functions:
      • Process_Globals As String
      • SetEvent (EventName As String) As String
        SetEvent("FL")
        Sub FL_OnClick(X as int, Y as int)
        Sub FL_OnDoubleClick(X as int, Y as int)
        Sub FL_OnLongClick(X as int, Y as int)
        Sub FL_OnMove(X as int, Y as int)
      • SetImageBitmap (img As Bitmap) As String
      • SetStartActivity (OnClick As Boolean, OnDoubleClick As Boolean, OnLongClick As Boolean) As String
      • SetStopFloating (OnClick As Boolean, OnDoubleClick As Boolean, OnLongClick As Boolean) As String
      • Start (Me_CallBack As Object) As String
        Es. Start(Me,Application.PackageName)
      • Stop As String
  • SpecialPermission
    • Functions:
      • ActivatePermissionResumable As ResumableSub
      • Class_Globals As String
      • GetPermission As Boolean
      • Initialize As String
        Inizializza l'oggetto. Puoi aggiungere parametri a questo metodo,se necessario.
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • OpenSettingPermission As String
      • SdkVersion As Int
  • chElement
    • Fields:
      • active As Boolean
      • id As Int
      • instance As JavaObject
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • ttype As chType
      • xpos As Int
      • ypos As Int
    • Functions:
      • Initialize
        Inizializza i campi al loro valore predefinito.
  • standout
    • Fields:
      • CallBack As Object
      • Snotif As Notification
    • Functions:
      • process_globals


N.B. Don't forget ADD to Manifest
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

request permission SDK 23+
B4X:
    Dim Permission As SpecialPermission
    Permission.Initialize
    If Permission.GetPermission Then
        FloatingStandOut.Start(Me)
    Else
        Permission.OpenSettingPermission
    End If

With resumable sub
B4X:
Sub RequestPermission
    Dim Permission As SpecialPermission
    Permission.Initialize
    Log(Permission.GetPermission)
    Wait For (Permission.ActivatePermissionResumable) Complete (Success As Boolean)
    If Success Then FloatingStandOut.Start(Me)
End Sub
 

Attachments

  • sample1.zip
    48.5 KB · Views: 1,108
  • sample2.zip
    26.8 KB · Views: 1,160
  • SD_FloatingStandOut 0.09.zip
    21.2 KB · Views: 369
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
I'm not fast, to be honest a lot of work you did it (and Henry Chuang for the Java part) I just finished some details to use it as a library.
But still needs work to create circle menus already integrated in the library and other small ideas I have in mind ... it will take time.

However, thank you for allowing me to work
 

FrankDev

Active Member
Licensed User
Longtime User
Hi

i've following error / Example1

Android 6.0 / 4.4
B4A 7.01

LogCat connected to: emulator-5554
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
** Service (svrautostart) Create **
** Service (svrautostart) Start **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (standout) Create **
java.lang.NoSuchMethodError: anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand
at b4a.example.standout.onStartCommand(standout.java:80)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2702)
at android.app.ActivityThread.access$2100(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)

regards Frank
 

Star-Dust

Expert
Licensed User
Longtime User
I just have to recompile the library for B4A7. @Erel has changed something.

I own BA4 6.5, just a few friends kindly compile me for B4A7 to have the liberia recompiled.

Also because I suspect that by compiling with B4A7, it will not work for B4A 6.5:(:(:(
 

Star-Dust

Expert
Licensed User
Longtime User
Use release 0.03 that is compiled for B4A 7+
 
Last edited:

FrankDev

Active Member
Licensed User
Longtime User
it works :)

>@Erel has changed something.<

could that be the reason why other lib's don't work?
I have this also in other lib's for example

IntentID
 

Star-Dust

Expert
Licensed User
Longtime User
I do not know, @Erel is the right person to talk to, or contact developers so they can recompile the library.

I was afraid of something like this and I spoke in this forum.
Personally I stay at 6.5 for now there are many users who do not have version 7 and they also bought the product, I do not think they are abandoned.
I'm sure @Erel will not abandon them in a sad fate.
 

Star-Dust

Expert
Licensed User
Longtime User
If I understood correctly, you did not want the white circle around the icon.

I put a boolean variable (WhiteCircle) to disable it.
You can download library from post#8 updated
 

Star-Dust

Expert
Licensed User
Longtime User
Tnk's but, I like to share the knowledge, if you see on top there is also a link to take the source code.
I'm sure I'll be back with the same help when I need it. ;);)

(However when developing for customers i pay for it :p:p:p)
 
Last edited:

Smee

Well-Known Member
Licensed User
Longtime User
Hi @Star-Dust I have been playing around with your library. It is everything a library should be small,succint, does it's job and easy to use. Many thanks. I add to Frank's comments re donation. I will be using this little gem in a non commercial app of mine.

Thanks again

EDIT: Is it possible to add text to this?
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Hi @Star-Dust I have been playing around with your library. It is everything a library should be small,succint, does it's job and easy to use. Many thanks. I add to Frank's comments re donation. I will be using this little gem in a non commercial app of mine.

Thanks again

EDIT: Is it possible to add text to this?
In the future it will probably be possible. I have in mind how much improvement and function. But I'm working on my third Library.

Thanks for the donation offer. Consoling that I produced a useful library. But I created this library because I'm afraid there are no free around. So I thought I would do one if I succeeded. Although simple but important that there was a free one.

I am not against who creates libraries and accepts donations, but for those who develop for personal use, you must also give at least one free tool. Perhaps not as powerful as the one paid, but there has to be
 

Star-Dust

Expert
Licensed User
Longtime User
Update 0.04 for B4A 6.5

New method for change bitmap
SetImageBitmap(img As Bitmap)
 
Top