public void popup(long delayMS) {
long startTime = System.currentTimeMillis() + delayMS;
this.setVisible(false);
PActivity showPopupActivity = new PActivity(0) {
@Override
protected void activityFinished() {
TransientMessage.this.setVisible(true);
Point2D startingOffset = getOffset();
animateToPositionScaleRotation(startingOffset.getX(),
startingOffset.getY() - 50, 1, 0, ANIMATE_MSG_DURATION);
PActivity fadeOutActivity = new Fader(TransientMessage.this,
ANIMATE_MSG_DURATION, 0f);
UIEnvironment.getInstance().addActivity(fadeOutActivity);
PActivity removeActivity = new PActivity(0) {
@Override
protected void activityStarted() {
TransientMessage.this.removeFromParent();
}
};
removeActivity.startAfter(fadeOutActivity);
UIEnvironment.getInstance().addActivity(removeActivity);
}
};
showPopupActivity.setStartTime(startTime);
UIEnvironment.getInstance().addActivity(showPopupActivity);