diff --git a/app/src/main/java/com/github/libretube/api/PipedApi.kt b/app/src/main/java/com/github/libretube/api/PipedApi.kt index 7daac2e6b..92a355884 100644 --- a/app/src/main/java/com/github/libretube/api/PipedApi.kt +++ b/app/src/main/java/com/github/libretube/api/PipedApi.kt @@ -1,6 +1,24 @@ 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.GET import retrofit2.http.Header diff --git a/app/src/main/java/com/github/libretube/api/SubscriptionHelper.kt b/app/src/main/java/com/github/libretube/api/SubscriptionHelper.kt index 48656bbd0..199c50d5d 100644 --- a/app/src/main/java/com/github/libretube/api/SubscriptionHelper.kt +++ b/app/src/main/java/com/github/libretube/api/SubscriptionHelper.kt @@ -11,7 +11,6 @@ import com.github.libretube.db.DatabaseHolder.Database import com.github.libretube.db.obj.LocalSubscription import com.github.libretube.extensions.TAG import com.github.libretube.helpers.PreferenceHelper -import com.github.libretube.util.deArrow import com.google.android.material.dialog.MaterialAlertDialogBuilder import kotlinx.coroutines.runBlocking diff --git a/app/src/main/java/com/github/libretube/api/obj/PipedStream.kt b/app/src/main/java/com/github/libretube/api/obj/PipedStream.kt index e4e1fa65d..52a26d545 100644 --- a/app/src/main/java/com/github/libretube/api/obj/PipedStream.kt +++ b/app/src/main/java/com/github/libretube/api/obj/PipedStream.kt @@ -2,8 +2,8 @@ package com.github.libretube.api.obj import com.github.libretube.db.obj.DownloadItem import com.github.libretube.enums.FileType -import kotlin.io.path.Path import kotlinx.serialization.Serializable +import kotlin.io.path.Path @Serializable data class PipedStream( diff --git a/app/src/main/java/com/github/libretube/api/obj/Streams.kt b/app/src/main/java/com/github/libretube/api/obj/Streams.kt index d7bb52ccd..db3223b94 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Streams.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Streams.kt @@ -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( diff --git a/app/src/main/java/com/github/libretube/db/Converters.kt b/app/src/main/java/com/github/libretube/db/Converters.kt index c4e38ee43..71bfb289a 100644 --- a/app/src/main/java/com/github/libretube/db/Converters.kt +++ b/app/src/main/java/com/github/libretube/db/Converters.kt @@ -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 diff --git a/app/src/main/java/com/github/libretube/db/obj/Download.kt b/app/src/main/java/com/github/libretube/db/obj/Download.kt index 447be46e4..e1a4862b3 100644 --- a/app/src/main/java/com/github/libretube/db/obj/Download.kt +++ b/app/src/main/java/com/github/libretube/db/obj/Download.kt @@ -3,8 +3,8 @@ package com.github.libretube.db.obj import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey -import java.nio.file.Path import kotlinx.datetime.LocalDate +import java.nio.file.Path @Entity(tableName = "download") data class Download( diff --git a/app/src/main/java/com/github/libretube/extensions/ContentLength.kt b/app/src/main/java/com/github/libretube/extensions/ContentLength.kt index f52ea8e12..f3ebcd8a7 100644 --- a/app/src/main/java/com/github/libretube/extensions/ContentLength.kt +++ b/app/src/main/java/com/github/libretube/extensions/ContentLength.kt @@ -1,9 +1,9 @@ package com.github.libretube.extensions -import java.net.HttpURLConnection -import java.net.URL import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext +import java.net.HttpURLConnection +import java.net.URL suspend fun URL.getContentLength(): Long? { try { diff --git a/app/src/main/java/com/github/libretube/helpers/DashHelper.kt b/app/src/main/java/com/github/libretube/helpers/DashHelper.kt index a21e5d8a2..0d2c8c022 100644 --- a/app/src/main/java/com/github/libretube/helpers/DashHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/DashHelper.kt @@ -2,13 +2,13 @@ package com.github.libretube.helpers import com.github.libretube.api.obj.PipedStream import com.github.libretube.api.obj.Streams +import org.w3c.dom.Document +import org.w3c.dom.Element import java.io.StringWriter import javax.xml.parsers.DocumentBuilderFactory import javax.xml.transform.TransformerFactory import javax.xml.transform.dom.DOMSource 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 diff --git a/app/src/main/java/com/github/libretube/helpers/ImportHelper.kt b/app/src/main/java/com/github/libretube/helpers/ImportHelper.kt index dff2dd702..9c417e789 100644 --- a/app/src/main/java/com/github/libretube/helpers/ImportHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/ImportHelper.kt @@ -20,11 +20,11 @@ import com.github.libretube.obj.NewPipeSubscriptions import com.github.libretube.obj.PipedImportPlaylist import com.github.libretube.obj.PipedPlaylistFile import com.github.libretube.ui.dialogs.ShareDialog -import java.util.Date -import java.util.stream.Collectors import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.decodeFromStream import kotlinx.serialization.json.encodeToStream +import java.util.Date +import java.util.stream.Collectors object ImportHelper { /** diff --git a/app/src/main/java/com/github/libretube/helpers/LocaleHelper.kt b/app/src/main/java/com/github/libretube/helpers/LocaleHelper.kt index 62821361c..8cfc9b048 100644 --- a/app/src/main/java/com/github/libretube/helpers/LocaleHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/LocaleHelper.kt @@ -8,7 +8,7 @@ import androidx.core.content.getSystemService import androidx.core.os.ConfigurationCompat import com.github.libretube.constants.PreferenceKeys import com.github.libretube.obj.Country -import java.util.* +import java.util.Locale object LocaleHelper { fun getAppLocale(): Locale { diff --git a/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt b/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt index 3fd1c1a6a..c45361638 100644 --- a/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt @@ -6,7 +6,6 @@ import android.content.Intent import android.content.pm.ActivityInfo import android.net.Uri import android.util.Base64 -import android.util.Log import android.view.accessibility.CaptioningManager import android.widget.Toast import androidx.annotation.OptIn diff --git a/app/src/main/java/com/github/libretube/helpers/ProxyHelper.kt b/app/src/main/java/com/github/libretube/helpers/ProxyHelper.kt index 21f929b6d..f2657b351 100644 --- a/app/src/main/java/com/github/libretube/helpers/ProxyHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/ProxyHelper.kt @@ -3,13 +3,13 @@ package com.github.libretube.helpers import com.github.libretube.api.CronetHelper import com.github.libretube.api.RetrofitInstance import com.github.libretube.constants.PreferenceKeys -import java.net.HttpURLConnection -import java.net.URL import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import okhttp3.HttpUrl.Companion.toHttpUrlOrNull +import java.net.HttpURLConnection +import java.net.URL object ProxyHelper { fun fetchProxyUrl() { diff --git a/app/src/main/java/com/github/libretube/services/DownloadService.kt b/app/src/main/java/com/github/libretube/services/DownloadService.kt index e37d12592..a431dbbdd 100644 --- a/app/src/main/java/com/github/libretube/services/DownloadService.kt +++ b/app/src/main/java/com/github/libretube/services/DownloadService.kt @@ -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_STOP 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.Dispatchers import kotlinx.coroutines.Job @@ -69,6 +57,18 @@ import kotlinx.datetime.toLocalDateTime import okio.buffer import okio.sink 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]. diff --git a/app/src/main/java/com/github/libretube/services/OfflinePlayerService.kt b/app/src/main/java/com/github/libretube/services/OfflinePlayerService.kt index dc0ab986e..94ed1eed5 100644 --- a/app/src/main/java/com/github/libretube/services/OfflinePlayerService.kt +++ b/app/src/main/java/com/github/libretube/services/OfflinePlayerService.kt @@ -32,10 +32,10 @@ import com.github.libretube.helpers.PlayerHelper import com.github.libretube.obj.PlayerNotificationData import com.github.libretube.util.NowPlayingNotification import com.github.libretube.util.PauseableTimer -import kotlin.io.path.exists import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import kotlin.io.path.exists /** * A service to play downloaded audio in the background diff --git a/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt index 2cdea64c0..72a1b1260 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt @@ -53,7 +53,6 @@ import com.github.libretube.util.UpdateChecker import com.google.android.material.elevation.SurfaceColors import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -import okhttp3.internal.toHexString class MainActivity : BaseActivity() { lateinit var binding: ActivityMainBinding diff --git a/app/src/main/java/com/github/libretube/ui/activities/OfflinePlayerActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/OfflinePlayerActivity.kt index d21f14a00..c2278175d 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/OfflinePlayerActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/OfflinePlayerActivity.kt @@ -49,10 +49,10 @@ import com.github.libretube.ui.models.PlayerViewModel import com.github.libretube.util.NowPlayingNotification import com.github.libretube.util.OfflineTimeFrameReceiver import com.github.libretube.util.PauseableTimer -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() { diff --git a/app/src/main/java/com/github/libretube/ui/adapters/DownloadsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/DownloadsAdapter.kt index de6026351..6c1a1b0a1 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/DownloadsAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/DownloadsAdapter.kt @@ -24,11 +24,11 @@ import com.github.libretube.ui.sheets.DownloadOptionsBottomSheet.Companion.DELET import com.github.libretube.ui.viewholders.DownloadsViewHolder import com.github.libretube.util.TextUtils import com.google.android.material.dialog.MaterialAlertDialogBuilder +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.runBlocking import kotlin.io.path.deleteIfExists import kotlin.io.path.exists import kotlin.io.path.fileSize -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.runBlocking class DownloadsAdapter( private val context: Context, diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/BackupDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/BackupDialog.kt index 796d90d61..a731ddafd 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/BackupDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/BackupDialog.kt @@ -15,7 +15,6 @@ import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.obj.BackupFile import com.github.libretube.obj.PipedImportPlaylist 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 kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt index d0503dd2a..ad5759529 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt @@ -24,11 +24,11 @@ import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.parcelable.DownloadData import com.github.libretube.util.TextUtils import com.google.android.material.dialog.MaterialAlertDialogBuilder -import java.io.IOException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import retrofit2.HttpException +import java.io.IOException class DownloadDialog : DialogFragment() { private lateinit var videoId: String diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/SubmitDeArrowDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/SubmitDeArrowDialog.kt index 28a0bbd4a..b57d4af1d 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/SubmitDeArrowDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/SubmitDeArrowDialog.kt @@ -3,7 +3,6 @@ package com.github.libretube.ui.dialogs import android.app.Dialog import android.content.DialogInterface import android.os.Bundle -import android.widget.CompoundButton import androidx.fragment.app.DialogFragment import androidx.lifecycle.lifecycleScope import com.github.libretube.R diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/SubmitSegmentDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/SubmitSegmentDialog.kt index 7754a1fa7..786f27379 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/SubmitSegmentDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/SubmitSegmentDialog.kt @@ -19,7 +19,6 @@ import com.github.libretube.extensions.toastFromMainDispatcher import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.util.TextUtils import com.google.android.material.dialog.MaterialAlertDialogBuilder -import java.lang.Exception import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext diff --git a/app/src/main/java/com/github/libretube/ui/fragments/AudioPlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/AudioPlayerFragment.kt index a8d2fd4f0..7636ed2b9 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/AudioPlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/AudioPlayerFragment.kt @@ -51,8 +51,8 @@ import com.github.libretube.ui.sheets.VideoOptionsBottomSheet import com.github.libretube.util.DataSaverMode import com.github.libretube.util.PlayingQueue import com.google.android.material.elevation.SurfaceColors -import kotlin.math.abs import kotlinx.coroutines.launch +import kotlin.math.abs class AudioPlayerFragment : Fragment(), AudioPlayerOptions { private var _binding: FragmentAudioPlayerBinding? = null diff --git a/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt index 163362714..b32a9bf68 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt @@ -37,11 +37,11 @@ import com.github.libretube.ui.extensions.addOnBottomReachedListener import com.github.libretube.ui.extensions.setupSubscriptionButton import com.github.libretube.ui.sheets.AddChannelToGroupSheet import com.github.libretube.util.deArrow -import java.io.IOException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import retrofit2.HttpException +import java.io.IOException class ChannelFragment : DynamicLayoutManagerFragment() { private var _binding: FragmentChannelBinding? = null diff --git a/app/src/main/java/com/github/libretube/ui/fragments/DownloadsFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/DownloadsFragment.kt index d18a4b7e3..7ac6bf527 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/DownloadsFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/DownloadsFragment.kt @@ -33,12 +33,12 @@ import com.github.libretube.ui.adapters.DownloadsAdapter import com.github.libretube.ui.base.DynamicLayoutManagerFragment import com.github.libretube.ui.viewholders.DownloadsViewHolder import com.google.android.material.dialog.MaterialAlertDialogBuilder -import kotlin.io.path.fileSize import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking +import kotlin.io.path.fileSize class DownloadsFragment : DynamicLayoutManagerFragment() { private var _binding: FragmentDownloadsBinding? = null diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt index 21577851e..bc48954d6 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt @@ -69,6 +69,7 @@ import com.github.libretube.extensions.setMetadata import com.github.libretube.extensions.toID import com.github.libretube.extensions.toastFromMainDispatcher import com.github.libretube.extensions.togglePlayPauseState +import com.github.libretube.extensions.updateIfChanged import com.github.libretube.extensions.updateParameters import com.github.libretube.helpers.BackgroundHelper 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 commentsViewModel.handleLink = this::handleLink updateMaxSheetHeight() - if (commentsViewModel.videoIdLiveData.value != videoId) { - commentsViewModel.videoIdLiveData.postValue(videoId) - } + commentsViewModel.videoIdLiveData.updateIfChanged(videoId) commentsViewModel.channelAvatar = streams.uploaderAvatar CommentsSheet().show(childFragmentManager) } diff --git a/app/src/main/java/com/github/libretube/ui/fragments/WatchHistoryFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/WatchHistoryFragment.kt index 2a09a67f7..6d31b2fe9 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/WatchHistoryFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/WatchHistoryFragment.kt @@ -5,7 +5,6 @@ import android.os.Bundle import android.os.Handler import android.os.Looper import android.os.Parcelable -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup diff --git a/app/src/main/java/com/github/libretube/ui/listeners/SeekbarPreviewListener.kt b/app/src/main/java/com/github/libretube/ui/listeners/SeekbarPreviewListener.kt index 298f68954..228c9257b 100644 --- a/app/src/main/java/com/github/libretube/ui/listeners/SeekbarPreviewListener.kt +++ b/app/src/main/java/com/github/libretube/ui/listeners/SeekbarPreviewListener.kt @@ -10,11 +10,11 @@ import androidx.media3.common.util.UnstableApi import androidx.media3.ui.TimeBar import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding import com.github.libretube.ui.interfaces.TimeFrameReceiver -import kotlin.math.absoluteValue import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import kotlin.math.absoluteValue @UnstableApi class SeekbarPreviewListener( diff --git a/app/src/main/java/com/github/libretube/ui/models/PlayerViewModel.kt b/app/src/main/java/com/github/libretube/ui/models/PlayerViewModel.kt index 9901e9ea3..09a799ac6 100644 --- a/app/src/main/java/com/github/libretube/ui/models/PlayerViewModel.kt +++ b/app/src/main/java/com/github/libretube/ui/models/PlayerViewModel.kt @@ -15,16 +15,14 @@ import com.github.libretube.api.obj.Message import com.github.libretube.api.obj.Segment import com.github.libretube.api.obj.Streams import com.github.libretube.api.obj.Subtitle -import com.github.libretube.constants.PreferenceKeys import com.github.libretube.helpers.PlayerHelper -import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.util.NowPlayingNotification import com.github.libretube.util.deArrow -import java.io.IOException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import kotlinx.serialization.encodeToString import retrofit2.HttpException +import java.io.IOException @UnstableApi class PlayerViewModel : ViewModel() { diff --git a/app/src/main/java/com/github/libretube/ui/models/TrendsViewModel.kt b/app/src/main/java/com/github/libretube/ui/models/TrendsViewModel.kt index 3f634807d..4cc928e3a 100644 --- a/app/src/main/java/com/github/libretube/ui/models/TrendsViewModel.kt +++ b/app/src/main/java/com/github/libretube/ui/models/TrendsViewModel.kt @@ -13,11 +13,11 @@ import com.github.libretube.api.obj.StreamItem import com.github.libretube.extensions.TAG import com.github.libretube.helpers.LocaleHelper import com.github.libretube.util.deArrow -import java.io.IOException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import retrofit2.HttpException +import java.io.IOException class TrendsViewModel : ViewModel() { val trendingVideos = MutableLiveData>() diff --git a/app/src/main/java/com/github/libretube/ui/preferences/BackupRestoreSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/BackupRestoreSettings.kt index c931f1d55..bf17716eb 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/BackupRestoreSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/BackupRestoreSettings.kt @@ -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.RequireRestartDialog import com.google.android.material.dialog.MaterialAlertDialogBuilder -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import kotlinx.serialization.json.Json +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter class BackupRestoreSettings : BasePreferenceFragment() { private val backupDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH:mm:ss") diff --git a/app/src/main/java/com/github/libretube/ui/sheets/PlayingQueueSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/PlayingQueueSheet.kt index ec0e2551a..b7131525b 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/PlayingQueueSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/PlayingQueueSheet.kt @@ -19,7 +19,6 @@ import com.github.libretube.ui.adapters.PlayingQueueAdapter import com.github.libretube.ui.dialogs.AddToPlaylistDialog import com.github.libretube.util.PlayingQueue import com.google.android.material.dialog.MaterialAlertDialogBuilder -import java.lang.IllegalArgumentException import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/github/libretube/ui/views/DescriptionLayout.kt b/app/src/main/java/com/github/libretube/ui/views/DescriptionLayout.kt index 5967f4af0..c1ccc7701 100644 --- a/app/src/main/java/com/github/libretube/ui/views/DescriptionLayout.kt +++ b/app/src/main/java/com/github/libretube/ui/views/DescriptionLayout.kt @@ -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, diff --git a/app/src/main/java/com/github/libretube/util/TextUtils.kt b/app/src/main/java/com/github/libretube/util/TextUtils.kt index db6370537..3d4666faa 100644 --- a/app/src/main/java/com/github/libretube/util/TextUtils.kt +++ b/app/src/main/java/com/github/libretube/util/TextUtils.kt @@ -7,6 +7,7 @@ import android.os.Build import android.text.format.DateUtils import com.github.libretube.BuildConfig import com.github.libretube.R +import kotlinx.datetime.toJavaLocalDate import java.time.Instant import java.time.LocalDateTime import java.time.ZoneId @@ -15,7 +16,6 @@ import java.time.format.FormatStyle import java.time.temporal.ChronoUnit import kotlin.time.Duration import kotlinx.datetime.LocalDate as KotlinLocalDate -import kotlinx.datetime.toJavaLocalDate object TextUtils { /** diff --git a/app/src/main/java/com/github/libretube/util/UpdateChecker.kt b/app/src/main/java/com/github/libretube/util/UpdateChecker.kt index 70a260a9a..3b1bf38bc 100644 --- a/app/src/main/java/com/github/libretube/util/UpdateChecker.kt +++ b/app/src/main/java/com/github/libretube/util/UpdateChecker.kt @@ -12,9 +12,9 @@ import com.github.libretube.constants.IntentData.appUpdateURL import com.github.libretube.extensions.TAG import com.github.libretube.extensions.toastFromMainDispatcher import com.github.libretube.ui.dialogs.UpdateAvailableDialog -import java.util.Locale import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext +import java.util.Locale class UpdateChecker(private val context: Context) { suspend fun checkUpdate(isManualCheck: Boolean = false) { diff --git a/app/src/main/java/com/github/libretube/workers/NotificationWorker.kt b/app/src/main/java/com/github/libretube/workers/NotificationWorker.kt index d6e053250..252771e8c 100644 --- a/app/src/main/java/com/github/libretube/workers/NotificationWorker.kt +++ b/app/src/main/java/com/github/libretube/workers/NotificationWorker.kt @@ -27,11 +27,11 @@ import com.github.libretube.helpers.ImageHelper import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.ui.activities.MainActivity import com.github.libretube.ui.views.TimePickerPreference -import java.time.LocalTime import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.withContext +import java.time.LocalTime /** * The notification worker which checks for new streams in a certain frequency diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 073d32a68..f2f6482f1 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -1,8 +1,7 @@ + android:layout_height="match_parent">