Share My Creation Croutons Demo - An alternative to Toasts

Croutons is a UI component used to show short messages to the user. It can be used as an alternative to ToastMessage mainly because Toasts do not maintain context (for e.g. a toast for a different activity will show on the wrong activity).

Idea taken from Cyril Mottier: Cyril Mottier » The making of Prixing #4: in-layout notifications

Anyway, this was my first class so I wanted to see what can be done.
 

Attachments

  • Screenshot_2012-12-23-02-05-04.png
    Screenshot_2012-12-23-02-05-04.png
    58.6 KB · Views: 6,956
  • Screenshot_2012-12-23-02-05-29.png
    Screenshot_2012-12-23-02-05-29.png
    58.7 KB · Views: 601
  • Screenshot_2012-12-23-02-05-51.png
    Screenshot_2012-12-23-02-05-51.png
    59.5 KB · Views: 570
  • CroutonsSample.apk
    160.9 KB · Views: 321
Last edited:

Ohanian

Active Member
Licensed User
Longtime User
Hi,

Image alignment (Left, Right) and customizable font would be nice.

tanx
 

susu

Well-Known Member
Licensed User
Longtime User
Very nice! Hope you will release your class soon.
 

bsnqt

Active Member
Licensed User
Longtime User
Croutons is a UI component used to show short messages to the user. It can be used as an alternative to ToastMessage mainly because Toasts do not maintain context (for e.g. a toast for a different activity will show on the wrong activity).

Idea taken from Cyril Mottier: Cyril Mottier » The making of Prixing #4: in-layout notifications

Anyway, this was my first class so I wanted to see what can be done.

Hi thedesolatesoul,

Happy New Year!

Have you already released your class. Where I can find it out. Thank you very much.

Best

bsnqt
 

Dario126

Member
Licensed User
Longtime User
I put some crouton message with mDuration=0 to make it visible until further notice.

B4X:
crouton.makeText("No internet connection",Icon,0,Gravity.LEFT)

How to remove by code so that it makes fade out?
This is not implemented or I'm missing it?

I tried to make use crouton.Animate_AnimationEnd (make it public), but that's not working ..
 

Dario126

Member
Licensed User
Longtime User
OMG, my mistake. I had some other idea on my mind, but made it wrong.
I was trying to change text by using .makeText(), and then fade out.

B4X:
crouton.makeText("CONNECTED",Icon,0,Gravity.LEFT)

But when I give this new command, it start again from transparent to solid (fade in).
Can I just change text on Crouton, and then FadeOut?
 

thedesolatesoul

Expert
Licensed User
Longtime User
I see. I havent done this but it sounds like a good idea.
I cant test this right now as Im not at my PC, but can you try this:

replace the makeText sub in the class with this:
B4X:
Public Sub makeText(text As String,icon As Bitmap,mDuration As Int,mAlign As Int)
    text_l = text
    icon_l = icon
    duration_l = mDuration
    align_l = mAlign
    TiledBackGround
    ShowMessage
    If panel_l.Visible = False then
            InitializeAnimate
    End If
End Sub
 

Dario126

Member
Licensed User
Longtime User
It work's .. thank You for very fast reply.

If You plan to make next release, maybe would be good idea to make possible to change text, hold it for desired time, and then make exit animation or fade.


Edit:

actually it works even like this
B4X:
crouton.makeText("Connected",Icon,1000,Gravity.LEFT)
crouton.hideText
 
Last edited:
Top