Animation when switching activities impossible?

58 views
Skip to first unread message

benneq

unread,
Oct 13, 2011, 6:40:28 AM10/13/11
to Google Web Toolkit
Hi,

I'd like to have some kind of animation when switching activities. For
example: Slide the current activity out of the screen and while it's
sliding out, slide the new activity in.
I think the problem is, that we have 'AcceptsOneWidget' and for the
time of the animation there would be shown two. A solution could be to
use two activities, but I don't want to care about synchronization
etc.

So, what's the solution?

Thomas Broyer

unread,
Oct 13, 2011, 9:54:20 AM10/13/11
to google-we...@googlegroups.com
The Expenses sample does just that; have a look at how it's done.

Basically, the widget implementing AcceptsOneWidget will append the new child and slide it into view, and then remove the old child; instead of replacing one by the other.

benneq

unread,
Oct 13, 2011, 3:33:59 PM10/13/11
to Google Web Toolkit
So, let's see:
They take this SlidingPanel which implements HasOneWidget (and though
AcceptsOneWidget) as their 'root'-Panel for the Activity.
The ActivityManager calls setWidget(widget) when a PlaceChange
happens. So they did an @Override setWidget(Widget widget). When this
method gets called, the SlidingPanel looks if it already contains
(inside the List<Widget>) the widget (if not appends it) and calls
show(index). show(index) looks if the new index is left or right of
the current index and then:
- add the new widget from the List<Widget> to the LayoutPanel
- set current widget to 0% left and 100% width
- set new widget to 100% left (newIndex > oldIndex) or -100% left
(newIndex < oldIndex) and 100% width
- run the animation
- remove old Widget from the LayoutPanel

It's a bit like they ignore the standards they created with
Activities. 'Cause in theory it's possible to show as many activities
as you like in parallel... ;)

George Agiasoglou

unread,
Oct 13, 2011, 4:15:25 PM10/13/11
to google-we...@googlegroups.com
Alternatively, you can use a DeckLayoutPanel

-G

Thomas Broyer

unread,
Oct 13, 2011, 5:41:38 PM10/13/11
to google-we...@googlegroups.com


On Thursday, October 13, 2011 9:33:59 PM UTC+2, benneq wrote:

It's a bit like they ignore the standards they created with
Activities. 'Cause in theory it's possible to show as many activities
as you like in parallel... ;)

I'm confused. It does exactly what you're looking for, and you're complaining that it doesn't follow the activities pattern? (which btw is bs: if you don't need mutiple actiities at a time, don't do it; just because you can do it doesn't mean you should).

Aidan O'Kelly

unread,
Oct 13, 2011, 5:54:11 PM10/13/11
to google-we...@googlegroups.com

It's a bit like they ignore the standards they created with
Activities. 'Cause in theory it's possible to show as many activities
as you like in parallel... ;)

They are more like informal contracts rather than 'standards'. :) and in any case, the activity will be stopped by the Activity Manager, its the view/widget that you keep around temporarily. In another situation you might have 3 views, and only one active at once, with the other two greyed out.
And FWIW, it is possible to have multiple Activity's running, but you would probably user multiple ActivityManagers or something similar.

Daniel Kurka

unread,
Oct 14, 2011, 3:16:29 AM10/14/11
to google-we...@googlegroups.com
For mgwt (http://www.m-gwt.com) I just put in a custom ActivityManager to handle animations, while switching activities. Maybe that could work for you was well

- Daniel Kurka

2011/10/13 Aidan O'Kelly <aid...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Reply all
Reply to author
Forward
0 new messages