Methods Summary |
---|
private void | cancelTimer()Cancel any running Timer.
if (task != null) {
task.cancel();
task = null;
}
flashCount = 0;
|
public boolean | flashBacklight(int displayId, int duration)Requests a flashing effect for the device's backlight.
// Test for negative of duration is in public class
if (duration == 0) {
cancelTimer();
if (isLit) {
isLit = !isLit;
return toggleBacklight0(displayId);
} else {
return isBacklightSupported0(displayId);
}
} else {
setTimer(displayId, duration);
isLit = !isLit;
return toggleBacklight0(displayId);
}
|
private native boolean | isBacklightSupported0(int displayId)Tests if backlight is supported.
|
private void | setTimer(int displayId, int duration)Set a new timer. Determine flashCount based on
duration divided by BLINK_RATE
cancelTimer();
try {
task = new TimerClient(displayId);
/* flash every <tt>BLINK_RATE</tt> miliseconds */
flashCount = duration / BLINK_RATE;
timerService.schedule(task, BLINK_RATE, BLINK_RATE);
} catch (IllegalStateException e) {
cancelTimer();
}
|
private native boolean | toggleBacklight0(int displayId)Toggles backlight.
|