B4A Library ProgressLoadToast

Discussion in 'Additional libraries, classes and official updates' started by walterf25, May 6, 2015.

  1. walterf25

    walterf25 Well-Known 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
     

    Attached Files:

    Last edited: May 6, 2015
  2. Kwame Twum

    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 likes this.
  3. walterf25

    walterf25 Well-Known 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
     
  4. Kwame Twum

    Kwame Twum Active Member Licensed User

    Oops! please I just noticed one of the images was incorrectly named after I changed the image manually. Thanks a lot!
     
    Ishmael likes this.
  5. Kwame Twum

    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:
    Code:
    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?
     
  6. RauchG

    RauchG Active Member Licensed User

    Set the properties of the *.png to read-only and allow
     

    Attached Files:

  7. walterf25

    walterf25 Well-Known Member Licensed User

    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
     
  8. RauchG

    RauchG Active Member Licensed User

    Take this
     

    Attached Files:

  9. walterf25

    walterf25 Well-Known Member Licensed User

    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
     
  10. qsrtech

    qsrtech Active Member Licensed User

    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
     
  11. RauchG

    RauchG Active Member Licensed User

    No. Copy in C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries

    That would be good
     
  12. Kwame Twum

    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.
     
  13. yiankos1

    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:
    Code:
    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.
     
  14. Croïd

    Croïd Active Member Licensed User

    Hi Walter

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

     
  15. ArminKH

    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?
     
  16. Croïd

    Croïd Active Member Licensed User

    walterf25

    You can see problem with Debug (legacy)

    Crash on startup with android 4.1
     
    Last edited: Aug 23, 2015
  17. walterf25

    walterf25 Well-Known 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
     
  18. Kwame Twum

    Kwame Twum Active Member Licensed User

    please my issue was never solved... pls check post #12
     
  19. walterf25

    walterf25 Well-Known Member Licensed User

    I will be revising the library this weekend, I will get back to you as soon as have it resolved!

    Thanks,
    Walter
     
    Kwame Twum likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice