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

Commit

Permalink
Merge pull request #243 from admin-ch/feature/screen-brightness
Browse files Browse the repository at this point in the history
set screen brightnes to maximum on detail screen
  • Loading branch information
benz-ubique authored Aug 19, 2021
2 parents f140271 + c1f4303 commit c0b40a9
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import android.text.SpannableString
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import androidx.appcompat.app.AlertDialog
Expand Down Expand Up @@ -147,6 +148,24 @@ class CertificateDetailFragment : Fragment() {
}
}

override fun onResume() {
super.onResume()
val window = requireActivity().window
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
val layoutParams: WindowManager.LayoutParams = window.attributes
layoutParams.screenBrightness = 1f
window.attributes = layoutParams
}

override fun onPause() {
super.onPause()
val window = requireActivity().window
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
val layoutParams: WindowManager.LayoutParams = window.attributes
layoutParams.screenBrightness = -1f
window.attributes = layoutParams
}

private fun updateToolbarTitle() {
val dccCert = certificateHolder.certificate as? DccCert

Expand Down

0 comments on commit c0b40a9

Please sign in to comment.