mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
commit
ff8c1a9c0d
@ -13,12 +13,9 @@ import android.view.View
|
||||
import android.view.WindowInsets
|
||||
import android.view.WindowInsetsController
|
||||
import android.view.WindowManager
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.widget.SearchView
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.NavController
|
||||
@ -394,24 +391,34 @@ class MainActivity : BaseActivity() {
|
||||
.replace(R.id.container, frag)
|
||||
.commitNow()
|
||||
Handler(Looper.getMainLooper()).postDelayed({
|
||||
val motionLayout = findViewById<MotionLayout>(R.id.playerMotionLayout)
|
||||
motionLayout.transitionToEnd()
|
||||
motionLayout.transitionToStart()
|
||||
supportFragmentManager.fragments.forEach { fragment ->
|
||||
(fragment as? PlayerFragment)
|
||||
?.binding?.playerMotionLayout?.apply {
|
||||
transitionToEnd()
|
||||
transitionToStart()
|
||||
}
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
|
||||
private fun minimizePlayer() {
|
||||
binding.mainMotionLayout.transitionToEnd()
|
||||
findViewById<ConstraintLayout>(R.id.main_container).isClickable = false
|
||||
val motionLayout = findViewById<MotionLayout>(R.id.playerMotionLayout)
|
||||
supportFragmentManager.fragments.forEach { fragment ->
|
||||
(fragment as? PlayerFragment)?.binding?.apply {
|
||||
mainContainer.isClickable = false
|
||||
linLayout.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
supportFragmentManager.fragments.forEach { fragment ->
|
||||
(fragment as? PlayerFragment)?.binding?.playerMotionLayout?.apply {
|
||||
// set the animation duration
|
||||
motionLayout.setTransitionDuration(250)
|
||||
motionLayout.transitionToEnd()
|
||||
with(motionLayout) {
|
||||
setTransitionDuration(250)
|
||||
transitionToEnd()
|
||||
getConstraintSet(R.id.start).constrainHeight(R.id.player, 0)
|
||||
enableTransition(R.id.yt_transition, true)
|
||||
}
|
||||
findViewById<LinearLayout>(R.id.linLayout).visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
val playerViewModel = ViewModelProvider(this)[PlayerViewModel::class.java]
|
||||
playerViewModel.isFullscreen.value = false
|
||||
requestedOrientation = if (autoRotationEnabled) {
|
||||
|
@ -107,7 +107,7 @@ import kotlin.math.abs
|
||||
|
||||
class PlayerFragment : BaseFragment() {
|
||||
|
||||
private lateinit var binding: FragmentPlayerBinding
|
||||
lateinit var binding: FragmentPlayerBinding
|
||||
private lateinit var playerBinding: ExoStyledPlayerControlViewBinding
|
||||
private lateinit var doubleTapOverlayBinding: DoubleTapOverlayBinding
|
||||
private val viewModel: PlayerViewModel by activityViewModels()
|
||||
|
@ -3,7 +3,6 @@ package com.github.libretube.util
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
import androidx.core.os.bundleOf
|
||||
import com.github.libretube.R
|
||||
import com.github.libretube.activities.MainActivity
|
||||
@ -21,14 +20,14 @@ object NavigationHelper {
|
||||
val bundle = bundleOf(IntentData.channelId to channelId)
|
||||
activity.navController.navigate(R.id.channelFragment, bundle)
|
||||
try {
|
||||
val mainMotionLayout =
|
||||
activity.findViewById<MotionLayout>(R.id.mainMotionLayout)
|
||||
if (mainMotionLayout.progress == 0.toFloat()) {
|
||||
mainMotionLayout.transitionToEnd()
|
||||
activity.findViewById<MotionLayout>(R.id.playerMotionLayout)
|
||||
.transitionToEnd()
|
||||
if (activity.binding.mainMotionLayout.progress == 0.toFloat()) {
|
||||
activity.binding.mainMotionLayout.transitionToEnd()
|
||||
activity.supportFragmentManager.fragments.forEach {
|
||||
(it as PlayerFragment?)?.binding?.playerMotionLayout?.transitionToEnd()
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,12 +10,6 @@ import android.view.View
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
import com.github.libretube.R
|
||||
|
||||
/**
|
||||
*
|
||||
* Created by Arman Chatikyan on 05 Sep 2018
|
||||
*
|
||||
*/
|
||||
|
||||
class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeSet? = null) :
|
||||
MotionLayout(context, attributeSet) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user