mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Reuse PictureInPictureCompat method.
This commit is contained in:
parent
8d44d241db
commit
5c1a0a4e7a
@ -4,7 +4,6 @@ import android.annotation.SuppressLint
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
@ -24,6 +23,7 @@ import androidx.navigation.fragment.NavHostFragment
|
|||||||
import androidx.navigation.ui.setupWithNavController
|
import androidx.navigation.ui.setupWithNavController
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
|
import com.github.libretube.compat.PictureInPictureCompat
|
||||||
import com.github.libretube.constants.IntentData
|
import com.github.libretube.constants.IntentData
|
||||||
import com.github.libretube.constants.PreferenceKeys
|
import com.github.libretube.constants.PreferenceKeys
|
||||||
import com.github.libretube.databinding.ActivityMainBinding
|
import com.github.libretube.databinding.ActivityMainBinding
|
||||||
@ -370,9 +370,7 @@ class MainActivity : BaseActivity() {
|
|||||||
|
|
||||||
private fun loadIntentData() {
|
private fun loadIntentData() {
|
||||||
// If activity is running in PiP mode, then start it in front.
|
// If activity is running in PiP mode, then start it in front.
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
|
if (PictureInPictureCompat.isInPictureInPictureMode(this)) {
|
||||||
isInPictureInPictureMode
|
|
||||||
) {
|
|
||||||
val nIntent = Intent(this, MainActivity::class.java)
|
val nIntent = Intent(this, MainActivity::class.java)
|
||||||
nIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
nIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||||
startActivity(nIntent)
|
startActivity(nIntent)
|
||||||
|
Loading…
Reference in New Issue
Block a user