use of com.codename1.ui.animations.BubbleTransition in project CodenameOne by codenameone.
the class LookAndFeel method getTransitionConstant.
private Transition getTransitionConstant(Transition t, String constant, String slideDir, int speed, boolean forward) {
Image img = manager.getThemeImageConstant(constant + "Image");
if (img != null) {
return CommonTransitions.createTimeline(img);
}
String val = manager.getThemeConstant(constant, null);
if (val == null) {
return t;
}
if (val.equalsIgnoreCase("empty")) {
return CommonTransitions.createEmpty();
}
if (val.equalsIgnoreCase("slide")) {
if (slideDir.equalsIgnoreCase("horizontal")) {
return CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, forward, speed);
} else {
return CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, forward, speed);
}
}
if (val.equalsIgnoreCase("cover")) {
if (slideDir.equalsIgnoreCase("horizontal")) {
return CommonTransitions.createCover(CommonTransitions.SLIDE_HORIZONTAL, forward, speed);
} else {
return CommonTransitions.createCover(CommonTransitions.SLIDE_VERTICAL, forward, speed);
}
}
if (val.equalsIgnoreCase("uncover")) {
if (slideDir.equalsIgnoreCase("horizontal")) {
return CommonTransitions.createUncover(CommonTransitions.SLIDE_HORIZONTAL, forward, speed);
} else {
return CommonTransitions.createUncover(CommonTransitions.SLIDE_VERTICAL, forward, speed);
}
}
if (val.equalsIgnoreCase("fslide")) {
if (slideDir.equalsIgnoreCase("horizontal")) {
return CommonTransitions.createFastSlide(CommonTransitions.SLIDE_HORIZONTAL, forward, speed);
} else {
return CommonTransitions.createFastSlide(CommonTransitions.SLIDE_VERTICAL, forward, speed);
}
}
if (val.equalsIgnoreCase("fade")) {
return CommonTransitions.createFade(speed);
}
if (val.equalsIgnoreCase("slidefade")) {
return CommonTransitions.createSlideFadeTitle(forward, speed);
}
if (val.equalsIgnoreCase("pulse")) {
return CommonTransitions.createDialogPulsate();
}
if (val.equalsIgnoreCase("bubble")) {
BubbleTransition transition = new BubbleTransition(speed);
transition.setRoundBubble(false);
return transition;
}
return t;
}
use of com.codename1.ui.animations.BubbleTransition in project CodenameOne by codenameone.
the class Toolbar method showOverflowMenu.
/*
* A Overflow Menu is implemented as a dialog, this method allows you to
* override the dialog display in order to customize the dialog menu in
* various ways
*
* @param menu a dialog containing Overflow Menu options that can be
* customized
* @return the command selected by the user in the dialog
*/
protected Command showOverflowMenu(Dialog menu) {
Form parent = sideMenu.getParentForm();
int height;
int marginLeft;
int marginRight = 0;
Container dialogContentPane = menu.getDialogComponent();
marginLeft = parent.getWidth() - (dialogContentPane.getPreferredW() + menu.getStyle().getHorizontalPadding());
marginLeft = Math.max(0, marginLeft);
if (parent.getSoftButtonCount() > 1) {
height = parent.getHeight() - parent.getSoftButton(0).getParent().getPreferredH() - dialogContentPane.getPreferredH();
} else {
height = parent.getHeight() - dialogContentPane.getPreferredH();
}
height = Math.max(0, height);
int th = getHeight();
Transition transitionIn;
Transition transitionOut;
UIManager manager = parent.getUIManager();
LookAndFeel lf = manager.getLookAndFeel();
if (lf.getDefaultMenuTransitionIn() != null || lf.getDefaultMenuTransitionOut() != null) {
transitionIn = lf.getDefaultMenuTransitionIn();
if (transitionIn instanceof BubbleTransition) {
((BubbleTransition) transitionIn).setComponentName("OverflowButton");
}
transitionOut = lf.getDefaultMenuTransitionOut();
} else {
transitionIn = CommonTransitions.createEmpty();
transitionOut = CommonTransitions.createEmpty();
}
menu.setTransitionInAnimator(transitionIn);
menu.setTransitionOutAnimator(transitionOut);
if (isRTL()) {
marginRight = marginLeft;
marginLeft = 0;
}
int tint = parent.getTintColor();
parent.setTintColor(0x00FFFFFF);
parent.tint = false;
boolean showBelowTitle = manager.isThemeConstant("showMenuBelowTitleBool", true);
int topPadding = 0;
Component statusBar = ((BorderLayout) getLayout()).getNorth();
if (statusBar != null) {
topPadding = statusBar.getAbsoluteY() + statusBar.getHeight();
}
if (showBelowTitle) {
topPadding = th;
}
Command r = menu.show(topPadding, Math.max(topPadding, height - topPadding), marginLeft, marginRight, true);
parent.setTintColor(tint);
return r;
}
Aggregations