Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void setBrightnessLevel(final float brightnessLevel) {
if (activity == null) {
return;
}

activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Expand All @@ -44,7 +44,13 @@ public void run() {

@ReactMethod
public void getBrightnessLevel(Promise promise) {
WindowManager.LayoutParams lp = getCurrentActivity().getWindow().getAttributes();
final Activity activity = getCurrentActivity();
if (activity == null) {
promise.reject("Activity not found");
return;
}

WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
promise.resolve(lp.screenBrightness);
}

Expand Down