mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +05:30
commit
261169a42d
@ -268,7 +268,9 @@ class PlayerFragment : Fragment() {
|
|||||||
// FullScreen button trigger
|
// FullScreen button trigger
|
||||||
playerBinding.fullscreen.setOnClickListener {
|
playerBinding.fullscreen.setOnClickListener {
|
||||||
exoPlayerView.hideController()
|
exoPlayerView.hideController()
|
||||||
|
var scaleFactor: Float? = null
|
||||||
if (!isFullScreen) {
|
if (!isFullScreen) {
|
||||||
|
// go to fullscreen mode
|
||||||
with(binding.playerMotionLayout) {
|
with(binding.playerMotionLayout) {
|
||||||
getConstraintSet(R.id.start).constrainHeight(R.id.player, -1)
|
getConstraintSet(R.id.start).constrainHeight(R.id.player, -1)
|
||||||
enableTransition(R.id.yt_transition, false)
|
enableTransition(R.id.yt_transition, false)
|
||||||
@ -279,9 +281,12 @@ class PlayerFragment : Fragment() {
|
|||||||
playerBinding.fullscreen.setImageResource(R.drawable.ic_fullscreen_exit)
|
playerBinding.fullscreen.setImageResource(R.drawable.ic_fullscreen_exit)
|
||||||
playerBinding.exoTitle.visibility = View.VISIBLE
|
playerBinding.exoTitle.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
scaleFactor = 1.3F
|
||||||
|
|
||||||
val mainActivity = activity as MainActivity
|
val mainActivity = activity as MainActivity
|
||||||
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
|
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
|
||||||
} else {
|
} else {
|
||||||
|
// leave fullscreen mode
|
||||||
with(binding.playerMotionLayout) {
|
with(binding.playerMotionLayout) {
|
||||||
getConstraintSet(R.id.start).constrainHeight(R.id.player, 0)
|
getConstraintSet(R.id.start).constrainHeight(R.id.player, 0)
|
||||||
enableTransition(R.id.yt_transition, true)
|
enableTransition(R.id.yt_transition, true)
|
||||||
@ -292,10 +297,20 @@ class PlayerFragment : Fragment() {
|
|||||||
playerBinding.fullscreen.setImageResource(R.drawable.ic_fullscreen)
|
playerBinding.fullscreen.setImageResource(R.drawable.ic_fullscreen)
|
||||||
playerBinding.exoTitle.visibility = View.INVISIBLE
|
playerBinding.exoTitle.visibility = View.INVISIBLE
|
||||||
|
|
||||||
|
scaleFactor = 1F
|
||||||
|
|
||||||
val mainActivity = activity as MainActivity
|
val mainActivity = activity as MainActivity
|
||||||
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
||||||
}
|
}
|
||||||
isFullScreen = !isFullScreen
|
isFullScreen = !isFullScreen
|
||||||
|
|
||||||
|
// scale the exo player center controls
|
||||||
|
playerBinding.exoFfwdWithAmount.scaleX = scaleFactor
|
||||||
|
playerBinding.exoFfwdWithAmount.scaleY = scaleFactor
|
||||||
|
playerBinding.exoRewWithAmount.scaleX = scaleFactor
|
||||||
|
playerBinding.exoRewWithAmount.scaleY = scaleFactor
|
||||||
|
playerBinding.exoPlayPause.scaleX = scaleFactor
|
||||||
|
playerBinding.exoPlayPause.scaleY = scaleFactor
|
||||||
}
|
}
|
||||||
|
|
||||||
// switching between original aspect ratio (black bars) and zoomed to fill device screen
|
// switching between original aspect ratio (black bars) and zoomed to fill device screen
|
||||||
@ -680,16 +695,13 @@ class PlayerFragment : Fragment() {
|
|||||||
// Set new width/height of view
|
// Set new width/height of view
|
||||||
// height or width must be cast to float as int/int will give 0
|
// height or width must be cast to float as int/int will give 0
|
||||||
|
|
||||||
val currentWidth = binding.mainContainer.height
|
// Redraw the player container with the new layout height
|
||||||
// Redraw myView
|
|
||||||
(binding.mainContainer.layoutParams as ConstraintLayout.LayoutParams).apply {
|
(binding.mainContainer.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||||
matchConstraintPercentHeight = (
|
matchConstraintPercentHeight = (
|
||||||
videoSize.height / videoSize.width
|
videoSize.height / videoSize.width
|
||||||
).toFloat()
|
).toFloat()
|
||||||
}
|
}
|
||||||
binding.mainContainer.requestLayout()
|
binding.mainContainer.requestLayout()
|
||||||
|
|
||||||
// FIXME and make me work :/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(message = "Deprecated", level = DeprecationLevel.HIDDEN)
|
@Deprecated(message = "Deprecated", level = DeprecationLevel.HIDDEN)
|
||||||
@ -1032,14 +1044,14 @@ class PlayerFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun lockPlayer(isLocked: Boolean) {
|
private fun lockPlayer(isLocked: Boolean) {
|
||||||
val visibility = if (isLocked) View.VISIBLE else View.INVISIBLE
|
val visibility = if (isLocked) View.VISIBLE else View.GONE
|
||||||
playerBinding.exoTopBarRight.visibility = visibility
|
playerBinding.exoTopBarRight.visibility = visibility
|
||||||
playerBinding.exoPlayPause.visibility = visibility
|
playerBinding.exoPlayPause.visibility = visibility
|
||||||
playerBinding.exoFfwdWithAmount.visibility = visibility
|
playerBinding.exoFfwdWithAmount.visibility = visibility
|
||||||
playerBinding.exoRewWithAmount.visibility = visibility
|
playerBinding.exoRewWithAmount.visibility = visibility
|
||||||
playerBinding.exoBottomBar.visibility = visibility
|
playerBinding.exoBottomBar.visibility = visibility
|
||||||
playerBinding.exoTitle.visibility =
|
playerBinding.closeImageButton.visibility = visibility
|
||||||
if (isLocked && isFullScreen) View.VISIBLE else View.INVISIBLE
|
playerBinding.exoTitle.visibility = visibility
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isSubscribed(button: MaterialButton, channel_id: String) {
|
private fun isSubscribed(button: MaterialButton, channel_id: String) {
|
||||||
|
@ -49,11 +49,10 @@
|
|||||||
android:id="@+id/close_imageButton"
|
android:id="@+id/close_imageButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="5dp"
|
||||||
android:background="#00FFFFFF"
|
android:background="#00FFFFFF"
|
||||||
android:padding="@dimen/exo_icon_padding"
|
android:padding="@dimen/exo_icon_padding"
|
||||||
android:src="@drawable/ic_close"
|
android:src="@drawable/ic_close"
|
||||||
android:visibility="gone"
|
|
||||||
app:tint="@android:color/white" />
|
app:tint="@android:color/white" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
@ -132,7 +131,6 @@
|
|||||||
android:layout_height="@dimen/exo_styled_bottom_bar_height"
|
android:layout_height="@dimen/exo_styled_bottom_bar_height"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:layout_marginTop="@dimen/exo_styled_bottom_bar_margin_top"
|
android:layout_marginTop="@dimen/exo_styled_bottom_bar_margin_top"
|
||||||
android:background="@color/exo_bottom_bar_background"
|
|
||||||
android:layoutDirection="ltr">
|
android:layoutDirection="ltr">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -200,7 +198,6 @@
|
|||||||
android:id="@id/exo_progress"
|
android:id="@id/exo_progress"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="15dp"
|
android:layout_height="15dp"
|
||||||
android:background="@color/exo_bottom_bar_background"
|
|
||||||
app:bar_height="2dp"
|
app:bar_height="2dp"
|
||||||
app:played_color="?attr/colorOnSecondary"
|
app:played_color="?attr/colorOnSecondary"
|
||||||
app:scrubber_color="?attr/colorOnPrimary"
|
app:scrubber_color="?attr/colorOnPrimary"
|
||||||
@ -225,7 +222,7 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@id/exo_center_controls"
|
android:id="@id/exo_center_controls"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
@ -233,25 +230,37 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="@dimen/exo_styled_controls_padding">
|
android:padding="@dimen/exo_styled_controls_padding">
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:id="@id/exo_rew_with_amount"
|
android:layout_width="0dp"
|
||||||
style="@style/ExoStyledControls.Button.Center.RewWithAmount"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginRight="25dp"
|
android:layout_weight="1"
|
||||||
android:scaleX="1.1"
|
android:orientation="vertical">
|
||||||
android:scaleY="1.1" />
|
|
||||||
|
<Button
|
||||||
|
android:id="@id/exo_rew_with_amount"
|
||||||
|
style="@style/ExoStyledControls.Button.Center.RewWithAmount"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="20dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@id/exo_play_pause"
|
android:id="@id/exo_play_pause"
|
||||||
style="@style/ExoStyledControls.Button.Center.PlayPause"
|
style="@style/ExoStyledControls.Button.Center.PlayPause" />
|
||||||
android:scaleX="1.1"
|
|
||||||
android:scaleY="1.1" />
|
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:id="@id/exo_ffwd_with_amount"
|
android:layout_width="0dp"
|
||||||
style="@style/ExoStyledControls.Button.Center.FfwdWithAmount"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="25dp"
|
android:layout_weight="1"
|
||||||
android:scaleX="1.1"
|
android:orientation="vertical">
|
||||||
android:scaleY="1.1" />
|
|
||||||
|
<Button
|
||||||
|
android:id="@id/exo_ffwd_with_amount"
|
||||||
|
style="@style/ExoStyledControls.Button.Center.FfwdWithAmount"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginRight="20dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layoutDescription="@xml/player_scene"
|
app:layoutDescription="@xml/player_scene"
|
||||||
tools:context=".PlayerFragment">
|
tools:context=".fragments.PlayerFragment">
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:id="@+id/player_scrollView"
|
android:id="@+id/player_scrollView"
|
||||||
@ -358,7 +358,7 @@
|
|||||||
android:id="@+id/player"
|
android:id="@+id/player"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#000000"
|
android:background="?attr/colorSurface"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/main_container"
|
app:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||||
app:layout_constraintStart_toStartOf="@id/main_container"
|
app:layout_constraintStart_toStartOf="@id/main_container"
|
||||||
|
Loading…
Reference in New Issue
Block a user