Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@

<application>

<meta-data
android:name="android.allow_multiple_resumed_activities"
android:value="true" />

<activity
android:name="com.shilapi.xcertplay.CarPlayHostActivity"
android:configChanges="density|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:exported="true"
android:launchMode="singleTask"
android:resizeableActivity="true"
android:screenOrientation="fullSensor"
android:supportsPictureInPicture="true"
android:theme="@style/Theme.Xcertplay"
android:windowSoftInputMode="adjustResize">
<intent-filter>
Expand All @@ -30,11 +35,13 @@
<activity
android:name="com.shilapi.xcertplay.MainActivity"
android:exported="true"
android:resizeableActivity="true"
android:theme="@style/Theme.Xcertplay" />

<activity
android:name="com.shilapi.xcertplay.ImageCropActivity"
android:exported="false"
android:resizeableActivity="true"
android:screenOrientation="fullSensor"
android:theme="@style/Theme.Xcertplay" />

Expand Down
17 changes: 15 additions & 2 deletions common/src/main/java/com/shilapi/xcertplay/CarPlayHostActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,15 @@ class CarPlayHostActivity : ComponentActivity() {
}
}

override fun onMultiWindowModeChanged(isInMultiWindowMode: Boolean, newConfig: Configuration) {
super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig)
applyFullscreenMode()
videoView?.post {
val view = videoView ?: return@post
scheduleDisplaySize(view.width, view.height)
}
}

override fun onDestroy() {
stopMicrophoneGainTest()
mainHandler.removeCallbacks(applyDisplaySize)
Expand Down Expand Up @@ -3097,6 +3106,9 @@ class CarPlayHostActivity : ComponentActivity() {
append(if (hideTopBar) "top hidden" else "top shown")
append(", ")
append(if (hideBottomBar) "bottom hidden" else "bottom shown")
if (isInMultiWindowMode) {
append(" (multi-window)")
}
}
resolutionPreviewView?.text = buildString {
append(resolution).append('\n')
Expand Down Expand Up @@ -4035,8 +4047,9 @@ class CarPlayHostActivity : ComponentActivity() {
}

private fun applyFullscreenMode() {
val hideTop = hideTopBar
val hideBottom = hideBottomBar
val inMultiWindow = isInMultiWindowMode
val hideTop = hideTopBar && !inMultiWindow
val hideBottom = hideBottomBar && !inMultiWindow
WindowCompat.setDecorFitsSystemWindows(window, !(hideTop && hideBottom))
val controller = WindowInsetsControllerCompat(window, window.decorView)
if (hideTop) {
Expand Down