Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch bluesky-video to handle edge-to-edge on android 15 #7216

Closed
wants to merge 2 commits into from
Closed
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
98 changes: 98 additions & 0 deletions patches/@haileyok+bluesky-video+0.2.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
diff --git a/node_modules/@haileyok/bluesky-video/android/src/main/java/expo/modules/blueskyvideo/FullscreenActivity.kt b/node_modules/@haileyok/bluesky-video/android/src/main/java/expo/modules/blueskyvideo/FullscreenActivity.kt
index d4f83cc..b5f8461 100644
--- a/node_modules/@haileyok/bluesky-video/android/src/main/java/expo/modules/blueskyvideo/FullscreenActivity.kt
+++ b/node_modules/@haileyok/bluesky-video/android/src/main/java/expo/modules/blueskyvideo/FullscreenActivity.kt
@@ -1,10 +1,15 @@
package expo.modules.blueskyvideo

import android.graphics.Color
+import android.os.Build
import android.os.Bundle
+import android.view.View
import android.view.ViewGroup
+import android.view.WindowInsets
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowCompat
import androidx.media3.common.util.UnstableApi
import androidx.media3.ui.PlayerView
import java.lang.ref.WeakReference
@@ -25,40 +30,49 @@ class FullscreenActivity : AppCompatActivity() {
return
}

- this.window.setFlags(
- WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN,
- )
+ // Enable edge-to-edge mode but keep navigation bar persistent
+ WindowCompat.setDecorFitsSystemWindows(window, false)

- val keepDisplayOn = this.getIntent().getBooleanExtra("keepDisplayOn", false)
-
- if (keepDisplayOn) {
- this.window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
+ val playerView = PlayerView(this).apply {
+ setBackgroundColor(Color.BLACK)
+ setShowSubtitleButton(true)
+ setShowNextButton(false)
+ setShowPreviousButton(false)
+ setFullscreenButtonClickListener {
+ finish()
+ }
+ layoutParams = ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT
+ )
+ useController = true
+ controllerAutoShow = false
+ controllerHideOnTouch = true
}
+ playerView.player = player
+ setContentView(playerView)

- // Update the player viewz
- val playerView =
- PlayerView(this).apply {
- setBackgroundColor(Color.BLACK)
- setShowSubtitleButton(true)
- setShowNextButton(false)
- setShowPreviousButton(false)
- setFullscreenButtonClickListener {
- finish()
- }
+ // Adjust layout for system insets to accommodate persistent nav bar
+ ViewCompat.setOnApplyWindowInsetsListener(playerView) { view, insets ->
+ val systemBarsInsets = insets.getInsets(WindowInsets.Type.systemBars())
+ view.setPadding(0, systemBarsInsets.top, 0, systemBarsInsets.bottom)
+ insets
+ }

- layoutParams =
- ViewGroup.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT,
- )
- useController = true
- controllerAutoShow = false
- controllerHideOnTouch = true
+ // Prevent hiding of the navigation bar
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ window.insetsController?.let {
+ it.systemBarsBehavior = android.view.WindowInsetsController.BEHAVIOR_DEFAULT
}
- playerView.player = player
+ } else {
+ @Suppress("DEPRECATION")
+ window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
+ }

- setContentView(playerView)
+ val keepDisplayOn = this.intent.getBooleanExtra("keepDisplayOn", false)
+ if (keepDisplayOn) {
+ this.window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
+ }
}

override fun onDestroy() {
Loading