mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
fullscreen done!
This commit is contained in:
parent
49cb54d2b4
commit
3bc1663f71
@ -22,7 +22,6 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="orientation|screenSize"
|
||||
>
|
||||
<intent-filter>
|
||||
|
@ -13,7 +13,6 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.exoplayer2.ExoPlayer
|
||||
import com.google.android.exoplayer2.MediaItem
|
||||
import com.google.android.exoplayer2.MediaItem.SubtitleConfiguration
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer
|
||||
import com.google.android.exoplayer2.source.MediaSource
|
||||
|
||||
import com.google.android.exoplayer2.ui.PlayerView
|
||||
@ -90,7 +89,6 @@ class PlayerFragment : Fragment() {
|
||||
super.onCreate(savedInstanceState)
|
||||
arguments?.let {
|
||||
videoId = it.getString("videoId")
|
||||
param2 = it.getString(ARG_PARAM2)
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,30 +169,44 @@ class PlayerFragment : Fragment() {
|
||||
mainActivity.supportFragmentManager.beginTransaction()
|
||||
.remove(this)
|
||||
.commit()
|
||||
|
||||
}
|
||||
val playImageView = view.findViewById<ImageView>(R.id.play_imageView)
|
||||
playImageView.setOnClickListener{
|
||||
paused = if(paused){
|
||||
playImageView.setImageResource(R.drawable.ic_play)
|
||||
playImageView.setImageResource(R.drawable.ic_pause)
|
||||
exoPlayer.play()
|
||||
false
|
||||
}else {
|
||||
playImageView.setImageResource(R.drawable.ic_pause)
|
||||
playImageView.setImageResource(R.drawable.ic_play)
|
||||
exoPlayer.pause()
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
view.findViewById<ImageButton>(R.id.fullscreen).setOnClickListener{
|
||||
exoPlayer.pause()
|
||||
println(exoPlayer.currentPosition)
|
||||
println("---------------------------------------------------------------------------------")
|
||||
val intent = Intent(view.context, Player::class.java)
|
||||
intent.putExtra("videoId", videoId)
|
||||
intent.putExtra("seekTo",exoPlayer.currentPosition.toString())
|
||||
intent.putExtra("quality",whichQuality.toString())
|
||||
startActivity(intent)
|
||||
if (!isFullScreen){
|
||||
view.findViewById<ScrollView>(R.id.scrollView2).visibility = View.GONE
|
||||
view.findViewById<LinearLayout>(R.id.linLayout).visibility = View.GONE
|
||||
view.findViewById<TextView>(R.id.textTest).visibility = View.GONE
|
||||
view.findViewById<ConstraintLayout>(R.id.main_container).visibility = View.GONE
|
||||
with(motionLayout) {
|
||||
getConstraintSet(R.id.start).constrainHeight(R.id.player, -1)
|
||||
enableTransition(R.xml.player_scene,false)
|
||||
}
|
||||
(activity as MainActivity)?.supportActionBar?.hide()
|
||||
isFullScreen=true
|
||||
|
||||
}else{
|
||||
view.findViewById<ScrollView>(R.id.scrollView2).visibility = View.VISIBLE
|
||||
view.findViewById<LinearLayout>(R.id.linLayout).visibility = View.VISIBLE
|
||||
view.findViewById<TextView>(R.id.textTest).visibility = View.VISIBLE
|
||||
view.findViewById<ConstraintLayout>(R.id.main_container).visibility = View.VISIBLE
|
||||
with(motionLayout) {
|
||||
getConstraintSet(R.id.start).constrainHeight(R.id.player, 0)
|
||||
enableTransition(R.xml.player_scene,true)
|
||||
}
|
||||
(activity as MainActivity)?.supportActionBar?.show()
|
||||
isFullScreen=false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -270,7 +282,7 @@ class PlayerFragment : Fragment() {
|
||||
exoPlayerView.setShowSubtitleButton(true)
|
||||
exoPlayerView.setShowNextButton(false)
|
||||
exoPlayerView.setShowPreviousButton(false)
|
||||
exoPlayerView.controllerShowTimeoutMs = 1500
|
||||
//exoPlayerView.controllerShowTimeoutMs = 1500
|
||||
exoPlayerView.controllerHideOnTouch = true
|
||||
exoPlayerView.player = exoPlayer
|
||||
exoPlayer.setMediaItem(mediaItem)
|
||||
@ -362,8 +374,6 @@ class PlayerFragment : Fragment() {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
|
||||
println("wtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtf")
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
@ -55,12 +56,13 @@
|
||||
<xyz.btcland.libretube.CustomExoPlayerView
|
||||
android:id="@+id/player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||
app:layout_constraintStart_toStartOf="@id/main_container"
|
||||
app:layout_constraintTop_toTopOf="@id/main_container"
|
||||
|
||||
app:show_buffering="always"
|
||||
android:background="@color/black"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
@ -101,6 +103,8 @@
|
||||
app:layout_constraintBottom_toBottomOf="@+id/play_imageView"
|
||||
app:layout_constraintEnd_toStartOf="@+id/play_imageView"
|
||||
app:layout_constraintStart_toEndOf="@+id/player"
|
||||
app:layout_constraintTop_toTopOf="@+id/play_imageView" />
|
||||
app:layout_constraintTop_toTopOf="@+id/play_imageView"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
</xyz.btcland.libretube.SingleViewTouchableMotionLayout>
|
@ -25,7 +25,7 @@
|
||||
<KeyAttribute
|
||||
motion:motionTarget="@+id/container"
|
||||
motion:framePosition="100"
|
||||
android:scaleY="0.86" />
|
||||
android:translationY="-60dp" />
|
||||
</KeyFrameSet>
|
||||
</Transition>
|
||||
|
||||
|
@ -33,6 +33,41 @@
|
||||
</Transition>
|
||||
|
||||
<ConstraintSet android:id="@+id/start">
|
||||
<Constraint
|
||||
android:id="@+id/player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
motion:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||
motion:layout_constraintTop_toTopOf="@id/main_container"
|
||||
motion:layout_constraintStart_toStartOf="@id/main_container" />
|
||||
<Constraint
|
||||
android:id="@+id/player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
motion:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||
motion:layout_constraintTop_toTopOf="@id/main_container"
|
||||
motion:layout_constraintStart_toStartOf="@id/main_container" />
|
||||
<Constraint
|
||||
android:id="@+id/player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
motion:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||
motion:layout_constraintTop_toTopOf="@id/main_container"
|
||||
motion:layout_constraintStart_toStartOf="@id/main_container" />
|
||||
<Constraint
|
||||
android:id="@+id/player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
motion:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||
motion:layout_constraintTop_toTopOf="@id/main_container"
|
||||
motion:layout_constraintStart_toStartOf="@id/main_container" />
|
||||
<Constraint
|
||||
android:id="@+id/player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
motion:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||
motion:layout_constraintTop_toTopOf="@id/main_container"
|
||||
motion:layout_constraintStart_toStartOf="@id/main_container" />
|
||||
</ConstraintSet>
|
||||
|
||||
<ConstraintSet android:id="@+id/end">
|
||||
@ -95,6 +130,8 @@
|
||||
android:layout_marginEnd="12dp"
|
||||
android:alpha="1"
|
||||
android:layout_marginStart="8dp"
|
||||
motion:layout_constraintTop_toTopOf="@+id/play_imageView" />
|
||||
motion:layout_constraintTop_toTopOf="@+id/play_imageView"
|
||||
android:visibility="visible"
|
||||
/>
|
||||
</ConstraintSet>
|
||||
</MotionScene>
|
Loading…
Reference in New Issue
Block a user