Merge pull request #6001 from Bnyro/master

chore: optimize imports
This commit is contained in:
Bnyro 2024-05-08 16:53:22 +02:00 committed by GitHub
commit 0aa9f15ec4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
36 changed files with 65 additions and 59 deletions

View File

@ -1,6 +1,24 @@
package com.github.libretube.api package com.github.libretube.api
import com.github.libretube.api.obj.* import com.github.libretube.api.obj.Channel
import com.github.libretube.api.obj.ChannelTabResponse
import com.github.libretube.api.obj.CommentsPage
import com.github.libretube.api.obj.DeArrowContent
import com.github.libretube.api.obj.DeleteUserRequest
import com.github.libretube.api.obj.EditPlaylistBody
import com.github.libretube.api.obj.Login
import com.github.libretube.api.obj.Message
import com.github.libretube.api.obj.PipedConfig
import com.github.libretube.api.obj.Playlist
import com.github.libretube.api.obj.Playlists
import com.github.libretube.api.obj.SearchResult
import com.github.libretube.api.obj.SegmentData
import com.github.libretube.api.obj.StreamItem
import com.github.libretube.api.obj.Streams
import com.github.libretube.api.obj.Subscribe
import com.github.libretube.api.obj.Subscribed
import com.github.libretube.api.obj.Subscription
import com.github.libretube.api.obj.Token
import retrofit2.http.Body import retrofit2.http.Body
import retrofit2.http.GET import retrofit2.http.GET
import retrofit2.http.Header import retrofit2.http.Header

View File

@ -11,7 +11,6 @@ import com.github.libretube.db.DatabaseHolder.Database
import com.github.libretube.db.obj.LocalSubscription import com.github.libretube.db.obj.LocalSubscription
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.helpers.PreferenceHelper
import com.github.libretube.util.deArrow
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking

View File

