B4A Library ProgressLoadToast

walterf25

Expert
Licensed User
Hello All, i wanted to share this small library with you guys, it's something i wrapped while i needed it for a project i'm working on, I hope it can be of use to someone here.
Is really not a big deal, but basically it shows a ToastMessage with a progressbar inside of it. It gives a very nice animation when you call the Progress.Success method.

Give it a try and let me know what you guys think.

The project is based on the original project here:
https://github.com/code-mc/loadtoast

Instructions:
copy and paste the three files inside the zipped folder, ProgressLoadToast.xml, ProgressLoadToast.jar and the NineOldAndroids.jar files into your additional libraries folder.

Also copy the two images named ic_error.png and the ic_navigation_check.png into your object/res/drawable folder and don't forget to mark them as read only.

Enjoy:

Documentation:

ProgressLoadToast
Version:
1.32
  • ProgressLoadToast
    Methods:
    • BackgroundColor (backgroundcolor As Int)

      ba:
      backgroundcolor: Sets the progressloadtoast background color
      Example:
      <code>
      dim prg as ProgressLoadToast
      prg.Initialize("Please wait while Loading...", Colors.Blue)
      prg.BackgroundColor(Colors.Green)
      </code>
    • Error

      ba: Displays an error icon if your operation failed:
      Example:
      <code>
      prg.Error
      </code>
    • Initialize (toastmessage As String, textcolor As Int)

      ba:
      toastmessage:
      textcolor: Initializes the progressloadtoast
      Parameters required are the message to be displayed and the textcolor
      Example:
      <code>
      dim prg as ProgressLoadToast
      prg.Initialize("Please wait while Loading...", Colors.Blue)
      </code>
    • ProgressColor (progresscolor As Int)

      ba:
      progresscolor: Sets the progress Circle Color.
      Example:
      <code>
      dim prg as ProgressLoadToast
      prg.Initialize("Please wait while Loading...", Colors.Blue)
      prg.ProgressColor(Colors.Red)
      </code>
    • Success

      ba: Animates the progressloadtoast when your function has finished
      Equivalent to
      <code>progressdialoghide</code>
      Example:
      <code>
      prg.Success
      </code>
    • TextColor (textcolor As Int)

      ba:
      textcolor: Sets the text color of the message in the progresstoast
      Example:
      <code>
      prg.TextColor(Colors.Black)
      </code>
    • YTranslation (y As Int)

      ba:
      y: Sets the Y position of the progressloadtoast
      Example:
      <code>
      dim prg as ProgressLoadToast
      prg.Initialize("Please wait while Loading...", Colors.Blue)
      prg.YTranslation(200dip)
      </code>
    • show

      ba: Shows the progressloadtoast when ready
      Example:
      <code>
      dim prg as ProgressLoadToast
      prg.Initialize("Please wait while Loading...", Colors.Blue)
      prg.show
      </code>

Thanks,
Walter
 

Attachments

Last edited:

Kwame Twum

Active Member
Licensed User
looks great, tried it... kept getting an error.. a shot of the logs is shown below.


results.png
 

walterf25

Expert
Licensed User
looks great, tried it... kept getting an error.. a shot of the logs is shown below.


View attachment 34164
Hey There Kwame, did you copy the two images as described in the first post into your res/drawable folder, the name of the images are ic_error.png and the ic_navigation_check.png.

Let me know!

Walter
 

Kwame Twum

Active Member
Licensed User
Hey There Kwame, did you copy the two images as described in the first post into your res/drawable folder, the name of the images are ic_error.png and the ic_navigation_check.png.

Let me know!

Walter
Oops! please I just noticed one of the images was incorrectly named after I changed the image manually. Thanks a lot!
 

Kwame Twum

Active Member
Licensed User
Hello @walterf25, now I'm getting java.lang.NullPointerException on Activity_Create, and app closes.
Here's my code:
B4X:
Sub Globals
    Dim prg As ProgressLoadToast
    Private good As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("starter")
    prg.Initialize("Please wait while Loading...", Colors.Blue)
    'prg.YTranslation(200dip)
    prg.BackgroundColor(Colors.Green)
    prg.show
End Sub

Sub good_Click
    prg.Success
End Sub
Am I doing something wrong please?
 

walterf25

Expert
Licensed User
Set the properties of the *.png to read-only and allow
Hi can you upload a sample project? It would be easier so I can test and find out what's going on! I apologize but I'm a little short on time at the moment.

Thanks,
Walter
 

walterf25

Expert
Licensed User
Take this
I just tried your project sample and everything works fine on my end, are you sure you copied all three files into your additional libraries folder?
Make sure you have the ProgressLoadToast.jar, ProgressLoadToast.xml and nineoldandroid.jar files.

Let me know how it goes!

Thanks,
Walter
 

qsrtech

Active Member
Licensed User
Hello All, i wanted to share this small library with you guys, it's something i wrapped while i needed it for a project i'm working on, I hope it can be of use to someone here.
Is really not a big deal, but basically it shows a ToastMessage with a progressbar inside of it. It gives a very nice animation when you call the Progress.Success method.

Give it a try and let me know what you guys think.

The project is based on the original project here:
https://github.com/code-mc/loadtoast

Instructions:
copy and paste the three files inside the zipped folder, ProgressLoadToast.xml, ProgressLoadToast.jar and the NineOldAndroids.jar files into your additional libraries folder.

Also copy the two images named ic_error.png and the ic_navigation_check.png into your object/res/drawable folder and don't forget to mark them as read only.

