Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions res/values/arrays_torch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
<item>@string/lockscreen_torch_cm_torch</item>
<item>@string/lockscreen_torch_tesla_torch</item>
<item>@string/lockscreen_torch_dashlight_torch</item>
<item>@string/lockscreen_torch_omnirom_torch</item>
</string-array>

<string-array name="lockscreen_torch_type_value">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
</resources>
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
<string name="lockscreen_torch_cm_torch">CM Torch</string>
<string name="lockscreen_torch_tesla_torch">TeslaLED</string>
<string name="lockscreen_torch_dashlight_torch">DashLight</string>
<string name="lockscreen_torch_omnirom_torch">OmniROM</string>

<!-- BatteryBar Pref-->
<string name="batterybar_title">BatteryBar Mod</string>
Expand Down
10 changes: 10 additions & 0 deletions src/com/zst/xposed/xuimod/mods/LockscreenTorchMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}

}