B4i Library iHUD library - Toast messages and progress dialogs

JanPRO

Well-Known Member
Licensed User
Longtime User
Hi,

Yes:
B4X:
'Example:
hd.ToastMessageShow("Have a nice day :)", True)
CustomizeHud(Font.CreateNew(30),Colors.Red,Colors.Green)

Sub CustomizeHud (aFont As Object, TextColor As Int, BackgroundColor As Int)
    Dim no1 As NativeObject = App.KeyController
    no1 = no1.GetField("view")
    Dim no2 As NativeObject
    Dim hud As NativeObject = no2.Initialize("MMBProgressHUD").RunMethod("HUDForView:", Array(no1))
    If hud.IsInitialized Then
        hud.SetField("color",hud.ColorToUIColor(BackgroundColor))
        hud.SetField("labelColor",hud.ColorToUIColor(TextColor))
        hud.SetField("labelFont",aFont)
    End If
End Sub

Jan
 

MikeH

Well-Known Member
Licensed User
Longtime User
Hi Jan,

Thank you for this code. Is it possible to change the colour of the indicator?



I'd like it to be the same colour as the text

Thanks again
 
Last edited:

Alessandro71

Well-Known Member
Licensed User
Longtime User
Last time I checked, BCToast was not able to show a Toast Message from a running Android service, which is the reason I still use native ToastMessage
 

MikeH

Well-Known Member
Licensed User
Longtime User
Which indicator? Why not use BCToast which is cross platform and easier to customize?
This round swirly thing:


I've tried the B4XProgress view and may go with that and also I'll look at BCToast, thank you. I just want a progress indicator to show the phone hasnt frozen. Ideally, Id like an actual progress indicator like this I did for iOS but couldnt get it working in Android:


I've thought of a way to do it though. Thats my next task.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Example of a custom progress indicator using B4XDialog + B4XActivityIndicator
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    ProgressDialog.Initialize(Root)
    ProgressDialog.OverlayColor = xui.Color_Transparent
    ProgressDialog.BorderWidth = 0
    ProgressDialog.BackgroundColor = xui.Color_Transparent
    ProgressDialog.ButtonsHeight = 0
End Sub


Private Sub Button1_Click
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl.SetLayoutAnimated(0, 0, 0, 100dip, 100dip)
    pnl.LoadLayout("ProgressDialog")
    ProgressDialog.ShowCustom(pnl, "", "", "")
    Sleep(5000)
    ProgressDialog.Close(xui.DialogResponse_Cancel)
End Sub
It is completely customizable.
The animation is very smooth in release mode.
 

Attachments

  • Project.zip
    176.1 KB · Views: 18
Cookies are required to use this site. You must accept them to continue using the site. Learn more…