Merge pull request #5951 from Bnyro/master

fix: video links dont open on android 10 and below
This commit is contained in:
Bnyro 2024-05-01 17:37:31 +02:00 committed by GitHub
commit 6a9205a5ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,7 @@ package com.github.libretube.ui.activities
import android.annotation.SuppressLint
import android.content.Intent
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.view.KeyEvent
import android.view.Menu
@ -438,6 +439,8 @@ class MainActivity : BaseActivity() {
.show(supportFragmentManager, null)
}
intent?.getStringExtra(IntentData.videoId)?.let {
// the below explained work around only seems to work on Android 11 and above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// the bottom navigation bar has to be created before opening the video
// otherwise the player layout measures aren't calculated properly
// and the miniplayer is opened at a closed state and overlapping the navigation bar
@ -452,6 +455,13 @@ class MainActivity : BaseActivity() {
binding.bottomNav.viewTreeObserver.removeOnGlobalLayoutListener(this)
}
})
} else {
NavigationHelper.navigateVideo(
context = this@MainActivity,
videoUrlOrId = it,
timestamp = intent.getLongExtra(IntentData.timeStamp, 0L)
)
}
}
intent?.getStringExtra(IntentData.query)?.let {
savedSearchQuery = it