mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #2083 from Kruna1Pate1/fix/link-open-issue
Fix activity goes in PiP mode on link opening
This commit is contained in:
commit
9c4928b862
@ -340,6 +340,15 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
private fun loadIntentData() {
|
||||
// If activity is running in PiP mode, then start it in front.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
|
||||
isInPictureInPictureMode
|
||||
) {
|
||||
moveTaskToBack(true)
|
||||
intent?.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
intent?.getStringExtra(IntentData.channelId)?.let {
|
||||
navController.navigate(
|
||||
R.id.channelFragment,
|
||||
|
@ -25,6 +25,7 @@ import com.github.libretube.ui.base.BaseFragment
|
||||
import com.github.libretube.ui.extensions.withMaxSize
|
||||
import com.github.libretube.util.LocaleHelper
|
||||
import com.github.libretube.util.PreferenceHelper
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@ -141,6 +142,9 @@ class HomeFragment : BaseFragment() {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
action.invoke()
|
||||
// Can be caused due to activity launch in front view from PiP mode.
|
||||
} catch (e: CancellationException) {
|
||||
Log.e("fetching home tab", e.toString())
|
||||
} catch (e: Exception) {
|
||||
e.localizedMessage?.let { context?.toastFromMainThread(it) }
|
||||
Log.e("fetching home tab", e.toString())
|
||||
|
Loading…
Reference in New Issue
Block a user