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:
parent
ddb3ab5d77
commit
cd01068632
3 changed files with 235 additions and 101 deletions
|
@ -77,7 +77,8 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
protected open var isFullScreenPlayer = true
|
protected open var isFullScreenPlayer = true
|
||||||
protected var playerBinding: PlayerCustomLayoutBinding? = null
|
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
|
// state of player UI
|
||||||
protected var isShowing = false
|
protected var isShowing = false
|
||||||
protected var isLocked = false
|
protected var isLocked = false
|
||||||
|
@ -283,7 +284,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
player.getCurrentPreferredSubtitle() == null
|
player.getCurrentPreferredSubtitle() == null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun restoreOrientationWithSensor(activity: Activity){
|
private fun restoreOrientationWithSensor(activity: Activity) {
|
||||||
val currentOrientation = activity.resources.configuration.orientation
|
val currentOrientation = activity.resources.configuration.orientation
|
||||||
var orientation = 0
|
var orientation = 0
|
||||||
when (currentOrientation) {
|
when (currentOrientation) {
|
||||||
|
@ -299,7 +300,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
activity.requestedOrientation = orientation
|
activity.requestedOrientation = orientation
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun toggleOrientationWithSensor(activity: Activity){
|
private fun toggleOrientationWithSensor(activity: Activity) {
|
||||||
val currentOrientation = activity.resources.configuration.orientation
|
val currentOrientation = activity.resources.configuration.orientation
|
||||||
var orientation = 0
|
var orientation = 0
|
||||||
when (currentOrientation) {
|
when (currentOrientation) {
|
||||||
|
@ -344,12 +345,11 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
|
|
||||||
private fun updateOrientation(ignoreDynamicOrientation: Boolean = false) {
|
private fun updateOrientation(ignoreDynamicOrientation: Boolean = false) {
|
||||||
activity?.apply {
|
activity?.apply {
|
||||||
if(lockRotation) {
|
if (lockRotation) {
|
||||||
if(isLocked) {
|
if (isLocked) {
|
||||||
lockOrientation(this)
|
lockOrientation(this)
|
||||||
}
|
} else {
|
||||||
else {
|
if (ignoreDynamicOrientation) {
|
||||||
if(ignoreDynamicOrientation){
|
|
||||||
// restore when lock is disabled
|
// restore when lock is disabled
|
||||||
restoreOrientationWithSensor(this)
|
restoreOrientationWithSensor(this)
|
||||||
} else {
|
} else {
|
||||||
|
@ -948,7 +948,10 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
player.handleEvent(CSPlayerEvent.PlayPauseToggle, PlayerEventSource.UI)
|
player.handleEvent(
|
||||||
|
CSPlayerEvent.PlayPauseToggle,
|
||||||
|
PlayerEventSource.UI
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (doubleTapEnabled && isFullScreenPlayer) {
|
} else if (doubleTapEnabled && isFullScreenPlayer) {
|
||||||
|
@ -1423,6 +1426,25 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
playerBinding?.apply {
|
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 {
|
playerPausePlay.setOnClickListener {
|
||||||
autoHide()
|
autoHide()
|
||||||
player.handleEvent(CSPlayerEvent.PlayPauseToggle)
|
player.handleEvent(CSPlayerEvent.PlayPauseToggle)
|
||||||
|
@ -1569,7 +1591,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
|
|
||||||
private fun setRemainingTimeCounter(showRemaining: Boolean) {
|
private fun setRemainingTimeCounter(showRemaining: Boolean) {
|
||||||
durationMode = showRemaining
|
durationMode = showRemaining
|
||||||
playerBinding?.exoDuration?.isInvisible= showRemaining
|
playerBinding?.exoDuration?.isInvisible = showRemaining
|
||||||
playerBinding?.timeLeft?.isVisible = showRemaining
|
playerBinding?.timeLeft?.isVisible = showRemaining
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,47 +176,104 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<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
|
<ImageView
|
||||||
android:id="@+id/player_go_back"
|
android:id="@+id/player_go_back"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/ic_baseline_arrow_back_24"
|
android:src="@drawable/ic_baseline_arrow_back_24"
|
||||||
app:tint="@android:color/white"
|
app:tint="@android:color/white"
|
||||||
android:background="@drawable/video_tap_button_always_white"
|
android:background="@drawable/video_tap_button_always_white"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:contentDescription="@string/go_back_img_des"
|
android:contentDescription="@string/go_back_img_des"
|
||||||
android:focusable="true"
|
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" />
|
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:layout_marginEnd="10dp"
|
||||||
|
android:id="@+id/player_restart_root"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/player_restart"
|
android:id="@+id/player_restart"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginStart="40dp"
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/ic_baseline_replay_24"
|
android:src="@drawable/ic_baseline_replay_24"
|
||||||
app:tint="@android:color/white"
|
app:tint="@android:color/white"
|
||||||
android:background="@drawable/video_tap_button_always_white"
|
android:background="@drawable/video_tap_button_always_white"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:contentDescription="@string/go_back_img_des"
|
android:contentDescription="@string/restart"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:visibility="gone"
|
android:nextFocusRight="@id/player_go_forward"
|
||||||
tools:visibility="visible"
|
android:nextFocusLeft="@id/player_go_back"
|
||||||
|
android:nextFocusDown="@id/player_pause_play"
|
||||||
|
android:nextFocusUp="@id/player_restart"
|
||||||
android:tag="@string/tv_no_focus_tag" />
|
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:layout_marginEnd="10dp"
|
||||||
|
android:id="@+id/player_go_forward_root"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/player_go_forward"
|
android:id="@+id/player_go_forward"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginStart="80dp"
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/ic_baseline_skip_next_rounded_24"
|
android:src="@drawable/ic_baseline_skip_next_rounded_24"
|
||||||
app:tint="@android:color/white"
|
app:tint="@android:color/white"
|
||||||
android:background="@drawable/video_tap_button_always_white"
|
android:background="@drawable/video_tap_button_always_white"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:contentDescription="@string/go_back_img_des"
|
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:focusable="true"
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible"
|
|
||||||
android:tag="@string/tv_no_focus_tag" />
|
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>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -287,16 +287,24 @@
|
||||||
android:id="@+id/player_go_back_holder"
|
android:id="@+id/player_go_back_holder"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="32dp"
|
android:layout_marginStart="17dp"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginEnd="32dp"
|
android:layout_marginEnd="17dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<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
|
<ImageView
|
||||||
android:id="@+id/player_go_back"
|
android:id="@+id/player_go_back"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/ic_baseline_arrow_back_24"
|
android:src="@drawable/ic_baseline_arrow_back_24"
|
||||||
app:tint="@android:color/white"
|
app:tint="@android:color/white"
|
||||||
android:background="@drawable/video_tap_button_always_white"
|
android:background="@drawable/video_tap_button_always_white"
|
||||||
|
@ -309,16 +317,34 @@
|
||||||
android:nextFocusUp="@id/player_go_back"
|
android:nextFocusUp="@id/player_go_back"
|
||||||
android:tag="@string/tv_no_focus_tag" />
|
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
|
<ImageView
|
||||||
android:id="@+id/player_restart"
|
android:id="@+id/player_restart"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginStart="40dp"
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/ic_baseline_replay_24"
|
android:src="@drawable/ic_baseline_replay_24"
|
||||||
app:tint="@android:color/white"
|
app:tint="@android:color/white"
|
||||||
android:background="@drawable/video_tap_button_always_white"
|
android:background="@drawable/video_tap_button_always_white"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:contentDescription="@string/go_back_img_des"
|
android:contentDescription="@string/restart"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:nextFocusRight="@id/player_go_forward"
|
android:nextFocusRight="@id/player_go_forward"
|
||||||
android:nextFocusLeft="@id/player_go_back"
|
android:nextFocusLeft="@id/player_go_back"
|
||||||
|
@ -326,11 +352,29 @@
|
||||||
android:nextFocusUp="@id/player_restart"
|
android:nextFocusUp="@id/player_restart"
|
||||||
android:tag="@string/tv_no_focus_tag" />
|
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
|
<ImageView
|
||||||
android:id="@+id/player_go_forward"
|
android:id="@+id/player_go_forward"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginStart="80dp"
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/ic_baseline_skip_next_rounded_24"
|
android:src="@drawable/ic_baseline_skip_next_rounded_24"
|
||||||
app:tint="@android:color/white"
|
app:tint="@android:color/white"
|
||||||
android:background="@drawable/video_tap_button_always_white"
|
android:background="@drawable/video_tap_button_always_white"
|
||||||
|
@ -339,10 +383,20 @@
|
||||||
android:nextFocusLeft="@id/player_restart"
|
android:nextFocusLeft="@id/player_restart"
|
||||||
android:nextFocusDown="@id/player_pause_play"
|
android:nextFocusDown="@id/player_pause_play"
|
||||||
android:nextFocusUp="@id/player_go_forward"
|
android:nextFocusUp="@id/player_go_forward"
|
||||||
android:contentDescription="@string/go_back_img_des"
|
android:contentDescription="@string/next_episode"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:tag="@string/tv_no_focus_tag" />
|
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>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
@ -545,6 +599,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layoutDirection="ltr"
|
android:layoutDirection="ltr"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/player_pause_play"
|
android:id="@+id/player_pause_play"
|
||||||
|
|
||||||
|
@ -560,10 +615,10 @@
|
||||||
android:src="@drawable/netflix_pause"
|
android:src="@drawable/netflix_pause"
|
||||||
|
|
||||||
android:tag="@string/tv_no_focus_tag"
|
android:tag="@string/tv_no_focus_tag"
|
||||||
app:tint="@color/player_button_tv"
|
|
||||||
tools:ignore="ContentDescription"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
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
|
<TextView
|
||||||
android:id="@id/exo_position"
|
android:id="@id/exo_position"
|
||||||
|
@ -654,10 +709,10 @@
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="normal"
|
android:textStyle="normal"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintBaseline_toBaselineOf="@id/exo_position"
|
app:layout_constraintBaseline_toBaselineOf="@id/exo_position"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
tools:text="-23:20"
|
tools:text="-23:20" />
|
||||||
android:visibility="gone"/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue