3
3
Fork 1
mirror of https://github.com/recloudstream/cloudstream.git synced 2024-08-15 01:53:11 +00:00

Under Button text

This commit is contained in:
KingLucius 2024-07-18 16:33:44 +03:00
parent ddb3ab5d77
commit cd01068632
3 changed files with 235 additions and 101 deletions
app/src/main
java/com/lagradost/cloudstream3/ui/player
res/layout

View file

@ -77,7 +77,8 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
protected open var isFullScreenPlayer = true
protected var playerBinding: PlayerCustomLayoutBinding? = null
private var durationMode : Boolean by UserPreferenceDelegate("duration_mode", false)
private var durationMode: Boolean by UserPreferenceDelegate("duration_mode", false)
// state of player UI
protected var isShowing = false
protected var isLocked = false
@ -283,7 +284,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
player.getCurrentPreferredSubtitle() == null
}
private fun restoreOrientationWithSensor(activity: Activity){
private fun restoreOrientationWithSensor(activity: Activity) {
val currentOrientation = activity.resources.configuration.orientation
var orientation = 0
when (currentOrientation) {
@ -299,7 +300,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
activity.requestedOrientation = orientation
}
private fun toggleOrientationWithSensor(activity: Activity){
private fun toggleOrientationWithSensor(activity: Activity) {
val currentOrientation = activity.resources.configuration.orientation
var orientation = 0
when (currentOrientation) {
@ -344,12 +345,11 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
private fun updateOrientation(ignoreDynamicOrientation: Boolean = false) {
activity?.apply {
if(lockRotation) {
if(isLocked) {
if (lockRotation) {
if (isLocked) {
lockOrientation(this)
}
else {
if(ignoreDynamicOrientation){
} else {
if (ignoreDynamicOrientation) {
// restore when lock is disabled
restoreOrientationWithSensor(this)
} else {
@ -948,7 +948,10 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
}
else -> {
player.handleEvent(CSPlayerEvent.PlayPauseToggle, PlayerEventSource.UI)
player.handleEvent(
CSPlayerEvent.PlayPauseToggle,
PlayerEventSource.UI
)
}
}
} else if (doubleTapEnabled && isFullScreenPlayer) {
@ -1423,6 +1426,25 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
}
playerBinding?.apply {
if (isLayout(TV or EMULATOR)) {
mapOf(
playerGoBack to playerGoBackText,
playerRestart to playerRestartText,
playerGoForward to playerGoForwardText
).forEach { (button, text) ->
button.setOnFocusChangeListener { _, hasFocus ->
if (!hasFocus) {
text.isSelected = false
text.isVisible = false
return@setOnFocusChangeListener
}
text.isSelected = true
text.isVisible = true
}
}
}
playerPausePlay.setOnClickListener {
autoHide()
player.handleEvent(CSPlayerEvent.PlayPauseToggle)
@ -1569,7 +1591,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
private fun setRemainingTimeCounter(showRemaining: Boolean) {
durationMode = showRemaining
playerBinding?.exoDuration?.isInvisible= showRemaining
playerBinding?.exoDuration?.isInvisible = showRemaining
playerBinding?.timeLeft?.isVisible = showRemaining
}

View file

@ -176,47 +176,104 @@
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:src="@drawable/ic_baseline_arrow_back_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:tag="@string/tv_no_focus_tag" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:id="@+id/player_go_back_root"
android:orientation="vertical">
<ImageView
android:id="@+id/player_restart"
android:layout_width="30dp"
android:layout_height="30dp"
<ImageView
android:id="@+id/player_go_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_arrow_back_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_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" />
<TextView
android:id="@+id/player_go_back_text"
style="@style/ResultMarqueeButtonText"
android:text="@string/go_back_img_des"
android:visibility="gone"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:src="@drawable/ic_baseline_replay_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" />
android:layout_marginEnd="10dp"
android:id="@+id/player_restart_root"
android:orientation="vertical">
<ImageView
android:id="@+id/player_go_forward"
android:layout_width="30dp"
android:layout_height="30dp"
<ImageView
android:id="@+id/player_restart"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_replay_24"
app:tint="@android:color/white"
android:background="@drawable/video_tap_button_always_white"
android:clickable="true"
android:contentDescription="@string/restart"
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" />
<TextView
android:id="@+id/player_restart_text"
style="@style/ResultMarqueeButtonText"
android:text="@string/restart"
android:visibility="gone"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="80dp"
android:src="@drawable/ic_baseline_skip_next_rounded_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" />
android:layout_marginEnd="10dp"
android:id="@+id/player_go_forward_root"
android:orientation="vertical">
<ImageView
android:id="@+id/player_go_forward"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_skip_next_rounded_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/next_episode"
android:focusable="true"
android:tag="@string/tv_no_focus_tag" />
<TextView
android:id="@+id/player_go_forward_text"
style="@style/ResultMarqueeButtonText"
android:text="@string/next_episode"
android:visibility="gone"/>
</LinearLayout>
</FrameLayout>

View file

@ -287,61 +287,115 @@
android:id="@+id/player_go_back_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginStart="17dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="32dp"
android:layout_marginEnd="17dp"
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:src="@drawable/ic_baseline_arrow_back_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_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" />
<LinearLayout
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:id="@+id/player_go_back_root"
android:orientation="vertical">
<ImageView
android:id="@+id/player_restart"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="40dp"
android:src="@drawable/ic_baseline_replay_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_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_arrow_back_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_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_go_forward"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="80dp"
android:src="@drawable/ic_baseline_skip_next_rounded_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" />
<TextView
android:id="@+id/player_go_back_text"
android:layout_marginTop="5dp"
style="@style/ResultMarqueeButtonText"
android:text="@string/go_back_img_des"
android:visibility="invisible"
tools:visibility="visible"/>
</LinearLayout>
<LinearLayout
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginEnd="10dp"
android:id="@+id/player_restart_root"
android:orientation="vertical">
<ImageView
android:id="@+id/player_restart"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_replay_24"
app:tint="@android:color/white"
android:background="@drawable/video_tap_button_always_white"
android:clickable="true"
android:contentDescription="@string/restart"
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" />
<TextView
android:id="@+id/player_restart_text"
android:layout_marginTop="5dp"
style="@style/ResultMarqueeButtonText"
android:text="@string/restart"
android:visibility="invisible"
tools:visibility="visible"/>
</LinearLayout>
<LinearLayout
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_marginStart="100dp"
android:layout_marginEnd="10dp"
android:id="@+id/player_go_forward_root"
android:orientation="vertical">
<ImageView
android:id="@+id/player_go_forward"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_skip_next_rounded_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/next_episode"
android:focusable="true"
android:tag="@string/tv_no_focus_tag" />
<TextView
android:id="@+id/player_go_forward_text"
android:layout_marginTop="5dp"
style="@style/ResultMarqueeButtonText"
android:text="@string/next_episode"
android:visibility="invisible"
tools:visibility="visible"/>
</LinearLayout>
</FrameLayout>
</FrameLayout>
@ -545,6 +599,7 @@
android:layout_height="wrap_content"
android:layoutDirection="ltr"
android:orientation="horizontal">
<ImageView
android:id="@+id/player_pause_play"
@ -560,10 +615,10 @@
android:src="@drawable/netflix_pause"
android:tag="@string/tv_no_focus_tag"
app:tint="@color/player_button_tv"
tools:ignore="ContentDescription"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:tint="@color/player_button_tv"
tools:ignore="ContentDescription" />
<TextView
android:id="@id/exo_position"
@ -654,10 +709,10 @@
android:textColor="@android:color/white"
android:textSize="14sp"
android:textStyle="normal"
android:visibility="gone"
app:layout_constraintBaseline_toBaselineOf="@id/exo_position"
app:layout_constraintEnd_toEndOf="parent"
tools:text="-23:20"
android:visibility="gone"/>
tools:text="-23:20" />
</androidx.constraintlayout.widget.ConstraintLayout>