gentle-glow-onyx-boox
gentle-glow-onyx-boox copied to clipboard
sync with Android system brightness
- [x] demand - react with a ❤ to this comment to let me know I should work on this feature. Maybe also donate and add a 🍹reaction to the ❤
- [ ] spec ready for first development
- [ ] technical tasks defined
- [ ] first app store release
- [ ] tested and approved in app store
This feature would be useful in case there's another app that controls system brightness that anyone would like to use, or if there's a way to re-enable the native Android brightness slider.
Initial proposal for the acceptance criteria:
- If the system screen brightness is changed by any means - e.g. re-enabled brightness slider or third party app - the warmth should remain unchanged and the screen brightness should have the same behavior as the Gentle Glow brightness bar.
- If the max system screen brightness is different than 100, then the values will be mapped to Gentle Glow brightness as percent of max. E.g. a system screen brightness of 128 / 256 should map to a Gentle Glow brightness of 50 / 100
- If you open the Gentle Glow dialog after an external system brightness change, do not change the current preset. Rather select Onyx slider, which should be renamed to Native slider in all cases. The native slider should show the previously selected warmth + the new brightness.
- If you change the brightness via Gentle Glow, the system brightness should be updated at least every time the settings are saved, so next time when you see the native system brightness controls, they reflect the brightness selected via Gentle Glow.
- If you first play with the native Onyx sliders, then with the Android system screen brightness slider, first approximate the warmth the same way we do for currently showing the Onyx slider values, then apply he new brightness value. Going back to the original brightness value may result in a slightly different warm/cold light setting, which is acceptable.
https://developer.android.com/reference/android/database/ContentObserver
https://developer.android.com/reference/android/provider/Settings.System#getUriFor(java.lang.String)
https://stackoverflow.com/questions/46119279/how-to-detect-if-screen-brightness-has-changed-in-android
// listen to the brightness system settings
val contentObserver = object:ContentObserver(Handler())
{
override fun onChange(selfChange:Boolean)
{
// get system brightness level
val brightnessAmount = Settings.System.getInt(
contentResolver,Settings.System.SCREEN_BRIGHTNESS,0)
// do something...
}
}
// register the brightness listener upon starting
contentResolver.registerContentObserver(
Settings.System.getUriFor(Settings.System.SCREEN_BRIGHTNESS),
false,contentObserver)
// .....
// unregister the listener when we're done (e.g. activity destroyed)
contentResolver.unregisterContentObserver(contentObserver)