mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
improve layout and functionality
This commit is contained in:
parent
61721fd2df
commit
75f8ee88f7
@ -11,6 +11,8 @@ import android.net.Uri
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Build.VERSION.SDK_INT
|
import android.os.Build.VERSION.SDK_INT
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import android.support.v4.media.session.MediaSessionCompat
|
import android.support.v4.media.session.MediaSessionCompat
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
@ -847,21 +849,30 @@ class PlayerFragment : Fragment() {
|
|||||||
val seekIncrement =
|
val seekIncrement =
|
||||||
PreferenceHelper.getString(requireContext(), "seek_increment", "5")?.toLong()!! * 1000
|
PreferenceHelper.getString(requireContext(), "seek_increment", "5")?.toLong()!! * 1000
|
||||||
|
|
||||||
playerBinding.rewindFL.setOnClickListener(
|
binding.rewindFL.setOnClickListener(
|
||||||
DoubleClickListener(
|
DoubleClickListener(
|
||||||
callback = object : DoubleClickListener.Callback {
|
callback = object : DoubleClickListener.Callback {
|
||||||
override fun doubleClicked() {
|
override fun doubleClicked() {
|
||||||
|
binding.rewindBTN.visibility = View.VISIBLE
|
||||||
exoPlayer.seekTo(exoPlayer.currentPosition - seekIncrement)
|
exoPlayer.seekTo(exoPlayer.currentPosition - seekIncrement)
|
||||||
|
Handler(Looper.getMainLooper()).postDelayed({
|
||||||
|
binding.rewindBTN.visibility = View.INVISIBLE
|
||||||
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
playerBinding.forwardFL.setOnClickListener(
|
|
||||||
|
binding.forwardFL.setOnClickListener(
|
||||||
DoubleClickListener(
|
DoubleClickListener(
|
||||||
callback = object : DoubleClickListener.Callback {
|
callback = object : DoubleClickListener.Callback {
|
||||||
override fun doubleClicked() {
|
override fun doubleClicked() {
|
||||||
|
binding.forwardBTN.visibility = View.VISIBLE
|
||||||
exoPlayer.seekTo(exoPlayer.currentPosition + seekIncrement)
|
exoPlayer.seekTo(exoPlayer.currentPosition + seekIncrement)
|
||||||
|
Handler(Looper.getMainLooper()).postDelayed({
|
||||||
|
binding.forwardBTN.visibility = View.INVISIBLE
|
||||||
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
10
app/src/main/res/drawable/ic_forward.xml
Normal file
10
app/src/main/res/drawable/ic_forward.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="@android:color/white"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M4,18l8.5,-6L4,6v12zM13,6v12l8.5,-6L13,6z" />
|
||||||
|
</vector>
|
10
app/src/main/res/drawable/ic_rewind.xml
Normal file
10
app/src/main/res/drawable/ic_rewind.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="@android:color/white"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M11,18L11,6l-8.5,6 8.5,6zM11.5,12l8.5,6L20,6l-8.5,6z" />
|
||||||
|
</vector>
|
@ -170,7 +170,6 @@
|
|||||||
android:id="@+id/progress_bar"
|
android:id="@+id/progress_bar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="15dp"
|
android:layout_height="15dp"
|
||||||
android:layout_above="@id/exo_basic_controls"
|
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
@ -207,53 +206,15 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:background="@android:color/transparent"
|
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="@dimen/exo_styled_controls_padding">
|
android:padding="@dimen/exo_styled_controls_padding">
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/rewindFL"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/rewindBTN"
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="200dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:background="?android:selectableItemBackground"
|
|
||||||
android:src="@drawable/ic_three_dots"
|
|
||||||
android:clickable="false"
|
|
||||||
app:tint="@android:color/white" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@id/exo_play_pause"
|
android:id="@id/exo_play_pause"
|
||||||
style="@style/ExoStyledControls.Button.Center.PlayPause"
|
style="@style/ExoStyledControls.Button.Center.PlayPause"
|
||||||
app:tint="@android:color/white" />
|
app:tint="@android:color/white" />
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/forwardFL"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/forwardBTN"
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="200dp"
|
|
||||||
android:layout_gravity="center_vertical|end"
|
|
||||||
android:background="?android:selectableItemBackground"
|
|
||||||
android:src="@drawable/ic_three_dots"
|
|
||||||
android:clickable="false"
|
|
||||||
app:tint="@android:color/white" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</merge>
|
</merge>
|
@ -362,7 +362,47 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="@id/main_container"
|
app:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||||
app:layout_constraintStart_toStartOf="@id/main_container"
|
app:layout_constraintStart_toStartOf="@id/main_container"
|
||||||
app:layout_constraintTop_toTopOf="@id/main_container"
|
app:layout_constraintTop_toTopOf="@id/main_container"
|
||||||
app:show_buffering="always" />
|
app:show_buffering="always" >
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/forwardFL"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical|end"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/forwardBTN"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:background="?android:selectableItemBackgroundBorderless"
|
||||||
|
android:src="@drawable/ic_forward"
|
||||||
|
android:clickable="false"
|
||||||
|
app:tint="@android:color/white"
|
||||||
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/rewindFL"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical|start"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/rewindBTN"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:background="?android:selectableItemBackgroundBorderless"
|
||||||
|
android:src="@drawable/ic_rewind"
|
||||||
|
android:clickable="false"
|
||||||
|
app:tint="@android:color/white"
|
||||||
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</com.github.libretube.views.CustomExoPlayerView>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/close_imageView"
|
android:id="@+id/close_imageView"
|
||||||
|
Loading…
Reference in New Issue
Block a user