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.

9 comments:

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

    ReplyDelete
  2. A simple class that lets you use animations with a very simple API.web design tutorials

    ReplyDelete
  3. Wow, happy to see this awesome post. I hope this think help any newbie for their awesome work. By the way thanks for share this awesomeness from
    Speciaali

    ReplyDelete
  4. Importance of education has been reprised over by scholars, thinkers, social activists, teachers, leaders and every other being. Ancient philosophers like Aristotle too emphasized on importance of mass education for better governance as better thinking and learned community can make a better living in the future. "Education is the most powerful weapon which you can use to change the world." ― Nelson Mandela Nothing can better emphasize on importance of education than the words mentioned above. All great leaders of all time had focused on educating the society in order to achieve greater goals. A society that can think clearly and enjoys free dissemination of information can only bring positive changes that will lead us to sustainable lifestyle.http://www.assignmentsynonym.eu/

    ReplyDelete
  5. Thanks. That was useful post. I also encourage you to learn more about google apps for education.

    ReplyDelete
  6. Our programmers, developers and designers are experts in using the software development tools that support in building innovative, interactive and world-class apps. who sent me message on sarahah

    ReplyDelete
  7. Much obliged to you a pack for imparting this to every one of us you really acknowledge what you are discussing! Bookmarked. If it's not too much trouble likewise look for guidance from my site =). We could have a hyperlink change contract between us! web design 

    ReplyDelete
  8. As I read the blog I felt a pull on the heartstrings.
    web design company

    ReplyDelete
  9. Truly decent and intriguing post. I was searching for this sort of data and appreciated perusing this one. Continue posting. A debt of gratitude is in order for sharing.
    webdesign

    ReplyDelete