mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
style: run ktlint
This commit is contained in:
parent
fc9e3e6501
commit
f99198f99a
@ -5,12 +5,12 @@ import com.github.libretube.enums.FileType
|
||||
import com.github.libretube.helpers.ProxyHelper
|
||||
import com.github.libretube.json.SafeInstantSerializer
|
||||
import com.github.libretube.parcelable.DownloadData
|
||||
import kotlin.io.path.Path
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlinx.datetime.TimeZone
|
||||
import kotlinx.datetime.toLocalDateTime
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.io.path.Path
|
||||
|
||||
@Serializable
|
||||
data class Streams(
|
||||
|
@ -2,11 +2,11 @@ package com.github.libretube.db
|
||||
|
||||
import androidx.room.TypeConverter
|
||||
import com.github.libretube.api.JsonHelper
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.Path
|
||||
import kotlinx.datetime.LocalDate
|
||||
import kotlinx.datetime.toLocalDate
|
||||
import kotlinx.serialization.encodeToString
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.Path
|
||||
|
||||
object Converters {
|
||||
@TypeConverter
|
||||
|
@ -4,8 +4,8 @@ import androidx.media3.common.Player
|
||||
import com.github.libretube.helpers.PlayerHelper
|
||||
|
||||
fun Player.togglePlayPauseState() {
|
||||
val minBufferingReached = totalBufferedDuration >= PlayerHelper.MINIMUM_BUFFER_DURATION
|
||||
|| currentPosition + PlayerHelper.MINIMUM_BUFFER_DURATION >= duration
|
||||
val minBufferingReached = totalBufferedDuration >= PlayerHelper.MINIMUM_BUFFER_DURATION ||
|
||||
currentPosition + PlayerHelper.MINIMUM_BUFFER_DURATION >= duration
|
||||
when {
|
||||
playerError != null -> {
|
||||
prepare()
|
||||
|
@ -172,7 +172,12 @@ class OnlinePlayerService : LifecycleService() {
|
||||
if (!keepQueue) PlayingQueue.clear()
|
||||
|
||||
if (PlayingQueue.isEmpty()) {
|
||||
PlayingQueue.updateQueue(streams!!.toStreamItem(videoId), playlistId, channelId, streams!!.relatedStreams)
|
||||
PlayingQueue.updateQueue(
|
||||
streams!!.toStreamItem(videoId),
|
||||
playlistId,
|
||||
channelId,
|
||||
streams!!.relatedStreams
|
||||
)
|
||||
} else if (PlayingQueue.isLast() && playlistId == null && channelId == null) {
|
||||
PlayingQueue.insertRelatedStreams(streams!!.relatedStreams)
|
||||
}
|
||||
|
@ -37,11 +37,10 @@ import com.github.libretube.ui.interfaces.TimeFrameReceiver
|
||||
import com.github.libretube.ui.listeners.SeekbarPreviewListener
|
||||
import com.github.libretube.ui.models.PlayerViewModel
|
||||
import com.github.libretube.util.OfflineTimeFrameReceiver
|
||||
import kotlin.io.path.exists
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlin.io.path.exists
|
||||
|
||||
|
||||
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
|
||||
class OfflinePlayerActivity : BaseActivity() {
|
||||
|
@ -54,9 +54,13 @@ class VoteForSegmentDialog : DialogFragment() {
|
||||
?.uuid ?: return@setOnClickListener
|
||||
|
||||
// see https://wiki.sponsor.ajay.app/w/API_Docs#POST_/api/voteOnSponsorTime
|
||||
val score = if (binding.upvote.isChecked) 1
|
||||
else if (binding.downvote.isChecked) 0
|
||||
else 20
|
||||
val score = if (binding.upvote.isChecked) {
|
||||
1
|
||||
} else if (binding.downvote.isChecked) {
|
||||
0
|
||||
} else {
|
||||
20
|
||||
}
|
||||
|
||||
dialog?.hide()
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
|
@ -20,7 +20,6 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewGroup.LayoutParams
|
||||
import android.widget.Toast
|
||||
import android.window.OnBackInvokedDispatcher
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
import androidx.constraintlayout.motion.widget.TransitionAdapter
|
||||
import androidx.core.content.getSystemService
|
||||
@ -1595,7 +1594,11 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
* If true, the activity will be automatically restarted
|
||||
*/
|
||||
private fun checkForNecessaryOrientationRestart() {
|
||||
val lockedOrientations = listOf(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
|
||||
val lockedOrientations =
|
||||
listOf(
|
||||
ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT,
|
||||
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
||||
)
|
||||
if (mainActivity.screenOrientationPref in lockedOrientations) return
|
||||
|
||||
val orientation = resources.configuration.orientation
|
||||
|
@ -5,7 +5,6 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.fragment.app.commit
|
||||
|
@ -536,7 +536,9 @@ open class CustomExoPlayerView(
|
||||
override fun onRepeatModeClicked() {
|
||||
// repeat mode options dialog
|
||||
BaseBottomSheet()
|
||||
.setSimpleItems(PlayerHelper.repeatModes.map { context.getString(it.second) }) { index ->
|
||||
.setSimpleItems(
|
||||
PlayerHelper.repeatModes.map { context.getString(it.second) }
|
||||
) { index ->
|
||||
PlayingQueue.repeatMode = PlayerHelper.repeatModes[index].first
|
||||
}
|
||||
.show(supportFragmentManager)
|
||||
|
@ -19,9 +19,9 @@ import com.github.libretube.ui.activities.VideoTagsAdapter
|
||||
import com.github.libretube.util.HtmlParser
|
||||
import com.github.libretube.util.LinkHandler
|
||||
import com.github.libretube.util.TextUtils
|
||||
import java.util.Locale
|
||||
import kotlinx.datetime.TimeZone
|
||||
import kotlinx.datetime.toLocalDateTime
|
||||
import java.util.Locale
|
||||
|
||||
class DescriptionLayout(
|
||||
context: Context,
|
||||
@ -117,14 +117,18 @@ class DescriptionLayout(
|
||||
val viewInfo = context.getString(R.string.normal_views, views, localizeDate(streams))
|
||||
if (binding.descLinLayout.isVisible) {
|
||||
// hide the description and chapters
|
||||
binding.playerDescriptionArrow.animate().rotation(0F).setDuration(ANIMATION_DURATION).start()
|
||||
binding.playerDescriptionArrow.animate().rotation(
|
||||
0F
|
||||
).setDuration(ANIMATION_DURATION).start()
|
||||
binding.descLinLayout.isGone = true
|
||||
|
||||
// limit the title height to two lines
|
||||
binding.playerTitle.maxLines = 2
|
||||
} else {
|
||||
// show the description and chapters
|
||||
binding.playerDescriptionArrow.animate().rotation(180F).setDuration(ANIMATION_DURATION).start()
|
||||
binding.playerDescriptionArrow.animate().rotation(
|
||||
180F
|
||||
).setDuration(ANIMATION_DURATION).start()
|
||||
binding.descLinLayout.isVisible = true
|
||||
|
||||
// show the whole title
|
||||
|
Loading…
Reference in New Issue
Block a user