Skip to content

add reset brightness #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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
16 changes: 5 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
## [0.0.5] - August 21, 2018
* Update Android SDK reference
## [0.0.3] - November 6th, 2019.

## [0.0.4] - August 21, 2018
* Adjust pubspec.yml to match Dart 2.0 SDK version

## [0.0.3] - May 4th, 2018
* Port to Dart 2.0
* Update description

## [0.0.2] - January 23rd, 2018.
## [0.0.2] - October 1st, 2019.

* Update description

## [0.0.1] - January 23rd, 2018.
## [0.0.1] - October 1st, 2019.

* Brightness can be set and retrieved
* Device can be kept "on"
* Brightness can be reset after use

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ public void onMethodCall(MethodCall call, Result result) {
_registrar.activity().getWindow().setAttributes(layoutParams);
result.success(null);
break;
case "resetBrightness":
WindowManager.LayoutParams params = _registrar.activity().getWindow().getAttributes();
params.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
_registrar.activity().getWindow().setAttributes(params);
result.success(null);
break;
case "isKeptOn":
int flags = _registrar.activity().getWindow().getAttributes().flags;
result.success((flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) != 0) ;
Expand Down
1 change: 1 addition & 0 deletions lib/screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ class Screen {
static Future setBrightness(double brightness) =>_channel.invokeMethod('setBrightness',{"brightness" : brightness});
static Future<bool> get isKeptOn async => (await _channel.invokeMethod('isKeptOn')) as bool;
static Future keepOn(bool on) => _channel.invokeMethod('keepOn', {"on" : on});
static Future resetBrightness() => _channel.invokeMethod('resetBrightness');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if a different name would be appropriate. The brightness isn't really "reset", it's more like, the brightness override is removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you suggest me an appropriate name? @pikaju

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disableBrightnessOverride?

}