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