Fix custom brightness turning off the screen. #106

This commit is contained in:
len 2016-04-18 17:36:27 +02:00
parent a7840bc247
commit 78314077bb

View file

@ -495,13 +495,15 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
private fun setCustomBrightness(enabled: Boolean) { private fun setCustomBrightness(enabled: Boolean) {
if (enabled) { if (enabled) {
customBrightnessSubscription = preferences.customBrightnessValue().asObservable() customBrightnessSubscription = preferences.customBrightnessValue().asObservable()
.map { Math.max(0.01f, it) }
.subscribe { setCustomBrightnessValue(it) } .subscribe { setCustomBrightnessValue(it) }
subscriptions.add(customBrightnessSubscription) subscriptions.add(customBrightnessSubscription)
} else { } else {
if (customBrightnessSubscription != null) if (customBrightnessSubscription != null) {
subscriptions.remove(customBrightnessSubscription) subscriptions.remove(customBrightnessSubscription)
setCustomBrightnessValue(-1f) }
setCustomBrightnessValue(WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE)
} }
} }