mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
fullscreen workaround needs redesign
This commit is contained in:
parent
6d787fa425
commit
49cb54d2b4
12
.idea/deploymentTargetDropDown.xml
generated
12
.idea/deploymentTargetDropDown.xml
generated
@ -1,18 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<targetSelectedWithDropDown>
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_5_API_22.avd" />
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="3100ad43a3044300" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2021-12-12T20:15:13.174164Z" />
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2021-12-14T10:15:55.771386Z" />
|
||||
<runningDeviceTargetsSelectedWithDialog>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
|
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@ -7,10 +7,10 @@
|
||||
<entry key="app/src/main/res/drawable/ic_play.xml" value="0.17135416666666667" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.1" />
|
||||
<entry key="app/src/main/res/layout/activity_player.xml" value="0.1" />
|
||||
<entry key="app/src/main/res/layout/exo_styled_player_control_view.xml" value="0.25" />
|
||||
<entry key="app/src/main/res/layout/exo_styled_player_control_view.xml" value="0.12" />
|
||||
<entry key="app/src/main/res/layout/fragment_home.xml" value="0.16" />
|
||||
<entry key="app/src/main/res/layout/fragment_library.xml" value="0.11956521739130435" />
|
||||
<entry key="app/src/main/res/layout/fragment_player.xml" value="0.15520833333333334" />
|
||||
<entry key="app/src/main/res/layout/fragment_player.xml" value="0.1" />
|
||||
<entry key="app/src/main/res/layout/fragment_subscriptions.xml" value="0.1" />
|
||||
<entry key="app/src/main/res/layout/styled_quality_list.xml" value="0.15520833333333334" />
|
||||
<entry key="app/src/main/res/layout/styled_quality_list_item.xml" value="0.15520833333333334" />
|
||||
|
@ -10,15 +10,21 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.LibreTube">
|
||||
android:theme="@style/Theme.LibreTube"
|
||||
android:name=".myApp"
|
||||
>
|
||||
<activity
|
||||
android:name=".Player"
|
||||
android:exported="false"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
||||
android:configChanges="orientation|screenSize"
|
||||
/>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="orientation|screenSize"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
@ -16,8 +16,11 @@ internal class CustomExoPlayerView(
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
showController()
|
||||
|
||||
if (isControllerFullyVisible) {
|
||||
hideController()
|
||||
}else {
|
||||
showController()
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
@ -7,8 +7,10 @@ import androidx.fragment.app.Fragment
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.ui.setupWithNavController
|
||||
import com.google.android.exoplayer2.ExoPlayer
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
lateinit var exoPlayer:ExoPlayer
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
@ -16,6 +18,5 @@ class MainActivity : AppCompatActivity() {
|
||||
val navController = findNavController(R.id.fragment)
|
||||
bottomNavigationView.setupWithNavController(navController)
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,14 +1,221 @@
|
||||
package xyz.btcland.libretube
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.ImageButton
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.net.toUri
|
||||
import com.google.android.exoplayer2.ExoPlayer
|
||||
import com.google.android.exoplayer2.MediaItem
|
||||
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
|
||||
import com.google.android.exoplayer2.source.MediaSource
|
||||
import com.google.android.exoplayer2.source.MergingMediaSource
|
||||
import com.google.android.exoplayer2.source.ProgressiveMediaSource
|
||||
import com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
import com.google.android.exoplayer2.upstream.DataSource
|
||||
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource
|
||||
import com.google.gson.GsonBuilder
|
||||
import okhttp3.*
|
||||
import java.io.IOException
|
||||
|
||||
class Player : Activity() {
|
||||
|
||||
private lateinit var exoPlayerView: StyledPlayerView
|
||||
private lateinit var motionLayout: SingleViewTouchableMotionLayout
|
||||
private lateinit var exoPlayer: ExoPlayer
|
||||
private var videoId: String? =null
|
||||
private var seekTo: Long? = 0
|
||||
private var whichQuality: Int? = 0
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_player)
|
||||
val videoId=intent.getStringExtra("videoId")
|
||||
println(videoId)
|
||||
seekTo = intent.getStringExtra("seekTo")?.toLong()
|
||||
whichQuality = intent.getStringExtra("quality")?.toInt()
|
||||
videoId=intent.getStringExtra("videoId")
|
||||
exoPlayerView = findViewById(R.id.fullscreen_player)
|
||||
fetchJson(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun fetchJson(context: Context) {
|
||||
val client = OkHttpClient()
|
||||
|
||||
fun run() {
|
||||
val request = Request.Builder()
|
||||
.url("https://pipedapi.kavin.rocks/streams/$videoId")
|
||||
.build()
|
||||
client.newCall(request).enqueue(object : Callback {
|
||||
override fun onFailure(call: Call, e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
override fun onResponse(call: Call, response: Response) {
|
||||
response.use {
|
||||
if (!response.isSuccessful) throw IOException("Unexpected code $response")
|
||||
val body = response.body!!.string()
|
||||
println(body)
|
||||
val gson = GsonBuilder().create()
|
||||
val videoInPlayer = gson.fromJson(body, VideoInPlayer::class.java)
|
||||
var videosNameArray: Array<CharSequence> = arrayOf()
|
||||
videosNameArray += "HLS"
|
||||
for (vids in videoInPlayer.videoStreams){
|
||||
val name = vids.quality +" "+ vids.format
|
||||
videosNameArray += name
|
||||
}
|
||||
runOnUiThread {
|
||||
exoPlayer = ExoPlayer.Builder(context)
|
||||
.build()
|
||||
var subtitle = mutableListOf<MediaItem.SubtitleConfiguration>()
|
||||
if(videoInPlayer.subtitles.isNotEmpty()){
|
||||
subtitle?.add(
|
||||
MediaItem.SubtitleConfiguration.Builder(videoInPlayer.subtitles[0].url.toUri())
|
||||
.setMimeType(videoInPlayer.subtitles[0].mimeType) // The correct MIME type (required).
|
||||
.setLanguage(videoInPlayer.subtitles[0].code) // The subtitle language (optional).
|
||||
.build())}
|
||||
if(whichQuality==0){
|
||||
val mediaItem: MediaItem = MediaItem.Builder()
|
||||
.setUri(videoInPlayer.hls)
|
||||
.setSubtitleConfigurations(subtitle)
|
||||
.build()
|
||||
exoPlayer.setMediaItem(mediaItem)
|
||||
}else{
|
||||
val dataSourceFactory: DataSource.Factory =
|
||||
DefaultHttpDataSource.Factory()
|
||||
val videoItem: MediaItem = MediaItem.Builder()
|
||||
.setUri(videoInPlayer.videoStreams[whichQuality!!-1].url)
|
||||
.setSubtitleConfigurations(subtitle)
|
||||
.build()
|
||||
val videoSource: MediaSource = DefaultMediaSourceFactory(dataSourceFactory)
|
||||
.createMediaSource(videoItem)
|
||||
var audioSource: MediaSource = DefaultMediaSourceFactory(dataSourceFactory)
|
||||
.createMediaSource(
|
||||
MediaItem.fromUri(
|
||||
videoInPlayer.audioStreams[0].url
|
||||
)
|
||||
)
|
||||
if (videoInPlayer.videoStreams[whichQuality!!-1].quality=="720p" || videoInPlayer.videoStreams[whichQuality!!-1].quality=="1080p" || videoInPlayer.videoStreams[whichQuality!!-1].quality=="480p" ){
|
||||
audioSource = ProgressiveMediaSource.Factory(dataSourceFactory)
|
||||
.createMediaSource(
|
||||
MediaItem.fromUri(
|
||||
videoInPlayer.audioStreams[getMostBitRate(
|
||||
videoInPlayer.audioStreams
|
||||
)].url
|
||||
)
|
||||
)
|
||||
//println("fuckkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkitttttttttttttttttttttt")
|
||||
}
|
||||
val mergeSource: MediaSource = MergingMediaSource(videoSource,audioSource)
|
||||
exoPlayer.setMediaSource(mergeSource)
|
||||
}
|
||||
findViewById<TextView>(R.id.quality_text).text=videosNameArray[whichQuality!!]
|
||||
|
||||
exoPlayerView.setShowSubtitleButton(true)
|
||||
exoPlayerView.setShowNextButton(false)
|
||||
exoPlayerView.setShowPreviousButton(false)
|
||||
exoPlayerView.controllerShowTimeoutMs = 1500
|
||||
exoPlayerView.controllerHideOnTouch = true
|
||||
exoPlayerView.player = exoPlayer
|
||||
|
||||
///exoPlayer.getMediaItemAt(5)
|
||||
exoPlayer.prepare()
|
||||
exoPlayer.play()
|
||||
exoPlayer.seekTo(seekTo!!)
|
||||
findViewById<ImageButton>(R.id.quality_select).setOnClickListener{
|
||||
val builder: AlertDialog.Builder? = let {
|
||||
AlertDialog.Builder(context)
|
||||
}
|
||||
builder!!.setTitle(R.string.choose_quality_dialog)
|
||||
.setItems(videosNameArray,
|
||||
DialogInterface.OnClickListener { _, which ->
|
||||
// The 'which' argument contains the index position
|
||||
// of the selected item
|
||||
//println(which)
|
||||
if(videoInPlayer.subtitles.isNotEmpty()) {
|
||||
var subtitle =
|
||||
mutableListOf<MediaItem.SubtitleConfiguration>()
|
||||
subtitle?.add(
|
||||
MediaItem.SubtitleConfiguration.Builder(videoInPlayer.subtitles[0].url.toUri())
|
||||
.setMimeType(videoInPlayer.subtitles[0].mimeType) // The correct MIME type (required).
|
||||
.setLanguage(videoInPlayer.subtitles[0].code) // The subtitle language (optional).
|
||||
.build()
|
||||
)
|
||||
}
|
||||
if(which==0){
|
||||
val mediaItem: MediaItem = MediaItem.Builder()
|
||||
.setUri(videoInPlayer.hls)
|
||||
.setSubtitleConfigurations(subtitle)
|
||||
.build()
|
||||
exoPlayer.setMediaItem(mediaItem)
|
||||
}else{
|
||||
val dataSourceFactory: DataSource.Factory =
|
||||
DefaultHttpDataSource.Factory()
|
||||
val videoItem: MediaItem = MediaItem.Builder()
|
||||
.setUri(videoInPlayer.videoStreams[which-1].url)
|
||||
.setSubtitleConfigurations(subtitle)
|
||||
.build()
|
||||
val videoSource: MediaSource = DefaultMediaSourceFactory(dataSourceFactory)
|
||||
.createMediaSource(videoItem)
|
||||
var audioSource: MediaSource = DefaultMediaSourceFactory(dataSourceFactory)
|
||||
.createMediaSource(
|
||||
MediaItem.fromUri(
|
||||
videoInPlayer.audioStreams[0].url
|
||||
)
|
||||
)
|
||||
if (videoInPlayer.videoStreams[which-1].quality=="720p" || videoInPlayer.videoStreams[which-1].quality=="1080p" || videoInPlayer.videoStreams[which-1].quality=="480p" ){
|
||||
audioSource = ProgressiveMediaSource.Factory(dataSourceFactory)
|
||||
.createMediaSource(
|
||||
MediaItem.fromUri(
|
||||
videoInPlayer.audioStreams[getMostBitRate(
|
||||
videoInPlayer.audioStreams
|
||||
)].url
|
||||
)
|
||||
)
|
||||
//println("fuckkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkitttttttttttttttttttttt")
|
||||
}
|
||||
val mergeSource: MediaSource = MergingMediaSource(videoSource,audioSource)
|
||||
exoPlayer.setMediaSource(mergeSource)
|
||||
}
|
||||
findViewById<TextView>(R.id.quality_text).text=videosNameArray[which]
|
||||
})
|
||||
val dialog: AlertDialog? = builder?.create()
|
||||
dialog?.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
run()
|
||||
|
||||
}
|
||||
fun getMostBitRate(audios: List<Stream>):Int{
|
||||
var bitrate =0
|
||||
var index = 0
|
||||
for ((i, audio) in audios.withIndex()){
|
||||
val q = audio.quality.replace(" kbps","").toInt()
|
||||
if (q>bitrate){
|
||||
bitrate=q
|
||||
index = i
|
||||
}
|
||||
}
|
||||
return index
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
myApp.seekTo=exoPlayer.currentPosition
|
||||
exoPlayer.stop()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package xyz.btcland.libretube
|
||||
|
||||
import android.R.attr
|
||||
import android.R.attr.*
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
@ -25,8 +26,10 @@ import java.io.IOException
|
||||
import kotlin.math.abs
|
||||
import com.google.android.exoplayer2.util.MimeTypes
|
||||
import com.google.common.collect.ImmutableList
|
||||
import android.R.attr.subtitle
|
||||
import android.app.ActionBar
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.graphics.Color
|
||||
import android.widget.*
|
||||
import androidx.core.net.toUri
|
||||
@ -46,8 +49,11 @@ import android.graphics.drawable.Drawable
|
||||
import com.google.android.exoplayer2.util.Util
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.text.PrecomputedTextCompat
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
|
||||
import com.google.android.exoplayer2.util.RepeatModeUtil
|
||||
|
||||
import com.google.android.exoplayer2.ui.TimeBar
|
||||
@ -72,11 +78,12 @@ class PlayerFragment : Fragment() {
|
||||
private var sId: Int=0
|
||||
private var eId: Int=0
|
||||
private var paused =false
|
||||
|
||||
private var isFullScreen = false
|
||||
private var whichQuality = 0
|
||||
|
||||
private lateinit var exoPlayerView: StyledPlayerView
|
||||
private lateinit var motionLayout: SingleViewTouchableMotionLayout
|
||||
lateinit var exoPlayer: ExoPlayer
|
||||
private lateinit var exoPlayer: ExoPlayer
|
||||
private lateinit var mediaSource: MediaSource
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@ -179,9 +186,21 @@ class PlayerFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
try {
|
||||
@ -211,7 +230,6 @@ class PlayerFragment : Fragment() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun fetchJson(view: View) {
|
||||
val client = OkHttpClient()
|
||||
|
||||
@ -238,10 +256,11 @@ class PlayerFragment : Fragment() {
|
||||
}
|
||||
runOnUiThread {
|
||||
var subtitle = mutableListOf<SubtitleConfiguration>()
|
||||
if(videoInPlayer.subtitles.isNotEmpty()){
|
||||
subtitle?.add(SubtitleConfiguration.Builder(videoInPlayer.subtitles[0].url.toUri())
|
||||
.setMimeType(videoInPlayer.subtitles[0].mimeType) // The correct MIME type (required).
|
||||
.setLanguage(videoInPlayer.subtitles[0].code) // The subtitle language (optional).
|
||||
.build())
|
||||
.build())}
|
||||
val mediaItem: MediaItem = MediaItem.Builder()
|
||||
.setUri(videoInPlayer.hls)
|
||||
.setSubtitleConfigurations(subtitle)
|
||||
@ -251,6 +270,8 @@ class PlayerFragment : Fragment() {
|
||||
exoPlayerView.setShowSubtitleButton(true)
|
||||
exoPlayerView.setShowNextButton(false)
|
||||
exoPlayerView.setShowPreviousButton(false)
|
||||
exoPlayerView.controllerShowTimeoutMs = 1500
|
||||
exoPlayerView.controllerHideOnTouch = true
|
||||
exoPlayerView.player = exoPlayer
|
||||
exoPlayer.setMediaItem(mediaItem)
|
||||
///exoPlayer.getMediaItemAt(5)
|
||||
@ -263,18 +284,23 @@ class PlayerFragment : Fragment() {
|
||||
val builder: AlertDialog.Builder? = activity?.let {
|
||||
AlertDialog.Builder(it)
|
||||
}
|
||||
builder!!.setTitle("Choose Quality:")
|
||||
builder!!.setTitle(R.string.choose_quality_dialog)
|
||||
.setItems(videosNameArray,
|
||||
DialogInterface.OnClickListener { dialog, which ->
|
||||
DialogInterface.OnClickListener { _, which ->
|
||||
// The 'which' argument contains the index position
|
||||
// of the selected item
|
||||
//println(which)
|
||||
var subtitle = mutableListOf<SubtitleConfiguration>()
|
||||
subtitle?.add(SubtitleConfiguration.Builder(videoInPlayer.subtitles[0].url.toUri())
|
||||
.setMimeType(videoInPlayer.subtitles[0].mimeType) // The correct MIME type (required).
|
||||
.setLanguage(videoInPlayer.subtitles[0].code) // The subtitle language (optional).
|
||||
.build())
|
||||
|
||||
whichQuality = which
|
||||
if(videoInPlayer.subtitles.isNotEmpty()) {
|
||||
var subtitle =
|
||||
mutableListOf<SubtitleConfiguration>()
|
||||
subtitle?.add(
|
||||
SubtitleConfiguration.Builder(videoInPlayer.subtitles[0].url.toUri())
|
||||
.setMimeType(videoInPlayer.subtitles[0].mimeType) // The correct MIME type (required).
|
||||
.setLanguage(videoInPlayer.subtitles[0].code) // The subtitle language (optional).
|
||||
.build()
|
||||
)
|
||||
}
|
||||
if(which==0){
|
||||
val mediaItem: MediaItem = MediaItem.Builder()
|
||||
.setUri(videoInPlayer.hls)
|
||||
@ -284,9 +310,13 @@ class PlayerFragment : Fragment() {
|
||||
}else{
|
||||
val dataSourceFactory: DataSource.Factory =
|
||||
DefaultHttpDataSource.Factory()
|
||||
val videoSource: MediaSource = ProgressiveMediaSource.Factory(dataSourceFactory)
|
||||
.createMediaSource(fromUri(videoInPlayer.videoStreams[which-1].url))
|
||||
var audioSource: MediaSource = ProgressiveMediaSource.Factory(dataSourceFactory)
|
||||
val videoItem: MediaItem = MediaItem.Builder()
|
||||
.setUri(videoInPlayer.videoStreams[which-1].url)
|
||||
.setSubtitleConfigurations(subtitle)
|
||||
.build()
|
||||
val videoSource: MediaSource = DefaultMediaSourceFactory(dataSourceFactory)
|
||||
.createMediaSource(videoItem)
|
||||
var audioSource: MediaSource = DefaultMediaSourceFactory(dataSourceFactory)
|
||||
.createMediaSource(fromUri(videoInPlayer.audioStreams[0].url))
|
||||
if (videoInPlayer.videoStreams[which-1].quality=="720p" || videoInPlayer.videoStreams[which-1].quality=="1080p" || videoInPlayer.videoStreams[which-1].quality=="480p" ){
|
||||
audioSource = ProgressiveMediaSource.Factory(dataSourceFactory)
|
||||
@ -295,8 +325,8 @@ class PlayerFragment : Fragment() {
|
||||
}
|
||||
val mergeSource: MediaSource = MergingMediaSource(videoSource,audioSource)
|
||||
exoPlayer.setMediaSource(mergeSource)
|
||||
view.findViewById<TextView>(R.id.quality_text).text=videosNameArray[which]
|
||||
}
|
||||
view.findViewById<TextView>(R.id.quality_text).text=videosNameArray[which]
|
||||
})
|
||||
val dialog: AlertDialog? = builder?.create()
|
||||
dialog?.show()
|
||||
@ -329,4 +359,11 @@ class PlayerFragment : Fragment() {
|
||||
}
|
||||
return index
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
|
||||
println("wtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtfwtf")
|
||||
}
|
||||
}
|
11
app/src/main/java/xyz/btcland/libretube/myApp.kt
Normal file
11
app/src/main/java/xyz/btcland/libretube/myApp.kt
Normal file
@ -0,0 +1,11 @@
|
||||
package xyz.btcland.libretube
|
||||
|
||||
import android.app.Application
|
||||
|
||||
class myApp : Application() {
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
var seekTo : Long? = 0
|
||||
}
|
||||
}
|
@ -1,96 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layoutDescription="@xml/activity_player_scene"
|
||||
tools:context=".Player"
|
||||
android:background="#00ffffff"
|
||||
android:background="@color/black"
|
||||
>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView2"
|
||||
<xyz.btcland.libretube.CustomExoPlayerView
|
||||
android:id="@+id/fullscreen_player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/main_container">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="fuckkkkkkkkkkkkkkkkkkkkkkkkkkkkk"/>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/main_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:background="#10000000"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||
app:layout_constraintStart_toStartOf="@id/main_container"
|
||||
app:layout_constraintTop_toTopOf="@id/main_container"
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close_imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:alpha="0"
|
||||
app:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||
app:layout_constraintEnd_toEndOf="@id/main_container"
|
||||
app:layout_constraintTop_toTopOf="@id/main_container"
|
||||
android:src="@drawable/ic_close"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/play_imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:alpha="0"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/close_imageView"
|
||||
app:layout_constraintEnd_toStartOf="@+id/close_imageView"
|
||||
app:layout_constraintTop_toTopOf="@+id/close_imageView"
|
||||
android:src="@drawable/ic_play"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_textView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:alpha="0"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="This is very very very very long title"
|
||||
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" />
|
||||
|
||||
</androidx.constraintlayout.motion.widget.MotionLayout>
|
||||
</RelativeLayout>
|
@ -20,6 +20,7 @@
|
||||
entirety of the parent in code, after the parent's size has been
|
||||
determined. See: https://github.com/google/ExoPlayer/issues/8726.
|
||||
-->
|
||||
|
||||
<View android:id="@id/exo_controls_background"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
@ -130,6 +131,9 @@
|
||||
<ImageButton android:id="@id/exo_settings"
|
||||
style="@style/ExoStyledControls.Button.Bottom.Settings"/>
|
||||
|
||||
<ImageButton android:id="@+id/fullscreen"
|
||||
style="@style/ExoStyledControls.Button.Bottom.FullScreen"/>
|
||||
|
||||
<ImageButton android:id="@id/exo_fullscreen"
|
||||
style="@style/ExoStyledControls.Button.Bottom.FullScreen"/>
|
||||
|
||||
@ -162,7 +166,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/exo_styled_progress_layout_height"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginBottom="@dimen/exo_styled_progress_margin_bottom"/>
|
||||
android:layout_marginBottom="@dimen/exo_styled_progress_margin_bottom"
|
||||
android:background="@color/exo_bottom_bar_background"
|
||||
/>
|
||||
|
||||
<LinearLayout android:id="@id/exo_minimal_controls"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -20,18 +20,23 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/main_container"
|
||||
android:background="@color/white"
|
||||
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textTest"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="fuckkkkkkkkkkkkkkkkkkkkkkkkkkkkk"/>
|
||||
android:text=""
|
||||
|
||||
/>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
@ -39,7 +44,7 @@
|
||||
android:id="@+id/main_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="350dp"
|
||||
android:background="#EBFFFFFF"
|
||||
android:background="#FFFFFF"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@ -2,4 +2,5 @@
|
||||
<string name="app_name">LibreTube</string>
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="choose_quality_dialog">Choose Quality:</string>
|
||||
</resources>
|
@ -1,91 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MotionScene
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:motion="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<Transition
|
||||
motion:constraintSetEnd="@+id/end"
|
||||
motion:constraintSetStart="@id/start"
|
||||
motion:duration="1000">
|
||||
<KeyFrameSet>
|
||||
<KeyAttribute
|
||||
motion:motionTarget="@+id/close_imageView"
|
||||
motion:framePosition="90"
|
||||
android:alpha="0" />
|
||||
<KeyAttribute
|
||||
motion:motionTarget="@+id/play_imageView"
|
||||
motion:framePosition="90"
|
||||
android:alpha="0" />
|
||||
<KeyAttribute
|
||||
motion:motionTarget="@+id/title_textView"
|
||||
motion:framePosition="95"
|
||||
android:alpha="0" />
|
||||
</KeyFrameSet>
|
||||
<OnSwipe
|
||||
motion:touchAnchorId="@+id/main_container"
|
||||
motion:dragDirection="dragDown"
|
||||
motion:touchAnchorSide="bottom" />
|
||||
</Transition>
|
||||
|
||||
<ConstraintSet android:id="@+id/start">
|
||||
</ConstraintSet>
|
||||
|
||||
<ConstraintSet android:id="@+id/end">
|
||||
<Constraint
|
||||
android:id="@+id/scrollView2"
|
||||
motion:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
motion:layout_constraintBottom_toBottomOf="parent"
|
||||
motion:layout_constraintTop_toBottomOf="@+id/main_container"
|
||||
motion:layout_constraintHorizontal_bias="0.5"
|
||||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintVertical_bias="1.0" />
|
||||
<Constraint
|
||||
android:id="@+id/main_container"
|
||||
motion:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
motion:layout_constraintHorizontal_bias="0.5"
|
||||
motion:layout_constraintTop_toTopOf="parent"
|
||||
motion:layout_constraintStart_toStartOf="parent"
|
||||
motion:layout_constraintBottom_toBottomOf="parent"
|
||||
motion:layout_constraintVertical_bias="1.0" />
|
||||
<Constraint
|
||||
android:id="@+id/player"
|
||||
android:layout_width="100dp"
|
||||
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" />
|
||||
<Constraint
|
||||
android:id="@+id/close_imageView"
|
||||
motion:layout_constraintEnd_toEndOf="@id/main_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
motion:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:alpha="1"
|
||||
motion:layout_constraintTop_toTopOf="@id/main_container" />
|
||||
<Constraint
|
||||
android:id="@+id/play_imageView"
|
||||
motion:layout_constraintEnd_toStartOf="@+id/close_imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
motion:layout_constraintBottom_toBottomOf="@+id/close_imageView"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:alpha="1"
|
||||
motion:layout_constraintTop_toTopOf="@+id/close_imageView" />
|
||||
<Constraint
|
||||
android:id="@+id/title_textView"
|
||||
motion:layout_constraintEnd_toStartOf="@+id/play_imageView"
|
||||
motion:layout_constraintStart_toEndOf="@+id/player"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
motion:layout_constraintBottom_toBottomOf="@+id/play_imageView"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:alpha="1"
|
||||
android:layout_marginStart="8dp"
|
||||
motion:layout_constraintTop_toTopOf="@+id/play_imageView" />
|
||||
</ConstraintSet>
|
||||
</MotionScene>
|
Loading…
Reference in New Issue
Block a user