Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Increase screen brightness when QrCode is in full screen Mode (EXPOSUREAPP-8224) #4611

Conversation

rkw95
Copy link

@rkw95 rkw95 commented Dec 22, 2021

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.

@rkw95 rkw95 requested a review from a team December 22, 2021 18:40
@rkw95 rkw95 changed the title Feature/increase scanability issue 4606 Feature/increase scanability issue 4606 (EXPOSUREAPP-8224) Dec 22, 2021
@mtwalli mtwalli changed the title Feature/increase scanability issue 4606 (EXPOSUREAPP-8224) Increase screen brightness on QrCode is in full screen Mode (EXPOSUREAPP-8224) Dec 22, 2021
@mtwalli mtwalli self-assigned this Dec 22, 2021
@mtwalli mtwalli added community Tag issues created by community members enhancement Improvement of an existing feature labels Dec 22, 2021
@mtwalli mtwalli added this to the 2.16.0 milestone Dec 22, 2021
@mtwalli mtwalli changed the title Increase screen brightness on QrCode is in full screen Mode (EXPOSUREAPP-8224) Increase screen brightness when QrCode is in full screen Mode (EXPOSUREAPP-8224) Dec 22, 2021
Copy link
Contributor

@mtwalli mtwalli left a 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

build.gradle Outdated Show resolved Hide resolved
@@ -25,6 +25,8 @@

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<uses-permission android:name="android.permission.WRITE_SETTINGS" tools:ignore="ProtectedPermissions" />

Copy link
Contributor

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)
}
}

Copy link
Contributor

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
)
}
}
Copy link
Contributor

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 }
    }

@mtwalli mtwalli linked an issue Dec 22, 2021 that may be closed by this pull request
@rkw95
Copy link
Author

rkw95 commented Dec 22, 2021

Thanks! @rkw95 for your contribution. Please see my suggestion below which does not require extra permissions

@mtwalli Thanks for your response! :) I will try to implement your suggestions.

@mtwalli
Copy link
Contributor

mtwalli commented Dec 27, 2021

@rkw95 if you don't have the time to address the comments, please let us know so we can take care of it ?

@mtwalli
Copy link
Contributor

mtwalli commented Dec 28, 2021

@rkw95 Closing in favor of #4624

@mtwalli mtwalli closed this Dec 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community Tag issues created by community members enhancement Improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase screen brightness to 100% when opening QR-codes
3 participants