Enjoy:

Documentation:

ProgressLoadToast
Version:
1.32
  • ProgressLoadToast
    Methods:
    • BackgroundColor (backgroundcolor As Int)

      ba:
      backgroundcolor: Sets the progressloadtoast background color
      Example:
      <code>
      dim prg as ProgressLoadToast
      prg.Initialize("Please wait while Loading...", Colors.Blue)
      prg.BackgroundColor(Colors.Green)
      </code>
    • Error

      ba: Displays an error icon if your operation failed:
      Example:
      <code>
      prg.Error
      </code>
    • Initialize (toastmessage As String, textcolor As Int)

      ba:
      toastmessage:
      textcolor: Initializes the progressloadtoast
      Parameters required are the message to be displayed and the textcolor
      Example:
      <code>
      dim prg as ProgressLoadToast
      prg.Initialize("Please wait while Loading...", Colors.Blue)
      </code>
    • ProgressColor (progresscolor As Int)

      ba:
      progresscolor: Sets the progress Circle Color.
      Example:
      <code>
      dim prg as ProgressLoadToast
      prg.Initialize("Please wait while Loading...", Colors.Blue)
      prg.ProgressColor(Colors.Red)
      </code>
    • Success

      ba: Animates the progressloadtoast when your function has finished
      Equivalent to
      <code>progressdialoghide</code>
      Example:
      <code>
      prg.Success
      </code>
    • TextColor (textcolor As Int)

      ba:
      textcolor: Sets the text color of the message in the progresstoast
      Example:
      <code>
      prg.TextColor(Colors.Black)
      </code>
    • YTranslation (y As Int)

      ba:
      y: Sets the Y position of the progressloadtoast
      Example:
      <code>
      dim prg as ProgressLoadToast
      prg.Initialize("Please wait while Loading...", Colors.Blue)
      prg.YTranslation(200dip)
      </code>
    • show

      ba: Shows the progressloadtoast when ready
      Example:
      <code>
      dim prg as ProgressLoadToast
      prg.Initialize("Please wait while Loading...", Colors.Blue)
      prg.show
      </code>

Thanks,
Walter
Seems like a nice UI touch but I see an issue with mine not showing all the text, maybe 20 chars max. please look into and try to resize to fit chars. Thanks.

Also, it would be nice if it's possible to create a "global" object like the traditional progressdialog
 

RauchG

Active Member
Licensed User
are you sure you copied all three files into your additional libraries folder?
No. Copy in C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries

Seems like a nice UI touch but I see an issue with mine not showing all the text, maybe 20 chars max. please look into and try to resize to fit chars. Thanks.

Also, it would be nice if it's possible to create a "global" object like the traditional progressdialog
That would be good
 

Kwame Twum

Active Member
Licensed User
I tried @RauchG 's attached project at my end and still doesn't function... the main activity just closes. :(
Really like the look of the library, pls help.
 

yiankos1

Active Member
Licensed User
Hello my friend, i have two questions for your library. Firstly, i didn't figure it out how show the "ic_navigation_check.png", it is just keep spinning and spinning. Here is a part of my code:
B4X:
Dim progress As ProgressLoadToast
progress.Initialize("Εγκατάσταση...",Colors.Gray)
progress.YTranslation(100%y-100dip)
progress.show
If FirstTime Then
   If File.Exists(File.DirDefaultExternal,"True6.txt")=False Then
      Try
         'couple of copies
         progress.Success
      Catch
         progress.Error
      End Try
   End if
End if
Secondly, random i figure it out to show the check.png, but it didn't dissapeared as show at .gif on github library, instead it keep shows the check.png all the time.
Thanks for your time.
 

Croïd

Active Member
Licensed User
Hi Walter

Thanks for your lib, but my test crash ! you can find the origin ?

java.lang.NoSuchMethodError: android.app.Application.getDrawable
at net.steamcrafted.loadtoast.LoadToastView.<init>(LoadToastView.java:111)
at net.steamcrafted.loadtoast.LoadToast.<init>(LoadToast.java:28)
at com.genesis.ProgressLoadToast.Initialize(ProgressLoadToast.java:39)
at com.b4a.exemple._activity_create(main.java:941)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at com.b4a.exemple.afterFirstLayout(main.java:100)
at com.b4a.exemple.access$100(main.java:17)
at com.b4a.exemple$WaitForLayout.run(main.java:78)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
 

ArminKH

Well-Known Member
upload_2015-8-18_12-16-18.png
upload_2015-8-18_12-16-57.png


i have same problem
i think the configurations are correct but which part is wrong?
 

Croïd

Active Member
Licensed User
walterf25

You can see problem with Debug (legacy)

Crash on startup with android 4.1
 
Last edited:

walterf25

Expert
Licensed User
Hello guys, sorry for not being able to follow up with you regarding some issues you guys are seeing, i've been pretty pre-occupied, please let me know if you guys are still having issues, i will try to look into this issues as soon as i can.

Thanks,
Walter
 

Kwame Twum

Active Member
Licensed User
Hello guys, sorry for not being able to follow up with you regarding some issues you guys are seeing, i've been pretty pre-occupied, please let me know if you guys are still having issues, i will try to look into this issues as soon as i can.

Thanks,
Walter
please my issue was never solved... pls check post #12
 

walterf25

Expert
Licensed User
please my issue was never solved... pls check post #12
I will be revising the library this weekend, I will get back to you as soon as have it resolved!

Thanks,
Walter
 
Top