mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 15:30:31 +05:30
Fix that the last few comments can't be seen
This commit is contained in:
parent
15afbc2a82
commit
55aa62da84
@ -42,5 +42,5 @@ fun View?.setWatchProgressLength(videoId: String, duration: Long): Boolean {
|
||||
}
|
||||
})
|
||||
|
||||
return (progress ?: 0f) / duration.toFloat() > 0.9
|
||||
return progress / duration.toFloat() > 0.9
|
||||
}
|
||||
|
@ -107,15 +107,15 @@ import com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
import com.google.android.exoplayer2.upstream.DefaultDataSource
|
||||
import com.google.android.exoplayer2.util.MimeTypes
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
import java.util.concurrent.Executors
|
||||
import kotlin.math.abs
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.chromium.net.CronetEngine
|
||||
import retrofit2.HttpException
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
import java.util.concurrent.Executors
|
||||
import kotlin.math.abs
|
||||
|
||||
class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
||||
|
||||
@ -1163,8 +1163,8 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
||||
|
||||
for (vid in videoStreams) {
|
||||
if (resolutions.any {
|
||||
it.resolution == vid.quality.qualityToInt()
|
||||
} || vid.url == null
|
||||
it.resolution == vid.quality.qualityToInt()
|
||||
} || vid.url == null
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
@ -4,10 +4,12 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.github.libretube.R
|
||||
import com.github.libretube.databinding.CommentsSheetBinding
|
||||
import com.github.libretube.extensions.toPixel
|
||||
import com.github.libretube.ui.adapters.CommentsAdapter
|
||||
import com.github.libretube.ui.models.CommentsViewModel
|
||||
|
||||
@ -24,14 +26,22 @@ class CommentsSheet : ExpandedBottomSheet() {
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = CommentsSheetBinding.inflate(layoutInflater)
|
||||
// set a fixed maximum height
|
||||
binding.root.maxHeight = viewModel.maxHeight
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.dragHandle.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
|
||||
override fun onGlobalLayout() {
|
||||
binding.dragHandle.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||
// limit the recyclerview height to not cover the video
|
||||
binding.commentsRV.layoutParams = binding.commentsRV.layoutParams.apply {
|
||||
height = viewModel.maxHeight - (binding.dragHandle.height + (20).toPixel().toInt())
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
binding.commentsRV.layoutManager = LinearLayoutManager(requireContext())
|
||||
binding.commentsRV.setItemViewCacheSize(20)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user