Skip to content

Commit

Permalink
Fixed: Hopefully fixed ability to show Activity under display cutouts.
Browse files Browse the repository at this point in the history
  • Loading branch information
tareksander committed Apr 6, 2024
1 parent 1ba8155 commit 57566b6
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import android.os.Build
import android.util.Log
import android.util.Rational
import android.view.View
import android.view.WindowInsetsController
import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import com.termux.gui.App
Expand Down Expand Up @@ -524,9 +524,24 @@ class HandleActivity(val v: V0Proto, val main: OutputStream, val activities: Mut
else -> {}
}
if (m.underCutout) {
c.hide(WindowInsetsCompat.Type.displayCutout())
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
it.window.addFlags(WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
it.window.addFlags(WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS)
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
it.window.clearFlags(WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
it.window.clearFlags(WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS)
}
}
if (m.shown == ConfigureInsetsRequest.Bars.BOTH_BARS && ! m.underCutout) {
WindowCompat.setDecorFitsSystemWindows(it.window, true)
} else {
c.show(WindowInsetsCompat.Type.displayCutout())
WindowCompat.setDecorFitsSystemWindows(it.window, false)
}
ret.success = true
}) {
Expand Down

0 comments on commit 57566b6

Please sign in to comment.