@ -2,8 +2,8 @@ package com.github.libretube.api.obj
import com.github.libretube.db.obj.DownloadItem import com.github.libretube.db.obj.DownloadItem
import com.github.libretube.enums.FileType import com.github.libretube.enums.FileType
import kotlin.io.path.Path
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlin.io.path.Path
@Serializable @Serializable
data class PipedStream( data class PipedStream(

View File

@ -5,12 +5,12 @@ import com.github.libretube.enums.FileType
import com.github.libretube.helpers.ProxyHelper import com.github.libretube.helpers.ProxyHelper
import com.github.libretube.json.SafeInstantSerializer import com.github.libretube.json.SafeInstantSerializer
import com.github.libretube.parcelable.DownloadData import com.github.libretube.parcelable.DownloadData
import kotlin.io.path.Path
import kotlinx.datetime.Instant import kotlinx.datetime.Instant
import kotlinx.datetime.TimeZone import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime import kotlinx.datetime.toLocalDateTime
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlin.io.path.Path
@Serializable @Serializable
data class Streams( data class Streams(

View File

@ -2,11 +2,11 @@ package com.github.libretube.db
import androidx.room.TypeConverter import androidx.room.TypeConverter
import com.github.libretube.api.JsonHelper import com.github.libretube.api.JsonHelper
import java.nio.file.Path
import kotlin.io.path.Path
import kotlinx.datetime.LocalDate import kotlinx.datetime.LocalDate
import kotlinx.datetime.toLocalDate import kotlinx.datetime.toLocalDate
import kotlinx.serialization.encodeToString import kotlinx.serialization.encodeToString
import java.nio.file.Path
import kotlin.io.path.Path
object Converters { object Converters {
@TypeConverter @TypeConverter

View File

@ -3,8 +3,8 @@ package com.github.libretube.db.obj
import androidx.room.ColumnInfo import androidx.room.ColumnInfo
import androidx.room.Entity import androidx.room.Entity
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import java.nio.file.Path
import kotlinx.datetime.LocalDate import kotlinx.datetime.LocalDate
import java.nio.file.Path
@Entity(tableName = "download") @Entity(tableName = "download")
data class Download( data class Download(

View File

@ -1,9 +1,9 @@
package com.github.libretube.extensions package com.github.libretube.extensions
import java.net.HttpURLConnection
import java.net.URL
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.net.HttpURLConnection
import java.net.URL
suspend fun URL.getContentLength(): Long? { suspend fun URL.getContentLength(): Long? {
try { try {

View File

@ -2,13 +2,13 @@ package com.github.libretube.helpers
import com.github.libretube.api.obj.PipedStream import com.github.libretube.api.obj.PipedStream
import com.github.libretube.api.obj.Streams import com.github.libretube.api.obj.Streams
import org.w3c.dom.Document
import org.w3c.dom.Element
import java.io.StringWriter import java.io.StringWriter
import javax.xml.parsers.DocumentBuilderFactory import javax.xml.parsers.DocumentBuilderFactory
import javax.xml.transform.TransformerFactory import javax.xml.transform.TransformerFactory
import javax.xml.transform.dom.DOMSource import javax.xml.transform.dom.DOMSource
import javax.xml.transform.stream.StreamResult import javax.xml.transform.stream.StreamResult
import org.w3c.dom.Document
import org.w3c.dom.Element
// Based off of https://github.com/TeamPiped/Piped/blob/master/src/utils/DashUtils.js // Based off of https://github.com/TeamPiped/Piped/blob/master/src/utils/DashUtils.js

View File

@ -20,11 +20,11 @@ import com.github.libretube.obj.NewPipeSubscriptions
import com.github.libretube.obj.PipedImportPlaylist import com.github.libretube.obj.PipedImportPlaylist
import com.github.libretube.obj.PipedPlaylistFile import com.github.libretube.obj.PipedPlaylistFile
import com.github.libretube.ui.dialogs.ShareDialog import com.github.libretube.ui.dialogs.ShareDialog
import java.util.Date
import java.util.stream.Collectors
import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.decodeFromStream import kotlinx.serialization.json.decodeFromStream
import kotlinx.serialization.json.encodeToStream import kotlinx.serialization.json.encodeToStream
import java.util.Date
import java.util.stream.Collectors
object ImportHelper { object ImportHelper {
/** /**

View File

@ -8,7 +8,7 @@ import androidx.core.content.getSystemService
import androidx.core.os.ConfigurationCompat import androidx.core.os.ConfigurationCompat
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.obj.Country import com.github.libretube.obj.Country
import java.util.* import java.util.Locale
object LocaleHelper { object LocaleHelper {
fun getAppLocale(): Locale { fun getAppLocale(): Locale {

View File

@ -6,7 +6,6 @@ import android.content.Intent
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.net.Uri import android.net.Uri
import android.util.Base64 import android.util.Base64
import android.util.Log
import android.view.accessibility.CaptioningManager import android.view.accessibility.CaptioningManager
import android.widget.Toast import android.widget.Toast
import androidx.annotation.OptIn import androidx.annotation.OptIn

View File

@ -3,13 +3,13 @@ package com.github.libretube.helpers
import com.github.libretube.api.CronetHelper import com.github.libretube.api.CronetHelper
import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.RetrofitInstance
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import java.net.HttpURLConnection
import java.net.URL
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 okhttp3.HttpUrl.Companion.toHttpUrlOrNull import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import java.net.HttpURLConnection
import java.net.URL
object ProxyHelper { object ProxyHelper {
fun fetchProxyUrl() { fun fetchProxyUrl() {

View File

@ -42,18 +42,6 @@ import com.github.libretube.receivers.NotificationReceiver.Companion.ACTION_DOWN
import com.github.libretube.receivers.NotificationReceiver.Companion.ACTION_DOWNLOAD_RESUME import com.github.libretube.receivers.NotificationReceiver.Companion.ACTION_DOWNLOAD_RESUME
import com.github.libretube.receivers.NotificationReceiver.Companion.ACTION_DOWNLOAD_STOP import com.github.libretube.receivers.NotificationReceiver.Companion.ACTION_DOWNLOAD_STOP
import com.github.libretube.ui.activities.MainActivity import com.github.libretube.ui.activities.MainActivity
import java.io.File
import java.net.HttpURLConnection
import java.net.SocketTimeoutException
import java.net.URL
import java.nio.file.Path
import java.nio.file.StandardOpenOption
import java.util.concurrent.Executors
import kotlin.io.path.createFile
import kotlin.io.path.deleteIfExists
import kotlin.io.path.div
import kotlin.io.path.fileSize
import kotlin.math.min
import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
@ -69,6 +57,18 @@ import kotlinx.datetime.toLocalDateTime
import okio.buffer import okio.buffer
import okio.sink import okio.sink
import okio.source import okio.source
import java.io.File
import java.net.HttpURLConnection
import java.net.SocketTimeoutException
import java.net.URL
import java.nio.file.Path
import java.nio.file.StandardOpenOption
import java.util.concurrent.Executors
import kotlin.io.path.createFile
import kotlin.io.path.deleteIfExists
import kotlin.io.path.div
import kotlin.io.path.fileSize
import kotlin.math.min
/** /**
* Download service with custom implementation of downloading using [HttpURLConnection]. * Download service with custom implementation of downloading using [HttpURLConnection].

View File

@ -32,10 +32,10 @@ import com.github.libretube.helpers.PlayerHelper
import com.github.libretube.obj.PlayerNotificationData import com.github.libretube.obj.PlayerNotificationData
import com.github.libretube.util.NowPlayingNotification import com.github.libretube.util.NowPlayingNotification
import com.github.libretube.util.PauseableTimer import com.github.libretube.util.PauseableTimer
import kotlin.io.path.exists
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 kotlin.io.path.exists
/** /**
* A service to play downloaded audio in the background * A service to play downloaded audio in the background

View File

@ -53,7 +53,6 @@ import com.github.libretube.util.UpdateChecker
import com.google.android.material.elevation.SurfaceColors import com.google.android.material.elevation.SurfaceColors
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import okhttp3.internal.toHexString
class MainActivity : BaseActivity() { class MainActivity : BaseActivity() {
lateinit var binding: ActivityMainBinding lateinit var binding: ActivityMainBinding

View File

@ -49,10 +49,10 @@ import com.github.libretube.ui.models.PlayerViewModel
import com.github.libretube.util.NowPlayingNotification import com.github.libretube.util.NowPlayingNotification
import com.github.libretube.util.OfflineTimeFrameReceiver import com.github.libretube.util.OfflineTimeFrameReceiver
import com.github.libretube.util.PauseableTimer import com.github.libretube.util.PauseableTimer
import kotlin.io.path.exists
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 kotlin.io.path.exists
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class) @androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
class OfflinePlayerActivity : BaseActivity() { class OfflinePlayerActivity : BaseActivity() {

View File

@ -24,11 +24,11 @@ import com.github.libretube.ui.sheets.DownloadOptionsBottomSheet.Companion.DELET
import com.github.libretube.ui.viewholders.DownloadsViewHolder import com.github.libretube.ui.viewholders.DownloadsViewHolder
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 kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlin.io.path.deleteIfExists import kotlin.io.path.deleteIfExists
import kotlin.io.path.exists import kotlin.io.path.exists
import kotlin.io.path.fileSize import kotlin.io.path.fileSize
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
class DownloadsAdapter( class DownloadsAdapter(
private val context: Context, private val context: Context,

View File

@ -15,7 +15,6 @@ import com.github.libretube.helpers.PreferenceHelper
import com.github.libretube.obj.BackupFile import com.github.libretube.obj.BackupFile
import com.github.libretube.obj.PipedImportPlaylist import com.github.libretube.obj.PipedImportPlaylist
import com.github.libretube.obj.PreferenceItem import com.github.libretube.obj.PreferenceItem
import com.github.libretube.ui.dialogs.ShareDialog.Companion.YOUTUBE_FRONTEND_URL
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch

View File

@ -24,11 +24,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

View File

@ -3,7 +3,6 @@ package com.github.libretube.ui.dialogs
import android.app.Dialog import android.app.Dialog
import android.content.DialogInterface import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
import android.widget.CompoundButton
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.github.libretube.R import com.github.libretube.R

View File

@ -19,7 +19,6 @@ import com.github.libretube.extensions.toastFromMainDispatcher
import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.helpers.PreferenceHelper
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.lang.Exception
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext

View File

@ -51,8 +51,8 @@ import com.github.libretube.ui.sheets.VideoOptionsBottomSheet
import com.github.libretube.util.DataSaverMode import com.github.libretube.util.DataSaverMode
import com.github.libretube.util.PlayingQueue import com.github.libretube.util.PlayingQueue
import com.google.android.material.elevation.SurfaceColors import com.google.android.material.elevation.SurfaceColors
import kotlin.math.abs
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlin.math.abs
class AudioPlayerFragment : Fragment(), AudioPlayerOptions { class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
private var _binding: FragmentAudioPlayerBinding? = null private var _binding: FragmentAudioPlayerBinding? = null

View File

@ -37,11 +37,11 @@ import com.github.libretube.ui.extensions.addOnBottomReachedListener
import com.github.libretube.ui.extensions.setupSubscriptionButton import com.github.libretube.ui.extensions.setupSubscriptionButton
import com.github.libretube.ui.sheets.AddChannelToGroupSheet import com.github.libretube.ui.sheets.AddChannelToGroupSheet
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 : DynamicLayoutManagerFragment() { class ChannelFragment : DynamicLayoutManagerFragment() {
private var _binding: FragmentChannelBinding? = null private var _binding: FragmentChannelBinding? = null

View File

@ -33,12 +33,12 @@ import com.github.libretube.ui.adapters.DownloadsAdapter
import com.github.libretube.ui.base.DynamicLayoutManagerFragment import com.github.libretube.ui.base.DynamicLayoutManagerFragment
import com.github.libretube.ui.viewholders.DownloadsViewHolder import com.github.libretube.ui.viewholders.DownloadsViewHolder
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlin.io.path.fileSize
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import kotlin.io.path.fileSize
class DownloadsFragment : DynamicLayoutManagerFragment() { class DownloadsFragment : DynamicLayoutManagerFragment() {
private var _binding: FragmentDownloadsBinding? = null private var _binding: FragmentDownloadsBinding? = null

View File

@ -69,6 +69,7 @@ import com.github.libretube.extensions.setMetadata
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.extensions.toastFromMainDispatcher import com.github.libretube.extensions.toastFromMainDispatcher
import com.github.libretube.extensions.togglePlayPauseState import com.github.libretube.extensions.togglePlayPauseState
import com.github.libretube.extensions.updateIfChanged
import com.github.libretube.extensions.updateParameters import com.github.libretube.extensions.updateParameters
import com.github.libretube.helpers.BackgroundHelper import com.github.libretube.helpers.BackgroundHelper
import com.github.libretube.helpers.ImageHelper import com.github.libretube.helpers.ImageHelper
@ -525,9 +526,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
// set the max height to not cover the currently playing video // set the max height to not cover the currently playing video
commentsViewModel.handleLink = this::handleLink commentsViewModel.handleLink = this::handleLink
updateMaxSheetHeight() updateMaxSheetHeight()
if (commentsViewModel.videoIdLiveData.value != videoId) { commentsViewModel.videoIdLiveData.updateIfChanged(videoId)
commentsViewModel.videoIdLiveData.postValue(videoId)
}
commentsViewModel.channelAvatar = streams.uploaderAvatar commentsViewModel.channelAvatar = streams.uploaderAvatar
CommentsSheet().show(childFragmentManager) CommentsSheet().show(childFragmentManager)
} }

View File

@ -5,7 +5,6 @@ import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.os.Parcelable import android.os.Parcelable
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

View File

@ -10,11 +10,11 @@ import androidx.media3.common.util.UnstableApi
import androidx.media3.ui.TimeBar import androidx.media3.ui.TimeBar
import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding
import com.github.libretube.ui.interfaces.TimeFrameReceiver import com.github.libretube.ui.interfaces.TimeFrameReceiver
import kotlin.math.absoluteValue
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 kotlin.math.absoluteValue
@UnstableApi @UnstableApi
class SeekbarPreviewListener( class SeekbarPreviewListener(

View File

@ -15,16 +15,14 @@ import com.github.libretube.api.obj.Message
import com.github.libretube.api.obj.Segment import com.github.libretube.api.obj.Segment
import com.github.libretube.api.obj.Streams import com.github.libretube.api.obj.Streams
import com.github.libretube.api.obj.Subtitle import com.github.libretube.api.obj.Subtitle
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.helpers.PlayerHelper import com.github.libretube.helpers.PlayerHelper
import com.github.libretube.helpers.PreferenceHelper
import com.github.libretube.util.NowPlayingNotification import com.github.libretube.util.NowPlayingNotification
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.withContext import kotlinx.coroutines.withContext
import kotlinx.serialization.encodeToString import kotlinx.serialization.encodeToString
import retrofit2.HttpException import retrofit2.HttpException
import java.io.IOException
@UnstableApi @UnstableApi
class PlayerViewModel : ViewModel() { class PlayerViewModel : ViewModel() {

View File

@ -13,11 +13,11 @@ import com.github.libretube.api.obj.StreamItem
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.helpers.LocaleHelper import com.github.libretube.helpers.LocaleHelper
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 TrendsViewModel : ViewModel() { class TrendsViewModel : ViewModel() {
val trendingVideos = MutableLiveData<List<StreamItem>>() val trendingVideos = MutableLiveData<List<StreamItem>>()

View File

@ -17,13 +17,13 @@ import com.github.libretube.ui.dialogs.BackupDialog
import com.github.libretube.ui.dialogs.BackupDialog.Companion.BACKUP_DIALOG_REQUEST_KEY import com.github.libretube.ui.dialogs.BackupDialog.Companion.BACKUP_DIALOG_REQUEST_KEY
import com.github.libretube.ui.dialogs.RequireRestartDialog import com.github.libretube.ui.dialogs.RequireRestartDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
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.json.Json import kotlinx.serialization.json.Json
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
class BackupRestoreSettings : BasePreferenceFragment() { class BackupRestoreSettings : BasePreferenceFragment() {
private val backupDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH:mm:ss") private val backupDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH:mm:ss")

View File

@ -19,7 +19,6 @@ import com.github.libretube.ui.adapters.PlayingQueueAdapter
import com.github.libretube.ui.dialogs.AddToPlaylistDialog import com.github.libretube.ui.dialogs.AddToPlaylistDialog
import com.github.libretube.util.PlayingQueue import com.github.libretube.util.PlayingQueue
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.lang.IllegalArgumentException
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch

View File

@ -19,9 +19,9 @@ import com.github.libretube.ui.activities.VideoTagsAdapter
import com.github.libretube.util.HtmlParser import com.github.libretube.util.HtmlParser
import com.github.libretube.util.LinkHandler import com.github.libretube.util.LinkHandler
import com.github.libretube.util.TextUtils import com.github.libretube.util.TextUtils
import java.util.Locale
import kotlinx.datetime.TimeZone import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime import kotlinx.datetime.toLocalDateTime
import java.util.Locale
class DescriptionLayout( class DescriptionLayout(
context: Context, context: Context,

View File

@ -7,6 +7,7 @@ import android.os.Build
import android.text.format.DateUtils import android.text.format.DateUtils
import com.github.libretube.BuildConfig import com.github.libretube.BuildConfig
import com.github.libretube.R import com.github.libretube.R
import kotlinx.datetime.toJavaLocalDate
import java.time.Instant import java.time.Instant
import java.time.LocalDateTime import java.time.LocalDateTime
import java.time.ZoneId import java.time.ZoneId
@ -15,7 +16,6 @@ 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
object TextUtils { object TextUtils {
/** /**

View File

@ -12,9 +12,9 @@ import com.github.libretube.constants.IntentData.appUpdateURL
import com.github.libretube.extensions.TAG import com.github.libretube.extensions.TAG
import com.github.libretube.extensions.toastFromMainDispatcher import com.github.libretube.extensions.toastFromMainDispatcher
import com.github.libretube.ui.dialogs.UpdateAvailableDialog import com.github.libretube.ui.dialogs.UpdateAvailableDialog
import java.util.Locale
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.util.Locale
class UpdateChecker(private val context: Context) { class UpdateChecker(private val context: Context) {
suspend fun checkUpdate(isManualCheck: Boolean = false) { suspend fun checkUpdate(isManualCheck: Boolean = false) {

View File

@ -27,11 +27,11 @@ import com.github.libretube.helpers.ImageHelper
import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.helpers.PreferenceHelper
import com.github.libretube.ui.activities.MainActivity import com.github.libretube.ui.activities.MainActivity
import com.github.libretube.ui.views.TimePickerPreference import com.github.libretube.ui.views.TimePickerPreference
import java.time.LocalTime
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.time.LocalTime
/** /**
* The notification worker which checks for new streams in a certain frequency * The notification worker which checks for new streams in a certain frequency

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto">
<ProgressBar <ProgressBar
android:id="@+id/progress" android:id="@+id/progress"