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_MINIMUM_TIME_BETWEEN = 200L // this also affects the UI show response time
|
||||
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
|
||||
open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||
|
@ -1120,11 +1121,20 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
|||
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")
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
// init variables
|
||||
setPlayBackSpeed(getKey(PLAYBACK_SPEED_KEY) ?: 1.0f)
|
||||
savedInstanceState?.getLong(SUBTITLE_DELAY_BUNDLE_KEY)?.let {
|
||||
subtitleDelay = it
|
||||
}
|
||||
|
||||
// handle tv controls
|
||||
playerEventListener = { eventType ->
|
||||
|
|
|
@ -13,7 +13,6 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.animation.addListener
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isGone
|
||||
|
@ -734,19 +733,17 @@ class GeneratorPlayer : FullScreenPlayer() {
|
|||
}
|
||||
val currentAudioTracks = tracks.allAudioTracks
|
||||
|
||||
val trackBuilder = AlertDialog.Builder(ctx, R.style.AlertDialogCustomBlack)
|
||||
.setView(R.layout.player_select_tracks)
|
||||
|
||||
val tracksDialog = trackBuilder.create()
|
||||
val trackDialog = Dialog(ctx, R.style.AlertDialogCustomBlack)
|
||||
trackDialog.setContentView(R.layout.player_select_tracks)
|
||||
trackDialog.show()
|
||||
|
||||
// selectTracksDialog = tracksDialog
|
||||
|
||||
tracksDialog.show()
|
||||
val videosList = tracksDialog.video_tracks_list
|
||||
val audioList = tracksDialog.auto_tracks_list
|
||||
val videosList = trackDialog.video_tracks_list
|
||||
val audioList = trackDialog.auto_tracks_list
|
||||
|
||||
tracksDialog.video_tracks_holder.isVisible = currentVideoTracks.size > 1
|
||||
tracksDialog.audio_tracks_holder.isVisible = currentAudioTracks.size > 1
|
||||
trackDialog.video_tracks_holder.isVisible = currentVideoTracks.size > 1
|
||||
trackDialog.audio_tracks_holder.isVisible = currentAudioTracks.size > 1
|
||||
|
||||
fun dismiss() {
|
||||
if (isPlaying) {
|
||||
|
@ -781,7 +778,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
|||
videosList.setItemChecked(which, true)
|
||||
}
|
||||
|
||||
tracksDialog.setOnDismissListener {
|
||||
trackDialog.setOnDismissListener {
|
||||
dismiss()
|
||||
// selectTracksDialog = null
|
||||
}
|
||||
|
@ -811,11 +808,11 @@ class GeneratorPlayer : FullScreenPlayer() {
|
|||
audioList.setItemChecked(which, true)
|
||||
}
|
||||
|
||||
tracksDialog.cancel_btt?.setOnClickListener {
|
||||
tracksDialog.dismissSafe(activity)
|
||||
trackDialog.cancel_btt?.setOnClickListener {
|
||||
trackDialog.dismissSafe(activity)
|
||||
}
|
||||
|
||||
tracksDialog.apply_btt?.setOnClickListener {
|
||||
trackDialog.apply_btt?.setOnClickListener {
|
||||
val currentTrack = currentAudioTracks.getOrNull(audioIndexStart)
|
||||
player.setPreferredAudioTrack(
|
||||
currentTrack?.language, currentTrack?.id
|
||||
|
@ -828,7 +825,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
|||
player.setMaxVideoSize(width, height, currentVideo?.id)
|
||||
}
|
||||
|
||||
tracksDialog.dismissSafe(activity)
|
||||
trackDialog.dismissSafe(activity)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
@ -1145,7 +1142,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
|||
|
||||
val source = currentSelectedLink?.first?.name ?: currentSelectedLink?.second?.name ?: "NULL"
|
||||
|
||||
val title = when (titleRez) {
|
||||
val title = when (titleRez) {
|
||||
0 -> ""
|
||||
1 -> extra
|
||||
2 -> source
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/home_header"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -86,7 +85,6 @@
|
|||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -115,7 +113,6 @@
|
|||
style="@style/WhiteButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
android:text="@string/home_play"
|
||||
app:icon="@drawable/ic_baseline_play_arrow_24" />
|
||||
|
||||
|
@ -148,17 +145,16 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/home_watch_parent_item_title"
|
||||
|
||||
style="@style/WatchHeaderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:contentDescription="@string/home_more_info"
|
||||
android:padding="12dp"
|
||||
android:text="@string/continue_watching"
|
||||
app:drawableRightCompat="@drawable/ic_baseline_arrow_forward_24"
|
||||
app:drawableTint="?attr/white"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:contentDescription="@string/home_more_info"/>
|
||||
app:drawableTint="?attr/white" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/home_watch_child_recyclerview"
|
||||
|
@ -167,7 +163,7 @@
|
|||
android:clipToPadding="false"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingHorizontal="5dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/home_result_grid" />
|
||||
|
||||
|
@ -184,9 +180,9 @@
|
|||
<FrameLayout
|
||||
android:id="@+id/home_bookmark_parent_item_title"
|
||||
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -262,14 +258,13 @@
|
|||
</HorizontalScrollView>
|
||||
|
||||
<ImageView
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_gravity="end"
|
||||
|
||||
android:layout_width="wrap_content"
|
||||
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"
|
||||
app:drawableTint="?attr/white"
|
||||
android:contentDescription="@string/home_more_info"/>
|
||||
app:drawableTint="?attr/white" />
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -277,10 +272,9 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
|
||||
android:descendantFocusability="afterDescendants"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingHorizontal="5dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/home_result_grid" />
|
||||
</LinearLayout>
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
android:nextFocusUp="@id/home_child_more_info"
|
||||
android:paddingHorizontal="5dp"
|
||||
android:clipToPadding="false"
|
||||
|
||||
android:descendantFocusability="afterDescendants"
|
||||
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
android:id="@+id/home_child_recyclerview"
|
||||
android:orientation="horizontal"
|
||||
|
|
Loading…
Reference in a new issue