/** * Turns the backlight off * * @see #lightOn() */ public static void lightOff() { // #if polish.HasOptionalApis if (!controllerInitializationDone) { initController(); } if (controller != null) { controller.lightOn(); } // #elif polish.android MidletBridge.instance.backlightRelease(); // #else synchronized (lightsLock) { // #if tmp.useNokiaUi com.nokia.mid.ui.DeviceControl.setLights(0, 0); // #elif tmp.useBlackBerry net.rim.device.api.system.Backlight.enable(false); // #elif tmp.useThread DeviceControl dc = thread; if (dc != null) { dc.switchLightOff(); thread = null; } // #endif } // #endif }
/** * Turns the backlight on on a device until lightOff() is called * * @return true when backlight is supported on this device. * @see #lightOff() */ public static boolean lightOn() { // #if polish.HasOptionalApis if (!controllerInitializationDone) { initController(); } if (controller != null) { return controller.lightOn(); } else { // # return false; } // #elif polish.android MidletBridge.instance.backlightOn(); // # return true; // #else synchronized (lightsLock) { boolean success = false; // #if tmp.useNokiaUi com.nokia.mid.ui.DeviceControl.setLights(0, 100); success = true; // #elif tmp.useBlackBerry net.rim.device.api.system.Backlight.enable(true); success = true; // #elif tmp.useThread if (thread == null) { if (isLightSupported()) { DeviceControl dc = new DeviceControl(); dc.start(); success = true; } } // #endif return success; } // #endif }
/** * Checks if backlight can be controlled by the application * * @return true when the backlight can be controlled by the application * @see #lightOn() * @see #lightOff() */ public static boolean isLightSupported() { boolean isSupported = false; // #if polish.hasOptionalApis if (!controllerInitializationDone) { initController(); } if (controller != null) { isSupported = controller.isLightSupported(); } // #elif polish.android isSupported = true; // #elif polish.api.nokia-ui && !polish.Bugs.NoBacklight isSupported = true; // #elif tmp.useBlackBerry isSupported = true; // #elif polish.api.samsung isSupported = com.samsung.util.LCDLight.isSupported(); // //#elif polish.midp2 && polish.usePolishGui // isSupported = StyleSheet.display.flashBacklight(0); // #endif return isSupported; }