Skip to content

Commit 9686f6e

Browse files
authored
chore(android): run fmt (#66)
1 parent 54cad3d commit 9686f6e

3 files changed

Lines changed: 42 additions & 36 deletions

File tree

android/src/main/java/com/getcapacitor/community/keepawake/KeepAwakePlugin.java

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,20 @@ public class KeepAwakePlugin extends Plugin {
1313

1414
@PluginMethod
1515
public void keepAwake(final PluginCall call) {
16-
getBridge()
17-
.executeOnMainThread(() -> {
18-
Window window = getActivity().getWindow();
19-
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
20-
call.resolve();
21-
});
16+
getBridge().executeOnMainThread(() -> {
17+
Window window = getActivity().getWindow();
18+
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
19+
call.resolve();
20+
});
2221
}
2322

2423
@PluginMethod
2524
public void allowSleep(final PluginCall call) {
26-
getBridge()
27-
.executeOnMainThread(() -> {
28-
Window window = getActivity().getWindow();
29-
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
30-
call.resolve();
31-
});
25+
getBridge().executeOnMainThread(() -> {
26+
Window window = getActivity().getWindow();
27+
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
28+
call.resolve();
29+
});
3230
}
3331

3432
@PluginMethod
@@ -40,16 +38,15 @@ public void isSupported(PluginCall call) {
4038

4139
@PluginMethod
4240
public void isKeptAwake(final PluginCall call) {
43-
getBridge()
44-
.executeOnMainThread(() -> {
45-
// use the "bitwise and" operator to check if FLAG_KEEP_SCREEN_ON is on or off
46-
// credits: https://stackoverflow.com/a/24214209/9979122
47-
int flags = getActivity().getWindow().getAttributes().flags;
48-
boolean isKeptAwake = (flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) != 0;
41+
getBridge().executeOnMainThread(() -> {
42+
// use the "bitwise and" operator to check if FLAG_KEEP_SCREEN_ON is on or off
43+
// credits: https://stackoverflow.com/a/24214209/9979122
44+
int flags = getActivity().getWindow().getAttributes().flags;
45+
boolean isKeptAwake = (flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) != 0;
4946

50-
JSObject ret = new JSObject();
51-
ret.put("isKeptAwake", isKeptAwake);
52-
call.resolve(ret);
53-
});
47+
JSObject ret = new JSObject();
48+
ret.put("isKeptAwake", isKeptAwake);
49+
call.resolve(ret);
50+
});
5451
}
5552
}

package-lock.json

Lines changed: 22 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@types/dom-screen-wake-lock": "1.0.0",
5858
"eslint": "^8.57.0",
5959
"prettier": "^3.4.2",
60-
"prettier-plugin-java": "^2.6.6",
60+
"prettier-plugin-java": "2.7.7",
6161
"rimraf": "^6.0.1",
6262
"rollup": "^4.30.1",
6363
"standard-version": "9.5.0",

0 commit comments

Comments
 (0)