diff --git a/res/values/arrays_torch.xml b/res/values/arrays_torch.xml index af9349a..2d42e79 100644 --- a/res/values/arrays_torch.xml +++ b/res/values/arrays_torch.xml @@ -5,11 +5,13 @@ @string/lockscreen_torch_cm_torch @string/lockscreen_torch_tesla_torch @string/lockscreen_torch_dashlight_torch + @string/lockscreen_torch_omnirom_torch 0 1 2 + 3 diff --git a/res/values/strings.xml b/res/values/strings.xml index 533f077..d0cf876 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -219,6 +219,7 @@ CM Torch TeslaLED DashLight + OmniROM BatteryBar Mod diff --git a/src/com/zst/xposed/xuimod/mods/LockscreenTorchMod.java b/src/com/zst/xposed/xuimod/mods/LockscreenTorchMod.java index a5a4683..26422b3 100644 --- a/src/com/zst/xposed/xuimod/mods/LockscreenTorchMod.java +++ b/src/com/zst/xposed/xuimod/mods/LockscreenTorchMod.java @@ -40,6 +40,7 @@ public class LockscreenTorchMod { private static final int CM_TORCH = 0; private static final int TESLA_TORCH = 1; private static final int DASHLIGHT_TORCH = 2; + private static final int OMNIROM_TORCH = 3; private static final int LONGPRESS_TIMEOUT = ViewConfiguration.getLongPressTimeout(); private static final int VIBRATE_DURATION = 25; @@ -202,6 +203,8 @@ private static void toggleTorch(boolean turnOn) { toggleTeslaLedTorch(turnOn); }else if(type == DASHLIGHT_TORCH){ toggleDashLightTorch(turnOn); + }else if(type == OMNIROM_TORCH){ + toggleOmniRomTorch(turnOn); } vibrate(); @@ -248,4 +251,11 @@ private static void toggleDashLightTorch(boolean turnOn) { isTorchOn = !isTorchOn; } + /* Sends broadcast to default torch app found in OmniROM. */ + private static void toggleOmniRomTorch(boolean turnOn) { + Intent i = new Intent("org.omnirom.torch.TOGGLE_FLASHLIGHT"); + sContext.sendBroadcast(i); + isTorchOn = !isTorchOn; + } + }