Skip to content

Commit

Permalink
Update overlay only if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
GustavoASantos committed Mar 9, 2024
1 parent 106ee85 commit fc897e8
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,15 @@ class AccessibilityService : AccessibilityService() {
sharedPreferences.getBoolean("showBelowNotch", false) && progressBarStyle == "linear"
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val params = overlayView.layoutParams as WindowManager.LayoutParams
params.layoutInDisplayCutoutMode = if (showBelowNotch) {
val displayCutoutMode = if (showBelowNotch) {
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
} else {
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
}
windowManager.updateViewLayout(overlayView, params)
if (params.layoutInDisplayCutoutMode != displayCutoutMode) {
params.layoutInDisplayCutoutMode = displayCutoutMode
windowManager.updateViewLayout(overlayView, params)
}
}

progressBar = overlayView.findViewById(R.id.progressBar)
Expand Down

0 comments on commit fc897e8

Please sign in to comment.