mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
add toggable options menu
This commit is contained in:
parent
fc8279cfff
commit
ae08491d0b
@ -276,6 +276,16 @@ class PlayerFragment : Fragment() {
|
|||||||
.remove(this)
|
.remove(this)
|
||||||
.commit()
|
.commit()
|
||||||
}
|
}
|
||||||
|
// show the advanced player options
|
||||||
|
playerBinding.toggleOptions.setOnClickListener {
|
||||||
|
if (playerBinding.advancedOptions.isVisible) {
|
||||||
|
playerBinding.toggleOptions.animate().rotationX(0F).setDuration(200).start()
|
||||||
|
playerBinding.advancedOptions.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
playerBinding.toggleOptions.animate().rotationX(180F).setDuration(200).start()
|
||||||
|
playerBinding.advancedOptions.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
binding.playImageView.setOnClickListener {
|
binding.playImageView.setOnClickListener {
|
||||||
paused = if (paused) {
|
paused = if (paused) {
|
||||||
binding.playImageView.setImageResource(R.drawable.ic_pause)
|
binding.playImageView.setImageResource(R.drawable.ic_pause)
|
||||||
|
@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
|
import android.view.View
|
||||||
import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding
|
import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding
|
||||||
import com.google.android.exoplayer2.ui.StyledPlayerView
|
import com.google.android.exoplayer2.ui.StyledPlayerView
|
||||||
|
|
||||||
@ -13,6 +14,12 @@ internal class CustomExoPlayerView(
|
|||||||
) : StyledPlayerView(context, attributeSet) {
|
) : StyledPlayerView(context, attributeSet) {
|
||||||
val binding: ExoStyledPlayerControlViewBinding = ExoStyledPlayerControlViewBinding.bind(this)
|
val binding: ExoStyledPlayerControlViewBinding = ExoStyledPlayerControlViewBinding.bind(this)
|
||||||
|
|
||||||
|
override fun hideController() {
|
||||||
|
super.hideController()
|
||||||
|
binding.toggleOptions.animate().rotationX(0F).start()
|
||||||
|
binding.advancedOptions.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||||
when (event.action) {
|
when (event.action) {
|
||||||
|
@ -11,73 +11,105 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/exo_top_bar"
|
android:id="@+id/exo_top_bar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/exo_styled_bottom_bar_height"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="top"
|
android:layout_gravity="top"
|
||||||
android:layout_marginBottom="@dimen/exo_styled_bottom_bar_margin_top"
|
android:animateLayoutChanges="true"
|
||||||
android:layoutDirection="ltr">
|
android:orientation="vertical"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="10dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:layoutDirection="ltr">
|
android:layoutDirection="ltr">
|
||||||
|
|
||||||
<ImageView
|
<LinearLayout
|
||||||
android:id="@+id/close_imageButton"
|
android:layout_width="wrap_content"
|
||||||
style="@style/PlayerControlTop"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/ic_close"
|
android:layout_gravity="center"
|
||||||
app:tint="@android:color/white" />
|
android:layoutDirection="ltr">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/lock_player"
|
android:id="@+id/close_imageButton"
|
||||||
style="@style/PlayerControlTop"
|
style="@style/PlayerControlTop"
|
||||||
android:layout_marginStart="-5dp"
|
android:src="@drawable/ic_close"
|
||||||
android:scaleX=".9"
|
app:tint="@android:color/white" />
|
||||||
android:scaleY=".9"
|
|
||||||
android:src="@drawable/ic_unlocked" />
|
<ImageView
|
||||||
|
android:id="@+id/lock_player"
|
||||||
|
style="@style/PlayerControlTop"
|
||||||
|
android:layout_marginStart="-5dp"
|
||||||
|
android:scaleX=".9"
|
||||||
|
android:scaleY=".9"
|
||||||
|
android:src="@drawable/ic_unlocked" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/exo_title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginHorizontal="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:visibility="invisible" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/exo_top_bar_right"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layoutDirection="ltr">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/speed_text"
|
||||||
|
style="@style/PlayerControlTop"
|
||||||
|
android:text="1x" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/quality_text"
|
||||||
|
style="@style/PlayerControlTop"
|
||||||
|
android:text="@string/hls" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/toggle_options"
|
||||||
|
style="@style/PlayerControlTop"
|
||||||
|
android:layout_marginTop="-.5dp"
|
||||||
|
android:src="@drawable/ic_arrow_down"
|
||||||
|
app:tint="@android:color/white" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/exo_title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginHorizontal="10dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:visibility="invisible" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/exo_top_bar_right"
|
android:id="@+id/advanced_options"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="right"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginTop="-10dp"
|
||||||
android:layoutDirection="ltr">
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@id/exo_subtitle"
|
||||||
|
style="@style/PlayerControlBottom" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/repeat_toggle"
|
||||||
|
style="@style/PlayerControlTop"
|
||||||
|
android:src="@drawable/ic_repeat"
|
||||||
|
app:tint="@android:color/darker_gray" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/aspect_ratio_button"
|
android:id="@+id/aspect_ratio_button"
|
||||||
style="@style/PlayerControlTop"
|
style="@style/PlayerControlTop"
|
||||||
android:layout_marginTop="-1dp"
|
|
||||||
android:scaleX=".9"
|
|
||||||
android:scaleY=".9"
|
|
||||||
android:src="@drawable/ic_aspect_ratio" />
|
android:src="@drawable/ic_aspect_ratio" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/speed_text"
|
|
||||||
style="@style/PlayerControlTop"
|
|
||||||
android:text="1x" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/quality_text"
|
|
||||||
style="@style/PlayerControlTop"
|
|
||||||
android:text="@string/hls" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -150,19 +182,10 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/repeat_toggle"
|
|
||||||
style="@style/PlayerControlBottom"
|
|
||||||
android:src="@drawable/ic_repeat"
|
|
||||||
app:tint="@android:color/darker_gray" />
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@id/exo_subtitle"
|
|
||||||
style="@style/PlayerControlBottom" />
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/fullscreen"
|
android:id="@+id/fullscreen"
|
||||||
style="@style/PlayerControlBottom"
|
style="@style/PlayerControlBottom"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
android:src="@drawable/ic_fullscreen"
|
android:src="@drawable/ic_fullscreen"
|
||||||
app:tint="@android:color/white" />
|
app:tint="@android:color/white" />
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@
|
|||||||
android:id="@+id/doubleTapOverlayLL"
|
android:id="@+id/doubleTapOverlayLL"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginVertical="50dp">
|
android:layout_marginVertical="60dp">
|
||||||
|
|
||||||
<!-- double tap rewind btn -->
|
<!-- double tap rewind btn -->
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user