Search in sources :

Example 66 with Timer

use of com.google.gwt.user.client.Timer 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 67 with Timer

use of com.google.gwt.user.client.Timer in project GwtMobile by dennisjzh.

the class MediaUi method play.

public void play() {
    text.setHTML("Playing...");
    media.play();
    timer = new Timer() {

        @Override
        public void run() {
            if (Utils.isAndroid()) {
                media.getCurrentPosition(new PositionCallback() {

                    @Override
                    public void onSuccess(int position) {
                        int duration = media.getDuration();
                        text.setHTML(position + " / " + duration);
                    }

                    @Override
                    public void onError(MediaError error) {
                        text.setHTML("Get Current Position Error<br/>" + "Code: " + error.getCode() + "<br/>" + "Message: " + error.getMessage());
                    }
                });
            } else if (Utils.isIOS()) {
                text.setHTML(text.getHTML() + ".");
            }
        }
    };
    timer.scheduleRepeating(1000);
}
Also used : Timer(com.google.gwt.user.client.Timer) PositionCallback(com.gwtmobile.phonegap.client.Media.PositionCallback) MediaError(com.gwtmobile.phonegap.client.Media.MediaError)

Example 68 with Timer

use of com.google.gwt.user.client.Timer in project GwtMobile by dennisjzh.

the class MediaUi method startRecord.

public void startRecord() {
    text.setHTML("Recording. Say or sing something.<br/>");
    media.startRecord();
    timer = new Timer() {

        @Override
        public void run() {
            text.setHTML(text.getHTML() + ".");
        }
    };
    timer.scheduleRepeating(1000);
}
Also used : Timer(com.google.gwt.user.client.Timer)

Example 69 with Timer

use of com.google.gwt.user.client.Timer in project GwtMobile by dennisjzh.

the class NotificationUi method activity.

public void activity() {
    Notification.activityStart();
    new Timer() {

        @Override
        public void run() {
            Notification.activityStop();
        }
    }.schedule(3000);
}
Also used : Timer(com.google.gwt.user.client.Timer)

Example 70 with Timer

use of com.google.gwt.user.client.Timer in project GwtMobile by dennisjzh.

the class NotificationUi method progress.

public void progress() {
    Notification.progressStart("Downloading", "Please be patient...");
    new Timer() {

        int value = 0;

        @Override
        public void run() {
            Notification.progressValue(value++);
            if (value > 100) {
                Notification.progressStop();
                this.cancel();
            }
        }
    }.scheduleRepeating(20);
}
Also used : Timer(com.google.gwt.user.client.Timer)

Aggregations

Timer (com.google.gwt.user.client.Timer)133 Command (com.google.gwt.user.client.Command)7 Element (com.google.gwt.dom.client.Element)6 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)4 Style (com.google.gwt.dom.client.Style)4 Request (com.google.gwt.http.client.Request)4 RequestBuilder (com.google.gwt.http.client.RequestBuilder)4 RequestCallback (com.google.gwt.http.client.RequestCallback)4 RequestException (com.google.gwt.http.client.RequestException)4 Response (com.google.gwt.http.client.Response)4 JSONString (com.google.gwt.json.client.JSONString)4 Widget (com.google.gwt.user.client.ui.Widget)4 ArrayList (java.util.ArrayList)4 ServerError (org.rstudio.studio.client.server.ServerError)4 Label (com.google.gwt.user.client.ui.Label)3 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)3 Date (java.util.Date)3 SessionInfo (org.rstudio.studio.client.workbench.model.SessionInfo)3 SliderEvent (com.extjs.gxt.ui.client.event.SliderEvent)2 Animation (com.google.gwt.animation.client.Animation)2