mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
style: run ktlint
This commit is contained in:
parent
9fa20aca7d
commit
1abc9cfe8c
@ -100,7 +100,8 @@ object SubscriptionHelper {
|
|||||||
} else {
|
} else {
|
||||||
val subscriptions = Database.localSubscriptionDao().getAll().map { it.channelId }
|
val subscriptions = Database.localSubscriptionDao().getAll().map { it.channelId }
|
||||||
when {
|
when {
|
||||||
subscriptions.size > GET_SUBSCRIPTIONS_LIMIT -> RetrofitInstance.authApi
|
subscriptions.size > GET_SUBSCRIPTIONS_LIMIT ->
|
||||||
|
RetrofitInstance.authApi
|
||||||
.unauthenticatedSubscriptions(subscriptions)
|
.unauthenticatedSubscriptions(subscriptions)
|
||||||
|
|
||||||
else -> RetrofitInstance.authApi.unauthenticatedSubscriptions(
|
else -> RetrofitInstance.authApi.unauthenticatedSubscriptions(
|
||||||
@ -116,7 +117,8 @@ object SubscriptionHelper {
|
|||||||
} else {
|
} else {
|
||||||
val subscriptions = Database.localSubscriptionDao().getAll().map { it.channelId }
|
val subscriptions = Database.localSubscriptionDao().getAll().map { it.channelId }
|
||||||
when {
|
when {
|
||||||
subscriptions.size > GET_SUBSCRIPTIONS_LIMIT -> RetrofitInstance.authApi
|
subscriptions.size > GET_SUBSCRIPTIONS_LIMIT ->
|
||||||
|
RetrofitInstance.authApi
|
||||||
.getUnauthenticatedFeed(subscriptions)
|
.getUnauthenticatedFeed(subscriptions)
|
||||||
|
|
||||||
else -> RetrofitInstance.authApi.getUnauthenticatedFeed(
|
else -> RetrofitInstance.authApi.getUnauthenticatedFeed(
|
||||||
|
@ -143,11 +143,19 @@ class PlaylistAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val shortTitle = TextUtils.limitTextToLength(video.title.orEmpty(), 50)
|
val shortTitle = TextUtils.limitTextToLength(video.title.orEmpty(), 50)
|
||||||
val snackBarText = rootView.context.getString(R.string.successfully_removed_from_playlist, shortTitle)
|
val snackBarText = rootView.context.getString(
|
||||||
|
R.string.successfully_removed_from_playlist,
|
||||||
|
shortTitle
|
||||||
|
)
|
||||||
Snackbar.make(rootView, snackBarText, Snackbar.LENGTH_LONG)
|
Snackbar.make(rootView, snackBarText, Snackbar.LENGTH_LONG)
|
||||||
.setTextMaxLines(3)
|
.setTextMaxLines(3)
|
||||||
.setAction(R.string.undo) {
|
.setAction(R.string.undo) {
|
||||||
reAddToPlaylist(appContext, video, sortedFeedPosition, originalPlaylistPosition)
|
reAddToPlaylist(
|
||||||
|
appContext,
|
||||||
|
video,
|
||||||
|
sortedFeedPosition,
|
||||||
|
originalPlaylistPosition
|
||||||
|
)
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -65,7 +65,8 @@ class AddToPlaylistDialog : DialogFragment() {
|
|||||||
getButton(DialogInterface.BUTTON_NEGATIVE).setOnClickListener {
|
getButton(DialogInterface.BUTTON_NEGATIVE).setOnClickListener {
|
||||||
CreatePlaylistDialog().show(childFragmentManager, null)
|
CreatePlaylistDialog().show(childFragmentManager, null)
|
||||||
}
|
}
|
||||||
getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener {val index = binding.playlistsSpinner.selectedItemPosition
|
getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener {
|
||||||
|
val index = binding.playlistsSpinner.selectedItemPosition
|
||||||
val playlist = playlists[index]
|
val playlist = playlists[index]
|
||||||
viewModel.lastSelectedPlaylistId = playlist.id!!
|
viewModel.lastSelectedPlaylistId = playlist.id!!
|
||||||
dialog?.hide()
|
dialog?.hide()
|
||||||
@ -73,7 +74,6 @@ class AddToPlaylistDialog : DialogFragment() {
|
|||||||
addToPlaylist(playlist.id, playlist.name!!)
|
addToPlaylist(playlist.id, playlist.name!!)
|
||||||
dialog?.dismiss()
|
dialog?.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,11 @@ class CustomInstanceDialog : DialogFragment() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// at least one empty input
|
// at least one empty input
|
||||||
Toast.makeText(requireContext(), R.string.empty_instance, Toast.LENGTH_SHORT).show()
|
Toast.makeText(
|
||||||
|
requireContext(),
|
||||||
|
R.string.empty_instance,
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
|
@ -25,11 +25,11 @@ import com.github.libretube.helpers.PreferenceHelper
|
|||||||
import com.github.libretube.parcelable.DownloadData
|
import com.github.libretube.parcelable.DownloadData
|
||||||
import com.github.libretube.util.TextUtils
|
import com.github.libretube.util.TextUtils
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
import java.io.IOException
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
import java.io.IOException
|
|
||||||
|
|
||||||
class DownloadDialog : DialogFragment() {
|
class DownloadDialog : DialogFragment() {
|
||||||
private lateinit var videoId: String
|
private lateinit var videoId: String
|
||||||
|
@ -5,7 +5,6 @@ import android.util.Log
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.core.view.children
|
import androidx.core.view.children
|
||||||
import androidx.core.view.isGone
|
import androidx.core.view.isGone
|
||||||
@ -32,11 +31,11 @@ import com.github.libretube.ui.adapters.VideosAdapter
|
|||||||
import com.github.libretube.ui.dialogs.ShareDialog
|
import com.github.libretube.ui.dialogs.ShareDialog
|
||||||
import com.github.libretube.ui.extensions.setupSubscriptionButton
|
import com.github.libretube.ui.extensions.setupSubscriptionButton
|
||||||
import com.github.libretube.util.deArrow
|
import com.github.libretube.util.deArrow
|
||||||
|
import java.io.IOException
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
import java.io.IOException
|
|
||||||
|
|
||||||
class ChannelFragment : Fragment() {
|
class ChannelFragment : Fragment() {
|
||||||
private var _binding: FragmentChannelBinding? = null
|
private var _binding: FragmentChannelBinding? = null
|
||||||
|
@ -115,16 +115,16 @@ import com.github.libretube.util.TextUtils.toTimeInSeconds
|
|||||||
import com.github.libretube.util.YoutubeHlsPlaylistParser
|
import com.github.libretube.util.YoutubeHlsPlaylistParser
|
||||||
import com.github.libretube.util.deArrow
|
import com.github.libretube.util.deArrow
|
||||||
import com.google.android.material.elevation.SurfaceColors
|
import com.google.android.material.elevation.SurfaceColors
|
||||||
|
import java.io.IOException
|
||||||
|
import java.util.*
|
||||||
|
import java.util.concurrent.Executors
|
||||||
|
import kotlin.math.abs
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import kotlinx.serialization.encodeToString
|
import kotlinx.serialization.encodeToString
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
import java.io.IOException
|
|
||||||
import java.util.*
|
|
||||||
import java.util.concurrent.Executors
|
|
||||||
import kotlin.math.abs
|
|
||||||
|
|
||||||
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
|
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
|
||||||
class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||||
@ -596,8 +596,11 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
|
|
||||||
binding.relatedRecView.layoutManager = LinearLayoutManager(
|
binding.relatedRecView.layoutManager = LinearLayoutManager(
|
||||||
context,
|
context,
|
||||||
if (resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT)
|
if (resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
LinearLayoutManager.HORIZONTAL else LinearLayoutManager.VERTICAL,
|
LinearLayoutManager.HORIZONTAL
|
||||||
|
} else {
|
||||||
|
LinearLayoutManager.VERTICAL
|
||||||
|
},
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -887,8 +890,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
// set media sources for the player
|
// set media sources for the player
|
||||||
initStreamSources()
|
initStreamSources()
|
||||||
|
|
||||||
if (PreferenceHelper.getBoolean(PreferenceKeys.AUTO_FULLSCREEN_SHORTS, false)
|
if (PreferenceHelper.getBoolean(PreferenceKeys.AUTO_FULLSCREEN_SHORTS, false) &&
|
||||||
&& isShort && binding.playerMotionLayout.progress == 0f
|
isShort && binding.playerMotionLayout.progress == 0f
|
||||||
) {
|
) {
|
||||||
setFullscreen()
|
setFullscreen()
|
||||||
playerBinding.fullscreen.isVisible = true
|
playerBinding.fullscreen.isVisible = true
|
||||||
@ -1024,7 +1027,11 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
streams.relatedStreams.filter { !it.title.isNullOrBlank() }.toMutableList(),
|
streams.relatedStreams.filter { !it.title.isNullOrBlank() }.toMutableList(),
|
||||||
forceMode = if (
|
forceMode = if (
|
||||||
resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
|
resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
|
||||||
) VideosAdapter.Companion.ForceMode.RELATED else VideosAdapter.Companion.ForceMode.TRENDING
|
) {
|
||||||
|
VideosAdapter.Companion.ForceMode.RELATED
|
||||||
|
} else {
|
||||||
|
VideosAdapter.Companion.ForceMode.TRENDING
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,11 +19,11 @@ import com.github.libretube.ui.activities.SettingsActivity
|
|||||||
import com.github.libretube.ui.adapters.VideosAdapter
|
import com.github.libretube.ui.adapters.VideosAdapter
|
||||||
import com.github.libretube.util.deArrow
|
import com.github.libretube.util.deArrow
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
import java.io.IOException
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
import java.io.IOException
|
|
||||||
|
|
||||||
class TrendsFragment : Fragment() {
|
class TrendsFragment : Fragment() {
|
||||||
private var _binding: FragmentTrendsBinding? = null
|
private var _binding: FragmentTrendsBinding? = null
|
||||||
|
@ -6,7 +6,6 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewGroup.MarginLayoutParams
|
import android.view.ViewGroup.MarginLayoutParams
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.core.view.setMargins
|
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -212,8 +212,11 @@ open class CustomExoPlayerView(
|
|||||||
|
|
||||||
fun toggleSystemBars(showBars: Boolean) {
|
fun toggleSystemBars(showBars: Boolean) {
|
||||||
getWindow().toggleSystemBars(
|
getWindow().toggleSystemBars(
|
||||||
types = if (showBars) WindowHelper.getGestureControlledBars(context)
|
types = if (showBars) {
|
||||||
else WindowInsetsCompat.Type.systemBars(),
|
WindowHelper.getGestureControlledBars(context)
|
||||||
|
} else {
|
||||||
|
WindowInsetsCompat.Type.systemBars()
|
||||||
|
},
|
||||||
showBars = showBars
|
showBars = showBars
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,6 @@ import android.os.Build
|
|||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.ui.dialogs.ShareDialog
|
import com.github.libretube.ui.dialogs.ShareDialog
|
||||||
import kotlinx.datetime.toJavaLocalDate
|
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
@ -17,6 +14,9 @@ import java.time.format.FormatStyle
|
|||||||
import java.time.temporal.ChronoUnit
|
import java.time.temporal.ChronoUnit
|
||||||
import kotlin.time.Duration
|
import kotlin.time.Duration
|
||||||
import kotlinx.datetime.LocalDate as KotlinLocalDate
|
import kotlinx.datetime.LocalDate as KotlinLocalDate
|
||||||
|
import kotlinx.datetime.toJavaLocalDate
|
||||||
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||||
|
|
||||||
object TextUtils {
|
object TextUtils {
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user