-
Notifications
You must be signed in to change notification settings - Fork 496
Increase screen brightness when QrCode is in full screen Mode (EXPOSUREAPP-8224) #4611
Increase screen brightness when QrCode is in full screen Mode (EXPOSUREAPP-8224) #4611
Conversation
… code in full screen mode and setting brightness back to old brighness level when leaving full screen mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! @rkw95 for your contribution.
Please see my suggestion below which does not require extra permissions
@@ -25,6 +25,8 @@ | |||
|
|||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | |||
|
|||
<uses-permission android:name="android.permission.WRITE_SETTINGS" tools:ignore="ProtectedPermissions" /> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this won't be necessary, please see my suggestion below in QrCodeFullScreenFragment
file ?
startActivity(intent) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert ?
Settings.System.SCREEN_BRIGHTNESS, | ||
this.brightness | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the changes in here and just try the following snippet ?
override fun onResume() {
super.onResume()
keepScreenOn(on = true)
}
override fun onPause() {
super.onPause()
keepScreenOn(on = false)
}
private fun keepScreenOn(on: Boolean) = with(requireActivity().window) {
if (on) addFlags(FLAG_KEEP_SCREEN_ON) else clearFlags(FLAG_KEEP_SCREEN_ON)
attributes = attributes.apply { screenBrightness = if (on) 1f else -1f }
}
This reverts commit 9d8fe50.
@rkw95 if you don't have the time to address the comments, please let us know so we can take care of it ? |
Implemented setting screen brightness to 100% while a QR code is shown in full screen mode for better scanability. Does not apply to other views when a QR code is shown but not as full screen.
Drawback might be the necessity to give the cwa the permission to write system settings.
See #4606 for more information.