This was asked here as a Wish . Enjoy it @fredo and all friends here
A wrap for this https://github.com/JohnPersano/SuperToasts
Please note :
1-
2- Not the whole project have been wrapped but I think the most important stuff .
SuperToasts
Author: SMM
Version: 0.01
Sample
This is testbg service code if you want to test toasts from services
UPDATE : Really sorry I forgot to upload resources folder now it is uploaded .
UPDATE : version 2 fixes issue reported here thanks @kkkpe and sorry for taking too much time .
Please note that now we have two different objects SuperActivityToast which is an ActivityObject as its name shows and SuperToast which can be used from a service .
SuperToasts
Author: SMM
Version: 0.02
A wrap for this https://github.com/JohnPersano/SuperToasts
Please note :
1-
B4X:
@DependsOn(values={"android-support-v4"})
SuperToasts
Author: SMM
Version: 0.01
- SuperToasts
Events:- _click
- _dismiss
- ANIMATIONS_FADE As Int
- ANIMATIONS_FLY As Int
- ANIMATIONS_POP As Int
- ANIMATIONS_SCALE As Int
- DURATION_LONG As Int
- DURATION_MEDIUM As Int
- DURATION_SHORT As Int
- DURATION_VERY_LONG As Int
- DURATION_VERY_SHORT As Int
- FRAME_KITKAT As Int
- FRAME_LOLLIPOP As Int
- FRAME_STANDARD As Int
- ICONPOSITION_BOTTOM As Int
- ICONPOSITION_LEFT As Int
- ICONPOSITION_RIGHT As Int
- ICONPOSITION_TOP As Int
- MATERIAL_AMBER As String
- MATERIAL_BLUE As String
- MATERIAL_BLUE_GREY As String
- MATERIAL_BROWN As String
- MATERIAL_CYAN As String
- MATERIAL_DEEP_ORANGE As String
- MATERIAL_DEEP_PURPLE As String
- MATERIAL_GREEN As String
- MATERIAL_GREY As String
- MATERIAL_INDIGO As String
- MATERIAL_LIGHT_BLUE As String
- MATERIAL_LIGHT_GREEN As String
- MATERIAL_LIME As String
- MATERIAL_ORANGE As String
- MATERIAL_PINK As String
- MATERIAL_PURPLE As String
- MATERIAL_RED As String
- MATERIAL_TEAL As String
- MATERIAL_YELLOW As String
- TYPE_BUTTON As Int
- TYPE_PROGRESS_BAR As Int
- TYPE_PROGRESS_CIRCLE As Int
- TYPE_STANDARD As Int
- Initialize (EventName As String)
- SuperActivityToast (type As Int, buttontext As String, drawable As String, tag As String, ProgressBarColor As Int, text As String, duration As Int, frame As Int, color As String, animation As Int)
- SuperToast (type As Int, drawable As String, tag As String, text As String, duration As Int, frame As Int, color As String, animation As Int)
Sample
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim st As SuperToasts
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("Layout1")
' Activity.Finish
' CallSubDelayed(testbg,"display_toast")
st.Initialize("st")
'baicon is the name of image drawable
st.SuperActivityToast(st.TYPE_BUTTON,"Done","baicon","my own tag",Colors.Red,"Well done",st.DURATION_VERY_LONG,st.FRAME_STANDARD,st.MATERIAL_BROWN,st.ANIMATIONS_FLY)
End Sub
Sub st_click(tag As String)
Log(tag)
End Sub
This is testbg service code if you want to test toasts from services
B4X:
#Region Service Attributes
#StartAtBoot: False
#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 sts As SuperToasts
End Sub
Sub Service_Create
sts.Initialize("sts")
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_Destroy
End Sub
Sub display_toast
sts.SuperToast(sts.TYPE_BUTTON,"baicon","my own toast tag","Well done",sts.DURATION_VERY_LONG,sts.FRAME_STANDARD,sts.MATERIAL_BROWN,sts.ANIMATIONS_FLY)
End Sub
Sub sts_dismiss(tag As String)
Log(tag)
End Sub
UPDATE : Really sorry
UPDATE : version 2 fixes issue reported here thanks @kkkpe and sorry for taking too much time .
Please note that now we have two different objects SuperActivityToast which is an ActivityObject as its name shows and SuperToast which can be used from a service .
SuperToasts
Author: SMM
Version: 0.02
- SuperActivityToast
Events:- _click
- ANIMATIONS_FADE As Int
- ANIMATIONS_FLY As Int
- ANIMATIONS_POP As Int
- ANIMATIONS_SCALE As Int
- DURATION_LONG As Int
- DURATION_MEDIUM As Int
- DURATION_SHORT As Int
- DURATION_VERY_LONG As Int
- DURATION_VERY_SHORT As Int
- FRAME_KITKAT As Int
- FRAME_LOLLIPOP As Int
- FRAME_STANDARD As Int
- ICONPOSITION_BOTTOM As Int
- ICONPOSITION_LEFT As Int
- ICONPOSITION_RIGHT As Int
- ICONPOSITION_TOP As Int
- MATERIAL_AMBER As String
- MATERIAL_BLUE As String
- MATERIAL_BLUE_GREY As String
- MATERIAL_BROWN As String
- MATERIAL_CYAN As String
- MATERIAL_DEEP_ORANGE As String
- MATERIAL_DEEP_PURPLE As String
- MATERIAL_GREEN As String
- MATERIAL_GREY As String
- MATERIAL_INDIGO As String
- MATERIAL_LIGHT_BLUE As String
- MATERIAL_LIGHT_GREEN As String
- MATERIAL_LIME As String
- MATERIAL_ORANGE As String
- MATERIAL_PINK As String
- MATERIAL_PURPLE As String
- MATERIAL_RED As String
- MATERIAL_TEAL As String
- MATERIAL_YELLOW As String
- TYPE_BUTTON As Int
- TYPE_PROGRESS_BAR As Int
- TYPE_PROGRESS_CIRCLE As Int
- TYPE_STANDARD As Int
- Initialize (EventName As String)
- SuperActivityToast (type As Int, buttontext As String, drawable As String, tag As String, ProgressBarColor As Int, text As String, duration As Int, frame As Int, color As String, animation As Int)
- SuperToast
Events:- _dismiss
- ANIMATIONS_FADE As Int
- ANIMATIONS_FLY As Int
- ANIMATIONS_POP As Int
- ANIMATIONS_SCALE As Int
- DURATION_LONG As Int
- DURATION_MEDIUM As Int
- DURATION_SHORT As Int
- DURATION_VERY_LONG As Int
- DURATION_VERY_SHORT As Int
- FRAME_KITKAT As Int
- FRAME_LOLLIPOP As Int
- FRAME_STANDARD As Int
- ICONPOSITION_BOTTOM As Int
- ICONPOSITION_LEFT As Int
- ICONPOSITION_RIGHT As Int
- ICONPOSITION_TOP As Int
- MATERIAL_AMBER As String
- MATERIAL_BLUE As String
- MATERIAL_BLUE_GREY As String
- MATERIAL_BROWN As String
- MATERIAL_CYAN As String
- MATERIAL_DEEP_ORANGE As String
- MATERIAL_DEEP_PURPLE As String
- MATERIAL_GREEN As String
- MATERIAL_GREY As String
- MATERIAL_INDIGO As String
- MATERIAL_LIGHT_BLUE As String
- MATERIAL_LIGHT_GREEN As String
- MATERIAL_LIME As String
- MATERIAL_ORANGE As String
- MATERIAL_PINK As String
- MATERIAL_PURPLE As String
- MATERIAL_RED As String
- MATERIAL_TEAL As String
- MATERIAL_YELLOW As String
- TYPE_BUTTON As Int
- TYPE_PROGRESS_BAR As Int
- TYPE_PROGRESS_CIRCLE As Int
- TYPE_STANDARD As Int
- Initialize (EventName As String)
- SuperToast (type As Int, drawable As String, tag As String, text As String, duration As Int, frame As Int, color As String, animation As Int)
Attachments
Last edited: