Saturday, June 16, 2012

using animation helper

This post is part of a series of blogposts that show the usage of  some mgwt / gwt-phonegap components.

If you do not want to use GWT Activities and Places you can not use the AnimatingActivityManager from mgwt. This is why we created AnimationHelper. A simple class that lets you use animations with a very simple API.


1. Setup the viewport for the mobile browser:
MGWT.applySettings(MGWTSettings.getAppSetting());

2. Instantiate an AnimationHelper and attach it to the RootPanel:

AnimationHelper animationHelper = new AnimationHelper();
RootPanel.get().add(animationHelper);

3. Instantiate a LayoutPanel and a button. Attach the TapHandler to it and animate to another UI on Tap:
LayoutPanel layoutPanel = new LayoutPanel();
Button button = new Button();
button.setText("Animate");

button.addTapHandler(new TapHandler() {

 @Override
 public void onTap(TapEvent event) {
  //build second ui
  LayoutPanel layoutPanel = new LayoutPanel();
  Button button = new Button();
  button.setText("second");
  layoutPanel.add(button);
  animationHelper.goTo(layoutPanel, Animation.FLIP);

 }
});

layoutPanel.add(button);

4. Animate to the created UI:
animationHelper.goTo(layoutPanel, Animation.SLIDE);

A complete example can be found here. If you want to see the mgwt animation in action take a look at the showcase.

7 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. his strategy is tore new we need to see toons in 2 recuperating, This makes cartoon movement looks like a considerable measure of to the $64000 photographs. news

    ReplyDelete
  3. As a seller of legal steroids, you can buy Crazy Bulk products, explore stacks and finally get the body you’ve always wanted
    Labyrintoom Berlin

    ReplyDelete
  4. This is my first time visit here. From the tons of comments on your articles,I guess I am not only one having all the enjoyment right here!
    ​Speciaali

    ReplyDelete
  5. useful information on topics that plenty are interested on for this wonderful post.Admiring the time and effort you put into your b!..
    ​Speciaali

    ReplyDelete
  6. In short, woocommerce mobile app development spreads benefits from all ends to not just the host but also its audience. Make money

    ReplyDelete
  7. In order to minimize the effects of such a reality, it will be necessary to cut down on wastage and become far more energy efficient.
    http://www.showboxdownloadsapp.com/

    ReplyDelete