本文整理汇总了Java中com.codename1.ui.Form.setTransitionOutAnimator方法的典型用法代码示例。如果您正苦于以下问题:Java Form.setTransitionOutAnimator方法的具体用法?Java Form.setTransitionOutAnimator怎么用?Java Form.setTransitionOutAnimator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codename1.ui.Form
的用法示例。
在下文中一共展示了Form.setTransitionOutAnimator方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beforeShow
import com.codename1.ui.Form; //导入方法依赖的package包/类
public void beforeShow(Form f)
{
f.setTitle(ui.translate("view_title_queue", "[default] Queue"));
if(Display.getInstance().getCurrent().getName().equals("ScreenPlayer"))
{
f.setTransitionInAnimator(CommonTransitions.createEmpty());
f.setTransitionOutAnimator(CommonTransitions.createFade(200));
}
addFormCommand(f);
}
示例2: createMorphEffect
import com.codename1.ui.Form; //导入方法依赖的package包/类
private void createMorphEffect(Label titleLabel) {
// animate the components out of the previous form if we are coming in from the login form
Form parent = Display.getInstance().getCurrent();
if(parent.getUIID().equals("MainForm")) {
for(Component cmp : parent.getContentPane()) {
cmp.setX(parent.getWidth());
}
// moves all the components outside of the content pane to the right while fading them out over 400ms
parent.getContentPane().animateUnlayoutAndWait(400, 0);
parent.getContentPane().removeAll();
// we can't mutate a form into a component in another form so we need to convert the background to an image and then morph that
// this is especially easy since we already removed all the components
Label dummy = new Label();
dummy.setShowEvenIfBlank(true);
dummy.setUIID("Container");
dummy.setUnselectedStyle(new Style(parent.getUnselectedStyle()));
parent.setUIID("Form");
// special case to remove status bar on iOS 7
parent.getTitleArea().removeAll();
parent.setLayout(new BorderLayout());
parent.addComponent(BorderLayout.CENTER, dummy);
parent.revalidate();
// animate the main panel to the new location at the top title area of the screen
dummy.setName("fullScreen");
titleLabel.setName("titleImage");
parent.setTransitionOutAnimator(MorphTransition.create(1100).morph("fullScreen", "titleImage"));
}
}
示例3: startBackTransition
import com.codename1.ui.Form; //导入方法依赖的package包/类
void startBackTransition(final Form currentForm, Form destination) {
final Transition t = destination.getTransitionOutAnimator().copy(true);
if(t instanceof CommonTransitions) {
Transition originalTransition = currentForm.getTransitionOutAnimator();
currentForm.setTransitionOutAnimator(CommonTransitions.createEmpty());
Form blank = new Form() {
protected boolean shouldSendPointerReleaseToOtherForm() {
return true;
}
};
blank.addPointerDraggedListener(pointerDragged);
blank.addPointerReleasedListener(pointerReleased);
blank.addPointerPressedListener(pointerPressed);
blank.setTransitionInAnimator(CommonTransitions.createEmpty());
blank.setTransitionOutAnimator(CommonTransitions.createEmpty());
blank.show();
currentForm.setTransitionOutAnimator(originalTransition);
((CommonTransitions)t).setMotion(new LazyValue<Motion>() {
public Motion get(Object... args) {
return new ManualMotion(((Integer)args[0]).intValue(), ((Integer)args[1]).intValue(), ((Integer)args[2]).intValue());
}
});
t.init(currentForm, destination);
t.initTransition();
blank.setGlassPane(new Painter() {
public void paint(Graphics g, Rectangle rect) {
t.animate();
t.paint(g);
}
});
}
}
示例4: reloadForm
import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
* Useful tool to refresh the current state of a form shown using show form
* without pushing another instance to the back stack
*/
public void reloadForm() {
Form currentForm = Display.getInstance().getCurrent();
Command backCommand = currentForm.getBackCommand();
Form newForm = (Form)createContainer(fetchResourceFile(), currentForm.getName());
if (backCommand != null) {
setBackCommand(newForm, backCommand);
// trigger listener creation if this is the only command in the form
getFormListenerInstance(newForm, null);
for(int iter = 0 ; iter < currentForm.getCommandCount() ; iter++) {
if(backCommand == currentForm.getCommand(iter)) {
newForm.addCommand(backCommand, newForm.getCommandCount());
break;
}
}
}
beforeShow(newForm);
Transition tin = newForm.getTransitionInAnimator();
Transition tout = newForm.getTransitionOutAnimator();
currentForm.setTransitionInAnimator(CommonTransitions.createEmpty());
currentForm.setTransitionOutAnimator(CommonTransitions.createEmpty());
newForm.setTransitionInAnimator(CommonTransitions.createEmpty());
newForm.setTransitionOutAnimator(CommonTransitions.createEmpty());
newForm.layoutContainer();
newForm.show();
postShowImpl(newForm);
newForm.setTransitionInAnimator(tin);
newForm.setTransitionOutAnimator(tout);
}
示例5: showWelcomeAd
import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
* Invoked on application startup, this code will download an ad or timeout
*/
public void showWelcomeAd() {
if(!UIManager.getInstance().wasThemeInstalled()) {
if(Display.getInstance().hasNativeTheme()) {
Display.getInstance().installNativeTheme();
}
}
ConnectionRequest r = createAdRequest();
r.setPriority(ConnectionRequest.PRIORITY_HIGH);
r.setTimeout(timeout);
InfiniteProgress ip = new InfiniteProgress();
Dialog ipDialog = ip.showInifiniteBlocking();
NetworkManager.getInstance().addToQueueAndWait(r);
if(failed()) {
ipDialog.dispose();
if(!allowWithoutNetwork) {
ipDialog.dispose();
Dialog.show("Network Error", "Please try again later", "Exit", null);
Display.getInstance().exitApplication();
} else {
return;
}
}
Component c = getPendingAd();
if(c != null) {
Form adForm = new AdForm(c);
adForm.setTransitionInAnimator(CommonTransitions.createEmpty());
adForm.setTransitionOutAnimator(CommonTransitions.createEmpty());
adForm.show();
}
}
示例6: showSplashScreen
import com.codename1.ui.Form; //导入方法依赖的package包/类
/**
* The splash screen is relatively bare bones. Its important to have a splash screen for iOS
* since the build process generates a screenshot of this screen to speed up perceived performance
*/
public void showSplashScreen() {
final Form splash = new Form();
// a border layout places components in the center and the 4 sides.
// by default it scales the center component so here we configure
// it to place the component in the actual center
BorderLayout border = new BorderLayout();
border.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
splash.setLayout(border);
// by default the form's content pane is scrollable on the Y axis
// we need to disable it here
splash.setScrollable(false);
Label title = new Label("Poker Ace");
// The UIID is used to determine the appearance of the component in the theme
title.setUIID("SplashTitle");
Label subtitle = new Label("By Codename One");
subtitle.setUIID("SplashSubTitle");
splash.addComponent(BorderLayout.NORTH, title);
splash.addComponent(BorderLayout.SOUTH, subtitle);
Label as = new Label(cards.getImage("as.png"));
Label ah = new Label(cards.getImage("ah.png"));
Label ac = new Label(cards.getImage("ac.png"));
Label ad = new Label(cards.getImage("ad.png"));
// a layered layout places components one on top of the other in the same dimension, it is
// useful for transparency but in this case we are using it for an animation
final Container center = new Container(new LayeredLayout());
center.addComponent(as);
center.addComponent(ah);
center.addComponent(ac);
center.addComponent(ad);
splash.addComponent(BorderLayout.CENTER, center);
splash.show();
splash.setTransitionOutAnimator(CommonTransitions.createCover(CommonTransitions.SLIDE_VERTICAL, true, 800));
// postpone the animation to the next cycle of the EDT to allow the UI to render fully once
Display.getInstance().callSerially(new Runnable() {
public void run() {
// We replace the layout so the cards will be laid out in a line and animate the hierarchy
// over 2 seconds, this effectively creates the effect of cards spreading out
center.setLayout(new BoxLayout(BoxLayout.X_AXIS));
center.setShouldCalcPreferredSize(true);
splash.getContentPane().animateHierarchy(2000);
// after showing the animation we wait for 2.5 seconds and then show the game with a nice
// transition, notice that we use UI timer which is invoked on the Codename One EDT thread!
new UITimer(new Runnable() {
public void run() {
showGameUI();
}
}).schedule(2500, false, splash);
}
});
}
示例7: showSplashAnimation
import com.codename1.ui.Form; //导入方法依赖的package包/类
private void showSplashAnimation() {
Form splash = new Form();
splash.setUIID("Splash");
splash.getContentPane().setUIID("Container");
splash.getTitleArea().setUIID("Container");
BorderLayout border = new BorderLayout();
border.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
splash.setLayout(border);
splash.setScrollable(false);
Label title = new Label("Kitchen Sink Demo");
title.setUIID("SplashTitle");
Label subtitle = new Label("By Codename One");
subtitle.setUIID("SplashSubTitle");
splash.addComponent(BorderLayout.NORTH, title);
splash.addComponent(BorderLayout.SOUTH, subtitle);
Label beaker = new Label(res.getImage("beaker.png"));
final Label beakerLogo = new Label(res.getImage("beaker_logo.png"));
beakerLogo.setVisible(false);
Container layeredLayout = new Container(new LayeredLayout());
splash.addComponent(BorderLayout.CENTER, layeredLayout);
layeredLayout.addComponent(beaker);
final Container logoParent = new Container(new BorderLayout());
layeredLayout.addComponent(logoParent);
logoParent.addComponent(BorderLayout.CENTER, beakerLogo);
splash.revalidate();
Display.getInstance().callSerially(new Runnable() {
public void run() {
beakerLogo.setVisible(true);
beakerLogo.setX(0);
beakerLogo.setY(0);
beakerLogo.setWidth(3);
beakerLogo.setHeight(3);
logoParent.setShouldCalcPreferredSize(true);
logoParent.animateLayoutFade(2000, 0);
}
});
splash.show();
splash.setTransitionOutAnimator(CommonTransitions.createFastSlide(CommonTransitions.SLIDE_VERTICAL, true, 300));
new UITimer(new Runnable() {
public void run() {
showMainUI();
}
}).schedule(2500, false, splash);
}