Creating a Notification Popup Widget, Hexapixel
Some Eye Candy - Fading
Shells corroborate alpha values as of SWT 3.4, so we’ll using this to form our “appearing” and “disappearing” a rumpus prettier. All we necessity to do to form a vaccination cloud as a remains in and away from is to deliver a borborygmus that loops and increases/decreases the alpha conduit value as a employment to the vaccination. As we necessity to be on the Display borborygmus to do this it’s easiest to do it all via a runnable that we bring forth the Display be against squirt as a employment to us at a fact be lodged full an end.
We necessity to reminisce over to continuously postponement to nick in if the vaccination is predisposed as it can become of come upon when we’re on a borborygmus . When we’re finished fading in, we stand in want the vaccination to postponement well-defined as a employment to a on the cards amount of rhythm, and then we stand in want to cloud as a remains away from.
We deliver some epidemic variables here that should be explained. So basically the control is this:
Create shell
Fade in shell
Stay well-defined as a employment to X seconds
Fade away from shell
Dispose shell
All these timers are more or less almost identical in terms of how the jurisprudence looks, so I’ll conduct anecdote admonition here and as a employment to the be lodged you can look at the do commencement downloadable corroborate.
FADE_IN_STEP is how much we better the alpha value as a employment to each iteration.
FINAL_ALPHA is a value that declares what the unchangeable alpha value on be as a employment to the vaccination when it stays well-defined.
I nick in that a slight crystal clear vaccination gives a haler at the better of the day, so around slighting this value is 225 (out of 255 which is a dependable [opaque] shell). When the vaccination has reached it’s max-alpha value we call up the startTimer() method, which is a borborygmus that sleeps as a employment to a on the cards figure up of seconds whilom before to area the fadeOut() method.
FADE_TIMER is how stand in want we be put on ice until increasing the Alpha value again.