mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Standardized some home screen padding and made subtitle delay persistent. Fixes #405
This commit is contained in:
parent
f0515c4dc9
commit
76545f55c3
4 changed files with 34 additions and 35 deletions
|
@ -84,6 +84,7 @@ const val HORIZONTAL_MULTIPLIER = 2.0f
|
||||||
const val DOUBLE_TAB_MAXIMUM_HOLD_TIME = 200L
|
const val DOUBLE_TAB_MAXIMUM_HOLD_TIME = 200L
|
||||||
const val DOUBLE_TAB_MINIMUM_TIME_BETWEEN = 200L // this also affects the UI show response time
|
const val DOUBLE_TAB_MINIMUM_TIME_BETWEEN = 200L // this also affects the UI show response time
|
||||||
const val DOUBLE_TAB_PAUSE_PERCENTAGE = 0.15 // in both directions
|
const val DOUBLE_TAB_PAUSE_PERCENTAGE = 0.15 // in both directions
|
||||||
|
private const val SUBTITLE_DELAY_BUNDLE_KEY = "subtitle_delay"
|
||||||
|
|
||||||
// All the UI Logic for the player
|
// All the UI Logic for the player
|
||||||
open class FullScreenPlayer : AbstractPlayerFragment() {
|
open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
|
@ -1120,11 +1121,20 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
resetRewindText()
|
resetRewindText()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
// As this is video specific it is better to not do any setKey/getKey
|
||||||
|
outState.putLong(SUBTITLE_DELAY_BUNDLE_KEY, subtitleDelay)
|
||||||
|
super.onSaveInstanceState(outState)
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
// init variables
|
// init variables
|
||||||
setPlayBackSpeed(getKey(PLAYBACK_SPEED_KEY) ?: 1.0f)
|
setPlayBackSpeed(getKey(PLAYBACK_SPEED_KEY) ?: 1.0f)
|
||||||
|
savedInstanceState?.getLong(SUBTITLE_DELAY_BUNDLE_KEY)?.let {
|
||||||
|
subtitleDelay = it
|
||||||
|
}
|
||||||
|
|
||||||
// handle tv controls
|
// handle tv controls
|
||||||
playerEventListener = { eventType ->
|
playerEventListener = { eventType ->
|
||||||
|
|
|
@ -13,7 +13,6 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.*
|
import android.widget.*
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.appcompat.app.AlertDialog
|
|
||||||
import androidx.core.animation.addListener
|
import androidx.core.animation.addListener
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.view.isGone
|
import androidx.core.view.isGone
|
||||||
|
@ -734,19 +733,17 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
}
|
}
|
||||||
val currentAudioTracks = tracks.allAudioTracks
|
val currentAudioTracks = tracks.allAudioTracks
|
||||||
|
|
||||||
val trackBuilder = AlertDialog.Builder(ctx, R.style.AlertDialogCustomBlack)
|
val trackDialog = Dialog(ctx, R.style.AlertDialogCustomBlack)
|
||||||
.setView(R.layout.player_select_tracks)
|
trackDialog.setContentView(R.layout.player_select_tracks)
|
||||||
|
trackDialog.show()
|
||||||
val tracksDialog = trackBuilder.create()
|
|
||||||
|
|
||||||
// selectTracksDialog = tracksDialog
|
// selectTracksDialog = tracksDialog
|
||||||
|
|
||||||
tracksDialog.show()
|
val videosList = trackDialog.video_tracks_list
|
||||||
val videosList = tracksDialog.video_tracks_list
|
val audioList = trackDialog.auto_tracks_list
|
||||||
val audioList = tracksDialog.auto_tracks_list
|
|
||||||
|
|
||||||
tracksDialog.video_tracks_holder.isVisible = currentVideoTracks.size > 1
|
trackDialog.video_tracks_holder.isVisible = currentVideoTracks.size > 1
|
||||||
tracksDialog.audio_tracks_holder.isVisible = currentAudioTracks.size > 1
|
trackDialog.audio_tracks_holder.isVisible = currentAudioTracks.size > 1
|
||||||
|
|
||||||
fun dismiss() {
|
fun dismiss() {
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
|
@ -781,7 +778,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
videosList.setItemChecked(which, true)
|
videosList.setItemChecked(which, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
tracksDialog.setOnDismissListener {
|
trackDialog.setOnDismissListener {
|
||||||
dismiss()
|
dismiss()
|
||||||
// selectTracksDialog = null
|
// selectTracksDialog = null
|
||||||
}
|
}
|
||||||
|
@ -811,11 +808,11 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
audioList.setItemChecked(which, true)
|
audioList.setItemChecked(which, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
tracksDialog.cancel_btt?.setOnClickListener {
|
trackDialog.cancel_btt?.setOnClickListener {
|
||||||
tracksDialog.dismissSafe(activity)
|
trackDialog.dismissSafe(activity)
|
||||||
}
|
}
|
||||||
|
|
||||||
tracksDialog.apply_btt?.setOnClickListener {
|
trackDialog.apply_btt?.setOnClickListener {
|
||||||
val currentTrack = currentAudioTracks.getOrNull(audioIndexStart)
|
val currentTrack = currentAudioTracks.getOrNull(audioIndexStart)
|
||||||
player.setPreferredAudioTrack(
|
player.setPreferredAudioTrack(
|
||||||
currentTrack?.language, currentTrack?.id
|
currentTrack?.language, currentTrack?.id
|
||||||
|
@ -828,7 +825,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
player.setMaxVideoSize(width, height, currentVideo?.id)
|
player.setMaxVideoSize(width, height, currentVideo?.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
tracksDialog.dismissSafe(activity)
|
trackDialog.dismissSafe(activity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -1145,7 +1142,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
|
|
||||||
val source = currentSelectedLink?.first?.name ?: currentSelectedLink?.second?.name ?: "NULL"
|
val source = currentSelectedLink?.first?.name ?: currentSelectedLink?.second?.name ?: "NULL"
|
||||||
|
|
||||||
val title = when (titleRez) {
|
val title = when (titleRez) {
|
||||||
0 -> ""
|
0 -> ""
|
||||||
1 -> extra
|
1 -> extra
|
||||||
2 -> source
|
2 -> source
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/home_header"
|
android:id="@+id/home_header"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -86,7 +85,6 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -115,7 +113,6 @@
|
||||||
style="@style/WhiteButton"
|
style="@style/WhiteButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
|
||||||
android:text="@string/home_play"
|
android:text="@string/home_play"
|
||||||
app:icon="@drawable/ic_baseline_play_arrow_24" />
|
app:icon="@drawable/ic_baseline_play_arrow_24" />
|
||||||
|
|
||||||
|
@ -148,17 +145,16 @@
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/home_watch_parent_item_title"
|
android:id="@+id/home_watch_parent_item_title"
|
||||||
|
|
||||||
style="@style/WatchHeaderText"
|
style="@style/WatchHeaderText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
|
android:contentDescription="@string/home_more_info"
|
||||||
android:padding="12dp"
|
android:padding="12dp"
|
||||||
android:text="@string/continue_watching"
|
android:text="@string/continue_watching"
|
||||||
app:drawableRightCompat="@drawable/ic_baseline_arrow_forward_24"
|
app:drawableRightCompat="@drawable/ic_baseline_arrow_forward_24"
|
||||||
app:drawableTint="?attr/white"
|
app:drawableTint="?attr/white" />
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:contentDescription="@string/home_more_info"/>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/home_watch_child_recyclerview"
|
android:id="@+id/home_watch_child_recyclerview"
|
||||||
|
@ -167,7 +163,7 @@
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:descendantFocusability="afterDescendants"
|
android:descendantFocusability="afterDescendants"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingEnd="5dp"
|
android:paddingHorizontal="5dp"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
tools:listitem="@layout/home_result_grid" />
|
tools:listitem="@layout/home_result_grid" />
|
||||||
|
|
||||||
|
@ -184,9 +180,9 @@
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/home_bookmark_parent_item_title"
|
android:id="@+id/home_bookmark_parent_item_title"
|
||||||
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?android:attr/selectableItemBackground">
|
||||||
|
|
||||||
<HorizontalScrollView
|
<HorizontalScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -262,14 +258,13 @@
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_marginEnd="12dp"
|
|
||||||
android:layout_gravity="end"
|
|
||||||
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:contentDescription="@string/home_more_info"
|
||||||
android:src="@drawable/ic_baseline_arrow_forward_24"
|
android:src="@drawable/ic_baseline_arrow_forward_24"
|
||||||
app:drawableTint="?attr/white"
|
app:drawableTint="?attr/white" />
|
||||||
android:contentDescription="@string/home_more_info"/>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -277,10 +272,9 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
|
|
||||||
android:descendantFocusability="afterDescendants"
|
android:descendantFocusability="afterDescendants"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingEnd="5dp"
|
android:paddingHorizontal="5dp"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
tools:listitem="@layout/home_result_grid" />
|
tools:listitem="@layout/home_result_grid" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -23,9 +23,7 @@
|
||||||
android:nextFocusUp="@id/home_child_more_info"
|
android:nextFocusUp="@id/home_child_more_info"
|
||||||
android:paddingHorizontal="5dp"
|
android:paddingHorizontal="5dp"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
|
|
||||||
android:descendantFocusability="afterDescendants"
|
android:descendantFocusability="afterDescendants"
|
||||||
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
android:id="@+id/home_child_recyclerview"
|
android:id="@+id/home_child_recyclerview"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
|
|
Loading…
Reference in a new issue