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