Search in sources :

Example 1 with Callback

use of com.gwtmobile.phonegap.client.Event.Callback in project GwtMobile by dennisjzh.

the class KitchenSink method onModuleLoad.

@Override
public void onModuleLoad() {
    if (Utils.isAndroid() || Utils.isIOS()) {
        if (Utils.isAndroid()) {
            Event.onBackButton(new Event.Callback() {

                @Override
                public void onEventFired() {
                    onBackKeyDown();
                }
            });
        }
        Event.onDeviceReady(new Callback() {

            @Override
            public void onEventFired() {
                new Timer() {

                    @Override
                    public void run() {
                        if (mainUi == null) {
                            Utils.Console("Loading main ui...");
                            mainUi = new MainUi();
                            Page.load(mainUi);
                        } else {
                            this.cancel();
                        }
                    }
                }.scheduleRepeating(50);
            }
        });
    } else {
        mainUi = new MainUi();
        Page.load(mainUi);
    }
}
Also used : Callback(com.gwtmobile.phonegap.client.Event.Callback) Timer(com.google.gwt.user.client.Timer) Callback(com.gwtmobile.phonegap.client.Event.Callback) NativeEvent(com.google.gwt.dom.client.NativeEvent) Event(com.gwtmobile.phonegap.client.Event)

Example 2 with Callback

use of com.gwtmobile.phonegap.client.Event.Callback in project GwtMobile by dennisjzh.

the class EventUi method onLoad.

@Override
public void onLoad() {
    super.onLoad();
    BackButton back = (BackButton) header.getLeftButton();
    back.setReturnParameter("Back");
    Event.onDeviceReady(new Callback() {

        @Override
        public void onEventFired() {
            text.setHTML((new Date()).toString() + ": onDeviceReady<br/>" + text.getHTML());
        }
    });
    Event.onPause(new Callback() {

        @Override
        public void onEventFired() {
            text.setHTML((new Date()).toString() + ": onPause<br/>" + text.getHTML());
        }
    });
    Event.onResume(new Callback() {

        @Override
        public void onEventFired() {
            text.setHTML((new Date()).toString() + ": onResume<br/>" + text.getHTML());
        }
    });
    Event.onBackButton(new Callback() {

        @Override
        public void onEventFired() {
            text.setHTML((new Date()).toString() + ": onBackButton<br/>" + text.getHTML());
        }
    });
    Event.onMenuButton(new Callback() {

        @Override
        public void onEventFired() {
            text.setHTML((new Date()).toString() + ": onMenuButton<br/>" + text.getHTML());
        }
    });
    Event.onSearchButton(new Callback() {

        @Override
        public void onEventFired() {
            text.setHTML((new Date()).toString() + ": onSearchButton<br/>" + text.getHTML());
        }
    });
    Event.onOnline(new Callback() {

        @Override
        public void onEventFired() {
            text.setHTML((new Date()).toString() + ": onOnline<br/>" + text.getHTML());
        }
    });
    Event.onOffline(new Callback() {

        @Override
        public void onEventFired() {
            text.setHTML((new Date()).toString() + ": onOffline<br/>" + text.getHTML());
        }
    });
}
Also used : Callback(com.gwtmobile.phonegap.client.Event.Callback) BackButton(com.gwtmobile.ui.client.widgets.BackButton) Date(java.util.Date)

Aggregations

Callback (com.gwtmobile.phonegap.client.Event.Callback)2 NativeEvent (com.google.gwt.dom.client.NativeEvent)1 Timer (com.google.gwt.user.client.Timer)1 Event (com.gwtmobile.phonegap.client.Event)1 BackButton (com.gwtmobile.ui.client.widgets.BackButton)1 Date (java.util.Date)1