maximize on single tap

This commit is contained in:
Bnyro 2022-07-29 09:33:00 +02:00
parent 838b9bed64
commit 46acb3bda2
2 changed files with 17 additions and 5 deletions

View File

@ -21,6 +21,7 @@ import android.text.Html
import android.text.TextUtils import android.text.TextUtils
import android.util.Log import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.Toast import android.widget.Toast
@ -192,7 +193,7 @@ class PlayerFragment : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
arguments?.let { arguments?.let {
videoId = it.getString("videoId") videoId = it.getString("videoId").toID()
playlistId = it.getString("playlistId") playlistId = it.getString("playlistId")
} }
} }
@ -344,8 +345,6 @@ class PlayerFragment : Fragment() {
} }
private fun initializeTransitionLayout() { private fun initializeTransitionLayout() {
videoId = videoId.toID()
val mainActivity = activity as MainActivity val mainActivity = activity as MainActivity
mainActivity.binding.container.visibility = View.VISIBLE mainActivity.binding.container.visibility = View.VISIBLE
@ -399,6 +398,17 @@ class PlayerFragment : Fragment() {
binding.playerMotionLayout.progress = 1.toFloat() binding.playerMotionLayout.progress = 1.toFloat()
binding.playerMotionLayout.transitionToStart() binding.playerMotionLayout.transitionToStart()
// quitting miniPlayer on single click
binding.titleTextView.setOnTouchListener { view, motionEvent ->
view.onTouchEvent(motionEvent)
if (motionEvent.action == MotionEvent.ACTION_UP) view.performClick()
binding.root.onTouchEvent(motionEvent)
}
binding.titleTextView.setOnClickListener {
binding.playerMotionLayout.setTransitionDuration(300)
binding.playerMotionLayout.transitionToStart()
}
} }
// actions that don't depend on video information // actions that don't depend on video information
@ -941,6 +951,7 @@ class PlayerFragment : Fragment() {
playerChannelName.text = response.uploader playerChannelName.text = response.uploader
titleTextView.text = response.title titleTextView.text = response.title
playerTitle.text = response.title playerTitle.text = response.title
playerDescription.text = response.description playerDescription.text = response.description
} }

View File

@ -411,8 +411,9 @@
android:id="@+id/title_textView" android:id="@+id/title_textView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:paddingVertical="15dp"
android:layout_marginEnd="12dp" android:paddingStart="8dp"
android:paddingEnd="12dp"
android:alpha="0" android:alpha="0"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"