mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 15:30:31 +05:30
exoplayer bug and close fragment working
This commit is contained in:
parent
64de3dd54d
commit
cd31734d9a
12
.idea/deploymentTargetDropDown.xml
generated
12
.idea/deploymentTargetDropDown.xml
generated
@ -1,18 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="3100ad43a3044300" />
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_5_API_22.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2021-12-12T14:57:43.909907Z" />
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2021-12-12T20:15:13.174164Z" />
|
||||
<runningDeviceTargetsSelectedWithDialog>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
|
@ -5,6 +5,8 @@ import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
@ -64,6 +66,8 @@ class PlayerFragment : Fragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val mainActivity = activity as MainActivity
|
||||
mainActivity.findViewById<FrameLayout>(R.id.container).visibility=View.VISIBLE
|
||||
val playerMotionLayout = view.findViewById<SingleViewTouchableMotionLayout>(R.id.playerMotionLayout)
|
||||
motionLayout = playerMotionLayout
|
||||
exoPlayerView = view.findViewById(R.id.player)
|
||||
@ -111,9 +115,21 @@ class PlayerFragment : Fragment() {
|
||||
playerMotionLayout.progress=1.toFloat()
|
||||
playerMotionLayout.transitionToStart()
|
||||
fetchJson(view)
|
||||
view.findViewById<ImageView>(R.id.close_imageView).setOnClickListener{
|
||||
println("wtf?")
|
||||
val mainActivity = activity as MainActivity
|
||||
mainActivity.supportFragmentManager.beginTransaction()
|
||||
.remove(this)
|
||||
.commit()
|
||||
mainActivity.findViewById<FrameLayout>(R.id.container).layoutParams=ViewGroup.LayoutParams(0,0)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
exoPlayer.stop()
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
@ -140,6 +156,7 @@ class PlayerFragment : Fragment() {
|
||||
exoPlayerView.player = exoPlayer
|
||||
exoPlayer.setMediaItem(MediaItem.fromUri(url))
|
||||
exoPlayer.prepare()
|
||||
exoPlayer.play()
|
||||
}
|
||||
|
||||
private fun fetchJson(view: View) {
|
||||
@ -162,7 +179,7 @@ class PlayerFragment : Fragment() {
|
||||
val videoInPlayer = gson.fromJson(body, VideoInPlayer::class.java)
|
||||
runOnUiThread {
|
||||
initPlayer(view,videoInPlayer.hls)
|
||||
|
||||
view.findViewById<TextView>(R.id.title_textView).text = videoInPlayer.title
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,10 @@ class TrendingAdapter(private val videoFeed: List<Video>): RecyclerView.Adapter<
|
||||
frag.arguments = bundle
|
||||
val activity = holder.v.context as AppCompatActivity
|
||||
activity.supportFragmentManager.beginTransaction()
|
||||
.add(R.id.container, frag)
|
||||
.remove(PlayerFragment())
|
||||
.commit()
|
||||
activity.supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.container, frag)
|
||||
.commitNow()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user