mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
feat(TV UI): Player's Top controls redesign
This commit is contained in:
parent
30d223cfe3
commit
68bba83cb4
10 changed files with 130 additions and 55 deletions
|
@ -913,7 +913,11 @@ class CS3IPlayer : IPlayer {
|
|||
}
|
||||
|
||||
CSPlayerEvent.SeekForward -> seekTime(seekActionTime, source)
|
||||
|
||||
CSPlayerEvent.SeekBack -> seekTime(-seekActionTime, source)
|
||||
|
||||
CSPlayerEvent.Restart -> seekTo(0, source)
|
||||
|
||||
CSPlayerEvent.NextEpisode -> event(
|
||||
EpisodeSeekEvent(
|
||||
offset = 1,
|
||||
|
|
|
@ -243,7 +243,6 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
|||
|
||||
val playerSourceMove = if (isShowing) 0f else -50.toPx.toFloat()
|
||||
|
||||
|
||||
playerBinding?.apply {
|
||||
playerOpenSource.let {
|
||||
ObjectAnimator.ofFloat(it, "translationY", playerSourceMove).apply {
|
||||
|
@ -705,7 +704,6 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
|||
//player_media_route_button?.isClickable = !isGone
|
||||
playerGoBackHolder.isGone = isGone
|
||||
playerSourcesBtt.isGone = isGone
|
||||
playerSkipEpisode.isClickable = !isGone
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1224,7 +1222,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
|||
|
||||
// if nothing has loaded these buttons should not be visible
|
||||
playerBinding?.apply {
|
||||
playerSkipEpisode.isVisible = false
|
||||
playerGoForward.isVisible = false
|
||||
playerTracksBtt.isVisible = false
|
||||
playerSkipOp.isVisible = false
|
||||
shadowOverlay.isVisible = false
|
||||
|
@ -1298,6 +1296,10 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
|||
player.handleEvent(CSPlayerEvent.SeekBack)
|
||||
}
|
||||
|
||||
PlayerEventType.Restart -> {
|
||||
player.handleEvent(CSPlayerEvent.Restart)
|
||||
}
|
||||
|
||||
PlayerEventType.ToggleMute -> {
|
||||
player.handleEvent(CSPlayerEvent.ToggleMute)
|
||||
}
|
||||
|
@ -1457,11 +1459,16 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
|||
skipOp()
|
||||
}
|
||||
|
||||
playerSkipEpisode.setOnClickListener {
|
||||
playerGoForward.setOnClickListener {
|
||||
autoHide()
|
||||
player.handleEvent(CSPlayerEvent.NextEpisode)
|
||||
}
|
||||
|
||||
playerRestart.setOnClickListener {
|
||||
autoHide()
|
||||
player.handleEvent(CSPlayerEvent.Restart)
|
||||
}
|
||||
|
||||
playerLock.setOnClickListener {
|
||||
autoHide()
|
||||
toggleLock()
|
||||
|
|
|
@ -1095,7 +1095,8 @@ class GeneratorPlayer : FullScreenPlayer() {
|
|||
}
|
||||
|
||||
playerBinding?.playerSkipOp?.isVisible = isOpVisible
|
||||
playerBinding?.playerSkipEpisode?.isVisible =
|
||||
|
||||
playerBinding?.playerGoForward?.isVisible =
|
||||
!isOpVisible && viewModel.hasNextEpisode() == true
|
||||
|
||||
if (percentage >= PRELOAD_NEXT_EPISODE_PERCENTAGE) {
|
||||
|
@ -1252,7 +1253,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
|||
fun setPlayerDimen(widthHeight: Pair<Int, Int>?) {
|
||||
val extra = if (widthHeight != null) {
|
||||
val (width, height) = widthHeight
|
||||
"${width}x${height}"
|
||||
"- ${width}x${height}"
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
@ -1263,7 +1264,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
|||
0 -> ""
|
||||
1 -> extra
|
||||
2 -> source
|
||||
3 -> "$source - $extra"
|
||||
3 -> "$source $extra"
|
||||
else -> ""
|
||||
}
|
||||
playerBinding?.playerVideoTitleRez?.apply {
|
||||
|
|
|
@ -27,6 +27,7 @@ enum class PlayerEventType(val value: Int) {
|
|||
Resize(13),
|
||||
SearchSubtitlesOnline(14),
|
||||
SkipOp(15),
|
||||
Restart(16),
|
||||
}
|
||||
|
||||
enum class CSPlayerEvent(val value: Int) {
|
||||
|
@ -40,6 +41,7 @@ enum class CSPlayerEvent(val value: Int) {
|
|||
PrevEpisode(6),
|
||||
PlayPauseToggle(7),
|
||||
ToggleMute(8),
|
||||
Restart(9),
|
||||
}
|
||||
|
||||
enum class CSPlayerLoading {
|
||||
|
|
9
app/src/main/res/drawable/ic_baseline_equalizer_24.xml
Normal file
9
app/src/main/res/drawable/ic_baseline_equalizer_24.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="M160,800v-320h160v320L160,800ZM400,800v-640h160v640L400,800ZM640,800v-440h160v440L640,800Z"
|
||||
android:fillColor="#5f6368"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_baseline_restart_24.xml
Normal file
9
app/src/main/res/drawable/ic_baseline_restart_24.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="M440,838q-121,-15 -200.5,-105.5T160,520q0,-66 26,-126.5T260,288l57,57q-38,34 -57.5,79T240,520q0,88 56,155.5T440,758v80ZM520,838v-80q87,-16 143.5,-83T720,520q0,-100 -70,-170t-170,-70h-3l44,44 -56,56 -140,-140 140,-140 56,56 -44,44h3q134,0 227,93t93,227q0,121 -79.5,211.5T520,838Z"
|
||||
android:fillColor="#e8eaed"/>
|
||||
</vector>
|
|
@ -68,7 +68,9 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
|
@ -82,12 +84,11 @@
|
|||
android:id="@+id/player_loading_go_back"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/video_tap_button_always_white"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:nextFocusRight="@id/overlay_loading_skip_button"
|
||||
android:nextFocusDown="@id/overlay_loading_skip_button" />
|
||||
</FrameLayout>
|
||||
|
|
|
@ -172,27 +172,51 @@
|
|||
android:id="@+id/player_go_back_holder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_margin="20dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/player_go_back"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/go_back_img_des"
|
||||
android:src="@drawable/ic_baseline_arrow_back_24"
|
||||
app:tint="@android:color/white" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/player_go_back"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_gravity="center"
|
||||
app:tint="@android:color/white"
|
||||
android:background="@drawable/video_tap_button_always_white"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/go_back_img_des"
|
||||
android:focusable="true" />
|
||||
android:focusable="true"
|
||||
android:tag="@string/tv_no_focus_tag" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/player_restart"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:src="@drawable/ic_baseline_restart_24"
|
||||
app:tint="@android:color/white"
|
||||
android:background="@drawable/video_tap_button_always_white"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/go_back_img_des"
|
||||
android:focusable="true"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:tag="@string/tv_no_focus_tag" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/player_go_forward"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="80dp"
|
||||
android:src="@drawable/ic_baseline_arrow_forward_24"
|
||||
app:tint="@android:color/white"
|
||||
android:background="@drawable/video_tap_button_always_white"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/go_back_img_des"
|
||||
android:focusable="true"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:tag="@string/tv_no_focus_tag" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
|
@ -637,14 +661,6 @@
|
|||
android:text="@string/video_skip_op"
|
||||
app:icon="@drawable/ic_baseline_fast_forward_24" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/player_skip_episode"
|
||||
style="@style/VideoButton"
|
||||
android:nextFocusLeft="@id/player_skip_op"
|
||||
|
||||
android:nextFocusRight="@id/player_lock"
|
||||
android:text="@string/next_episode"
|
||||
app:icon="@drawable/ic_baseline_skip_next_24" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
|
|
|
@ -231,7 +231,7 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:orientation="vertical">
|
||||
|
@ -240,6 +240,7 @@
|
|||
android:id="@+id/player_video_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="viewEnd"
|
||||
android:gravity="end"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
|
@ -250,6 +251,7 @@
|
|||
android:id="@+id/player_video_title_rez"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="viewEnd"
|
||||
android:gravity="end"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
|
@ -285,28 +287,62 @@
|
|||
android:id="@+id/player_go_back_holder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/player_go_back"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/go_back_img_des"
|
||||
android:src="@drawable/ic_baseline_arrow_back_24"
|
||||
app:tint="@android:color/white" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/player_go_back"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_gravity="center"
|
||||
app:tint="@android:color/white"
|
||||
android:background="@drawable/video_tap_button_always_white"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/go_back_img_des"
|
||||
android:focusable="true"
|
||||
android:nextFocusRight="@id/player_restart"
|
||||
android:nextFocusLeft="@id/player_go_back"
|
||||
android:nextFocusDown="@id/player_pause_play"
|
||||
android:nextFocusUp="@id/player_go_back"
|
||||
android:tag="@string/tv_no_focus_tag" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/player_restart"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:src="@drawable/ic_baseline_restart_24"
|
||||
app:tint="@android:color/white"
|
||||
android:background="@drawable/video_tap_button_always_white"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/go_back_img_des"
|
||||
android:focusable="true"
|
||||
android:nextFocusRight="@id/player_go_forward"
|
||||
android:nextFocusLeft="@id/player_go_back"
|
||||
android:nextFocusDown="@id/player_pause_play"
|
||||
android:nextFocusUp="@id/player_restart"
|
||||
android:tag="@string/tv_no_focus_tag" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/player_go_forward"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="80dp"
|
||||
android:src="@drawable/ic_baseline_arrow_forward_24"
|
||||
app:tint="@android:color/white"
|
||||
android:background="@drawable/video_tap_button_always_white"
|
||||
android:clickable="true"
|
||||
android:nextFocusRight="@id/player_go_forward"
|
||||
android:nextFocusLeft="@id/player_restart"
|
||||
android:nextFocusDown="@id/player_pause_play"
|
||||
android:nextFocusUp="@id/player_go_forward"
|
||||
android:contentDescription="@string/go_back_img_des"
|
||||
android:focusable="true"
|
||||
android:tag="@string/tv_no_focus_tag" />
|
||||
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
|
||||
|
@ -520,7 +556,7 @@
|
|||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:nextFocusUp="@id/skip_chapter_button"
|
||||
android:nextFocusDown="@id/player_skip_op"
|
||||
android:nextFocusDown="@id/player_lock_holder"
|
||||
android:src="@drawable/netflix_pause"
|
||||
|
||||
android:tag="@string/tv_no_focus_tag"
|
||||
|
@ -668,17 +704,6 @@
|
|||
android:text="@string/video_skip_op"
|
||||
app:icon="@drawable/ic_baseline_fast_forward_24" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/player_skip_episode"
|
||||
style="@style/VideoButtonTV"
|
||||
android:nextFocusLeft="@id/player_skip_op"
|
||||
|
||||
android:nextFocusRight="@id/player_resize_btt"
|
||||
android:nextFocusUp="@id/player_pause_play"
|
||||
android:nextFocusDown="@id/player_resize_btt"
|
||||
android:text="@string/next_episode"
|
||||
app:icon="@drawable/ic_baseline_skip_next_24" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/player_resize_btt"
|
||||
style="@style/VideoButtonTV"
|
||||
|
@ -732,7 +757,7 @@
|
|||
android:nextFocusRight="@id/player_skip_op"
|
||||
android:nextFocusUp="@id/player_pause_play"
|
||||
android:text="@string/tracks"
|
||||
app:icon="@drawable/ic_baseline_playlist_play_24" />
|
||||
app:icon="@drawable/ic_baseline_equalizer_24" />
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
<string name="home_next_random_img_des">Next Random</string>
|
||||
<string name="episode_play_img_des" translatable="false">@string/play_episode</string>
|
||||
<string name="go_back_img_des">Go back</string>
|
||||
<string name="play_from_beginning_img_des">Play from the Beginning</string>
|
||||
<string name="change_providers_img_des" translatable="false">@string/home_change_provider_img_des</string>
|
||||
<string name="home_change_provider_img_des">Change Provider</string>
|
||||
<string name="preview_background_img_des">Preview Background</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue