GWT Swipe between Pages / Panels - gwt

I have a web app I'm creating, where I need to allow the user to swipe between pages. From what I've been researching you need to use MGWT (mobile Google web toolkit -- http://code.google.com/p/mgwt/)
Then you have to create a class that extends a Panel class and implements MGWT's "HasTouchHandlers" interface:
(http://code.google.com/p/mgwt/source/browse/mgwt/src/main/java/com/googlecode/mgwt/ui/client/widget/touch/TouchPanel.java?name=v1.0.0-alpha1)
Also your Panel should implement GWT's AnimatedLayout interface (such as LayoutPanel, DockLayoutPanel, and SplitLayoutPane), so you can natively slide the Panel after intercepting the touch event.
My question is can any one point me to a tutorial or example code on how to do this? Or how layout a GWT project in terms of
Panels? For example, if I have multiple pages in my app do I have multiple Panels?
thanks - Mike

mgwt now has support for swipes. There is a swipe recognizer as well as a swipe panel:
See it in action:
http://mobilegwt.appspot.com/showcase/#CarouselPlace:
Here is the code:
http://code.google.com/p/mgwt/source/browse/src/main/java/com/googlecode/mgwt/ui/client/widget/Carousel.java

I prefer that you use iScroll for swipe because it works without any issues on Android as well as iOS Browsers. The Implementation will also work on 3rd party browsers like Diigo or Dolphin. With this you i think you can completely avoid using the mgwt API.

You can also do it yourself by adding implements TouchStartHandler, TouchMoveHandler, TouchEndHandler to you class and handling the events and store what has happened. If you have moved more than X between start and end it's a swipe.

Related

Implement swipe gestures in apple watch using watchOS2.0

Hi I need to implement a functionality in my apple watch where when user swipes down will move from one module(InterfaceController1) to another module(InterfaceController2).And when user force touch menu should pop up and tapping on any button in the menu should present a model.
I am able to implement forceTouch menu option. But where as with swipe down to move to second module, i am not able to get any doc about this.
Please let me know if someone is aware of it.
Short Answer:
No, You can't.
Long Answer:
All WKInterface objects are proxy objects(aka Remote UI) that allows you to send queries to real UI Objects.
Reminds that the bundle that contains storyboard is separated with extension bundle. In sand-box concept, Your code that running on extension bundle can't access real UI Objects directly.
So there is no way to react against of user actions except that are available with interface builder(aka sentAction).

Enabling/Disabling MGWT Button

I'm beginner to GWT and MGWT. In my project I've a requirement that I have to enable
and disable the MGWT Botton. direct method is not given in current version of MGWT.
I've seen it in GWT button.
com.google.gwt.user.client.ui.Button b = new com.google.gwt.user.client.ui.Button();
b.setEnable(boolean);
But it is not given in MGWT.
Please help me,How can we achieve above functionality using CSS/something else
I am not a MGWT guy. And there must be some better solution. You can try low level element manipulation:
Button mgwtButton;
mgwtButton.getElement().setAttribute("disabled", "disabled");
If you take this solution it will be better to prepare later your CustomButton that extends MGWT Button with additional setEnabled(boolean enabled) method to have better API.

onClick appears to work on all but my iphone

For some reason the following html doesnt work inside safari on iphone 4.
Test Link</div>
it works on safari inside a regular browser. I am using senchatouch2 framework.
Thanks
The only way you can add events to dom elements in Sencha touch 2.0 that I know of, is to use their element events api. this is an example of it. Alot of events are available like tap, double tap and so on.
var el = Ext.get("test");
el.addListener( 'tap', function(e){
alert('it works!');
});
This goes after the panel is rendered.
I propose that you do not use such inline event handlers.
Not only is it better to separate markup and behavior, but you should let sencha touch handle the messy business of unifying events across browsers.
At the very least give your tag an id and do Ext.get('id').on('tap', function(){...})
But still better look into MVC features to avoid such low-level code altogether.

Create springboard like main view

Is there some sample code, or an easy way, to implement an application with as its first view something like Springboard?
What I am looking for is just a view with basic icons which after a tab on an icon tells the view-controller to push the view associated with the selected icon.
This in itself is not that difficult off-course (just putting images on a view), but is there an easy way to implement all the extra functionality as well (as e.g. moving the icons around (start 'vibrating' when when you push hold them), multiple pages etc.). The Facebook App seems to have this. It is probably not worth my while to write it myself, but it would be nice if there is something 'out of the box' to give the App a bit more of an iPhone feel.
Thanks in advance!
Facebook uses the Three20 library for its UI. The specific view used for the SpringBoard-like interface is known as TTLauncherView.
This is not an endorsement (I have yet to really check this out, and I may be too entrenched in using Three20 at this point to even bother), but here is another project that implements the springboard functionality: myLauncher on Github
You can use UICollectionView to create this
Look at this example
https://github.com/tularovbeslan/Springboard

android UI external libraries?

I'm starting with android, and the app I'm developing is gonna need custom widgets look (glossy buttons, animated backgrounds etc.),
I've googled for any external libraries to achieve this and did not find anything.
let me guess, the only way to this is by painly extending base view classes and overriding onDraw etc. ?
You need to explore View Styles. You can customize almost any view element. You might not need any external library that extends and designs custom buttons.
More ref:
http://blog.androgames.net/40/custom-button-style-and-theme/
http://www.androidworks.com/changing-the-android-edittext-ui-widget
I like this library quite a lot: https://github.com/cyrilmottier/GreenDroid
It includes:
Action bar
Quick action
AsyncImageView
and a lot of other things
It's easy to use and nice for quick developments.