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);
}
}
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);
}
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);
}
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);
}
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);
}
Aggregations