diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index b6bc85fe2..93b2d6f59 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -21,6 +21,7 @@ import android.text.Html import android.text.TextUtils import android.util.Log import android.view.LayoutInflater +import android.view.MotionEvent import android.view.View import android.view.ViewGroup import android.widget.Toast @@ -192,7 +193,7 @@ class PlayerFragment : Fragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) arguments?.let { - videoId = it.getString("videoId") + videoId = it.getString("videoId").toID() playlistId = it.getString("playlistId") } } @@ -344,8 +345,6 @@ class PlayerFragment : Fragment() { } private fun initializeTransitionLayout() { - videoId = videoId.toID() - val mainActivity = activity as MainActivity mainActivity.binding.container.visibility = View.VISIBLE @@ -399,6 +398,17 @@ class PlayerFragment : Fragment() { binding.playerMotionLayout.progress = 1.toFloat() 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 @@ -941,6 +951,7 @@ class PlayerFragment : Fragment() { playerChannelName.text = response.uploader titleTextView.text = response.title + playerTitle.text = response.title playerDescription.text = response.description } diff --git a/app/src/main/res/layout/fragment_player.xml b/app/src/main/res/layout/fragment_player.xml index 60165caf9..1119e3943 100644 --- a/app/src/main/res/layout/fragment_player.xml +++ b/app/src/main/res/layout/fragment_player.xml @@ -411,8 +411,9 @@ android:id="@+id/title_textView" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginEnd="12dp" + android:paddingVertical="15dp" + android:paddingStart="8dp" + android:paddingEnd="12dp" android:alpha="0" android:ellipsize="end" android:maxLines="1"