diff --git a/app/src/main/java/com/github/libretube/LibreTubeApp.kt b/app/src/main/java/com/github/libretube/LibreTubeApp.kt index 64a4631713..45d0004ebd 100644 --- a/app/src/main/java/com/github/libretube/LibreTubeApp.kt +++ b/app/src/main/java/com/github/libretube/LibreTubeApp.kt @@ -49,7 +49,7 @@ class LibreTubeApp : Application() { */ NotificationHelper.enqueueWork( context = this, - existingPeriodicWorkPolicy = ExistingPeriodicWorkPolicy.KEEP + existingPeriodicWorkPolicy = ExistingPeriodicWorkPolicy.KEEP, ) /** @@ -76,21 +76,21 @@ class LibreTubeApp : Application() { private fun initializeNotificationChannels() { val downloadChannel = NotificationChannelCompat.Builder( DOWNLOAD_CHANNEL_ID, - NotificationManagerCompat.IMPORTANCE_LOW + NotificationManagerCompat.IMPORTANCE_LOW, ) .setName(getString(R.string.download_channel_name)) .setDescription(getString(R.string.download_channel_description)) .build() val backgroundChannel = NotificationChannelCompat.Builder( BACKGROUND_CHANNEL_ID, - NotificationManagerCompat.IMPORTANCE_LOW + NotificationManagerCompat.IMPORTANCE_LOW, ) .setName(getString(R.string.background_channel_name)) .setDescription(getString(R.string.background_channel_description)) .build() val pushChannel = NotificationChannelCompat.Builder( PUSH_CHANNEL_ID, - NotificationManagerCompat.IMPORTANCE_DEFAULT + NotificationManagerCompat.IMPORTANCE_DEFAULT, ) .setName(getString(R.string.push_channel_name)) .setDescription(getString(R.string.push_channel_description)) @@ -101,8 +101,8 @@ class LibreTubeApp : Application() { listOf( downloadChannel, backgroundChannel, - pushChannel - ) + pushChannel, + ), ) } 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 e436b83102..c7a5aee82c 100644 --- a/app/src/main/java/com/github/libretube/api/PipedApi.kt +++ b/app/src/main/java/com/github/libretube/api/PipedApi.kt @@ -41,26 +41,26 @@ interface PipedApi { @GET("sponsors/{videoId}") suspend fun getSegments( @Path("videoId") videoId: String, - @Query("category") category: String + @Query("category") category: String, ): SegmentData @GET("nextpage/comments/{videoId}") suspend fun getCommentsNextPage( @Path("videoId") videoId: String, - @Query("nextpage") nextPage: String + @Query("nextpage") nextPage: String, ): CommentsPage @GET("search") suspend fun getSearchResults( @Query("q") searchQuery: String, - @Query("filter") filter: String + @Query("filter") filter: String, ): SearchResult @GET("nextpage/search") suspend fun getSearchResultsNextPage( @Query("q") searchQuery: String, @Query("filter") filter: String, - @Query("nextpage") nextPage: String + @Query("nextpage") nextPage: String, ): SearchResult @GET("suggestions") @@ -72,7 +72,7 @@ interface PipedApi { @GET("channels/tabs") suspend fun getChannelTab( @Query("data") data: String, - @Query("nextpage") nextPage: String? = null + @Query("nextpage") nextPage: String? = null, ): ChannelTabResponse @GET("user/{name}") @@ -81,7 +81,7 @@ interface PipedApi { @GET("nextpage/channel/{channelId}") suspend fun getChannelNextPage( @Path("channelId") channelId: String, - @Query("nextpage") nextPage: String + @Query("nextpage") nextPage: String, ): Channel @GET("playlists/{playlistId}") @@ -90,7 +90,7 @@ interface PipedApi { @GET("nextpage/playlists/{playlistId}") suspend fun getPlaylistNextPage( @Path("playlistId") playlistId: String, - @Query("nextpage") nextPage: String + @Query("nextpage") nextPage: String, ): Playlist @POST("login") @@ -102,7 +102,7 @@ interface PipedApi { @POST("user/delete") suspend fun deleteAccount( @Header("Authorization") token: String, - @Body password: DeleteUserRequest + @Body password: DeleteUserRequest, ) @GET("feed") @@ -110,18 +110,18 @@ interface PipedApi { @GET("feed/unauthenticated") suspend fun getUnauthenticatedFeed( - @Query("channels") channels: String + @Query("channels") channels: String, ): List @POST("feed/unauthenticated") suspend fun getUnauthenticatedFeed( - @Body channels: List + @Body channels: List, ): List @GET("subscribed") suspend fun isSubscribed( @Query("channelId") channelId: String, - @Header("Authorization") token: String + @Header("Authorization") token: String, ): Subscribed @GET("subscriptions") @@ -129,37 +129,37 @@ interface PipedApi { @GET("subscriptions/unauthenticated") suspend fun unauthenticatedSubscriptions( - @Query("channels") channels: String + @Query("channels") channels: String, ): List @POST("subscriptions/unauthenticated") suspend fun unauthenticatedSubscriptions( - @Body channels: List + @Body channels: List, ): List @POST("subscribe") suspend fun subscribe( @Header("Authorization") token: String, - @Body subscribe: Subscribe + @Body subscribe: Subscribe, ): Message @POST("unsubscribe") suspend fun unsubscribe( @Header("Authorization") token: String, - @Body subscribe: Subscribe + @Body subscribe: Subscribe, ): Message @POST("import") suspend fun importSubscriptions( @Query("override") override: Boolean, @Header("Authorization") token: String, - @Body channels: List + @Body channels: List, ): Message @POST("import/playlist") suspend fun clonePlaylist( @Header("Authorization") token: String, - @Body playlistId: PlaylistId + @Body playlistId: PlaylistId, ): PlaylistId @GET("user/playlists") @@ -168,30 +168,30 @@ interface PipedApi { @POST("user/playlists/rename") suspend fun renamePlaylist( @Header("Authorization") token: String, - @Body playlistId: PlaylistId + @Body playlistId: PlaylistId, ): Message @POST("user/playlists/delete") suspend fun deletePlaylist( @Header("Authorization") token: String, - @Body playlistId: PlaylistId + @Body playlistId: PlaylistId, ): Message @POST("user/playlists/create") suspend fun createPlaylist( @Header("Authorization") token: String, - @Body name: Playlists + @Body name: Playlists, ): PlaylistId @POST("user/playlists/add") suspend fun addToPlaylist( @Header("Authorization") token: String, - @Body playlistId: PlaylistId + @Body playlistId: PlaylistId, ): Message @POST("user/playlists/remove") suspend fun removeFromPlaylist( @Header("Authorization") token: String, - @Body playlistId: PlaylistId + @Body playlistId: PlaylistId, ): Message } diff --git a/app/src/main/java/com/github/libretube/api/PlaylistsHelper.kt b/app/src/main/java/com/github/libretube/api/PlaylistsHelper.kt index a999a9cdea..07c2b8ef6e 100644 --- a/app/src/main/java/com/github/libretube/api/PlaylistsHelper.kt +++ b/app/src/main/java/com/github/libretube/api/PlaylistsHelper.kt @@ -36,7 +36,7 @@ object PlaylistsHelper { id = it.playlist.id.toString(), name = it.playlist.name, thumbnail = ProxyHelper.rewriteUrl(it.playlist.thumbnailUrl), - videos = it.videos.size.toLong() + videos = it.videos.size.toLong(), ) } } @@ -54,7 +54,7 @@ object PlaylistsHelper { name = relation.playlist.name, thumbnailUrl = ProxyHelper.rewriteUrl(relation.playlist.thumbnailUrl), videos = relation.videos.size, - relatedStreams = relation.videos.map { it.toStreamItem() } + relatedStreams = relation.videos.map { it.toStreamItem() }, ) } } @@ -117,7 +117,7 @@ object PlaylistsHelper { val transaction = DatabaseHolder.Database.localPlaylistsDao().getAll() .first { it.playlist.id.toString() == playlistId } DatabaseHolder.Database.localPlaylistsDao().removePlaylistVideo( - transaction.videos[index] + transaction.videos[index], ) // set a new playlist thumbnail if the first video got removed if (index == 0) { @@ -128,7 +128,7 @@ object PlaylistsHelper { } else { RetrofitInstance.authApi.removeFromPlaylist( PreferenceHelper.getToken(), - PlaylistId(playlistId = playlistId, index = index) + PlaylistId(playlistId = playlistId, index = index), ).message == "ok" } } @@ -144,7 +144,7 @@ object PlaylistsHelper { playlistId, *playlist.videos.map { StreamItem(url = it) - }.toTypedArray() + }.toTypedArray(), ) } else { // if not logged in, all video information needs to become fetched manually @@ -155,7 +155,7 @@ object PlaylistsHelper { async { runCatching { val stream = RetrofitInstance.api.getStreams(it.first).toStreamItem( - it.first + it.first, ) addToPlaylist(playlistId, stream) } @@ -210,7 +210,7 @@ object PlaylistsHelper { return runCatching { RetrofitInstance.authApi.deletePlaylist( PreferenceHelper.getToken(), - PlaylistId(playlistId) + PlaylistId(playlistId), ).message == "ok" }.getOrDefault(false) } diff --git a/app/src/main/java/com/github/libretube/api/ResettableLazy.kt b/app/src/main/java/com/github/libretube/api/ResettableLazy.kt index 01b479fca7..79fa52e58c 100644 --- a/app/src/main/java/com/github/libretube/api/ResettableLazy.kt +++ b/app/src/main/java/com/github/libretube/api/ResettableLazy.kt @@ -46,8 +46,7 @@ class ResettableLazy(val manager: ResettableLazyManager, val init: () } } -fun resettableLazy(manager: ResettableLazyManager, init: () -> PROPTYPE): - ResettableLazy { +fun resettableLazy(manager: ResettableLazyManager, init: () -> PROPTYPE): ResettableLazy { return ResettableLazy(manager, init) } diff --git a/app/src/main/java/com/github/libretube/api/RetrofitInstance.kt b/app/src/main/java/com/github/libretube/api/RetrofitInstance.kt index 34e852e63a..4897c158ab 100644 --- a/app/src/main/java/com/github/libretube/api/RetrofitInstance.kt +++ b/app/src/main/java/com/github/libretube/api/RetrofitInstance.kt @@ -53,12 +53,12 @@ object RetrofitInstance { if ( PreferenceHelper.getBoolean( PreferenceKeys.AUTH_INSTANCE_TOGGLE, - false + false, ) ) { PreferenceHelper.getString( PreferenceKeys.AUTH_INSTANCE, - PIPED_API_URL + PIPED_API_URL, ) } else { url 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 f92817341b..5e8cb04fec 100644 --- a/app/src/main/java/com/github/libretube/api/SubscriptionHelper.kt +++ b/app/src/main/java/com/github/libretube/api/SubscriptionHelper.kt @@ -53,7 +53,7 @@ object SubscriptionHelper { context: Context, channelId: String, channelName: String?, - onUnsubscribe: () -> Unit + onUnsubscribe: () -> Unit, ) { if (!PreferenceHelper.getBoolean(PreferenceKeys.CONFIRM_UNSUBSCRIBE, false)) { runBlocking { @@ -112,10 +112,10 @@ object SubscriptionHelper { val subscriptions = Database.localSubscriptionDao().getAll().map { it.channelId } when { subscriptions.size > GET_SUBSCRIPTIONS_LIMIT -> RetrofitInstance.authApi.unauthenticatedSubscriptions( - subscriptions + subscriptions, ) else -> RetrofitInstance.authApi.unauthenticatedSubscriptions( - subscriptions.joinToString(",") + subscriptions.joinToString(","), ) } } @@ -129,10 +129,10 @@ object SubscriptionHelper { val subscriptions = Database.localSubscriptionDao().getAll().map { it.channelId } when { subscriptions.size > GET_SUBSCRIPTIONS_LIMIT -> RetrofitInstance.authApi.getUnauthenticatedFeed( - subscriptions + subscriptions, ) else -> RetrofitInstance.authApi.getUnauthenticatedFeed( - subscriptions.joinToString(",") + subscriptions.joinToString(","), ) } } diff --git a/app/src/main/java/com/github/libretube/api/obj/Channel.kt b/app/src/main/java/com/github/libretube/api/obj/Channel.kt index 67573ea8f5..f2cd211462 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Channel.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Channel.kt @@ -13,5 +13,5 @@ data class Channel( val subscriberCount: Long = 0, val verified: Boolean = false, val relatedStreams: List = emptyList(), - val tabs: List = emptyList() + val tabs: List = emptyList(), ) diff --git a/app/src/main/java/com/github/libretube/api/obj/ChannelTab.kt b/app/src/main/java/com/github/libretube/api/obj/ChannelTab.kt index 14e0f86cfd..f8e1606387 100644 --- a/app/src/main/java/com/github/libretube/api/obj/ChannelTab.kt +++ b/app/src/main/java/com/github/libretube/api/obj/ChannelTab.kt @@ -5,5 +5,5 @@ import kotlinx.serialization.Serializable @Serializable data class ChannelTab( val name: String, - val data: String + val data: String, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/ChannelTabResponse.kt b/app/src/main/java/com/github/libretube/api/obj/ChannelTabResponse.kt index 8208239a0f..e21e2d7bba 100644 --- a/app/src/main/java/com/github/libretube/api/obj/ChannelTabResponse.kt +++ b/app/src/main/java/com/github/libretube/api/obj/ChannelTabResponse.kt @@ -5,5 +5,5 @@ import kotlinx.serialization.Serializable @Serializable data class ChannelTabResponse( val content: List = emptyList(), - val nextpage: String? = null + val nextpage: String? = null, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/ChapterSegment.kt b/app/src/main/java/com/github/libretube/api/obj/ChapterSegment.kt index d6019c3255..d9a3cab635 100644 --- a/app/src/main/java/com/github/libretube/api/obj/ChapterSegment.kt +++ b/app/src/main/java/com/github/libretube/api/obj/ChapterSegment.kt @@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable data class ChapterSegment( val title: String, val image: String, - val start: Long + val start: Long, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/Comment.kt b/app/src/main/java/com/github/libretube/api/obj/Comment.kt index 3b779b09fc..4e40a17b10 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Comment.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Comment.kt @@ -15,5 +15,5 @@ data class Comment( val pinned: Boolean, val thumbnail: String, val verified: Boolean, - val replyCount: Long + val replyCount: Long, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/CommentsPage.kt b/app/src/main/java/com/github/libretube/api/obj/CommentsPage.kt index 3f8f83eec0..9271a8339b 100644 --- a/app/src/main/java/com/github/libretube/api/obj/CommentsPage.kt +++ b/app/src/main/java/com/github/libretube/api/obj/CommentsPage.kt @@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable data class CommentsPage( var comments: List = emptyList(), val disabled: Boolean = false, - val nextpage: String? = null + val nextpage: String? = null, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/ContentItem.kt b/app/src/main/java/com/github/libretube/api/obj/ContentItem.kt index 7d1492a660..e2b19dbbbc 100644 --- a/app/src/main/java/com/github/libretube/api/obj/ContentItem.kt +++ b/app/src/main/java/com/github/libretube/api/obj/ContentItem.kt @@ -24,5 +24,5 @@ data class ContentItem( val description: String? = null, val subscribers: Long = -1, val videos: Long = -1, - val verified: Boolean? = null + val verified: Boolean? = null, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/Instances.kt b/app/src/main/java/com/github/libretube/api/obj/Instances.kt index d2fa72114d..3f7a5bdded 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Instances.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Instances.kt @@ -12,5 +12,5 @@ data class Instances( @SerialName("up_to_date") val upToDate: Boolean = true, val cdn: Boolean = false, val registered: Long = 0, - @SerialName("last_checked") val lastChecked: Long = 0 + @SerialName("last_checked") val lastChecked: Long = 0, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/Login.kt b/app/src/main/java/com/github/libretube/api/obj/Login.kt index eb8411491b..b038885de8 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Login.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Login.kt @@ -5,5 +5,5 @@ import kotlinx.serialization.Serializable @Serializable data class Login( val username: String, - val password: String + val password: String, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/Message.kt b/app/src/main/java/com/github/libretube/api/obj/Message.kt index 9fe8bbb612..77457b228c 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Message.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Message.kt @@ -5,5 +5,5 @@ import kotlinx.serialization.Serializable @Serializable data class Message( val error: String? = null, - val message: String? = null + val message: String? = null, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/PipedConfig.kt b/app/src/main/java/com/github/libretube/api/obj/PipedConfig.kt index e7f1c33ad3..ba97508398 100644 --- a/app/src/main/java/com/github/libretube/api/obj/PipedConfig.kt +++ b/app/src/main/java/com/github/libretube/api/obj/PipedConfig.kt @@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable data class PipedConfig( val donationUrl: String? = null, val statusPageUrl: String? = null, - val imageProxyUrl: String? = null + val imageProxyUrl: String? = null, ) 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 246e6e5519..a6ecf58361 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 @@ -19,7 +19,7 @@ data class PipedStream( val height: Int? = null, val fps: Int? = null, val audioTrackName: String? = null, - val audioTrackId: String? = null + val audioTrackId: String? = null, ) { fun getQualityString(fileName: String): String { return "${fileName}_${quality?.replace(" ", "_")}_$format." + diff --git a/app/src/main/java/com/github/libretube/api/obj/Playlist.kt b/app/src/main/java/com/github/libretube/api/obj/Playlist.kt index da7d1f77a5..38d7e0fd8c 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Playlist.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Playlist.kt @@ -13,7 +13,7 @@ data class Playlist( val uploaderUrl: String? = null, val uploaderAvatar: String? = null, val videos: Int = 0, - val relatedStreams: List = emptyList() + val relatedStreams: List = emptyList(), ) { fun toPlaylistBookmark(playlistId: String): PlaylistBookmark { return PlaylistBookmark( @@ -22,7 +22,7 @@ data class Playlist( thumbnailUrl = thumbnailUrl, uploader = uploader, uploaderAvatar = uploaderAvatar, - uploaderUrl = uploaderUrl + uploaderUrl = uploaderUrl, ) } } diff --git a/app/src/main/java/com/github/libretube/api/obj/PlaylistId.kt b/app/src/main/java/com/github/libretube/api/obj/PlaylistId.kt index 3b083deffb..734bd1d577 100644 --- a/app/src/main/java/com/github/libretube/api/obj/PlaylistId.kt +++ b/app/src/main/java/com/github/libretube/api/obj/PlaylistId.kt @@ -8,5 +8,5 @@ data class PlaylistId( val videoId: String? = null, val videoIds: List = emptyList(), val newName: String? = null, - val index: Int = -1 + val index: Int = -1, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/Playlists.kt b/app/src/main/java/com/github/libretube/api/obj/Playlists.kt index 48d7db543b..02266f231a 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Playlists.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Playlists.kt @@ -8,5 +8,5 @@ data class Playlists( var name: String? = null, val shortDescription: String? = null, val thumbnail: String? = null, - val videos: Long = 0 + val videos: Long = 0, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/PreviewFrames.kt b/app/src/main/java/com/github/libretube/api/obj/PreviewFrames.kt index 48966998e8..7802617853 100644 --- a/app/src/main/java/com/github/libretube/api/obj/PreviewFrames.kt +++ b/app/src/main/java/com/github/libretube/api/obj/PreviewFrames.kt @@ -10,5 +10,5 @@ data class PreviewFrames( val totalCount: Int? = null, val durationPerFrame: Int? = null, val framesPerPageX: Int? = null, - val framesPerPageY: Int? = null + val framesPerPageY: Int? = null, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/SearchResult.kt b/app/src/main/java/com/github/libretube/api/obj/SearchResult.kt index 8cdb45d56a..bf9cd11dc1 100644 --- a/app/src/main/java/com/github/libretube/api/obj/SearchResult.kt +++ b/app/src/main/java/com/github/libretube/api/obj/SearchResult.kt @@ -7,5 +7,5 @@ data class SearchResult( val items: List = emptyList(), val nextpage: String? = null, val suggestion: String? = null, - val corrected: Boolean? = null + val corrected: Boolean? = null, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/Segment.kt b/app/src/main/java/com/github/libretube/api/obj/Segment.kt index c1711e417b..32b580afd9 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Segment.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Segment.kt @@ -12,5 +12,5 @@ data class Segment( val segment: List = listOf(), val userID: String? = null, val videoDuration: Double? = null, - val votes: Int? = null + val votes: Int? = null, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/SegmentData.kt b/app/src/main/java/com/github/libretube/api/obj/SegmentData.kt index 4f65720af0..4a3c6572d0 100644 --- a/app/src/main/java/com/github/libretube/api/obj/SegmentData.kt +++ b/app/src/main/java/com/github/libretube/api/obj/SegmentData.kt @@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable data class SegmentData( val hash: String? = null, val segments: List = listOf(), - val videoID: String? = null + val videoID: String? = null, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/StreamItem.kt b/app/src/main/java/com/github/libretube/api/obj/StreamItem.kt index 44c3c965f9..8c273b02de 100644 --- a/app/src/main/java/com/github/libretube/api/obj/StreamItem.kt +++ b/app/src/main/java/com/github/libretube/api/obj/StreamItem.kt @@ -19,7 +19,7 @@ data class StreamItem( val uploaderVerified: Boolean? = null, val uploaded: Long? = null, val shortDescription: String? = null, - val isShort: Boolean = false + val isShort: Boolean = false, ) { fun toLocalPlaylistItem(playlistId: String): LocalPlaylistItem { return LocalPlaylistItem( @@ -31,7 +31,7 @@ data class StreamItem( uploaderUrl = uploaderUrl, uploaderAvatar = uploaderAvatar, uploadDate = uploadedDate, - duration = duration + duration = duration, ) } } 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 182eb41c0d..79eb584ac3 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 @@ -3,9 +3,9 @@ package com.github.libretube.api.obj import com.github.libretube.db.obj.DownloadItem import com.github.libretube.enums.FileType import com.github.libretube.helpers.ProxyHelper -import java.nio.file.Paths import kotlinx.datetime.LocalDate import kotlinx.serialization.Serializable +import java.nio.file.Paths @Serializable data class Streams( @@ -33,7 +33,7 @@ data class Streams( val proxyUrl: String? = null, val chapters: List = emptyList(), val uploaderSubscriberCount: Long = 0, - val previewFrames: List = emptyList() + val previewFrames: List = emptyList(), ) { @Suppress("NewApi") // The Paths class is desugared. fun toDownloadItems( @@ -43,7 +43,7 @@ data class Streams( videoQuality: String?, audioFormat: String?, audioQuality: String?, - subtitleCode: String? + subtitleCode: String?, ): List { val items = mutableListOf() @@ -59,8 +59,8 @@ data class Streams( path = Paths.get(""), url = stream?.url?.let { ProxyHelper.unwrapIfEnabled(it) }, format = videoFormat, - quality = videoQuality - ) + quality = videoQuality, + ), ) } @@ -76,8 +76,8 @@ data class Streams( path = Paths.get(""), url = stream?.url?.let { ProxyHelper.unwrapIfEnabled(it) }, format = audioFormat, - quality = audioQuality - ) + quality = audioQuality, + ), ) } @@ -90,8 +90,8 @@ data class Streams( path = Paths.get(""), url = subtitles.find { it.code == subtitleCode - }?.url?.let { ProxyHelper.unwrapIfEnabled(it) } - ) + }?.url?.let { ProxyHelper.unwrapIfEnabled(it) }, + ), ) } @@ -111,7 +111,7 @@ data class Streams( duration = duration, views = views, uploaderVerified = uploaderVerified, - shortDescription = description + shortDescription = description, ) } } diff --git a/app/src/main/java/com/github/libretube/api/obj/Subscription.kt b/app/src/main/java/com/github/libretube/api/obj/Subscription.kt index b6dbf323b9..dec1ca8924 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Subscription.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Subscription.kt @@ -7,5 +7,5 @@ data class Subscription( val url: String, val name: String, val avatar: String, - val verified: Boolean + val verified: Boolean, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/Subtitle.kt b/app/src/main/java/com/github/libretube/api/obj/Subtitle.kt index 91b6760cde..ac34140f4a 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Subtitle.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Subtitle.kt @@ -8,5 +8,5 @@ data class Subtitle( val mimeType: String? = null, val name: String? = null, val code: String? = null, - val autoGenerated: Boolean? = null + val autoGenerated: Boolean? = null, ) diff --git a/app/src/main/java/com/github/libretube/api/obj/Token.kt b/app/src/main/java/com/github/libretube/api/obj/Token.kt index a551dc7270..036827d0f6 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Token.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Token.kt @@ -5,5 +5,5 @@ import kotlinx.serialization.Serializable @Serializable data class Token( val token: String? = null, - val error: String? = null + val error: String? = null, ) diff --git a/app/src/main/java/com/github/libretube/compat/PictureInPictureParamsCompat.kt b/app/src/main/java/com/github/libretube/compat/PictureInPictureParamsCompat.kt index 317dbaf22b..7dfb8762e4 100644 --- a/app/src/main/java/com/github/libretube/compat/PictureInPictureParamsCompat.kt +++ b/app/src/main/java/com/github/libretube/compat/PictureInPictureParamsCompat.kt @@ -17,7 +17,7 @@ class PictureInPictureParamsCompat private constructor( private val title: CharSequence?, private val subtitle: CharSequence?, private val aspectRatio: Rational?, - private val expandedAspectRatio: Rational? + private val expandedAspectRatio: Rational?, ) { @RequiresApi(Build.VERSION_CODES.O) fun toPictureInPictureParams(): PictureInPictureParams { @@ -109,7 +109,7 @@ class PictureInPictureParamsCompat private constructor( title, subtitle, aspectRatio, - expandedAspectRatio + expandedAspectRatio, ) } } diff --git a/app/src/main/java/com/github/libretube/db/AppDatabase.kt b/app/src/main/java/com/github/libretube/db/AppDatabase.kt index 54aceb9b66..77b9f364e2 100644 --- a/app/src/main/java/com/github/libretube/db/AppDatabase.kt +++ b/app/src/main/java/com/github/libretube/db/AppDatabase.kt @@ -37,15 +37,15 @@ import com.github.libretube.db.obj.WatchPosition LocalPlaylistItem::class, Download::class, DownloadItem::class, - SubscriptionGroup::class + SubscriptionGroup::class, ], version = 11, autoMigrations = [ AutoMigration(from = 7, to = 8), AutoMigration(from = 8, to = 9), AutoMigration(from = 9, to = 10), - AutoMigration(from = 10, to = 11) - ] + AutoMigration(from = 10, to = 11), + ], ) @TypeConverters(Converters::class) abstract class AppDatabase : RoomDatabase() { 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 340457c45d..7cfb4f3bc0 100644 --- a/app/src/main/java/com/github/libretube/db/Converters.kt +++ b/app/src/main/java/com/github/libretube/db/Converters.kt @@ -2,12 +2,12 @@ package com.github.libretube.db import androidx.room.TypeConverter import com.github.libretube.api.JsonHelper -import java.nio.file.Path -import java.nio.file.Paths import kotlinx.datetime.LocalDate import kotlinx.datetime.toLocalDate import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString +import java.nio.file.Path +import java.nio.file.Paths object Converters { @TypeConverter diff --git a/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt b/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt index a613b4f86a..7c489f5a3a 100644 --- a/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt +++ b/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt @@ -22,7 +22,7 @@ object DatabaseHelper { streams.uploaderUrl.toID(), streams.uploaderAvatar, streams.thumbnailUrl, - streams.duration + streams.duration, ) Database.watchHistoryDao().insert(watchHistoryItem) val maxHistorySize = PreferenceHelper.getString(PreferenceKeys.WATCH_HISTORY_SIZE, "100") diff --git a/app/src/main/java/com/github/libretube/db/obj/CustomInstance.kt b/app/src/main/java/com/github/libretube/db/obj/CustomInstance.kt index e2d9d92495..277d008b8f 100644 --- a/app/src/main/java/com/github/libretube/db/obj/CustomInstance.kt +++ b/app/src/main/java/com/github/libretube/db/obj/CustomInstance.kt @@ -10,5 +10,5 @@ import kotlinx.serialization.Serializable class CustomInstance( @PrimaryKey var name: String = "", @ColumnInfo var apiUrl: String = "", - @ColumnInfo var frontendUrl: String = "" + @ColumnInfo var frontendUrl: String = "", ) 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 a30953dc2b..11cba266f0 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 @@ -2,8 +2,8 @@ package com.github.libretube.db.obj 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( @@ -13,5 +13,5 @@ data class Download( val description: String = "", val uploader: String = "", val uploadDate: LocalDate? = null, - val thumbnailPath: Path? = null + val thumbnailPath: Path? = null, ) diff --git a/app/src/main/java/com/github/libretube/db/obj/DownloadItem.kt b/app/src/main/java/com/github/libretube/db/obj/DownloadItem.kt index c309657e55..83557f6c64 100644 --- a/app/src/main/java/com/github/libretube/db/obj/DownloadItem.kt +++ b/app/src/main/java/com/github/libretube/db/obj/DownloadItem.kt @@ -15,9 +15,9 @@ import java.nio.file.Path entity = Download::class, parentColumns = ["videoId"], childColumns = ["videoId"], - onDelete = ForeignKey.CASCADE - ) - ] + onDelete = ForeignKey.CASCADE, + ), + ], ) data class DownloadItem( @PrimaryKey(autoGenerate = true) @@ -29,5 +29,5 @@ data class DownloadItem( var url: String? = null, var format: String? = null, var quality: String? = null, - var downloadSize: Long = -1L + var downloadSize: Long = -1L, ) diff --git a/app/src/main/java/com/github/libretube/db/obj/DownloadWithItems.kt b/app/src/main/java/com/github/libretube/db/obj/DownloadWithItems.kt index 1357a8dec5..44618f548e 100644 --- a/app/src/main/java/com/github/libretube/db/obj/DownloadWithItems.kt +++ b/app/src/main/java/com/github/libretube/db/obj/DownloadWithItems.kt @@ -7,7 +7,7 @@ data class DownloadWithItems( @Embedded val download: Download, @Relation( parentColumn = "videoId", - entityColumn = "videoId" + entityColumn = "videoId", ) - val downloadItems: List + val downloadItems: List, ) diff --git a/app/src/main/java/com/github/libretube/db/obj/LocalPlaylist.kt b/app/src/main/java/com/github/libretube/db/obj/LocalPlaylist.kt index 3ef94118bd..890b59127c 100644 --- a/app/src/main/java/com/github/libretube/db/obj/LocalPlaylist.kt +++ b/app/src/main/java/com/github/libretube/db/obj/LocalPlaylist.kt @@ -10,5 +10,5 @@ data class LocalPlaylist( @PrimaryKey(autoGenerate = true) val id: Int = 0, var name: String = "", - var thumbnailUrl: String = "" + var thumbnailUrl: String = "", ) diff --git a/app/src/main/java/com/github/libretube/db/obj/LocalPlaylistItem.kt b/app/src/main/java/com/github/libretube/db/obj/LocalPlaylistItem.kt index 6bc58958de..c482a3faa9 100644 --- a/app/src/main/java/com/github/libretube/db/obj/LocalPlaylistItem.kt +++ b/app/src/main/java/com/github/libretube/db/obj/LocalPlaylistItem.kt @@ -19,7 +19,7 @@ data class LocalPlaylistItem( @ColumnInfo val uploaderUrl: String? = null, @ColumnInfo val uploaderAvatar: String? = null, @ColumnInfo val thumbnailUrl: String? = null, - @ColumnInfo val duration: Long? = null + @ColumnInfo val duration: Long? = null, ) { fun toStreamItem(): StreamItem { return StreamItem( @@ -31,7 +31,7 @@ data class LocalPlaylistItem( uploaderAvatar = ProxyHelper.rewriteUrl(uploaderAvatar), uploadedDate = uploadDate, uploaded = null, - duration = duration + duration = duration, ) } } diff --git a/app/src/main/java/com/github/libretube/db/obj/LocalPlaylistWithVideos.kt b/app/src/main/java/com/github/libretube/db/obj/LocalPlaylistWithVideos.kt index 671b477bd2..cd21208e40 100644 --- a/app/src/main/java/com/github/libretube/db/obj/LocalPlaylistWithVideos.kt +++ b/app/src/main/java/com/github/libretube/db/obj/LocalPlaylistWithVideos.kt @@ -9,7 +9,7 @@ data class LocalPlaylistWithVideos( @Embedded val playlist: LocalPlaylist = LocalPlaylist(), @Relation( parentColumn = "id", - entityColumn = "playlistId" + entityColumn = "playlistId", ) - val videos: List = listOf() + val videos: List = listOf(), ) diff --git a/app/src/main/java/com/github/libretube/db/obj/LocalSubscription.kt b/app/src/main/java/com/github/libretube/db/obj/LocalSubscription.kt index 3fe2a1abb7..d8426265a9 100644 --- a/app/src/main/java/com/github/libretube/db/obj/LocalSubscription.kt +++ b/app/src/main/java/com/github/libretube/db/obj/LocalSubscription.kt @@ -7,5 +7,5 @@ import kotlinx.serialization.Serializable @Serializable @Entity(tableName = "localSubscription") data class LocalSubscription( - @PrimaryKey val channelId: String = "" + @PrimaryKey val channelId: String = "", ) diff --git a/app/src/main/java/com/github/libretube/db/obj/PlaylistBookmark.kt b/app/src/main/java/com/github/libretube/db/obj/PlaylistBookmark.kt index b44e0f5b20..020034fd19 100644 --- a/app/src/main/java/com/github/libretube/db/obj/PlaylistBookmark.kt +++ b/app/src/main/java/com/github/libretube/db/obj/PlaylistBookmark.kt @@ -13,5 +13,5 @@ data class PlaylistBookmark( var thumbnailUrl: String? = null, var uploader: String? = null, var uploaderUrl: String? = null, - var uploaderAvatar: String? = null + var uploaderAvatar: String? = null, ) diff --git a/app/src/main/java/com/github/libretube/db/obj/SearchHistoryItem.kt b/app/src/main/java/com/github/libretube/db/obj/SearchHistoryItem.kt index d677d2dbcb..89410cdf37 100644 --- a/app/src/main/java/com/github/libretube/db/obj/SearchHistoryItem.kt +++ b/app/src/main/java/com/github/libretube/db/obj/SearchHistoryItem.kt @@ -7,5 +7,5 @@ import kotlinx.serialization.Serializable @Serializable @Entity(tableName = "searchHistoryItem") data class SearchHistoryItem( - @PrimaryKey val query: String = "" + @PrimaryKey val query: String = "", ) diff --git a/app/src/main/java/com/github/libretube/db/obj/SubscriptionGroup.kt b/app/src/main/java/com/github/libretube/db/obj/SubscriptionGroup.kt index 7569a28ec4..94c3d35e55 100644 --- a/app/src/main/java/com/github/libretube/db/obj/SubscriptionGroup.kt +++ b/app/src/main/java/com/github/libretube/db/obj/SubscriptionGroup.kt @@ -8,5 +8,5 @@ import kotlinx.serialization.Serializable @Entity(tableName = "subscriptionGroups") data class SubscriptionGroup( @PrimaryKey var name: String, - val channels: MutableList + val channels: MutableList, ) diff --git a/app/src/main/java/com/github/libretube/db/obj/WatchHistoryItem.kt b/app/src/main/java/com/github/libretube/db/obj/WatchHistoryItem.kt index 54503d0b66..b0ee5ca0cd 100644 --- a/app/src/main/java/com/github/libretube/db/obj/WatchHistoryItem.kt +++ b/app/src/main/java/com/github/libretube/db/obj/WatchHistoryItem.kt @@ -16,5 +16,5 @@ data class WatchHistoryItem( @ColumnInfo val uploaderUrl: String? = null, @ColumnInfo var uploaderAvatar: String? = null, @ColumnInfo var thumbnailUrl: String? = null, - @ColumnInfo val duration: Long? = null + @ColumnInfo val duration: Long? = null, ) diff --git a/app/src/main/java/com/github/libretube/db/obj/WatchPosition.kt b/app/src/main/java/com/github/libretube/db/obj/WatchPosition.kt index 2f6f0e0501..341da80260 100644 --- a/app/src/main/java/com/github/libretube/db/obj/WatchPosition.kt +++ b/app/src/main/java/com/github/libretube/db/obj/WatchPosition.kt @@ -9,5 +9,5 @@ import kotlinx.serialization.Serializable @Entity(tableName = "watchPosition") data class WatchPosition( @PrimaryKey val videoId: String = "", - @ColumnInfo val position: Long = 0L + @ColumnInfo val position: Long = 0L, ) diff --git a/app/src/main/java/com/github/libretube/enums/AudioQuality.kt b/app/src/main/java/com/github/libretube/enums/AudioQuality.kt index 69f8826fe9..041a3b7bea 100644 --- a/app/src/main/java/com/github/libretube/enums/AudioQuality.kt +++ b/app/src/main/java/com/github/libretube/enums/AudioQuality.kt @@ -2,5 +2,5 @@ package com.github.libretube.enums enum class AudioQuality { BEST, - WORST + WORST, } diff --git a/app/src/main/java/com/github/libretube/enums/FileType.kt b/app/src/main/java/com/github/libretube/enums/FileType.kt index e81da8aa70..d6c4253d53 100644 --- a/app/src/main/java/com/github/libretube/enums/FileType.kt +++ b/app/src/main/java/com/github/libretube/enums/FileType.kt @@ -3,5 +3,5 @@ package com.github.libretube.enums enum class FileType { AUDIO, VIDEO, - SUBTITLE + SUBTITLE, } diff --git a/app/src/main/java/com/github/libretube/enums/PlayerEvent.kt b/app/src/main/java/com/github/libretube/enums/PlayerEvent.kt index 9a9e680e84..c623f54f88 100644 --- a/app/src/main/java/com/github/libretube/enums/PlayerEvent.kt +++ b/app/src/main/java/com/github/libretube/enums/PlayerEvent.kt @@ -7,7 +7,8 @@ enum class PlayerEvent(val value: Int) { Rewind(3), Next(5), Prev(6), - Background(7); + Background(7), + ; companion object { fun fromInt(value: Int) = PlayerEvent.values().first { it.value == value } diff --git a/app/src/main/java/com/github/libretube/enums/PlaylistType.kt b/app/src/main/java/com/github/libretube/enums/PlaylistType.kt index 852a1cda9e..67cae480ab 100644 --- a/app/src/main/java/com/github/libretube/enums/PlaylistType.kt +++ b/app/src/main/java/com/github/libretube/enums/PlaylistType.kt @@ -14,5 +14,5 @@ enum class PlaylistType { /** * YouTube playlist */ - PUBLIC + PUBLIC, } diff --git a/app/src/main/java/com/github/libretube/enums/ShareObjectType.kt b/app/src/main/java/com/github/libretube/enums/ShareObjectType.kt index 09b55be674..6998a47e7e 100644 --- a/app/src/main/java/com/github/libretube/enums/ShareObjectType.kt +++ b/app/src/main/java/com/github/libretube/enums/ShareObjectType.kt @@ -3,5 +3,5 @@ package com.github.libretube.enums enum class ShareObjectType { VIDEO, PLAYLIST, - CHANNEL + CHANNEL, } 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 b6f0a77527..5754974538 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(def: Long = -1): Long { try { diff --git a/app/src/main/java/com/github/libretube/extensions/Round.kt b/app/src/main/java/com/github/libretube/extensions/Round.kt index 2a18ca489d..aa03ec9208 100644 --- a/app/src/main/java/com/github/libretube/extensions/Round.kt +++ b/app/src/main/java/com/github/libretube/extensions/Round.kt @@ -5,7 +5,7 @@ import kotlin.math.roundToInt fun Float.round(decimalPlaces: Int): Float { return (this * 10.0.pow(decimalPlaces.toDouble())).roundToInt() / 10.0.pow( - decimalPlaces.toDouble() + decimalPlaces.toDouble(), ) .toFloat() } diff --git a/app/src/main/java/com/github/libretube/extensions/ToastFromMainThread.kt b/app/src/main/java/com/github/libretube/extensions/ToastFromMainThread.kt index 1e52be5bdb..5561b651b1 100644 --- a/app/src/main/java/com/github/libretube/extensions/ToastFromMainThread.kt +++ b/app/src/main/java/com/github/libretube/extensions/ToastFromMainThread.kt @@ -12,7 +12,7 @@ fun Context.toastFromMainThread(text: String) { Toast.makeText( this, text, - Toast.LENGTH_SHORT + Toast.LENGTH_SHORT, ).show() } } diff --git a/app/src/main/java/com/github/libretube/extensions/UpdateParameters.kt b/app/src/main/java/com/github/libretube/extensions/UpdateParameters.kt index 23d93231b5..96d2b02cac 100644 --- a/app/src/main/java/com/github/libretube/extensions/UpdateParameters.kt +++ b/app/src/main/java/com/github/libretube/extensions/UpdateParameters.kt @@ -3,5 +3,5 @@ package com.github.libretube.extensions import com.google.android.exoplayer2.trackselection.DefaultTrackSelector inline fun DefaultTrackSelector.updateParameters( - actions: DefaultTrackSelector.Parameters.Builder.() -> Unit + actions: DefaultTrackSelector.Parameters.Builder.() -> Unit, ) = setParameters(buildUponParameters().apply(actions)) diff --git a/app/src/main/java/com/github/libretube/helpers/BackgroundHelper.kt b/app/src/main/java/com/github/libretube/helpers/BackgroundHelper.kt index 7821af3880..9d261cabfc 100644 --- a/app/src/main/java/com/github/libretube/helpers/BackgroundHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/BackgroundHelper.kt @@ -27,7 +27,7 @@ object BackgroundHelper { playlistId: String? = null, channelId: String? = null, keepQueue: Boolean? = null, - keepVideoPlayerAlive: Boolean = false + keepVideoPlayerAlive: Boolean = false, ) { // close the previous video player if open if (!keepVideoPlayerAlive) { diff --git a/app/src/main/java/com/github/libretube/helpers/BrightnessHelper.kt b/app/src/main/java/com/github/libretube/helpers/BrightnessHelper.kt index f96a7b04c3..da5dfa1f21 100644 --- a/app/src/main/java/com/github/libretube/helpers/BrightnessHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/BrightnessHelper.kt @@ -56,7 +56,7 @@ class BrightnessHelper(private val activity: Activity) { value: Float, maxValue: Float, minValue: Float = 0.0f, - shouldSave: Boolean = false + shouldSave: Boolean = false, ) { brightness = value.normalize(minValue, maxValue, minBrightness, maxBrightness) if (shouldSave) savedBrightness = brightness @@ -69,7 +69,7 @@ class BrightnessHelper(private val activity: Activity) { fun getBrightnessWithScale( maxValue: Float, minValue: Float = 0.0f, - saved: Boolean = false + saved: Boolean = false, ): Float { return if (saved) { savedBrightness.normalize(minBrightness, maxBrightness, minValue, maxValue) 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 0a39a6a2d6..2cbe21006d 100644 --- a/app/src/main/java/com/github/libretube/helpers/DashHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/DashHelper.kt @@ -2,14 +2,14 @@ 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.DocumentBuilder 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 @@ -21,7 +21,7 @@ object DashHelper { private data class AdapSetInfo( val mimeType: String, val audioTrackId: String? = null, - val formats: MutableList = mutableListOf() + val formats: MutableList = mutableListOf(), ) fun createManifest(streams: Streams, supportsHdr: Boolean): String { @@ -47,7 +47,7 @@ object DashHelper { // filter the codecs according to the user's preferences .filter { enabledVideoCodecs == "all" || it.codec.orEmpty().lowercase().startsWith( - enabledVideoCodecs + enabledVideoCodecs, ) } .filter { supportsHdr || !it.quality.orEmpty().uppercase().contains("HDR") } @@ -71,8 +71,8 @@ object DashHelper { AdapSetInfo( stream.mimeType!!, null, - mutableListOf(stream) - ) + mutableListOf(stream), + ), ) } @@ -89,8 +89,8 @@ object DashHelper { AdapSetInfo( stream.mimeType!!, stream.audioTrackId, - mutableListOf(stream) - ) + mutableListOf(stream), + ), ) } @@ -145,7 +145,7 @@ object DashHelper { val audioChannelConfiguration = doc.createElement("AudioChannelConfiguration") audioChannelConfiguration.setAttribute( "schemeIdUri", - "urn:mpeg:dash:23003:3:audio_channel_configuration:2011" + "urn:mpeg:dash:23003:3:audio_channel_configuration:2011", ) audioChannelConfiguration.setAttribute("value", "2") diff --git a/app/src/main/java/com/github/libretube/helpers/DownloadHelper.kt b/app/src/main/java/com/github/libretube/helpers/DownloadHelper.kt index 3d062eca39..a259837066 100644 --- a/app/src/main/java/com/github/libretube/helpers/DownloadHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/DownloadHelper.kt @@ -42,7 +42,7 @@ object DownloadHelper { fun getMaxConcurrentDownloads(): Int { return PreferenceHelper.getString( PreferenceKeys.MAX_CONCURRENT_DOWNLOADS, - "6" + "6", ).toFloat().toInt() } @@ -54,7 +54,7 @@ object DownloadHelper { videoQuality: String? = null, audioFormat: String? = null, audioQuality: String? = null, - subtitleCode: String? = null + subtitleCode: String? = null, ) { val intent = Intent(context, DownloadService::class.java) diff --git a/app/src/main/java/com/github/libretube/helpers/ImageHelper.kt b/app/src/main/java/com/github/libretube/helpers/ImageHelper.kt index c08cd6fd02..463f91b90c 100644 --- a/app/src/main/java/com/github/libretube/helpers/ImageHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/ImageHelper.kt @@ -28,7 +28,7 @@ object ImageHelper { fun initializeImageLoader(context: Context) { val maxImageCacheSize = PreferenceHelper.getString( PreferenceKeys.MAX_IMAGE_CACHE, - "" + "", ) imageLoader = ImageLoader.Builder(context) @@ -42,7 +42,7 @@ object ImageHelper { DiskCache.Builder() .directory(context.cacheDir.resolve("coil")) .maxSizeBytes(maxImageCacheSize.toInt() * 1024 * 1024L) - .build() + .build(), ) } } @@ -109,7 +109,7 @@ object ImageHelper { (bitmap.width - newSize) / 2, (bitmap.height - newSize) / 2, newSize, - newSize + newSize, ) } } 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 06e281c8de..79d588ded8 100644 --- a/app/src/main/java/com/github/libretube/helpers/ImportHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/ImportHelper.kt @@ -15,10 +15,10 @@ import com.github.libretube.obj.ImportPlaylist import com.github.libretube.obj.ImportPlaylistFile import com.github.libretube.obj.NewPipeSubscription import com.github.libretube.obj.NewPipeSubscriptions -import kotlin.streams.toList import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.decodeFromStream import kotlinx.serialization.json.encodeToStream +import kotlin.streams.toList object ImportHelper { /** diff --git a/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt b/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt index 05a57eb682..5979ea2cc0 100644 --- a/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt @@ -21,7 +21,7 @@ object IntentHelper { context.packageManager .queryIntentActivities( intent, - PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_ALL.toLong()) + PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_ALL.toLong()), ) } else { context.packageManager 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 f6d65cd258..dac6868905 100644 --- a/app/src/main/java/com/github/libretube/helpers/LocaleHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/LocaleHelper.kt @@ -20,7 +20,7 @@ object LocaleHelper { val languageParts = languageName.split("-") Locale( languageParts[0], - languageParts[1].replace("r", "") + languageParts[1].replace("r", ""), ) } else -> Locale(languageName) diff --git a/app/src/main/java/com/github/libretube/helpers/NavBarHelper.kt b/app/src/main/java/com/github/libretube/helpers/NavBarHelper.kt index e2788b5b35..1d7a576c75 100644 --- a/app/src/main/java/com/github/libretube/helpers/NavBarHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/NavBarHelper.kt @@ -23,7 +23,7 @@ object NavBarHelper { val prefItems = try { PreferenceHelper.getString( PreferenceKeys.NAVBAR_ITEMS, - "" + "", ).split(SEPARATOR) } catch (e: Exception) { Log.e("fail to parse nav items", e.toString()) @@ -38,7 +38,7 @@ object NavBarHelper { navBarItems.add( p.menu[it.replace("-", "").toInt()].apply { this.isVisible = !it.contains("-") - } + }, ) } return navBarItems @@ -65,7 +65,7 @@ object NavBarHelper { } PreferenceHelper.putString( PreferenceKeys.NAVBAR_ITEMS, - prefString.joinToString(SEPARATOR) + prefString.joinToString(SEPARATOR), ) } @@ -90,7 +90,7 @@ object NavBarHelper { // remove the old items navBarItems.forEach { menuItems.add( - bottomNav.menu.findItem(it.itemId) + bottomNav.menu.findItem(it.itemId), ) bottomNav.menu.removeItem(it.itemId) } @@ -103,7 +103,7 @@ object NavBarHelper { menuItem.groupId, menuItem.itemId, Menu.NONE, - menuItem.title + menuItem.title, ).icon = menuItem.icon } } diff --git a/app/src/main/java/com/github/libretube/helpers/NavigationHelper.kt b/app/src/main/java/com/github/libretube/helpers/NavigationHelper.kt index 025075ee5f..a623bf5cd8 100644 --- a/app/src/main/java/com/github/libretube/helpers/NavigationHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/NavigationHelper.kt @@ -27,7 +27,7 @@ object NavigationHelper { fun navigateChannel( context: Context, - channelId: String? + channelId: String?, ) { if (channelId == null) return @@ -64,7 +64,7 @@ object NavigationHelper { channelId: String? = null, keepQueue: Boolean = false, timeStamp: Long? = null, - forceVideo: Boolean = false + forceVideo: Boolean = false, ) { if (videoId == null) return @@ -76,7 +76,7 @@ object NavigationHelper { timeStamp, playlistId, channelId, - keepQueue + keepQueue, ) handler.postDelayed(500) { startAudioPlayer(context) @@ -89,7 +89,7 @@ object NavigationHelper { IntentData.playlistId to playlistId, IntentData.channelId to channelId, IntentData.keepQueue to keepQueue, - IntentData.timeStamp to timeStamp + IntentData.timeStamp to timeStamp, ) val activity = unwrapActivity(context) @@ -101,14 +101,14 @@ object NavigationHelper { fun navigatePlaylist( context: Context, playlistId: String?, - playlistType: PlaylistType + playlistType: PlaylistType, ) { if (playlistId == null) return val activity = unwrapActivity(context) val bundle = bundleOf( IntentData.playlistId to playlistId, - IntentData.playlistType to playlistType + IntentData.playlistType to playlistType, ) activity.navController.navigate(R.id.playlistFragment, bundle) } diff --git a/app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt b/app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt index 4d44b1e709..3605d4299f 100644 --- a/app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt @@ -17,18 +17,18 @@ object NotificationHelper { */ fun enqueueWork( context: Context, - existingPeriodicWorkPolicy: ExistingPeriodicWorkPolicy + existingPeriodicWorkPolicy: ExistingPeriodicWorkPolicy, ) { // get the notification preferences PreferenceHelper.initialize(context) val notificationsEnabled = PreferenceHelper.getBoolean( PreferenceKeys.NOTIFICATION_ENABLED, - true + true, ) val checkingFrequency = PreferenceHelper.getString( PreferenceKeys.CHECKING_FREQUENCY, - "60" + "60", ).toLong() // schedule the work manager request if logged in and notifications enabled @@ -58,7 +58,7 @@ object NotificationHelper { // create the worker val notificationWorker = PeriodicWorkRequestBuilder( checkingFrequency, - TimeUnit.MINUTES + TimeUnit.MINUTES, ) .setConstraints(constraints) .build() @@ -68,7 +68,7 @@ object NotificationHelper { .enqueueUniquePeriodicWork( NOTIFICATION_WORK_NAME, existingPeriodicWorkPolicy, - notificationWorker + notificationWorker, ) // for testing the notifications by the work manager @@ -79,6 +79,6 @@ object NotificationHelper { .setConstraints(constraints) .build() ) - */ + */ } } 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 0ef79f27dc..ef2be931b7 100644 --- a/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt @@ -52,7 +52,7 @@ object PlayerHelper { return getBitRate( filteredAudios, - if (audioQuality == "best") AudioQuality.BEST else AudioQuality.WORST + if (audioQuality == "best") AudioQuality.BEST else AudioQuality.WORST, ) } @@ -93,56 +93,56 @@ object PlayerHelper { val categories: ArrayList = arrayListOf() if (PreferenceHelper.getBoolean( "intro_category_key", - false + false, ) ) { categories.add("intro") } if (PreferenceHelper.getBoolean( "selfpromo_category_key", - false + false, ) ) { categories.add("selfpromo") } if (PreferenceHelper.getBoolean( "interaction_category_key", - false + false, ) ) { categories.add("interaction") } if (PreferenceHelper.getBoolean( "sponsors_category_key", - true + true, ) ) { categories.add("sponsor") } if (PreferenceHelper.getBoolean( "outro_category_key", - false + false, ) ) { categories.add("outro") } if (PreferenceHelper.getBoolean( "filler_category_key", - false + false, ) ) { categories.add("filler") } if (PreferenceHelper.getBoolean( "music_offtopic_category_key", - false + false, ) ) { categories.add("music_offtopic") } if (PreferenceHelper.getBoolean( "preview_category_key", - false + false, ) ) { categories.add("preview") @@ -153,7 +153,7 @@ object PlayerHelper { fun getOrientation(videoWidth: Int, videoHeight: Int): Int { val fullscreenOrientationPref = PreferenceHelper.getString( PreferenceKeys.FULLSCREEN_ORIENTATION, - "ratio" + "ratio", ) return when (fullscreenOrientationPref) { @@ -176,25 +176,25 @@ object PlayerHelper { val autoRotationEnabled: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.AUTO_FULLSCREEN, - false + false, ) val relatedStreamsEnabled: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.RELATED_STREAMS, - true + true, ) val pausePlayerOnScreenOffEnabled: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.PAUSE_ON_SCREEN_OFF, - false + false, ) private val watchPositionsPref: String get() = PreferenceHelper.getString( PreferenceKeys.WATCH_POSITIONS, - "always" + "always", ) val watchPositionsVideo: Boolean @@ -206,38 +206,38 @@ object PlayerHelper { val watchHistoryEnabled: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.WATCH_HISTORY_TOGGLE, - true + true, ) val useSystemCaptionStyle: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.SYSTEM_CAPTION_STYLE, - true + true, ) private val bufferingGoal: Int get() = PreferenceHelper.getString( PreferenceKeys.BUFFERING_GOAL, - "50" + "50", ).toInt() * 1000 val sponsorBlockEnabled: Boolean get() = PreferenceHelper.getBoolean( "sb_enabled_key", - true + true, ) private val sponsorBlockNotifications: Boolean get() = PreferenceHelper.getBoolean( "sb_notifications_key", - true + true, ) val defaultSubtitleCode: String? get() { val code = PreferenceHelper.getString( PreferenceKeys.DEFAULT_SUBTITLE, - "" + "", ) if (code == "") return null @@ -251,37 +251,37 @@ object PlayerHelper { val skipButtonsEnabled: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.SKIP_BUTTONS, - false + false, ) val pipEnabled: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.PICTURE_IN_PICTURE, - true + true, ) val skipSegmentsManually: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.SB_SKIP_MANUALLY, - false + false, ) val autoPlayEnabled: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.AUTO_PLAY, - true + true, ) val autoPlayCountdown: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.AUTOPLAY_COUNTDOWN, - false + false, ) val seekIncrement: Long get() = PreferenceHelper.getString( PreferenceKeys.SEEK_INCREMENT, - "10.0" + "10.0", ).toFloat() .roundToInt() .toLong() * 1000 @@ -289,7 +289,7 @@ object PlayerHelper { private val playbackSpeed: Float get() = PreferenceHelper.getString( PreferenceKeys.PLAYBACK_SPEED, - "1" + "1", ).replace("F", "").toFloat() private val backgroundSpeed: Float @@ -301,73 +301,73 @@ object PlayerHelper { val resizeModePref: String get() = PreferenceHelper.getString( PreferenceKeys.PLAYER_RESIZE_MODE, - "fit" + "fit", ) val alternativeVideoLayout: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.ALTERNATIVE_PLAYER_LAYOUT, - false + false, ) val autoInsertRelatedVideos: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.QUEUE_AUTO_INSERT_RELATED, - true + true, ) val swipeGestureEnabled: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.PLAYER_SWIPE_CONTROLS, - true + true, ) val fullscreenGesturesEnabled: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.FULLSCREEN_GESTURES, - false + false, ) val pinchGestureEnabled: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.PLAYER_PINCH_CONTROL, - true + true, ) val captionsTextSize: Float get() = PreferenceHelper.getString( PreferenceKeys.CAPTIONS_SIZE, - "18" + "18", ).toFloat() val doubleTapToSeek: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.DOUBLE_TAP_TO_SEEK, - true + true, ) val pauseOnQuit: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.PAUSE_ON_QUIT, - false + false, ) private val alternativePiPControls: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.ALTERNATIVE_PIP_CONTROLS, - false + false, ) private val skipSilence: Boolean get() = PreferenceHelper.getBoolean( PreferenceKeys.SKIP_SILENCE, - false + false, ) val enabledVideoCodecs: String get() = PreferenceHelper.getString( PreferenceKeys.ENABLED_VIDEO_CODECS, - "all" + "all", ) fun getDefaultResolution(context: Context): String { @@ -392,14 +392,14 @@ object PlayerHelper { activity: Activity, id: Int, @StringRes title: Int, - event: PlayerEvent + event: PlayerEvent, ): RemoteActionCompat { val text = activity.getString(title) return RemoteActionCompat( IconCompat.createWithResource(activity, id), text, text, - getPendingIntent(activity, event.value) + getPendingIntent(activity, event.value), ) } @@ -411,35 +411,35 @@ object PlayerHelper { activity, R.drawable.ic_headphones, R.string.background_mode, - PlayerEvent.Background + PlayerEvent.Background, ) val rewindAction = getRemoteAction( activity, R.drawable.ic_rewind, R.string.rewind, - PlayerEvent.Rewind + PlayerEvent.Rewind, ) val playPauseAction = getRemoteAction( activity, if (isPlaying) R.drawable.ic_pause else R.drawable.ic_play, R.string.pause, - if (isPlaying) PlayerEvent.Pause else PlayerEvent.Play + if (isPlaying) PlayerEvent.Pause else PlayerEvent.Play, ) val skipNextAction = getRemoteAction( activity, R.drawable.ic_next, R.string.play_next, - PlayerEvent.Next + PlayerEvent.Next, ) val forwardAction = getRemoteAction( activity, R.drawable.ic_forward, R.string.forward, - PlayerEvent.Forward + PlayerEvent.Forward, ) return if (alternativePiPControls) { listOf(audioModeAction, playPauseAction, skipNextAction) @@ -469,7 +469,7 @@ object PlayerHelper { 1000 * 10, // exo default is 50s bufferingGoal, DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_MS, - DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS + DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS, ) .build() } @@ -494,7 +494,7 @@ object PlayerHelper { fun ExoPlayer.checkForSegments( context: Context, segments: List, - skipManually: Boolean = false + skipManually: Boolean = false, ): Long? { for (segment in segments) { val segmentStart = (segment.segment[0] * 1000f).toLong() diff --git a/app/src/main/java/com/github/libretube/helpers/PreferenceHelper.kt b/app/src/main/java/com/github/libretube/helpers/PreferenceHelper.kt index 97f83a8940..733123408f 100644 --- a/app/src/main/java/com/github/libretube/helpers/PreferenceHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/PreferenceHelper.kt @@ -135,12 +135,12 @@ object PreferenceHelper { ignorableChannels.remove(channelId) } else { ignorableChannels.add( - channelId + channelId, ) } editor.putString( PreferenceKeys.IGNORED_NOTIFICATION_CHANNELS, - ignorableChannels.joinToString(",") + ignorableChannels.joinToString(","), ).apply() } 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 7e4d6c2b9c..6fd0326164 100644 --- a/app/src/main/java/com/github/libretube/helpers/ProxyHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/ProxyHelper.kt @@ -34,7 +34,7 @@ object ProxyHelper { fun unwrapIfEnabled(url: String): String { if (!PreferenceHelper.getBoolean( PreferenceKeys.DISABLE_VIDEO_IMAGE_PROXY, - false + false, ) ) { return url diff --git a/app/src/main/java/com/github/libretube/helpers/ShortcutHelper.kt b/app/src/main/java/com/github/libretube/helpers/ShortcutHelper.kt index d1dfb0bb7e..1331cee9d2 100644 --- a/app/src/main/java/com/github/libretube/helpers/ShortcutHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/ShortcutHelper.kt @@ -15,7 +15,7 @@ object ShortcutHelper { AppShortcut("home", R.string.startpage, R.drawable.ic_home), AppShortcut("trends", R.string.trends, R.drawable.ic_trending), AppShortcut("subscriptions", R.string.subscriptions, R.drawable.ic_subscriptions), - AppShortcut("library", R.string.library, R.drawable.ic_library) + AppShortcut("library", R.string.library, R.drawable.ic_library), ) private fun createShortcut(context: Context, appShortcut: AppShortcut): ShortcutInfoCompat { @@ -26,7 +26,7 @@ object ShortcutHelper { .setIcon(IconCompat.createWithResource(context, appShortcut.drawable)) .setIntent( Intent(Intent.ACTION_VIEW, null, context, MainActivity::class.java) - .putExtra(IntentData.fragmentToOpen, appShortcut.action) + .putExtra(IntentData.fragmentToOpen, appShortcut.action), ) .build() } diff --git a/app/src/main/java/com/github/libretube/helpers/ThemeHelper.kt b/app/src/main/java/com/github/libretube/helpers/ThemeHelper.kt index 1796966c8d..8a3c2ffe24 100644 --- a/app/src/main/java/com/github/libretube/helpers/ThemeHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/ThemeHelper.kt @@ -33,12 +33,12 @@ object ThemeHelper { * Update the accent color of the app */ private fun updateAccentColor( - activity: AppCompatActivity + activity: AppCompatActivity, ) { val theme = when ( PreferenceHelper.getString( PreferenceKeys.ACCENT_COLOR, - "purple" + "purple", ) ) { // set the accent color, use the pure black/white theme if enabled @@ -62,7 +62,7 @@ object ThemeHelper { if ( PreferenceHelper.getString( PreferenceKeys.ACCENT_COLOR, - "purple" + "purple", ) == "my" ) { DynamicColors.applyToActivityIfAvailable(activity) @@ -75,7 +75,7 @@ object ThemeHelper { private fun applyPureThemeIfEnabled(activity: Activity) { val pureThemeEnabled = PreferenceHelper.getBoolean( PreferenceKeys.PURE_THEME, - false + false, ) if (pureThemeEnabled) activity.theme.applyStyle(R.style.Pure, true) } @@ -105,7 +105,7 @@ object ThemeHelper { context.packageManager.setComponentEnabledSetting( ComponentName(context.packageName, activityClass), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, - PackageManager.DONT_KILL_APP + PackageManager.DONT_KILL_APP, ) } @@ -115,7 +115,7 @@ object ThemeHelper { context.packageManager.setComponentEnabledSetting( ComponentName(context.packageName, newLogoActivityClass), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, - PackageManager.DONT_KILL_APP + PackageManager.DONT_KILL_APP, ) } diff --git a/app/src/main/java/com/github/libretube/helpers/WindowHelper.kt b/app/src/main/java/com/github/libretube/helpers/WindowHelper.kt index 8dfa48546e..2765602002 100644 --- a/app/src/main/java/com/github/libretube/helpers/WindowHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/WindowHelper.kt @@ -32,7 +32,7 @@ object WindowHelper { // See: https://developer.android.com/training/system-ui/immersive#kotlin activity.toggleSystemBars( types = WindowInsetsCompat.Type.systemBars(), - showBars = !isFullscreen + showBars = !isFullscreen, ) } } diff --git a/app/src/main/java/com/github/libretube/obj/AppShortcut.kt b/app/src/main/java/com/github/libretube/obj/AppShortcut.kt index b268ea3814..401b1eacc6 100644 --- a/app/src/main/java/com/github/libretube/obj/AppShortcut.kt +++ b/app/src/main/java/com/github/libretube/obj/AppShortcut.kt @@ -6,5 +6,5 @@ import androidx.annotation.StringRes data class AppShortcut( val action: String, @StringRes val label: Int, - @DrawableRes val drawable: Int + @DrawableRes val drawable: Int, ) diff --git a/app/src/main/java/com/github/libretube/obj/BackupFile.kt b/app/src/main/java/com/github/libretube/obj/BackupFile.kt index 503a3f3183..72f8427b23 100644 --- a/app/src/main/java/com/github/libretube/obj/BackupFile.kt +++ b/app/src/main/java/com/github/libretube/obj/BackupFile.kt @@ -20,5 +20,5 @@ data class BackupFile( var playlistBookmarks: List? = emptyList(), var localPlaylists: List? = emptyList(), var preferences: List? = emptyList(), - var channelGroups: List? = emptyList() + var channelGroups: List? = emptyList(), ) diff --git a/app/src/main/java/com/github/libretube/obj/BottomSheetItem.kt b/app/src/main/java/com/github/libretube/obj/BottomSheetItem.kt index 73195412ae..0f81bc2cbb 100644 --- a/app/src/main/java/com/github/libretube/obj/BottomSheetItem.kt +++ b/app/src/main/java/com/github/libretube/obj/BottomSheetItem.kt @@ -4,5 +4,5 @@ data class BottomSheetItem( val title: String, val drawable: Int? = null, val getCurrent: () -> String? = { null }, - val onClick: () -> Unit = {} + val onClick: () -> Unit = {}, ) diff --git a/app/src/main/java/com/github/libretube/obj/ChannelTabs.kt b/app/src/main/java/com/github/libretube/obj/ChannelTabs.kt index 9a7c918574..79521a8091 100644 --- a/app/src/main/java/com/github/libretube/obj/ChannelTabs.kt +++ b/app/src/main/java/com/github/libretube/obj/ChannelTabs.kt @@ -5,7 +5,7 @@ import com.github.libretube.R sealed class ChannelTabs( val identifierName: String, - @IdRes val chipId: Int + @IdRes val chipId: Int, ) { object Playlists : ChannelTabs("playlists", R.id.playlists) object Shorts : ChannelTabs("shorts", R.id.shorts) diff --git a/app/src/main/java/com/github/libretube/obj/Country.kt b/app/src/main/java/com/github/libretube/obj/Country.kt index 750fec3a7c..840d731767 100644 --- a/app/src/main/java/com/github/libretube/obj/Country.kt +++ b/app/src/main/java/com/github/libretube/obj/Country.kt @@ -2,5 +2,5 @@ package com.github.libretube.obj data class Country( val name: String, - val code: String + val code: String, ) diff --git a/app/src/main/java/com/github/libretube/obj/DownloadStatus.kt b/app/src/main/java/com/github/libretube/obj/DownloadStatus.kt index 9125caa66b..18e80540d6 100644 --- a/app/src/main/java/com/github/libretube/obj/DownloadStatus.kt +++ b/app/src/main/java/com/github/libretube/obj/DownloadStatus.kt @@ -9,7 +9,7 @@ sealed class DownloadStatus { data class Progress( val progress: Long, val downloaded: Long, - val total: Long + val total: Long, ) : DownloadStatus() data class Error(val message: String, val cause: Throwable? = null) : DownloadStatus() diff --git a/app/src/main/java/com/github/libretube/obj/DownloadedFile.kt b/app/src/main/java/com/github/libretube/obj/DownloadedFile.kt index 83450823d9..19e002ab13 100644 --- a/app/src/main/java/com/github/libretube/obj/DownloadedFile.kt +++ b/app/src/main/java/com/github/libretube/obj/DownloadedFile.kt @@ -7,5 +7,5 @@ data class DownloadedFile( val name: String, val size: Long, var metadata: Streams? = null, - var thumbnail: Bitmap? = null + var thumbnail: Bitmap? = null, ) diff --git a/app/src/main/java/com/github/libretube/obj/ImportPlaylist.kt b/app/src/main/java/com/github/libretube/obj/ImportPlaylist.kt index e31622d324..97435bc7d4 100644 --- a/app/src/main/java/com/github/libretube/obj/ImportPlaylist.kt +++ b/app/src/main/java/com/github/libretube/obj/ImportPlaylist.kt @@ -7,5 +7,5 @@ data class ImportPlaylist( var name: String? = null, val type: String? = null, val visibility: String? = null, - var videos: List = listOf() + var videos: List = listOf(), ) diff --git a/app/src/main/java/com/github/libretube/obj/ImportPlaylistFile.kt b/app/src/main/java/com/github/libretube/obj/ImportPlaylistFile.kt index 0693e2df6a..c217403ef7 100644 --- a/app/src/main/java/com/github/libretube/obj/ImportPlaylistFile.kt +++ b/app/src/main/java/com/github/libretube/obj/ImportPlaylistFile.kt @@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable data class ImportPlaylistFile( val format: String, val version: Int, - val playlists: List = emptyList() + val playlists: List = emptyList(), ) diff --git a/app/src/main/java/com/github/libretube/obj/NewPipeSubscription.kt b/app/src/main/java/com/github/libretube/obj/NewPipeSubscription.kt index c75befd6a2..02e8708298 100644 --- a/app/src/main/java/com/github/libretube/obj/NewPipeSubscription.kt +++ b/app/src/main/java/com/github/libretube/obj/NewPipeSubscription.kt @@ -7,5 +7,5 @@ import kotlinx.serialization.Serializable data class NewPipeSubscription( val name: String, @SerialName("service_id") val serviceId: Int, - val url: String + val url: String, ) diff --git a/app/src/main/java/com/github/libretube/obj/NewPipeSubscriptions.kt b/app/src/main/java/com/github/libretube/obj/NewPipeSubscriptions.kt index 8309b5f279..64c1e4703d 100644 --- a/app/src/main/java/com/github/libretube/obj/NewPipeSubscriptions.kt +++ b/app/src/main/java/com/github/libretube/obj/NewPipeSubscriptions.kt @@ -7,5 +7,5 @@ import kotlinx.serialization.Serializable data class NewPipeSubscriptions( @SerialName("app_version") val appVersion: String = "", @SerialName("app_version_int") val appVersionInt: Int = 0, - val subscriptions: List = emptyList() + val subscriptions: List = emptyList(), ) diff --git a/app/src/main/java/com/github/libretube/obj/PlayerNotificationData.kt b/app/src/main/java/com/github/libretube/obj/PlayerNotificationData.kt index 9f47632c44..404235c5d0 100644 --- a/app/src/main/java/com/github/libretube/obj/PlayerNotificationData.kt +++ b/app/src/main/java/com/github/libretube/obj/PlayerNotificationData.kt @@ -6,5 +6,5 @@ data class PlayerNotificationData( val title: String? = null, val uploaderName: String? = null, val thumbnailUrl: String? = null, - val thumbnailPath: Path? = null + val thumbnailPath: Path? = null, ) diff --git a/app/src/main/java/com/github/libretube/obj/PreferenceItem.kt b/app/src/main/java/com/github/libretube/obj/PreferenceItem.kt index 25bfd7ad41..df6ffd42fb 100644 --- a/app/src/main/java/com/github/libretube/obj/PreferenceItem.kt +++ b/app/src/main/java/com/github/libretube/obj/PreferenceItem.kt @@ -7,5 +7,5 @@ import kotlinx.serialization.json.JsonPrimitive @Serializable data class PreferenceItem( val key: String? = null, - val value: JsonPrimitive = JsonNull + val value: JsonPrimitive = JsonNull, ) diff --git a/app/src/main/java/com/github/libretube/obj/PreviewFrame.kt b/app/src/main/java/com/github/libretube/obj/PreviewFrame.kt index d3b8fb676c..36df93252b 100644 --- a/app/src/main/java/com/github/libretube/obj/PreviewFrame.kt +++ b/app/src/main/java/com/github/libretube/obj/PreviewFrame.kt @@ -5,5 +5,5 @@ data class PreviewFrame( val positionX: Int, val positionY: Int, val framesPerPageX: Int, - val framesPerPageY: Int + val framesPerPageY: Int, ) diff --git a/app/src/main/java/com/github/libretube/obj/ShareData.kt b/app/src/main/java/com/github/libretube/obj/ShareData.kt index 532558af0a..c5442a16de 100644 --- a/app/src/main/java/com/github/libretube/obj/ShareData.kt +++ b/app/src/main/java/com/github/libretube/obj/ShareData.kt @@ -4,5 +4,5 @@ data class ShareData( val currentChannel: String? = null, val currentVideo: String? = null, val currentPlaylist: String? = null, - var currentPosition: Long? = null + var currentPosition: Long? = null, ) diff --git a/app/src/main/java/com/github/libretube/obj/VideoResolution.kt b/app/src/main/java/com/github/libretube/obj/VideoResolution.kt index 465e01a16f..ba164198b0 100644 --- a/app/src/main/java/com/github/libretube/obj/VideoResolution.kt +++ b/app/src/main/java/com/github/libretube/obj/VideoResolution.kt @@ -2,5 +2,5 @@ package com.github.libretube.obj data class VideoResolution( val name: String, - val resolution: Int + val resolution: Int, ) diff --git a/app/src/main/java/com/github/libretube/obj/update/Asset.kt b/app/src/main/java/com/github/libretube/obj/update/Asset.kt index 19102970f6..e74646b5ff 100644 --- a/app/src/main/java/com/github/libretube/obj/update/Asset.kt +++ b/app/src/main/java/com/github/libretube/obj/update/Asset.kt @@ -20,5 +20,5 @@ data class Asset( val state: String, @SerialName("updated_at") val updatedAt: Instant, val uploader: User, - val url: String + val url: String, ) diff --git a/app/src/main/java/com/github/libretube/obj/update/Reactions.kt b/app/src/main/java/com/github/libretube/obj/update/Reactions.kt index 01cfdc21ee..1bb06e3f7a 100644 --- a/app/src/main/java/com/github/libretube/obj/update/Reactions.kt +++ b/app/src/main/java/com/github/libretube/obj/update/Reactions.kt @@ -12,5 +12,5 @@ data class Reactions( val laugh: Int, val rocket: Int, @SerialName("total_count") val totalCount: Int, - val url: String + val url: String, ) diff --git a/app/src/main/java/com/github/libretube/obj/update/UpdateInfo.kt b/app/src/main/java/com/github/libretube/obj/update/UpdateInfo.kt index 6d166add77..9e0fabcd30 100644 --- a/app/src/main/java/com/github/libretube/obj/update/UpdateInfo.kt +++ b/app/src/main/java/com/github/libretube/obj/update/UpdateInfo.kt @@ -25,5 +25,5 @@ data class UpdateInfo( @SerialName("target_commitish") val targetCommitish: String, @SerialName("upload_url") val uploadUrl: String, val url: String, - @SerialName("zipball_url") val zipballUrl: String + @SerialName("zipball_url") val zipballUrl: String, ) diff --git a/app/src/main/java/com/github/libretube/obj/update/User.kt b/app/src/main/java/com/github/libretube/obj/update/User.kt index b2103e904b..06671a404d 100644 --- a/app/src/main/java/com/github/libretube/obj/update/User.kt +++ b/app/src/main/java/com/github/libretube/obj/update/User.kt @@ -22,5 +22,5 @@ data class User( @SerialName("starred_url") val starredUrl: String, @SerialName("subscriptions_url") val subscriptionsUrl: String, val type: String, - val url: String + val url: String, ) 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 0c2aee1323..f79f8c100f 100644 --- a/app/src/main/java/com/github/libretube/services/DownloadService.kt +++ b/app/src/main/java/com/github/libretube/services/DownloadService.kt @@ -36,16 +36,6 @@ import com.github.libretube.receivers.NotificationReceiver import com.github.libretube.receivers.NotificationReceiver.Companion.ACTION_DOWNLOAD_PAUSE import com.github.libretube.receivers.NotificationReceiver.Companion.ACTION_DOWNLOAD_RESUME 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.absolute -import kotlin.io.path.createFile -import kotlin.io.path.fileSize import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job @@ -58,6 +48,16 @@ import kotlinx.coroutines.withContext 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.absolute +import kotlin.io.path.createFile +import kotlin.io.path.fileSize /** * Download service with custom implementation of downloading using [HttpURLConnection]. @@ -111,13 +111,13 @@ class DownloadService : LifecycleService() { streams.description, streams.uploader, streams.uploadDate, - thumbnailTargetPath + thumbnailTargetPath, ) Database.downloadDao().insertDownload(download) ImageHelper.downloadImage( this@DownloadService, streams.thumbnailUrl, - thumbnailTargetPath + thumbnailTargetPath, ) val downloadItems = streams.toDownloadItems( @@ -127,7 +127,7 @@ class DownloadService : LifecycleService() { videoQuality, audioFormat, audioQuality, - subtitleCode + subtitleCode, ) downloadItems.forEach { start(it) } } catch (e: Exception) { @@ -230,8 +230,8 @@ class DownloadService : LifecycleService() { item.id to DownloadStatus.Progress( lastRead, totalRead, - item.downloadSize - ) + item.downloadSize, + ), ) if (item.downloadSize != -1L && System.currentTimeMillis() / 1000 > lastTime @@ -239,16 +239,16 @@ class DownloadService : LifecycleService() { notificationBuilder .setContentText( totalRead.formatAsFileSize() + " / " + - item.downloadSize.formatAsFileSize() + item.downloadSize.formatAsFileSize(), ) .setProgress( item.downloadSize.toInt(), totalRead.toInt(), - false + false, ) notificationManager.notify( item.getNotificationId(), - notificationBuilder.build() + notificationBuilder.build(), ) lastTime = System.currentTimeMillis() / 1000 } @@ -377,7 +377,7 @@ class DownloadService : LifecycleService() { private fun setResumeNotification( notificationBuilder: NotificationCompat.Builder, - item: DownloadItem + item: DownloadItem, ) { notificationBuilder .setSmallIcon(android.R.drawable.stat_sys_download) @@ -392,7 +392,7 @@ class DownloadService : LifecycleService() { private fun setPauseNotification( notificationBuilder: NotificationCompat.Builder, item: DownloadItem, - isCompleted: Boolean = false + isCompleted: Boolean = false, ) { notificationBuilder .setProgress(0, 0, false) @@ -420,7 +420,7 @@ class DownloadService : LifecycleService() { return NotificationCompat.Action.Builder( R.drawable.ic_play, getString(R.string.resume), - PendingIntentCompat.getBroadcast(this, id, intent, FLAG_UPDATE_CURRENT, false) + PendingIntentCompat.getBroadcast(this, id, intent, FLAG_UPDATE_CURRENT, false), ).build() } @@ -432,7 +432,7 @@ class DownloadService : LifecycleService() { return NotificationCompat.Action.Builder( R.drawable.ic_pause, getString(R.string.pause), - PendingIntentCompat.getBroadcast(this, id, intent, FLAG_UPDATE_CURRENT, false) + PendingIntentCompat.getBroadcast(this, id, intent, FLAG_UPDATE_CURRENT, false), ).build() } 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 422e1c9c19..9950b7beea 100644 --- a/app/src/main/java/com/github/libretube/services/OfflinePlayerService.kt +++ b/app/src/main/java/com/github/libretube/services/OfflinePlayerService.kt @@ -53,12 +53,12 @@ class OfflinePlayerService : LifecycleService() { nowPlayingNotification = NowPlayingNotification( this@OfflinePlayerService, player!!, - true + true, ) val notificationData = PlayerNotificationData( title = downloadWithItems.download.title, uploaderName = downloadWithItems.download.uploader, - thumbnailPath = downloadWithItems.download.thumbnailPath + thumbnailPath = downloadWithItems.download.thumbnailPath, ) nowPlayingNotification?.updatePlayerNotification(videoId, notificationData) } else { diff --git a/app/src/main/java/com/github/libretube/services/OnlinePlayerService.kt b/app/src/main/java/com/github/libretube/services/OnlinePlayerService.kt index c0a55ba454..4f651c2163 100644 --- a/app/src/main/java/com/github/libretube/services/OnlinePlayerService.kt +++ b/app/src/main/java/com/github/libretube/services/OnlinePlayerService.kt @@ -160,7 +160,7 @@ class OnlinePlayerService : LifecycleService() { private fun loadAudio( videoId: String, seekToPosition: Long = 0, - keepQueue: Boolean = false + keepQueue: Boolean = false, ) { lifecycleScope.launch(Dispatchers.IO) { streams = runCatching { @@ -192,13 +192,13 @@ class OnlinePlayerService : LifecycleService() { nowPlayingNotification = NowPlayingNotification( this@OnlinePlayerService, player!!, - true + true, ) } val playerNotificationData = PlayerNotificationData( streams?.title, streams?.uploader, - streams?.thumbnailUrl + streams?.thumbnailUrl, ) nowPlayingNotification.updatePlayerNotification(videoId, playerNotificationData) @@ -269,7 +269,7 @@ class OnlinePlayerService : LifecycleService() { Toast.makeText( this@OnlinePlayerService.applicationContext, error.localizedMessage, - Toast.LENGTH_SHORT + Toast.LENGTH_SHORT, ).show() } } @@ -318,7 +318,7 @@ class OnlinePlayerService : LifecycleService() { if (categories.isEmpty()) return@runCatching segments = RetrofitInstance.api.getSegments( videoId, - JsonHelper.json.encodeToString(categories) + JsonHelper.json.encodeToString(categories), ).segments checkForSegments() } diff --git a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt index ada5df55c9..b0ad72df49 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt @@ -74,7 +74,7 @@ class AboutActivity : BaseActivity() { Snackbar.make( binding.root, R.string.copied_to_clipboard, - Snackbar.LENGTH_LONG + Snackbar.LENGTH_LONG, ) .setAction(R.string.open_copied) { IntentHelper.openLinkFromHref(this, supportFragmentManager, href) 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 61933b7b37..77e890072b 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 @@ -221,7 +221,7 @@ class MainActivity : BaseActivity() { private fun setupSubscriptionsBadge() { if (!PreferenceHelper.getBoolean( PreferenceKeys.NEW_VIDEOS_BADGE, - false + false, ) ) { return @@ -293,7 +293,7 @@ class MainActivity : BaseActivity() { val destIds = listOf( R.id.searchResultFragment, R.id.channelFragment, - R.id.playlistFragment + R.id.playlistFragment, ) if (navController.currentDestination?.id in destIds && newText.isNullOrEmpty()) { return false @@ -316,7 +316,7 @@ class MainActivity : BaseActivity() { navController.navigate(R.id.searchFragment) } item.setShowAsAction( - MenuItem.SHOW_AS_ACTION_ALWAYS or MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW + MenuItem.SHOW_AS_ACTION_ALWAYS or MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW, ) return true } @@ -385,26 +385,26 @@ class MainActivity : BaseActivity() { intent?.getStringExtra(IntentData.channelId)?.let { navController.navigate( R.id.channelFragment, - bundleOf(IntentData.channelId to it) + bundleOf(IntentData.channelId to it), ) } intent?.getStringExtra(IntentData.channelName)?.let { navController.navigate( R.id.channelFragment, - bundleOf(IntentData.channelName to it) + bundleOf(IntentData.channelName to it), ) } intent?.getStringExtra(IntentData.playlistId)?.let { navController.navigate( R.id.playlistFragment, - bundleOf(IntentData.playlistId to it) + bundleOf(IntentData.playlistId to it), ) } intent?.getStringExtra(IntentData.videoId)?.let { NavigationHelper.navigateVideo( context = this, videoId = it, - timeStamp = intent?.getLongExtra(IntentData.timeStamp, 0L) + timeStamp = intent?.getLongExtra(IntentData.timeStamp, 0L), ) } 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 1390b3c342..8f8a5e11d5 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 @@ -64,7 +64,7 @@ class OfflinePlayerActivity : BaseActivity() { requestedOrientation = PlayerHelper.getOrientation( player.videoSize.width, - player.videoSize.height + player.videoSize.height, ) } @@ -84,7 +84,7 @@ class OfflinePlayerActivity : BaseActivity() { super.onEvents(player, events) // update the displayed duration on changes playerBinding.duration.text = DateUtils.formatElapsedTime( - player.duration / 1000 + player.duration / 1000, ) } }) @@ -106,7 +106,7 @@ class OfflinePlayerActivity : BaseActivity() { null, binding.doubleTapOverlay.binding, binding.playerGestureControlsView.binding, - trackSelector + trackSelector, ) } @@ -168,7 +168,7 @@ class OfflinePlayerActivity : BaseActivity() { .apply { if (subtitle != null) setSubtitleConfigurations(listOf(subtitle)) } - .build() + .build(), ) audioUri != null -> player.setMediaItem( MediaItem.Builder() @@ -176,7 +176,7 @@ class OfflinePlayerActivity : BaseActivity() { .apply { if (subtitle != null) setSubtitleConfigurations(listOf(subtitle)) } - .build() + .build(), ) } } @@ -202,7 +202,7 @@ class OfflinePlayerActivity : BaseActivity() { this, PictureInPictureParamsCompat.Builder() .setAspectRatio(player.videoSize) - .build() + .build(), ) } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/BottomSheetAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/BottomSheetAdapter.kt index b58462ce4e..2e5ac5b40c 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/BottomSheetAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/BottomSheetAdapter.kt @@ -10,13 +10,13 @@ import com.github.libretube.ui.viewholders.BottomSheetViewHolder class BottomSheetAdapter( private val items: List, - private val listener: (index: Int) -> Unit + private val listener: (index: Int) -> Unit, ) : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BottomSheetViewHolder { val binding = BottomSheetItemBinding.inflate( LayoutInflater.from(parent.context), parent, - false + false, ) return BottomSheetViewHolder(binding) } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/ChaptersAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/ChaptersAdapter.kt index f55b9c5c49..d0135793ca 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/ChaptersAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/ChaptersAdapter.kt @@ -14,7 +14,7 @@ import com.google.android.exoplayer2.ExoPlayer class ChaptersAdapter( private val chapters: List, - private val exoPlayer: ExoPlayer + private val exoPlayer: ExoPlayer, ) : RecyclerView.Adapter() { private var selectedPosition = 0 diff --git a/app/src/main/java/com/github/libretube/ui/adapters/CommentsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/CommentsAdapter.kt index c56fd2f1b3..395910de92 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/CommentsAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/CommentsAdapter.kt @@ -2,7 +2,9 @@ package com.github.libretube.ui.adapters import android.annotation.SuppressLint import android.text.method.LinkMovementMethod -import android.view.* +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup import android.view.ViewGroup.MarginLayoutParams import android.widget.Toast import androidx.appcompat.content.res.AppCompatResources @@ -37,7 +39,7 @@ class CommentsAdapter( private val comments: MutableList, private val isRepliesAdapter: Boolean = false, private val handleLink: ((url: String) -> Unit)?, - private val dismiss: () -> Unit + private val dismiss: () -> Unit, ) : RecyclerView.Adapter() { fun clear() { @@ -61,7 +63,7 @@ class CommentsAdapter( private fun navigateToReplies(comment: Comment) { val args = bundleOf( IntentData.videoId to videoId, - IntentData.comment to JsonHelper.json.encodeToString(comment) + IntentData.comment to JsonHelper.json.encodeToString(comment), ) fragment!!.parentFragmentManager.commit { replace(R.id.commentFragContainer, args = args) @@ -101,14 +103,14 @@ class CommentsAdapter( // highlight the comment that is being replied to if (comment == comments.firstOrNull()) { root.setBackgroundColor( - ThemeHelper.getThemeColor(root.context, R.attr.colorSurface) + ThemeHelper.getThemeColor(root.context, R.attr.colorSurface), ) root.updatePadding(top = 20) root.updateLayoutParams { bottomMargin = 20 } } else { root.background = AppCompatResources.getDrawable( root.context, - R.drawable.rounded_ripple + R.drawable.rounded_ripple, ) } } @@ -124,7 +126,7 @@ class CommentsAdapter( root.setOnLongClickListener { ClipboardHelper.save( root.context, - comment.commentText.orEmpty().parseAsHtml().toString() + comment.commentText.orEmpty().parseAsHtml().toString(), ) Toast.makeText(root.context, R.string.copied, Toast.LENGTH_SHORT).show() true 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 8a85450d60..6d270be8a8 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 @@ -23,13 +23,13 @@ import kotlin.io.path.fileSize class DownloadsAdapter( private val context: Context, private val downloads: MutableList, - private val toggleDownload: (DownloadWithItems) -> Boolean + private val toggleDownload: (DownloadWithItems) -> Boolean, ) : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DownloadsViewHolder { val binding = DownloadedMediaRowBinding.inflate( LayoutInflater.from(parent.context), parent, - false + false, ) return DownloadsViewHolder(binding) } @@ -79,7 +79,7 @@ class DownloadsAdapter( R.drawable.ic_pause } else { R.drawable.ic_download - } + }, ) } @@ -95,7 +95,7 @@ class DownloadsAdapter( notifyItemRemoved(position) notifyItemRangeChanged(position, itemCount) }.show( - (root.context as AppCompatActivity).supportFragmentManager + (root.context as AppCompatActivity).supportFragmentManager, ) true } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/IconsSheetAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/IconsSheetAdapter.kt index 00daa1f592..7e94ce7de5 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/IconsSheetAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/IconsSheetAdapter.kt @@ -38,7 +38,7 @@ class IconsSheetAdapter : RecyclerView.Adapter() { sealed class AppIcon( @StringRes val nameResource: Int, @DrawableRes val iconResource: Int, - val activityAlias: String + val activityAlias: String, ) { object Default : AppIcon(R.string.defaultIcon, R.mipmap.ic_launcher, "ui.activities.MainActivity") @@ -66,7 +66,7 @@ class IconsSheetAdapter : RecyclerView.Adapter() { AppIcon.Torch, AppIcon.Shaped, AppIcon.Flame, - AppIcon.Bird + AppIcon.Bird, ) } } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/IntentChooserAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/IntentChooserAdapter.kt index 11073fb7f8..f64d084483 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/IntentChooserAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/IntentChooserAdapter.kt @@ -15,7 +15,7 @@ import com.github.libretube.ui.viewholders.IntentChooserViewHolder */ class IntentChooserAdapter( private val packages: List, - private val queryUrl: String + private val queryUrl: String, ) : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): IntentChooserViewHolder { val layoutInflater = LayoutInflater.from(parent.context) diff --git a/app/src/main/java/com/github/libretube/ui/adapters/LegacySubscriptionAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/LegacySubscriptionAdapter.kt index f4ecf65f74..14b188f5d1 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/LegacySubscriptionAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/LegacySubscriptionAdapter.kt @@ -12,12 +12,12 @@ import com.github.libretube.ui.sheets.ChannelOptionsBottomSheet import com.github.libretube.ui.viewholders.LegacySubscriptionViewHolder class LegacySubscriptionAdapter( - private val subscriptions: List + private val subscriptions: List, ) : RecyclerView.Adapter() { override fun onCreateViewHolder( parent: ViewGroup, - viewType: Int + viewType: Int, ): LegacySubscriptionViewHolder { val layoutInflater = LayoutInflater.from(parent.context) val binding = LegacySubscriptionChannelBinding.inflate(layoutInflater, parent, false) @@ -30,12 +30,12 @@ class LegacySubscriptionAdapter( channelName.text = subscription.name ImageHelper.loadImage( subscription.avatar, - channelAvatar + channelAvatar, ) root.setOnClickListener { NavigationHelper.navigateChannel( root.context, - subscription.url!!.toID() + subscription.url!!.toID(), ) } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/NavBarOptionsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/NavBarOptionsAdapter.kt index 8c12b0a69d..4b204b5cbd 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/NavBarOptionsAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/NavBarOptionsAdapter.kt @@ -10,14 +10,14 @@ import com.github.libretube.ui.viewholders.NavBarOptionsViewHolder class NavBarOptionsAdapter( val items: MutableList, - var selectedHomeTabId: Int + var selectedHomeTabId: Int, ) : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NavBarOptionsViewHolder { val binding = NavOptionsItemBinding.inflate( LayoutInflater.from(parent.context), parent, - false + false, ) return NavBarOptionsViewHolder(binding) } @@ -32,7 +32,7 @@ class NavBarOptionsAdapter( title.text = item.title checkbox.isChecked = item.isVisible home.setImageResource( - if (item.itemId == selectedHomeTabId) R.drawable.ic_home else R.drawable.ic_home_outlined + if (item.itemId == selectedHomeTabId) R.drawable.ic_home else R.drawable.ic_home_outlined, ) home.setOnClickListener { if (selectedHomeTabId == item.itemId) { diff --git a/app/src/main/java/com/github/libretube/ui/adapters/PlayingQueueAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/PlayingQueueAdapter.kt index dec3d6921d..a24fe59cdf 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/PlayingQueueAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/PlayingQueueAdapter.kt @@ -19,7 +19,7 @@ class PlayingQueueAdapter : RecyclerView.Adapter() { val binding = QueueRowBinding.inflate( LayoutInflater.from(parent.context), parent, - false + false, ) return PlayingQueueViewHolder(binding) } @@ -43,7 +43,7 @@ class PlayingQueueAdapter : RecyclerView.Adapter() { ThemeHelper.getThemeColor(root.context, android.R.attr.colorControlHighlight) } else { Color.TRANSPARENT - } + }, ) root.setOnClickListener { diff --git a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt index 51244bf241..26dd7cfb3c 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt @@ -20,15 +20,15 @@ import com.github.libretube.ui.extensions.setFormattedDuration import com.github.libretube.ui.extensions.setWatchProgressLength import com.github.libretube.ui.sheets.VideoOptionsBottomSheet import com.github.libretube.ui.viewholders.PlaylistViewHolder -import java.io.IOException import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import java.io.IOException class PlaylistAdapter( private val videoFeed: MutableList, private val playlistId: String, - private val playlistType: PlaylistType + private val playlistType: PlaylistType, ) : RecyclerView.Adapter() { private var visibleCount = minOf(20, videoFeed.size) @@ -77,7 +77,7 @@ class PlaylistAdapter( VideoOptionsBottomSheet(videoId, videoName) .show( (root.context as BaseActivity).supportFragmentManager, - VideoOptionsBottomSheet::class.java.name + VideoOptionsBottomSheet::class.java.name, ) true } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistBookmarkAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistBookmarkAdapter.kt index b5ae744ab2..4207ce85c4 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistBookmarkAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistBookmarkAdapter.kt @@ -21,16 +21,16 @@ import kotlinx.coroutines.launch class PlaylistBookmarkAdapter( private val bookmarks: List, - private val bookmarkMode: BookmarkMode = BookmarkMode.FRAGMENT + private val bookmarkMode: BookmarkMode = BookmarkMode.FRAGMENT, ) : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PlaylistBookmarkViewHolder { val layoutInflater = LayoutInflater.from(parent.context) return when (bookmarkMode) { BookmarkMode.HOME -> PlaylistBookmarkViewHolder( - PlaylistBookmarkRowBinding.inflate(layoutInflater, parent, false) + PlaylistBookmarkRowBinding.inflate(layoutInflater, parent, false), ) BookmarkMode.FRAGMENT -> PlaylistBookmarkViewHolder( - PlaylistsRowBinding.inflate(layoutInflater, parent, false) + PlaylistsRowBinding.inflate(layoutInflater, parent, false), ) } } @@ -50,7 +50,7 @@ class PlaylistBookmarkAdapter( NavigationHelper.navigatePlaylist( root.context, bookmark.playlistId, - PlaylistType.PUBLIC + PlaylistType.PUBLIC, ) } @@ -58,9 +58,9 @@ class PlaylistBookmarkAdapter( PlaylistOptionsBottomSheet( playlistId = bookmark.playlistId, playlistName = bookmark.playlistName ?: "", - playlistType = PlaylistType.PUBLIC + playlistType = PlaylistType.PUBLIC, ).show( - (root.context as AppCompatActivity).supportFragmentManager + (root.context as AppCompatActivity).supportFragmentManager, ) true } @@ -79,7 +79,7 @@ class PlaylistBookmarkAdapter( bookmarkPlaylist.setOnClickListener { isBookmarked = !isBookmarked bookmarkPlaylist.setImageResource( - if (isBookmarked) R.drawable.ic_bookmark else R.drawable.ic_bookmark_outlined + if (isBookmarked) R.drawable.ic_bookmark else R.drawable.ic_bookmark_outlined, ) CoroutineScope(Dispatchers.IO).launch { if (!isBookmarked) { @@ -96,7 +96,7 @@ class PlaylistBookmarkAdapter( NavigationHelper.navigatePlaylist( root.context, bookmark.playlistId, - PlaylistType.PUBLIC + PlaylistType.PUBLIC, ) } @@ -104,9 +104,9 @@ class PlaylistBookmarkAdapter( PlaylistOptionsBottomSheet( playlistId = bookmark.playlistId, playlistName = bookmark.playlistName ?: "", - playlistType = PlaylistType.PUBLIC + playlistType = PlaylistType.PUBLIC, ).show( - (root.context as AppCompatActivity).supportFragmentManager + (root.context as AppCompatActivity).supportFragmentManager, ) true } @@ -116,7 +116,7 @@ class PlaylistBookmarkAdapter( companion object { enum class BookmarkMode { HOME, - FRAGMENT + FRAGMENT, } } } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistsAdapter.kt index eb63bd5a7d..6d30a1153a 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistsAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistsAdapter.kt @@ -15,7 +15,7 @@ import com.github.libretube.ui.viewholders.PlaylistsViewHolder class PlaylistsAdapter( private val playlists: MutableList, - private val playlistType: PlaylistType + private val playlistType: PlaylistType, ) : RecyclerView.Adapter() { override fun getItemCount(): Int { @@ -63,11 +63,11 @@ class PlaylistsAdapter( onRename = { playlistTitle.text = it playlist.name = it - } + }, ) playlistOptionsDialog.show( (root.context as BaseActivity).supportFragmentManager, - PlaylistOptionsBottomSheet::class.java.name + PlaylistOptionsBottomSheet::class.java.name, ) true } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/SearchAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/SearchAdapter.kt index 21d5f9296d..2310043f01 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/SearchAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/SearchAdapter.kt @@ -30,13 +30,13 @@ class SearchAdapter : ListAdapter(SearchCallback) return when (viewType) { 0 -> SearchViewHolder( - VideoRowBinding.inflate(layoutInflater, parent, false) + VideoRowBinding.inflate(layoutInflater, parent, false), ) 1 -> SearchViewHolder( - ChannelRowBinding.inflate(layoutInflater, parent, false) + ChannelRowBinding.inflate(layoutInflater, parent, false), ) 2 -> SearchViewHolder( - PlaylistsRowBinding.inflate(layoutInflater, parent, false) + PlaylistsRowBinding.inflate(layoutInflater, parent, false), ) else -> throw IllegalArgumentException("Invalid type") } @@ -80,7 +80,7 @@ class SearchAdapter : ListAdapter(SearchCallback) videoInfo.text = root.context.getString( R.string.normal_views, viewsString, - uploadDate + uploadDate, ) channelName.text = item.uploaderName } @@ -93,7 +93,7 @@ class SearchAdapter : ListAdapter(SearchCallback) VideoOptionsBottomSheet(videoId, videoName) .show( (root.context as BaseActivity).supportFragmentManager, - VideoOptionsBottomSheet::class.java.name + VideoOptionsBottomSheet::class.java.name, ) true } @@ -150,7 +150,7 @@ class SearchAdapter : ListAdapter(SearchCallback) PlaylistOptionsBottomSheet(playlistId, playlistName, PlaylistType.PUBLIC) .show( (root.context as BaseActivity).supportFragmentManager, - PlaylistOptionsBottomSheet::class.java.name + PlaylistOptionsBottomSheet::class.java.name, ) true } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/SearchHistoryAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/SearchHistoryAdapter.kt index 1fe0ac59a1..49462962fd 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/SearchHistoryAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/SearchHistoryAdapter.kt @@ -14,7 +14,7 @@ import kotlinx.coroutines.runBlocking class SearchHistoryAdapter( private var historyList: List, - private val searchView: SearchView + private val searchView: SearchView, ) : RecyclerView.Adapter() { diff --git a/app/src/main/java/com/github/libretube/ui/adapters/SearchSuggestionsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/SearchSuggestionsAdapter.kt index cdc5508c80..072aef0c20 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/SearchSuggestionsAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/SearchSuggestionsAdapter.kt @@ -9,7 +9,7 @@ import com.github.libretube.ui.viewholders.SuggestionsViewHolder class SearchSuggestionsAdapter( private var suggestionsList: List, - private val searchView: SearchView + private val searchView: SearchView, ) : RecyclerView.Adapter() { diff --git a/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionChannelAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionChannelAdapter.kt index e5ec8d60d1..dc2976cb18 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionChannelAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionChannelAdapter.kt @@ -14,15 +14,14 @@ import com.github.libretube.ui.sheets.ChannelOptionsBottomSheet import com.github.libretube.ui.viewholders.SubscriptionChannelViewHolder class SubscriptionChannelAdapter( - private val subscriptions: MutableList + private val subscriptions: MutableList, ) : RecyclerView.Adapter() { override fun getItemCount(): Int { return subscriptions.size } - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): - SubscriptionChannelViewHolder { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SubscriptionChannelViewHolder { val layoutInflater = LayoutInflater.from(parent.context) val binding = ChannelSubscriptionRowBinding.inflate(layoutInflater, parent, false) return SubscriptionChannelViewHolder(binding) @@ -48,7 +47,7 @@ class SubscriptionChannelAdapter( subscription.url?.toID(), subscription.name, notificationBell, - true + true, ) } } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionGroupChannelsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionGroupChannelsAdapter.kt index 9d82804c69..eb52425482 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionGroupChannelsAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionGroupChannelsAdapter.kt @@ -14,11 +14,11 @@ import com.github.libretube.ui.viewholders.SubscriptionGroupChannelRowViewHolder class SubscriptionGroupChannelsAdapter( private val channels: List, private val group: SubscriptionGroup, - private val onGroupChanged: (SubscriptionGroup) -> Unit + private val onGroupChanged: (SubscriptionGroup) -> Unit, ) : RecyclerView.Adapter() { override fun onCreateViewHolder( parent: ViewGroup, - viewType: Int + viewType: Int, ): SubscriptionGroupChannelRowViewHolder { val layoutInflater = LayoutInflater.from(parent.context) val binding = SubscriptionGroupChannelRowBinding.inflate(layoutInflater, parent, false) diff --git a/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionGroupsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionGroupsAdapter.kt index a54be1c274..b343dfc53e 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionGroupsAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/SubscriptionGroupsAdapter.kt @@ -15,11 +15,11 @@ import kotlinx.coroutines.runBlocking class SubscriptionGroupsAdapter( private val groups: MutableList, private val parentFragmentManager: FragmentManager, - private val onGroupsChanged: (List) -> Unit + private val onGroupsChanged: (List) -> Unit, ) : RecyclerView.Adapter() { override fun onCreateViewHolder( parent: ViewGroup, - viewType: Int + viewType: Int, ): SubscriptionGroupsViewHolder { val layoutInflater = LayoutInflater.from(parent.context) val binding = SubscriptionGroupRowBinding.inflate(layoutInflater, parent, false) @@ -36,7 +36,7 @@ class SubscriptionGroupsAdapter( groups.removeAt(position) runBlocking(Dispatchers.IO) { DatabaseHolder.Database.subscriptionGroupsDao().deleteGroup( - subscriptionGroup.name + subscriptionGroup.name, ) } onGroupsChanged(groups) @@ -49,7 +49,7 @@ class SubscriptionGroupsAdapter( runBlocking(Dispatchers.IO) { // delete the old one as it might have a different name DatabaseHolder.Database.subscriptionGroupsDao().deleteGroup( - groupName.text.toString() + groupName.text.toString(), ) DatabaseHolder.Database.subscriptionGroupsDao().createGroup(it) } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt index 4d19b7edd2..5e3593e347 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt @@ -32,7 +32,7 @@ import com.github.libretube.util.TextUtils class VideosAdapter( private val streamItems: MutableList, private val showAllAtOnce: Boolean = true, - private val forceMode: ForceMode = ForceMode.NONE + private val forceMode: ForceMode = ForceMode.NONE, ) : RecyclerView.Adapter() { private var visibleCount = minOf(10, streamItems.size) @@ -75,21 +75,21 @@ class VideosAdapter( val layoutInflater = LayoutInflater.from(parent.context) return when { viewType == CAUGHT_UP_TYPE -> VideosViewHolder( - AllCaughtUpRowBinding.inflate(layoutInflater, parent, false) + AllCaughtUpRowBinding.inflate(layoutInflater, parent, false), ) forceMode in listOf( ForceMode.TRENDING, ForceMode.RELATED, - ForceMode.HOME + ForceMode.HOME, ) -> VideosViewHolder( - TrendingRowBinding.inflate(layoutInflater, parent, false) + TrendingRowBinding.inflate(layoutInflater, parent, false), ) forceMode == ForceMode.CHANNEL -> VideosViewHolder( - VideoRowBinding.inflate(layoutInflater, parent, false) + VideoRowBinding.inflate(layoutInflater, parent, false), ) PreferenceHelper.getBoolean( PreferenceKeys.ALTERNATIVE_VIDEOS_LAYOUT, - false + false, ) -> VideosViewHolder(VideoRowBinding.inflate(layoutInflater, parent, false)) else -> VideosViewHolder(TrendingRowBinding.inflate(layoutInflater, parent, false)) } @@ -123,7 +123,7 @@ class VideosAdapter( R.string.trending_views, video.uploaderName, video.views.formatShort(), - video.uploaded?.let { TextUtils.formatRelativeDate(root.context, it) } + video.uploaded?.let { TextUtils.formatRelativeDate(root.context, it) }, ) video.duration?.let { thumbnailDuration.setFormattedDuration(it, video.isShort) } channelImage.setOnClickListener { @@ -140,7 +140,7 @@ class VideosAdapter( VideoOptionsBottomSheet(videoId, videoName) .show( (root.context as BaseActivity).supportFragmentManager, - VideoOptionsBottomSheet::class.java.name + VideoOptionsBottomSheet::class.java.name, ) true @@ -156,7 +156,7 @@ class VideosAdapter( video.views.formatShort(), video.uploaded?.let { TextUtils.SEPARATOR + TextUtils.formatRelativeDate(root.context, it) - } + }, ) thumbnailDuration.text = video.duration?.let { DateUtils.formatElapsedTime(it) } @@ -181,7 +181,7 @@ class VideosAdapter( VideoOptionsBottomSheet(videoId, videoName) .show( (root.context as BaseActivity).supportFragmentManager, - VideoOptionsBottomSheet::class.java.name + VideoOptionsBottomSheet::class.java.name, ) true } @@ -195,13 +195,13 @@ class VideosAdapter( ROW, CHANNEL, RELATED, - HOME + HOME, } fun getLayout(context: Context): LayoutManager { return if (PreferenceHelper.getBoolean( PreferenceKeys.ALTERNATIVE_VIDEOS_LAYOUT, - false + false, ) ) { LinearLayoutManager(context) @@ -210,8 +210,8 @@ class VideosAdapter( context, PreferenceHelper.getString( PreferenceKeys.GRID_COLUMNS, - context.resources.getInteger(R.integer.grid_items).toString() - ).toInt() + context.resources.getInteger(R.integer.grid_items).toString(), + ).toInt(), ) } } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt index b0d40ec042..6847f16460 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt @@ -18,7 +18,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking class WatchHistoryAdapter( - private val watchHistory: MutableList + private val watchHistory: MutableList, ) : RecyclerView.Adapter() { @@ -71,7 +71,7 @@ class WatchHistoryAdapter( VideoOptionsBottomSheet(video.videoId, video.title!!) .show( (root.context as BaseActivity).supportFragmentManager, - VideoOptionsBottomSheet::class.java.name + VideoOptionsBottomSheet::class.java.name, ) true } diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt index cdaeb60cf5..102fc96aab 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt @@ -26,7 +26,7 @@ import kotlinx.coroutines.launch * @param videoId The id of the video to add. If non is provided, insert the whole playing queue */ class AddToPlaylistDialog( - private val videoId: String? = null + private val videoId: String? = null, ) : DialogFragment() { private val viewModel: PlaylistViewModel by activityViewModels() @@ -64,7 +64,7 @@ class AddToPlaylistDialog( // select the last used playlist viewModel.lastSelectedPlaylistId?.let { id -> binding.playlistsSpinner.setSelection( - response.indexOfFirst { it.id == id }.takeIf { it >= 0 } ?: 0 + response.indexOfFirst { it.id == id }.takeIf { it >= 0 } ?: 0, ) } binding.addToPlaylist.setOnClickListener { @@ -86,7 +86,7 @@ class AddToPlaylistDialog( videoId != null -> listOfNotNull( runCatching { RetrofitInstance.api.getStreams(videoId!!).toStreamItem(videoId) - }.getOrNull() + }.getOrNull(), ) else -> PlayingQueue.getStreams() } @@ -100,7 +100,7 @@ class AddToPlaylistDialog( return } appContext.toastFromMainDispatcher( - if (success) R.string.added_to_playlist else R.string.fail + if (success) R.string.added_to_playlist else R.string.fail, ) } } 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 f57e4383c6..d5626bcb32 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 @@ -17,11 +17,11 @@ import kotlinx.serialization.json.JsonNull import kotlinx.serialization.json.JsonPrimitive class BackupDialog( - private val createBackupFile: (BackupFile) -> Unit + private val createBackupFile: (BackupFile) -> Unit, ) : DialogFragment() { sealed class BackupOption( @StringRes val name: Int, - val onSelected: suspend (BackupFile) -> Unit + val onSelected: suspend (BackupFile) -> Unit, ) { object WatchHistory : BackupOption(R.string.watch_history, onSelected = { it.watchHistory = Database.watchHistoryDao().getAll() @@ -78,7 +78,7 @@ class BackupDialog( BackupOption.PlaylistBookmarks, BackupOption.LocalPlaylists, BackupOption.SubscriptionGroups, - BackupOption.Preferences + BackupOption.Preferences, ) val backupItems = backupOptions.map { context?.getString(it.name)!! }.toTypedArray() diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/CreatePlaylistDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/CreatePlaylistDialog.kt index 9b380ecf84..39a8608959 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/CreatePlaylistDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/CreatePlaylistDialog.kt @@ -16,7 +16,7 @@ import kotlinx.coroutines.withContext import okhttp3.HttpUrl.Companion.toHttpUrlOrNull class CreatePlaylistDialog( - private val onSuccess: () -> Unit = {} + private val onSuccess: () -> Unit = {}, ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val binding = DialogCreatePlaylistBinding.inflate(layoutInflater) @@ -37,7 +37,7 @@ class CreatePlaylistDialog( onSuccess() } appContext?.toastFromMainDispatcher( - if (playlistId != null) R.string.playlistCloned else R.string.server_error + if (playlistId != null) R.string.playlistCloned else R.string.server_error, ) dismiss() } @@ -64,7 +64,7 @@ class CreatePlaylistDialog( }.getOrNull() } appContext?.toastFromMainDispatcher( - if (playlistId != null) R.string.playlistCreated else R.string.unknown_error + if (playlistId != null) R.string.playlistCreated else R.string.unknown_error, ) playlistId?.let { onSuccess() } dismiss() diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/DeleteAccountDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/DeleteAccountDialog.kt index 80580e9528..23f2bb33b5 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/DeleteAccountDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/DeleteAccountDialog.kt @@ -20,7 +20,7 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext class DeleteAccountDialog( - private val onLogout: () -> Unit + private val onLogout: () -> Unit, ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val binding = DialogDeleteAccountBinding.inflate(layoutInflater) diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/DeletePlaylistDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/DeletePlaylistDialog.kt index b2b8c180e9..a93533d71e 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/DeletePlaylistDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/DeletePlaylistDialog.kt @@ -16,7 +16,7 @@ import kotlinx.coroutines.withContext class DeletePlaylistDialog( private val playlistId: String, private val playlistType: PlaylistType, - private val onSuccess: () -> Unit + private val onSuccess: () -> Unit, ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { return MaterialAlertDialogBuilder(requireContext()) @@ -27,7 +27,7 @@ class DeletePlaylistDialog( CoroutineScope(Dispatchers.IO).launch { val success = PlaylistsHelper.deletePlaylist(playlistId, playlistType) appContext?.toastFromMainDispatcher( - if (success) R.string.success else R.string.fail + if (success) R.string.success else R.string.fail, ) withContext(Dispatchers.Main) { runCatching { 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 f749b5f3c0..ba1302c1cd 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 @@ -23,14 +23,14 @@ import com.github.libretube.helpers.DownloadHelper import com.github.libretube.helpers.PreferenceHelper 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( - private val videoId: String + private val videoId: String, ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val binding = DialogDownloadBinding.inflate(layoutInflater) @@ -110,7 +110,7 @@ class DownloadDialog( R.layout.dropdown_item, videoStreams.map { "${it.quality} ${it.format}" }.toMutableList().also { it.add(0, getString(R.string.no_video)) - } + }, ) val audioArrayAdapter = ArrayAdapter( @@ -118,7 +118,7 @@ class DownloadDialog( R.layout.dropdown_item, audioStreams.map { "${it.quality} ${it.format}" }.toMutableList().also { it.add(0, getString(R.string.no_audio)) - } + }, ) val subtitleArrayAdapter = ArrayAdapter( @@ -126,7 +126,7 @@ class DownloadDialog( R.layout.dropdown_item, subtitles.map { it.name.orEmpty() }.toMutableList().also { it.add(0, getString(R.string.no_subtitle)) - } + }, ) binding.videoSpinner.adapter = videoArrayAdapter @@ -164,7 +164,7 @@ class DownloadDialog( videoQuality = videoStream?.quality, audioFormat = audioStream?.format, audioQuality = audioStream?.quality, - subtitleCode = subtitle?.code + subtitleCode = subtitle?.code, ) dismiss() @@ -177,7 +177,7 @@ class DownloadDialog( private fun saveSelections( videoStream: PipedStream?, audioStream: PipedStream?, - subtitle: Subtitle? + subtitle: Subtitle?, ) { PreferenceHelper.putString(SUBTITLE_LANGUAGE, subtitle?.code.orEmpty()) PreferenceHelper.putString(VIDEO_DOWNLOAD_FORMAT, videoStream?.format.orEmpty()) @@ -195,19 +195,19 @@ class DownloadDialog( binding: DialogDownloadBinding, videoStreams: List, audioStreams: List, - subtitles: List + subtitles: List, ) { getStreamSelection( videoStreams, getSel(VIDEO_DOWNLOAD_QUALITY), - getSel(VIDEO_DOWNLOAD_FORMAT) + getSel(VIDEO_DOWNLOAD_FORMAT), )?.let { binding.videoSpinner.setSelection(it + 1) } getStreamSelection( audioStreams, getSel(AUDIO_DOWNLOAD_QUALITY), - getSel(AUDIO_DOWNLOAD_FORMAT) + getSel(AUDIO_DOWNLOAD_FORMAT), )?.let { binding.audioSpinner.setSelection(it + 1) } diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/LoginDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/LoginDialog.kt index d5706c9332..f3b0ce9e84 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/LoginDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/LoginDialog.kt @@ -24,7 +24,7 @@ import kotlinx.serialization.decodeFromString import retrofit2.HttpException class LoginDialog( - private val onLogin: () -> Unit + private val onLogin: () -> Unit, ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val binding = DialogLoginBinding.inflate(layoutInflater) @@ -92,7 +92,7 @@ class LoginDialog( if (response.token == null) return@launch context?.toastFromMainDispatcher( - if (createNewAccount) R.string.registered else R.string.loggedIn + if (createNewAccount) R.string.registered else R.string.loggedIn, ) PreferenceHelper.setToken(response.token) diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/LogoutDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/LogoutDialog.kt index fad01e4fe1..d1bcb31af5 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/LogoutDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/LogoutDialog.kt @@ -11,7 +11,7 @@ import com.github.libretube.helpers.PreferenceHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder class LogoutDialog( - private val onLogout: () -> Unit + private val onLogout: () -> Unit, ) : DialogFragment() { @SuppressLint("SetTextI18n") override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/NavBarOptionsDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/NavBarOptionsDialog.kt index ae0ad9a44d..6e631045aa 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/NavBarOptionsDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/NavBarOptionsDialog.kt @@ -18,13 +18,13 @@ class NavBarOptionsDialog : DialogFragment() { val options = NavBarHelper.getNavBarItems(requireContext()) val adapter = NavBarOptionsAdapter( options.toMutableList(), - NavBarHelper.getStartFragmentId(requireContext()) + NavBarHelper.getStartFragmentId(requireContext()), ) val itemTouchCallback = object : ItemTouchHelper.Callback() { override fun getMovementFlags( recyclerView: RecyclerView, - viewHolder: RecyclerView.ViewHolder + viewHolder: RecyclerView.ViewHolder, ): Int { val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN return makeMovementFlags(dragFlags, 0) @@ -33,7 +33,7 @@ class NavBarOptionsDialog : DialogFragment() { override fun onMove( recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, - target: RecyclerView.ViewHolder + target: RecyclerView.ViewHolder, ): Boolean { val itemToMove = adapter.items[viewHolder.absoluteAdapterPosition] adapter.items.remove(itemToMove) @@ -41,7 +41,7 @@ class NavBarOptionsDialog : DialogFragment() { adapter.notifyItemMoved( viewHolder.absoluteAdapterPosition, - target.absoluteAdapterPosition + target.absoluteAdapterPosition, ) return true } diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/RenamePlaylistDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/RenamePlaylistDialog.kt index a8783f3411..11aa67324e 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/RenamePlaylistDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/RenamePlaylistDialog.kt @@ -21,7 +21,7 @@ import kotlinx.coroutines.withContext class RenamePlaylistDialog( private val playlistId: String, private val currentPlaylistName: String, - private val onSuccess: (String) -> Unit + private val onSuccess: (String) -> Unit, ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val binding = DialogTextPreferenceBinding.inflate(layoutInflater) diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/ShareDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/ShareDialog.kt index 244c25908c..81703953f7 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/ShareDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/ShareDialog.kt @@ -22,12 +22,12 @@ import kotlinx.coroutines.runBlocking class ShareDialog( private val id: String, private val shareObjectType: ShareObjectType, - private val shareData: ShareData + private val shareData: ShareData, ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { var shareOptions = arrayOf( getString(R.string.piped), - getString(R.string.youtube) + getString(R.string.youtube), ) val instanceUrl = getCustomInstanceFrontendUrl() val shareableTitle = shareData.currentChannel @@ -77,7 +77,7 @@ class ShareDialog( private fun setupTimeStampBinding(binding: DialogShareBinding) { binding.timeCodeSwitch.isChecked = PreferenceHelper.getBoolean( PreferenceKeys.SHARE_WITH_TIME_CODE, - true + true, ) binding.timeCodeSwitch.setOnCheckedChangeListener { _, isChecked -> binding.timeStampLayout.isVisible = isChecked @@ -93,7 +93,7 @@ class ShareDialog( private fun getCustomInstanceFrontendUrl(): String { val instancePref = PreferenceHelper.getString( PreferenceKeys.FETCH_INSTANCE, - PIPED_FRONTEND_URL + PIPED_FRONTEND_URL, ) // get the api urls of the other custom instances diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/StatsDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/StatsDialog.kt index c8fe8bb446..d18e7afc4b 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/StatsDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/StatsDialog.kt @@ -12,7 +12,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder class StatsDialog( private val player: ExoPlayer, - private val videoId: String + private val videoId: String, ) : DialogFragment() { @SuppressLint("SetTextI18n") @@ -21,16 +21,16 @@ class StatsDialog( binding.videoId.setText(videoId) binding.videoInfo.setText( "${player.videoFormat?.codecs.orEmpty()} ${TextUtils.formatBitrate( - player.videoFormat?.bitrate - )}" + player.videoFormat?.bitrate, + )}", ) binding.audioInfo.setText( "${player.audioFormat?.codecs.orEmpty()} ${TextUtils.formatBitrate( - player.audioFormat?.bitrate - )}" + player.audioFormat?.bitrate, + )}", ) binding.videoQuality.setText( - "${player.videoFormat?.width}x${player.videoFormat?.height} ${player.videoFormat?.frameRate?.toInt()}fps" + "${player.videoFormat?.width}x${player.videoFormat?.height} ${player.videoFormat?.frameRate?.toInt()}fps", ) return MaterialAlertDialogBuilder(requireContext()) diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/UpdateAvailableDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/UpdateAvailableDialog.kt index 7a80c9b87b..0750a1d3a6 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/UpdateAvailableDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/UpdateAvailableDialog.kt @@ -10,7 +10,7 @@ import com.github.libretube.obj.update.UpdateInfo import com.google.android.material.dialog.MaterialAlertDialogBuilder class UpdateAvailableDialog( - private val updateInfo: UpdateInfo + private val updateInfo: UpdateInfo, ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { diff --git a/app/src/main/java/com/github/libretube/ui/extensions/SetDrawables.kt b/app/src/main/java/com/github/libretube/ui/extensions/SetDrawables.kt index 5d9cc62c4d..e879f0c708 100644 --- a/app/src/main/java/com/github/libretube/ui/extensions/SetDrawables.kt +++ b/app/src/main/java/com/github/libretube/ui/extensions/SetDrawables.kt @@ -7,12 +7,12 @@ fun TextView.setDrawables( start: Int? = null, top: Int? = null, end: Int? = null, - bottom: Int? = null + bottom: Int? = null, ) { setCompoundDrawablesRelativeWithIntrinsicBounds( start?.let { AppCompatResources.getDrawable(context, it) }, top?.let { AppCompatResources.getDrawable(context, it) }, end?.let { AppCompatResources.getDrawable(context, it) }, - bottom?.let { AppCompatResources.getDrawable(context, it) } + bottom?.let { AppCompatResources.getDrawable(context, it) }, ) } diff --git a/app/src/main/java/com/github/libretube/ui/extensions/SetupSubscriptionButton.kt b/app/src/main/java/com/github/libretube/ui/extensions/SetupSubscriptionButton.kt index aa836e34e2..30114373f2 100644 --- a/app/src/main/java/com/github/libretube/ui/extensions/SetupSubscriptionButton.kt +++ b/app/src/main/java/com/github/libretube/ui/extensions/SetupSubscriptionButton.kt @@ -15,7 +15,7 @@ fun TextView.setupSubscriptionButton( channelId: String?, channelName: String?, notificationBell: MaterialButton? = null, - isSubscribed: Boolean? = null + isSubscribed: Boolean? = null, ) { if (channelId == null) return 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 ed1ebac4b6..43ca462221 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 @@ -85,7 +85,7 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentAudioPlayerBinding.inflate(inflater) return binding.root @@ -142,7 +142,7 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions { videoId = PlayingQueue.getCurrent()?.url?.toID(), timeStamp = playerService?.player?.currentPosition?.div(1000), keepQueue = true, - forceVideo = true + forceVideo = true, ) } @@ -151,7 +151,7 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions { ShareDialog( id = currentVideo.url!!.toID(), shareObjectType = ShareObjectType.VIDEO, - shareData = ShareData(currentVideo = currentVideo.title) + shareData = ShareData(currentVideo = currentVideo.title), ).show(childFragmentManager, null) } @@ -208,7 +208,7 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions { motionLayout: MotionLayout?, startId: Int, endId: Int, - progress: Float + progress: Float, ) { mainMotionLayout.progress = abs(progress) eId = endId @@ -287,14 +287,14 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions { // set the text for the indicators binding.duration.text = DateUtils.formatElapsedTime(duration / 1000) binding.currentPosition.text = DateUtils.formatElapsedTime( - (currentPosition / 1000).toLong() + (currentPosition / 1000).toLong(), ) // update the time bar current value and maximum value binding.timeBar.valueTo = (duration / 1000).toFloat() binding.timeBar.value = minOf( currentPosition / 1000, - binding.timeBar.valueTo + binding.timeBar.valueTo, ) handler.postDelayed(this::updateSeekBar, 200) @@ -361,7 +361,7 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions { when { distance > 0 -> R.drawable.ic_volume_up else -> R.drawable.ic_volume_off - } + }, ) } bar.incrementProgressBy(distance.toInt() / 3) 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 6a21ba9686..e4b9d78203 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 @@ -29,11 +29,11 @@ import com.github.libretube.ui.adapters.SearchAdapter import com.github.libretube.ui.adapters.VideosAdapter import com.github.libretube.ui.dialogs.ShareDialog import com.github.libretube.ui.extensions.setupSubscriptionButton -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 : Fragment() { private var _binding: FragmentChannelBinding? = null @@ -52,7 +52,7 @@ class ChannelFragment : Fragment() { ChannelTabs.Channels, ChannelTabs.Playlists, ChannelTabs.Livestreams, - ChannelTabs.Shorts + ChannelTabs.Shorts, ) override fun onCreate(savedInstanceState: Bundle?) { @@ -68,7 +68,7 @@ class ChannelFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentChannelBinding.inflate(inflater, container, false) return binding.root @@ -145,14 +145,14 @@ class ChannelFragment : Fragment() { binding.channelSubscribe.setupSubscriptionButton( channelId, channelName, - binding.notificationBell + binding.notificationBell, ) binding.channelShare.setOnClickListener { val shareDialog = ShareDialog( channelId.toID(), ShareObjectType.CHANNEL, - shareData + shareData, ) shareDialog.show(childFragmentManager, ShareDialog::class.java.name) } @@ -168,12 +168,12 @@ class ChannelFragment : Fragment() { 0, 0, R.drawable.ic_verified, - 0 + 0, ) } binding.channelSubs.text = resources.getString( R.string.subscribers, - response.subscriberCount.formatShort() + response.subscriberCount.formatShort(), ) if (response.description.orEmpty().isBlank()) { binding.channelDescription.visibility = View.GONE @@ -193,7 +193,7 @@ class ChannelFragment : Fragment() { // recyclerview of the videos by the channel channelAdapter = VideosAdapter( response.relatedStreams.toMutableList(), - forceMode = VideosAdapter.Companion.ForceMode.CHANNEL + forceMode = VideosAdapter.Companion.ForceMode.CHANNEL, ) binding.channelRecView.adapter = channelAdapter @@ -294,7 +294,7 @@ class ChannelFragment : Fragment() { nextPage: String, tab: ChannelTab, adapter: SearchAdapter, - onNewNextPage: (String?) -> Unit + onNewNextPage: (String?) -> Unit, ) { lifecycleScope.launch { val newContent = try { diff --git a/app/src/main/java/com/github/libretube/ui/fragments/CommentsMainFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/CommentsMainFragment.kt index d2604e7a99..ae2ae71aac 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/CommentsMainFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/CommentsMainFragment.kt @@ -25,7 +25,7 @@ class CommentsMainFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentCommentsBinding.inflate(inflater, container, false) return binding.root @@ -61,7 +61,7 @@ class CommentsMainFragment : Fragment() { this, viewModel.videoId!!, viewModel.commentsPage.value?.comments.orEmpty().toMutableList(), - handleLink = viewModel.handleLink + handleLink = viewModel.handleLink, ) { viewModel.commentsSheetDismiss?.invoke() } @@ -89,7 +89,7 @@ class CommentsMainFragment : Fragment() { } commentsAdapter.updateItems( // only add the new comments to the recycler view - it.comments.subList(commentsAdapter.itemCount, it.comments.size) + it.comments.subList(commentsAdapter.itemCount, it.comments.size), ) } } diff --git a/app/src/main/java/com/github/libretube/ui/fragments/CommentsRepliesFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/CommentsRepliesFragment.kt index c75f988f00..4e359b34b2 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/CommentsRepliesFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/CommentsRepliesFragment.kt @@ -37,7 +37,7 @@ class CommentsRepliesFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentCommentsBinding.inflate(inflater, container, false) return binding.root @@ -48,7 +48,7 @@ class CommentsRepliesFragment : Fragment() { val videoId = arguments?.getString(IntentData.videoId) ?: "" val comment = JsonHelper.json.decodeFromString( Comment.serializer(), - arguments?.getString(IntentData.comment)!! + arguments?.getString(IntentData.comment)!!, ) repliesAdapter = CommentsAdapter( @@ -56,7 +56,7 @@ class CommentsRepliesFragment : Fragment() { videoId, mutableListOf(comment), true, - viewModel.handleLink + viewModel.handleLink, ) { viewModel.commentsSheetDismiss?.invoke() } @@ -87,7 +87,7 @@ class CommentsRepliesFragment : Fragment() { private fun loadInitialReplies( videoId: String, nextPage: String, - repliesAdapter: CommentsAdapter + repliesAdapter: CommentsAdapter, ) { binding.progress.visibility = View.VISIBLE fetchReplies(videoId, nextPage) { @@ -99,7 +99,7 @@ class CommentsRepliesFragment : Fragment() { private fun fetchReplies( videoId: String, nextPage: String, - onFinished: (CommentsPage) -> Unit + onFinished: (CommentsPage) -> Unit, ) { lifecycleScope.launch(Dispatchers.IO) { if (isLoading) return@launch 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 db7fc7c9c9..5704459107 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 @@ -24,12 +24,12 @@ import com.github.libretube.receivers.DownloadReceiver import com.github.libretube.services.DownloadService import com.github.libretube.ui.adapters.DownloadsAdapter import com.github.libretube.ui.viewholders.DownloadsViewHolder -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 : Fragment() { private var _binding: FragmentDownloadsBinding? = null @@ -63,7 +63,7 @@ class DownloadsFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentDownloadsBinding.inflate(inflater) return binding.root @@ -120,7 +120,7 @@ class DownloadsFragment : Fragment() { binding.downloadsEmpty.visibility = View.VISIBLE } } - } + }, ) } diff --git a/app/src/main/java/com/github/libretube/ui/fragments/HomeFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/HomeFragment.kt index 3456834e3a..930af1119a 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/HomeFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/HomeFragment.kt @@ -41,7 +41,7 @@ class HomeFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentHomeBinding.inflate(inflater, container, false) return binding.root @@ -86,7 +86,7 @@ class HomeFragment : Fragment() { async { loadTrending() }, async { loadBookmarks() }, async { loadFeed() }, - async { loadPlaylists() } + async { loadPlaylists() }, ) } } @@ -105,7 +105,7 @@ class HomeFragment : Fragment() { binding.trendingRV.layoutManager = GridLayoutManager(context, 2) binding.trendingRV.adapter = VideosAdapter( trending.toMutableList(), - forceMode = VideosAdapter.Companion.ForceMode.TRENDING + forceMode = VideosAdapter.Companion.ForceMode.TRENDING, ) } @@ -133,11 +133,11 @@ class HomeFragment : Fragment() { binding.featuredRV.layoutManager = LinearLayoutManager( context, LinearLayoutManager.HORIZONTAL, - false + false, ) binding.featuredRV.adapter = VideosAdapter( feed.toMutableList(), - forceMode = VideosAdapter.Companion.ForceMode.HOME + forceMode = VideosAdapter.Companion.ForceMode.HOME, ) } @@ -151,11 +151,11 @@ class HomeFragment : Fragment() { binding.bookmarksRV.layoutManager = LinearLayoutManager( context, LinearLayoutManager.HORIZONTAL, - false + false, ) binding.bookmarksRV.adapter = PlaylistBookmarkAdapter( bookmarkedPlaylists, - PlaylistBookmarkAdapter.Companion.BookmarkMode.HOME + PlaylistBookmarkAdapter.Companion.BookmarkMode.HOME, ) } @@ -171,7 +171,7 @@ class HomeFragment : Fragment() { binding.playlistsRV.layoutManager = LinearLayoutManager(context) binding.playlistsRV.adapter = PlaylistsAdapter( playlists.toMutableList(), - PlaylistsHelper.getPrivatePlaylistType() + PlaylistsHelper.getPrivatePlaylistType(), ) binding.playlistsRV.adapter?.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() { diff --git a/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt index e486a324ed..b9d989c922 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt @@ -43,7 +43,7 @@ class LibraryFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentLibraryBinding.inflate(inflater, container, false) return binding.root @@ -154,7 +154,7 @@ class LibraryFragment : Fragment() { val playlistsAdapter = PlaylistsAdapter( playlists.toMutableList(), - PlaylistsHelper.getPrivatePlaylistType() + PlaylistsHelper.getPrivatePlaylistType(), ) // listen for playlists to become deleted 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 498c41f44c..3aa12eef10 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 @@ -64,9 +64,16 @@ import com.github.libretube.extensions.hideKeyboard import com.github.libretube.extensions.toID import com.github.libretube.extensions.toastFromMainDispatcher import com.github.libretube.extensions.updateParameters -import com.github.libretube.helpers.* +import com.github.libretube.helpers.BackgroundHelper +import com.github.libretube.helpers.DashHelper +import com.github.libretube.helpers.DisplayHelper +import com.github.libretube.helpers.ImageHelper +import com.github.libretube.helpers.NavigationHelper +import com.github.libretube.helpers.PlayerHelper import com.github.libretube.helpers.PlayerHelper.checkForSegments import com.github.libretube.helpers.PlayerHelper.loadPlaybackParams +import com.github.libretube.helpers.PreferenceHelper +import com.github.libretube.helpers.ProxyHelper import com.github.libretube.obj.PlayerNotificationData import com.github.libretube.obj.ShareData import com.github.libretube.obj.VideoResolution @@ -104,10 +111,6 @@ import com.google.android.exoplayer2.trackselection.DefaultTrackSelector 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 @@ -116,6 +119,10 @@ import kotlinx.coroutines.withContext import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import retrofit2.HttpException +import java.io.IOException +import java.util.* +import java.util.concurrent.Executors +import kotlin.math.abs class PlayerFragment : Fragment(), OnlinePlayerOptions { private var _binding: FragmentPlayerBinding? = null @@ -239,14 +246,14 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { // broadcast receiver for PiP actions context?.registerReceiver( broadcastReceiver, - IntentFilter(PlayerHelper.getIntentActon(requireContext())) + IntentFilter(PlayerHelper.getIntentActon(requireContext())), ) } override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentPlayerBinding.inflate(inflater) return binding.root @@ -292,7 +299,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { motionLayout: MotionLayout?, startId: Int, endId: Int, - progress: Float + progress: Float, ) { if (_binding == null) return @@ -406,7 +413,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { val updateSbImageResource = { playerBinding.sbToggle.setImageResource( - if (sponsorBlockEnabled) R.drawable.ic_sb_enabled else R.drawable.ic_sb_disabled + if (sponsorBlockEnabled) R.drawable.ic_sb_enabled else R.drawable.ic_sb_disabled, ) } updateSbImageResource() @@ -424,8 +431,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { ShareObjectType.VIDEO, ShareData( currentVideo = streams.title, - currentPosition = exoPlayer.currentPosition / 1000 - ) + currentPosition = exoPlayer.currentPosition / 1000, + ), ) shareDialog.show(childFragmentManager, ShareDialog::class.java.name) } @@ -464,7 +471,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { binding.alternativeTrendingRec.layoutManager = LinearLayoutManager( context, LinearLayoutManager.HORIZONTAL, - false + false, ) } @@ -477,7 +484,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { playlistId, channelId, keepQueue = true, - keepVideoPlayerAlive = true + keepVideoPlayerAlive = true, ) killPlayerFragment() NavigationHelper.startAudioPlayer(requireContext()) @@ -627,7 +634,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { // autoEnterEnabled is false by default PictureInPictureCompat.setPictureInPictureParams( requireActivity(), - PictureInPictureParamsCompat.Builder().build() + PictureInPictureParamsCompat.Builder().build(), ) } @@ -764,7 +771,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { segments = RetrofitInstance.api.getSegments( videoId!!, - JsonHelper.json.encodeToString(categories) + JsonHelper.json.encodeToString(categories), ).segments if (segments.isEmpty()) return@runCatching @@ -788,7 +795,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { // live stream but not watching at the end/live position playerBinding.timeSeparator.visibility = View.VISIBLE val diffText = DateUtils.formatElapsedTime( - (exoPlayer.duration - exoPlayer.currentPosition) / 1000 + (exoPlayer.duration - exoPlayer.currentPosition) / 1000, ) playerBinding.liveDiff.text = "-$diffText" } @@ -879,7 +886,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { playerGestureControlsViewBinding, trackSelector, viewModel, - viewLifecycleOwner + viewLifecycleOwner, ) binding.apply { @@ -898,7 +905,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { playerChannelSubCount.text = context?.getString( R.string.subscribers, - streams.uploaderSubscriberCount.formatShort() + streams.uploaderSubscriberCount.formatShort(), ) } @@ -928,7 +935,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { if (isPlaying && PlayerHelper.sponsorBlockEnabled) { handler.postDelayed( this@PlayerFragment::checkForSegments, - 100 + 100, ) } } @@ -939,7 +946,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { if (events.containsAny( Player.EVENT_PLAYBACK_STATE_CHANGED, Player.EVENT_IS_PLAYING_CHANGED, - Player.EVENT_PLAY_WHEN_READY_CHANGED + Player.EVENT_PLAY_WHEN_READY_CHANGED, ) ) { updatePlayPauseButton() @@ -1033,13 +1040,13 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { // update the subscribed state binding.playerSubscribe.setupSubscriptionButton( this.streams.uploaderUrl.toID(), - this.streams.uploader + this.streams.uploader, ) binding.relPlayerSave.setOnClickListener { AddToPlaylistDialog(videoId!!).show( childFragmentManager, - AddToPlaylistDialog::class.java.name + AddToPlaylistDialog::class.java.name, ) } @@ -1076,7 +1083,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { */ private fun setupDescription( descTextView: TextView, - description: String + description: String, ) { // detect whether the description is html formatted if (description.contains("<") && description.contains(">")) { @@ -1098,7 +1105,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { // get video id if the link is a valid youtube video link val videoId = TextUtils.getVideoIdFromUri(link) if (videoId.isNullOrEmpty()) { - // not a youtube video link, thus handle normally + // not a YouTube video link, thus handle normally val intent = Intent(Intent.ACTION_VIEW, uri) startActivity(intent) return @@ -1111,7 +1118,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { exoPlayer.seekTo(it * 1000) } } else { - // youtube video link without time or not the current video, thus load in player + // YouTube video link without time or not the current video, thus load in player playNextVideo(videoId) } } @@ -1124,14 +1131,14 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { if (exoPlayer.duration < 0 || streams.livestream) return playerBinding.duration.text = DateUtils.formatElapsedTime( - exoPlayer.duration.div(1000) + exoPlayer.duration.div(1000), ) if (segments.isEmpty()) return val durationWithSb = DateUtils.formatElapsedTime( exoPlayer.duration.div(1000) - segments.sumOf { it.segment[1] - it.segment[0] - }.toInt() + }.toInt(), ) playerBinding.duration.text = playerBinding.duration.text.toString() + " ($durationWithSb)" } @@ -1153,7 +1160,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { exoPlayer.isPlaying -> R.drawable.ic_pause exoPlayer.playbackState == Player.STATE_ENDED -> R.drawable.ic_restart else -> R.drawable.ic_play - } + }, ) } @@ -1163,11 +1170,11 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { if (PlayerHelper.alternativeVideoLayout) { binding.alternativeTrendingRec.adapter = VideosAdapter( relatedStreams.orEmpty().toMutableList(), - forceMode = VideosAdapter.Companion.ForceMode.RELATED + forceMode = VideosAdapter.Companion.ForceMode.RELATED, ) } else { binding.relatedRecView.adapter = VideosAdapter( - relatedStreams.orEmpty().toMutableList() + relatedStreams.orEmpty().toMutableList(), ) } } @@ -1187,7 +1194,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { LinearLayoutManager( context, LinearLayoutManager.HORIZONTAL, - false + false, ) binding.chaptersRecView.adapter = ChaptersAdapter(chapters, exoPlayer) @@ -1275,7 +1282,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { SubtitleConfiguration.Builder(it.url!!.toUri()) .setMimeType(it.mimeType!!) // The correct MIME type (required). .setLanguage(it.code) // The subtitle language (optional). - .build() + .build(), ) subtitlesNamesList += it.name!! subtitleCodesList += it.code!! @@ -1303,7 +1310,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { // LBRY HLS PreferenceHelper.getBoolean( PreferenceKeys.LBRY_HLS, - false + false, ) && streams.videoStreams.any { it.quality.orEmpty().contains("LBRY HLS") } -> { @@ -1315,7 +1322,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { // DASH !PreferenceHelper.getBoolean( PreferenceKeys.USE_HLS_OVER_DASH, - false + false, ) && streams.videoStreams.isNotEmpty() -> { // only use the dash manifest generated by YT if either it's a livestream or no other source is available val uri = streams.dash?.let { ProxyHelper.unwrapIfEnabled(it) }?.toUri().takeIf { @@ -1323,7 +1330,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { } ?: let { val manifest = DashHelper.createManifest( streams, - DisplayHelper.supportsHdr(requireContext()) + DisplayHelper.supportsHdr(requireContext()), ) // encode to base64 @@ -1338,7 +1345,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { streams.hls != null -> { setMediaSource( ProxyHelper.unwrapIfEnabled(streams.hls!!).toUri(), - MimeTypes.APPLICATION_M3U8 + MimeTypes.APPLICATION_M3U8, ) } // NO STREAM FOUND @@ -1351,7 +1358,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { private fun createExoPlayer() { val cronetDataSourceFactory = CronetDataSource.Factory( CronetHelper.cronetEngine, - Executors.newCachedThreadPool() + Executors.newCachedThreadPool(), ) val dataSourceFactory = DefaultDataSource.Factory(requireContext(), cronetDataSourceFactory) @@ -1360,7 +1367,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { trackSelector.updateParameters { setPreferredAudioLanguage( - Locale.getDefault().language.lowercase().substring(0, 2) + Locale.getDefault().language.lowercase().substring(0, 2), ) } @@ -1385,7 +1392,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { val playerNotificationData = PlayerNotificationData( streams.title, streams.uploader, - streams.thumbnailUrl + streams.thumbnailUrl, ) nowPlayingNotification.updatePlayerNotification(videoId!!, playerNotificationData) } @@ -1437,7 +1444,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { .setSimpleItems( resolutions.map { if (currentQuality == it.resolution) "${it.name} ✓" else it.name - } + }, ) { which -> setPlayerResolution(resolutions[which].resolution) } @@ -1556,8 +1563,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { onScrubEnd = { scrubbingTimeBar = false setCurrentChapterName(it) - } - ) + }, + ), ) } diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt index 81d6607e8b..00af98e547 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt @@ -79,7 +79,7 @@ class PlaylistFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentPlaylistBinding.inflate(inflater, container, false) return binding.root @@ -100,7 +100,7 @@ class PlaylistFragment : Fragment() { playerViewModel.isMiniPlayerVisible.observe(viewLifecycleOwner) { binding.playlistRecView.updatePadding( - bottom = if (it) (64).dpToPx().toInt() else 0 + bottom = if (it) (64).dpToPx().toInt() else 0, ) } @@ -114,7 +114,7 @@ class PlaylistFragment : Fragment() { private fun updateBookmarkRes() { binding.bookmark.setIconResource( - if (isBookmarked) R.drawable.ic_bookmark else R.drawable.ic_bookmark_outlined + if (isBookmarked) R.drawable.ic_bookmark else R.drawable.ic_bookmark_outlined, ) } @@ -162,10 +162,10 @@ class PlaylistFragment : Fragment() { onRename = { binding.playlistName.text = it playlistName = it - } + }, ).show( childFragmentManager, - PlaylistOptionsBottomSheet::class.java.name + PlaylistOptionsBottomSheet::class.java.name, ) } @@ -174,7 +174,7 @@ class PlaylistFragment : Fragment() { NavigationHelper.navigateVideo( requireContext(), response.relatedStreams.first().url?.toID(), - playlistId + playlistId, ) } @@ -205,7 +205,7 @@ class PlaylistFragment : Fragment() { requireContext(), queue.first().url?.toID(), playlistId = playlistId, - keepQueue = true + keepQueue = true, ) } binding.sortMenu.isGone = false @@ -262,7 +262,7 @@ class PlaylistFragment : Fragment() { if (positionStart == 0) { ImageHelper.loadImage( playlistFeed.firstOrNull()?.thumbnail ?: "", - binding.thumbnail + binding.thumbnail, ) } @@ -289,19 +289,19 @@ class PlaylistFragment : Fragment() { if (playlistType != PlaylistType.PUBLIC) { val itemTouchCallback = object : ItemTouchHelper.SimpleCallback( 0, - ItemTouchHelper.LEFT + ItemTouchHelper.LEFT, ) { override fun onMove( recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, - target: RecyclerView.ViewHolder + target: RecyclerView.ViewHolder, ): Boolean { return false } override fun onSwiped( viewHolder: RecyclerView.ViewHolder, - direction: Int + direction: Int, ) { val position = viewHolder.absoluteAdapterPosition playlistAdapter!!.removeFromPlaylist(requireContext(), position) diff --git a/app/src/main/java/com/github/libretube/ui/fragments/SearchFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/SearchFragment.kt index 8326d1b39a..dc07b7432c 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/SearchFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/SearchFragment.kt @@ -39,7 +39,7 @@ class SearchFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentSearchBinding.inflate(inflater) return binding.root @@ -84,7 +84,7 @@ class SearchFragment : Fragment() { // only load the suggestions if the input field didn't get cleared yet val suggestionsAdapter = SearchSuggestionsAdapter( response.reversed(), - (activity as MainActivity).searchView + (activity as MainActivity).searchView, ) if (isAdded && !viewModel.searchQuery.value.isNullOrEmpty()) { binding.suggestionsRecycler.adapter = suggestionsAdapter @@ -101,7 +101,7 @@ class SearchFragment : Fragment() { if (historyList.isNotEmpty()) { binding.suggestionsRecycler.adapter = SearchHistoryAdapter( historyList, - (activity as MainActivity).searchView + (activity as MainActivity).searchView, ) } else { binding.suggestionsRecycler.visibility = View.GONE diff --git a/app/src/main/java/com/github/libretube/ui/fragments/SearchResultFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/SearchResultFragment.kt index 57a76a3b2a..689ca4e6a4 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/SearchResultFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/SearchResultFragment.kt @@ -21,11 +21,11 @@ import com.github.libretube.extensions.TAG import com.github.libretube.extensions.hideKeyboard import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.ui.adapters.SearchAdapter -import java.io.IOException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import retrofit2.HttpException +import java.io.IOException class SearchResultFragment : Fragment() { private var _binding: FragmentSearchResultBinding? = null @@ -45,7 +45,7 @@ class SearchResultFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentSearchResultBinding.inflate(inflater) return binding.root @@ -123,7 +123,7 @@ class SearchResultFragment : Fragment() { RetrofitInstance.api.getSearchResultsNextPage( query, apiSearchFilter, - nextPage!! + nextPage!!, ) } } catch (e: IOException) { diff --git a/app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt index 0cd24f9107..56a5c7c143 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/SubscriptionsFragment.kt @@ -56,7 +56,7 @@ class SubscriptionsFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentSubscriptionsBinding.inflate(inflater, container, false) return binding.root @@ -67,7 +67,7 @@ class SubscriptionsFragment : Fragment() { val loadFeedInBackground = PreferenceHelper.getBoolean( PreferenceKeys.SAVE_FEED, - false + false, ) // update the text according to the current order and filter @@ -230,7 +230,7 @@ class SubscriptionsFragment : Fragment() { runBlocking { if (!PreferenceHelper.getBoolean( PreferenceKeys.HIDE_WATCHED_FROM_FEED, - false + false, ) ) { streams @@ -271,7 +271,7 @@ class SubscriptionsFragment : Fragment() { binding.subProgress.visibility = View.GONE subscriptionsAdapter = VideosAdapter( sortedFeed.toMutableList(), - showAllAtOnce = false + showAllAtOnce = false, ) binding.subFeed.adapter = subscriptionsAdapter @@ -299,7 +299,7 @@ class SubscriptionsFragment : Fragment() { val legacySubscriptions = PreferenceHelper.getBoolean( PreferenceKeys.LEGACY_SUBSCRIPTIONS, - false + false, ) binding.subChannels.layoutManager = if (legacySubscriptions) { @@ -307,8 +307,8 @@ class SubscriptionsFragment : Fragment() { context, PreferenceHelper.getString( PreferenceKeys.LEGACY_SUBSCRIPTIONS_COLUMNS, - "4" - ).toInt() + "4", + ).toInt(), ) } else { LinearLayoutManager(context) @@ -319,7 +319,7 @@ class SubscriptionsFragment : Fragment() { LegacySubscriptionAdapter(viewModel.subscriptions.value!!) } else { SubscriptionChannelAdapter( - viewModel.subscriptions.value!!.toMutableList() + viewModel.subscriptions.value!!.toMutableList(), ) } diff --git a/app/src/main/java/com/github/libretube/ui/fragments/TrendsFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/TrendsFragment.kt index 192ea8328b..7df9e8051a 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/TrendsFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/TrendsFragment.kt @@ -19,11 +19,11 @@ import com.github.libretube.helpers.LocaleHelper import com.github.libretube.ui.activities.SettingsActivity import com.github.libretube.ui.adapters.VideosAdapter import com.google.android.material.snackbar.Snackbar -import java.io.IOException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import retrofit2.HttpException +import java.io.IOException class TrendsFragment : Fragment() { private var _binding: FragmentTrendsBinding? = null @@ -32,7 +32,7 @@ class TrendsFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentTrendsBinding.inflate(inflater, container, false) return binding.root 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 cdc0f62386..9ec69a37d7 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 @@ -40,7 +40,7 @@ class WatchHistoryFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = FragmentWatchHistoryBinding.inflate(inflater, container, false) return binding.root @@ -51,7 +51,7 @@ class WatchHistoryFragment : Fragment() { playerViewModel.isMiniPlayerVisible.observe(viewLifecycleOwner) { _binding?.watchHistoryRecView?.updatePadding( - bottom = if (it) (64).dpToPx().toInt() else 0 + bottom = if (it) (64).dpToPx().toInt() else 0, ) } @@ -93,19 +93,19 @@ class WatchHistoryFragment : Fragment() { uploaderUrl = it.uploaderUrl, uploaderAvatar = it.uploaderAvatar, uploadedDate = it.uploadDate?.toString(), - duration = it.duration + duration = it.duration, ) - }.toTypedArray() + }.toTypedArray(), ) NavigationHelper.navigateVideo( requireContext(), watchHistory.last().videoId, - keepQueue = true + keepQueue = true, ) } val watchHistoryAdapter = WatchHistoryAdapter( - watchHistory.toMutableList() + watchHistory.toMutableList(), ) binding.watchHistoryRecView.layoutManager = LinearLayoutManager(context) @@ -115,19 +115,19 @@ class WatchHistoryFragment : Fragment() { val itemTouchCallback = object : ItemTouchHelper.SimpleCallback( 0, - ItemTouchHelper.LEFT + ItemTouchHelper.LEFT, ) { override fun onMove( recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, - target: RecyclerView.ViewHolder + target: RecyclerView.ViewHolder, ): Boolean { return false } override fun onSwiped( viewHolder: RecyclerView.ViewHolder, - direction: Int + direction: Int, ) { val position = viewHolder.absoluteAdapterPosition watchHistoryAdapter.removeFromWatchHistory(position) diff --git a/app/src/main/java/com/github/libretube/ui/listeners/AudioPlayerThumbnailListener.kt b/app/src/main/java/com/github/libretube/ui/listeners/AudioPlayerThumbnailListener.kt index 05e747704b..31820515ba 100644 --- a/app/src/main/java/com/github/libretube/ui/listeners/AudioPlayerThumbnailListener.kt +++ b/app/src/main/java/com/github/libretube/ui/listeners/AudioPlayerThumbnailListener.kt @@ -50,7 +50,7 @@ class AudioPlayerThumbnailListener(context: Context, private val listener: Audio e1: MotionEvent, e2: MotionEvent, distanceX: Float, - distanceY: Float + distanceY: Float, ): Boolean { val insideThreshHold = abs(e2.y - e1.y) <= MOVEMENT_THRESHOLD diff --git a/app/src/main/java/com/github/libretube/ui/listeners/PlayerGestureController.kt b/app/src/main/java/com/github/libretube/ui/listeners/PlayerGestureController.kt index 7b9c61c870..fdbf53c3ea 100644 --- a/app/src/main/java/com/github/libretube/ui/listeners/PlayerGestureController.kt +++ b/app/src/main/java/com/github/libretube/ui/listeners/PlayerGestureController.kt @@ -138,7 +138,7 @@ class PlayerGestureController(activity: BaseActivity, private val listener: Play e1: MotionEvent, e2: MotionEvent, distanceX: Float, - distanceY: Float + distanceY: Float, ): Boolean { if (!isEnabled || scaleGestureDetector.isInProgress) return false 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 ce4afd28e8..2045c73ee2 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 @@ -19,7 +19,7 @@ class SeekbarPreviewListener( private val playerBinding: ExoStyledPlayerControlViewBinding, private val duration: Long, private val onScrub: (position: Long) -> Unit, - private val onScrubEnd: (position: Long) -> Unit + private val onScrubEnd: (position: Long) -> Unit, ) : TimeBar.OnScrubListener { private var moving = false @@ -116,7 +116,7 @@ class SeekbarPreviewListener( previewFrame.positionX * widthPerFrame, previewFrame.positionY * heightPerFrame, widthPerFrame, - heightPerFrame + heightPerFrame, ) } diff --git a/app/src/main/java/com/github/libretube/ui/preferences/AppearanceSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/AppearanceSettings.kt index 3c9dd2ae62..68d8a0f491 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/AppearanceSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/AppearanceSettings.kt @@ -44,7 +44,7 @@ class AppearanceSettings : BasePreferenceFragment() { val changeIcon = findPreference(PreferenceKeys.APP_ICON) val iconPref = PreferenceHelper.getString( PreferenceKeys.APP_ICON, - IconsSheetAdapter.Companion.AppIcon.Default.activityAlias + IconsSheetAdapter.Companion.AppIcon.Default.activityAlias, ) IconsSheetAdapter.availableIcons.firstOrNull { it.activityAlias == iconPref }?.let { changeIcon?.summary = getString(it.nameResource) 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 0bed9364bf..f4cb5204bd 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 @@ -11,11 +11,11 @@ import com.github.libretube.helpers.ImportHelper import com.github.libretube.obj.BackupFile import com.github.libretube.ui.base.BasePreferenceFragment import com.github.libretube.ui.dialogs.BackupDialog -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter class BackupRestoreSettings : BasePreferenceFragment() { private val backupDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH:mm:ss") @@ -43,7 +43,7 @@ class BackupRestoreSettings : BasePreferenceFragment() { * result listeners for importing and exporting subscriptions */ private val getSubscriptionsFile = registerForActivityResult( - ActivityResultContracts.GetContent() + ActivityResultContracts.GetContent(), ) { it?.let { lifecycleScope.launch(Dispatchers.IO) { diff --git a/app/src/main/java/com/github/libretube/ui/preferences/GeneralSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/GeneralSettings.kt index a698caef41..58652af097 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/GeneralSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/GeneralSettings.kt @@ -39,7 +39,7 @@ class GeneralSettings : BasePreferenceFragment() { val breakReminderTime = findPreference(PreferenceKeys.SLEEP_TIMER_DELAY) breakReminderTime?.isEnabled = PreferenceHelper.getBoolean( PreferenceKeys.SLEEP_TIMER, - false + false, ) breakReminder?.setOnPreferenceChangeListener { _, newValue -> diff --git a/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt index b8aae847ad..243fc4104d 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt @@ -36,7 +36,7 @@ class InstanceSettings : BasePreferenceFragment() { val instancePref = findPreference(PreferenceKeys.FETCH_INSTANCE)!! val authInstanceToggle = findPreference( - PreferenceKeys.AUTH_INSTANCE_TOGGLE + PreferenceKeys.AUTH_INSTANCE_TOGGLE, )!! val authInstance = findPreference(PreferenceKeys.AUTH_INSTANCE)!! initInstancesPref(listOf(instancePref, authInstance)) diff --git a/app/src/main/java/com/github/libretube/ui/preferences/MainSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/MainSettings.kt index 46f329822f..a49ef25eb9 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/MainSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/MainSettings.kt @@ -100,7 +100,7 @@ class MainSettings : BasePreferenceFragment() { // show the UpdateAvailableDialog if there's an update available UpdateAvailableDialog(updateInfo).show( childFragmentManager, - UpdateAvailableDialog::class.java.name + UpdateAvailableDialog::class.java.name, ) } else { // otherwise show the no update available snackBar diff --git a/app/src/main/java/com/github/libretube/ui/preferences/NotificationSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/NotificationSettings.kt index 88e4b6843f..494e017b68 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/NotificationSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/NotificationSettings.kt @@ -41,7 +41,7 @@ class NotificationSettings : BasePreferenceFragment() { NotificationHelper .enqueueWork( context = requireContext(), - existingPeriodicWorkPolicy = ExistingPeriodicWorkPolicy.REPLACE + existingPeriodicWorkPolicy = ExistingPeriodicWorkPolicy.REPLACE, ) } } diff --git a/app/src/main/java/com/github/libretube/ui/sheets/BaseBottomSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/BaseBottomSheet.kt index 7531f3854a..611f503b97 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/BaseBottomSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/BaseBottomSheet.kt @@ -19,7 +19,7 @@ open class BaseBottomSheet : ExpandedBottomSheet() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { binding = BottomSheetBinding.inflate(layoutInflater) return binding.root diff --git a/app/src/main/java/com/github/libretube/ui/sheets/ChannelGroupsSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/ChannelGroupsSheet.kt index 7cca64f7be..f5f4afa5af 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/ChannelGroupsSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/ChannelGroupsSheet.kt @@ -14,12 +14,12 @@ import kotlinx.coroutines.runBlocking class ChannelGroupsSheet( private val groups: MutableList, - private val onGroupsChanged: (List) -> Unit + private val onGroupsChanged: (List) -> Unit, ) : ExpandedBottomSheet() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { val binding = DialogSubscriptionGroupsBinding.inflate(layoutInflater) @@ -27,7 +27,7 @@ class ChannelGroupsSheet( val adapter = SubscriptionGroupsAdapter( groups.toMutableList(), parentFragmentManager, - onGroupsChanged + onGroupsChanged, ) binding.groupsRV.adapter = adapter diff --git a/app/src/main/java/com/github/libretube/ui/sheets/ChannelOptionsBottomSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/ChannelOptionsBottomSheet.kt index 073ca23d57..57d8f4b1db 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/ChannelOptionsBottomSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/ChannelOptionsBottomSheet.kt @@ -21,7 +21,7 @@ import kotlinx.coroutines.withContext */ class ChannelOptionsBottomSheet( private val channelId: String, - channelName: String? + channelName: String?, ) : BaseBottomSheet() { private val shareData = ShareData(currentChannel = channelName) override fun onCreate(savedInstanceState: Bundle?) { @@ -31,7 +31,7 @@ class ChannelOptionsBottomSheet( val optionsList = mutableListOf( getString(R.string.share), getString(R.string.play_latest_videos), - getString(R.string.playOnBackground) + getString(R.string.playOnBackground), ) setSimpleItems(optionsList) { which -> @@ -49,7 +49,7 @@ class ChannelOptionsBottomSheet( NavigationHelper.navigateVideo( requireContext(), it, - channelId = channelId + channelId = channelId, ) } } catch (e: Exception) { @@ -65,7 +65,7 @@ class ChannelOptionsBottomSheet( BackgroundHelper.playOnBackground( requireContext(), videoId = it, - channelId = channelId + channelId = channelId, ) } } catch (e: Exception) { diff --git a/app/src/main/java/com/github/libretube/ui/sheets/CommentsSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/CommentsSheet.kt index 438520e120..a25ca80d3b 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/CommentsSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/CommentsSheet.kt @@ -23,7 +23,7 @@ class CommentsSheet : ExpandedBottomSheet() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { binding = CommentsSheetBinding.inflate(layoutInflater) return binding.root diff --git a/app/src/main/java/com/github/libretube/ui/sheets/DownloadOptionsBottomSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/DownloadOptionsBottomSheet.kt index 54180e3eb9..de255f5a41 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/DownloadOptionsBottomSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/DownloadOptionsBottomSheet.kt @@ -14,21 +14,21 @@ import com.github.libretube.obj.ShareData import com.github.libretube.services.OfflinePlayerService import com.github.libretube.ui.dialogs.ShareDialog import com.google.android.material.dialog.MaterialAlertDialogBuilder -import kotlin.io.path.deleteIfExists import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking +import kotlin.io.path.deleteIfExists class DownloadOptionsBottomSheet( private val download: Download, private val items: List, - private val onDelete: () -> Unit + private val onDelete: () -> Unit, ) : BaseBottomSheet() { override fun onCreate(savedInstanceState: Bundle?) { val options = listOf( R.string.playOnBackground, R.string.go_to_video, R.string.share, - R.string.delete + R.string.delete, ).map { getString(it) } setSimpleItems(options) { selectedIndex -> when (selectedIndex) { diff --git a/app/src/main/java/com/github/libretube/ui/sheets/EditChannelGroupSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/EditChannelGroupSheet.kt index 7924ea98aa..d479dfa512 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/EditChannelGroupSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/EditChannelGroupSheet.kt @@ -21,7 +21,7 @@ import kotlinx.coroutines.withContext class EditChannelGroupSheet( private var group: SubscriptionGroup, - private val onGroupChanged: (SubscriptionGroup) -> Unit + private val onGroupChanged: (SubscriptionGroup) -> Unit, ) : ExpandedBottomSheet() { private val subscriptionsModel: SubscriptionsViewModel by activityViewModels() private lateinit var binding: DialogEditChannelGroupBinding @@ -30,7 +30,7 @@ class EditChannelGroupSheet( override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View? { binding = DialogEditChannelGroupBinding.inflate(layoutInflater) binding.groupName.setText(group.name) @@ -75,7 +75,7 @@ class EditChannelGroupSheet( private fun showChannels(channels: List, query: String?) { binding.channelsRV.adapter = SubscriptionGroupChannelsAdapter( channels.filter { query == null || it.name.lowercase().contains(query.lowercase()) }, - group + group, ) { group = it } diff --git a/app/src/main/java/com/github/libretube/ui/sheets/IconsBottomSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/IconsBottomSheet.kt index 57f9a06560..72027d6522 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/IconsBottomSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/IconsBottomSheet.kt @@ -14,7 +14,7 @@ class IconsBottomSheet : ExpandedBottomSheet() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { binding = BottomSheetBinding.inflate(layoutInflater) return binding.root diff --git a/app/src/main/java/com/github/libretube/ui/sheets/IntentChooserSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/IntentChooserSheet.kt index 4065aa0645..751f51fcda 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/IntentChooserSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/IntentChooserSheet.kt @@ -11,7 +11,7 @@ import com.github.libretube.ui.adapters.IntentChooserAdapter class IntentChooserSheet( private val packages: List, - private val url: String + private val url: String, ) : BaseBottomSheet() { private var _binding: BottomSheetBinding? = null private val binding get() = _binding!! @@ -19,7 +19,7 @@ class IntentChooserSheet( override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { _binding = BottomSheetBinding.inflate(inflater) return binding.root diff --git a/app/src/main/java/com/github/libretube/ui/sheets/PlaybackOptionsSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/PlaybackOptionsSheet.kt index 01bc6ff158..9e22c37149 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/PlaybackOptionsSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/PlaybackOptionsSheet.kt @@ -12,14 +12,14 @@ import com.google.android.exoplayer2.ExoPlayer import com.google.android.exoplayer2.PlaybackParameters class PlaybackOptionsSheet( - private val player: ExoPlayer + private val player: ExoPlayer, ) : ExpandedBottomSheet() { private lateinit var binding: PlaybackBottomSheetBinding override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { binding = PlaybackBottomSheetBinding.inflate(layoutInflater) return binding.root @@ -61,7 +61,7 @@ class PlaybackOptionsSheet( private fun onChange() { player.playbackParameters = PlaybackParameters( binding.speed.value.round(2), - binding.pitch.value.round(2) + binding.pitch.value.round(2), ) } } 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 97474a0253..540063a93a 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,7 @@ class PlayingQueueSheet : ExpandedBottomSheet() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { binding = QueueBottomSheetBinding.inflate(layoutInflater) return binding.root @@ -77,12 +77,12 @@ class PlayingQueueSheet : ExpandedBottomSheet() { val callback = object : ItemTouchHelper.SimpleCallback( ItemTouchHelper.UP or ItemTouchHelper.DOWN, - ItemTouchHelper.LEFT + ItemTouchHelper.LEFT, ) { override fun onMove( recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, - target: RecyclerView.ViewHolder + target: RecyclerView.ViewHolder, ): Boolean { val from = viewHolder.absoluteAdapterPosition val to = target.absoluteAdapterPosition diff --git a/app/src/main/java/com/github/libretube/ui/sheets/PlaylistOptionsBottomSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/PlaylistOptionsBottomSheet.kt index 3fbf4164b7..ef49f9a9c0 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/PlaylistOptionsBottomSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/PlaylistOptionsBottomSheet.kt @@ -23,13 +23,13 @@ class PlaylistOptionsBottomSheet( private val playlistName: String, private val playlistType: PlaylistType, private val onRename: (newName: String) -> Unit = {}, - private val onDelete: () -> Unit = {} + private val onDelete: () -> Unit = {}, ) : BaseBottomSheet() { private val shareData = ShareData(currentPlaylist = playlistName) override fun onCreate(savedInstanceState: Bundle?) { // options for the dialog val optionsList = mutableListOf( - getString(R.string.playOnBackground) + getString(R.string.playOnBackground), ) val isBookmarked = runBlocking(Dispatchers.IO) { @@ -42,7 +42,7 @@ class PlaylistOptionsBottomSheet( // only add the bookmark option to the playlist if public optionsList.add( - getString(if (isBookmarked) R.string.remove_bookmark else R.string.add_to_bookmarks) + getString(if (isBookmarked) R.string.remove_bookmark else R.string.add_to_bookmarks), ) } else { optionsList.add(context?.getString(R.string.renamePlaylist)!!) @@ -60,7 +60,7 @@ class PlaylistOptionsBottomSheet( BackgroundHelper.playOnBackground( requireContext(), it.url!!.toID(), - playlistId = playlistId + playlistId = playlistId, ) } } @@ -73,7 +73,7 @@ class PlaylistOptionsBottomSheet( }.getOrNull() } context.toastFromMainDispatcher( - if (playlistId != null) R.string.playlistCloned else R.string.server_error + if (playlistId != null) R.string.playlistCloned else R.string.server_error, ) } // share the playlist diff --git a/app/src/main/java/com/github/libretube/ui/sheets/VideoOptionsBottomSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/VideoOptionsBottomSheet.kt index 8af405d138..4dbb94338b 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/VideoOptionsBottomSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/VideoOptionsBottomSheet.kt @@ -29,7 +29,7 @@ import kotlinx.coroutines.withContext */ class VideoOptionsBottomSheet( private val videoId: String, - videoName: String + videoName: String, ) : BaseBottomSheet() { private val shareData = ShareData(currentVideo = videoName) override fun onCreate(savedInstanceState: Bundle?) { @@ -38,7 +38,7 @@ class VideoOptionsBottomSheet( getString(R.string.playOnBackground), getString(R.string.addToPlaylist), getString(R.string.download), - getString(R.string.share) + getString(R.string.share), ) // Check whether the player is running and add queue options @@ -62,7 +62,7 @@ class VideoOptionsBottomSheet( getString(R.string.addToPlaylist) -> { AddToPlaylistDialog(videoId).show( parentFragmentManager, - AddToPlaylistDialog::class.java.name + AddToPlaylistDialog::class.java.name, ) } getString(R.string.download) -> { @@ -112,7 +112,7 @@ class VideoOptionsBottomSheet( // get the current fragment val fragment = navHostFragment?.childFragmentManager?.fragments?.firstOrNull() (fragment as? SubscriptionsFragment)?.subscriptionsAdapter?.removeItemById( - videoId + videoId, ) } } diff --git a/app/src/main/java/com/github/libretube/ui/tools/SleepTimer.kt b/app/src/main/java/com/github/libretube/ui/tools/SleepTimer.kt index 45b59a9acc..77d47a4b70 100644 --- a/app/src/main/java/com/github/libretube/ui/tools/SleepTimer.kt +++ b/app/src/main/java/com/github/libretube/ui/tools/SleepTimer.kt @@ -24,7 +24,7 @@ object SleepTimer { val breakReminderPref = PreferenceHelper.getString( PreferenceKeys.SLEEP_TIMER_DELAY, - "" + "", ).ifEmpty { return } handler.postDelayed(breakReminderPref.toLong() * 60 * 1000) { @@ -33,7 +33,7 @@ object SleepTimer { val snackBar = Snackbar.make( mainActivity.binding.root, R.string.take_a_break, - Snackbar.LENGTH_INDEFINITE + Snackbar.LENGTH_INDEFINITE, ) .setAction(R.string.cancel) { killApp = false diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/BottomSheetViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/BottomSheetViewHolder.kt index 52c59aee0c..6737dd0d2d 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/BottomSheetViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/BottomSheetViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.BottomSheetItemBinding class BottomSheetViewHolder( - val binding: BottomSheetItemBinding + val binding: BottomSheetItemBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/CommentsViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/CommentsViewHolder.kt index a5a8fb86d0..793d4426ff 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/CommentsViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/CommentsViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.CommentsRowBinding class CommentsViewHolder( - val binding: CommentsRowBinding + val binding: CommentsRowBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/DownloadsViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/DownloadsViewHolder.kt index 3cc59109dc..863c63cd6f 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/DownloadsViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/DownloadsViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.DownloadedMediaRowBinding class DownloadsViewHolder( - val binding: DownloadedMediaRowBinding + val binding: DownloadedMediaRowBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/IconsSheetViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/IconsSheetViewHolder.kt index 78d21a6f80..4e49f4c1ef 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/IconsSheetViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/IconsSheetViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.AppIconItemBinding class IconsSheetViewHolder( - val binding: AppIconItemBinding + val binding: AppIconItemBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/IntentChooserViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/IntentChooserViewHolder.kt index f9dfb13fec..d21774fe5a 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/IntentChooserViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/IntentChooserViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.IntentChooserItemBinding class IntentChooserViewHolder( - val binding: IntentChooserItemBinding + val binding: IntentChooserItemBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/LegacySubscriptionViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/LegacySubscriptionViewHolder.kt index 4b6bae4a51..62e76825a6 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/LegacySubscriptionViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/LegacySubscriptionViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.LegacySubscriptionChannelBinding class LegacySubscriptionViewHolder( - val binding: LegacySubscriptionChannelBinding + val binding: LegacySubscriptionChannelBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/NavBarOptionsViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/NavBarOptionsViewHolder.kt index 1faf97f39d..e9a3b2a029 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/NavBarOptionsViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/NavBarOptionsViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.NavOptionsItemBinding class NavBarOptionsViewHolder( - val binding: NavOptionsItemBinding + val binding: NavOptionsItemBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/PlayingQueueViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/PlayingQueueViewHolder.kt index 9fe6f200dd..ab328c6790 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/PlayingQueueViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/PlayingQueueViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.QueueRowBinding class PlayingQueueViewHolder( - val binding: QueueRowBinding + val binding: QueueRowBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistViewHolder.kt index dab3945d18..af384922b8 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.VideoRowBinding class PlaylistViewHolder( - val binding: VideoRowBinding + val binding: VideoRowBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistsViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistsViewHolder.kt index be55b21c7d..410dd1eaad 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistsViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistsViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.PlaylistsRowBinding class PlaylistsViewHolder( - val binding: PlaylistsRowBinding + val binding: PlaylistsRowBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionChannelViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionChannelViewHolder.kt index 4cbb61aee3..c4b71de638 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionChannelViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionChannelViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.ChannelSubscriptionRowBinding class SubscriptionChannelViewHolder( - val binding: ChannelSubscriptionRowBinding + val binding: ChannelSubscriptionRowBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionGroupChannelRowViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionGroupChannelRowViewHolder.kt index eb25fb4910..398cc7a548 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionGroupChannelRowViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionGroupChannelRowViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.SubscriptionGroupChannelRowBinding class SubscriptionGroupChannelRowViewHolder( - val binding: SubscriptionGroupChannelRowBinding + val binding: SubscriptionGroupChannelRowBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionGroupsViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionGroupsViewHolder.kt index 6f021364a6..3afb35b82b 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionGroupsViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/SubscriptionGroupsViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.SubscriptionGroupRowBinding class SubscriptionGroupsViewHolder( - val binding: SubscriptionGroupRowBinding + val binding: SubscriptionGroupRowBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/SuggestionsViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/SuggestionsViewHolder.kt index c55f3847d6..e3789ad449 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/SuggestionsViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/SuggestionsViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.SuggestionRowBinding class SuggestionsViewHolder( - val binding: SuggestionRowBinding + val binding: SuggestionRowBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/WatchHistoryViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/WatchHistoryViewHolder.kt index e2c48cfaae..616a2ab7db 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/WatchHistoryViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/WatchHistoryViewHolder.kt @@ -4,5 +4,5 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.VideoRowBinding class WatchHistoryViewHolder( - val binding: VideoRowBinding + val binding: VideoRowBinding, ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/views/AutoplayCountdownView.kt b/app/src/main/java/com/github/libretube/ui/views/AutoplayCountdownView.kt index 2f58ca2e49..91cbaa5266 100644 --- a/app/src/main/java/com/github/libretube/ui/views/AutoplayCountdownView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/AutoplayCountdownView.kt @@ -13,7 +13,7 @@ import com.github.libretube.databinding.AutoplayCountdownBinding class AutoplayCountdownView( context: Context, - attributeSet: AttributeSet? + attributeSet: AttributeSet?, ) : FrameLayout(context, attributeSet) { private val layoutInflater = LayoutInflater.from(context) val binding = AutoplayCountdownBinding.inflate(layoutInflater, this, true) @@ -55,7 +55,7 @@ class AutoplayCountdownView( binding.currentState.text = context.getString( R.string.playing_next, - currentTimerState.toString() + currentTimerState.toString(), ) currentTimerState -= 1 handler.postDelayed(1000, TIMER_RUNNABLE_TOKEN, this::updateCountdown) diff --git a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt index 2eac2efcc9..9883971ee2 100644 --- a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt @@ -58,7 +58,7 @@ import com.google.android.exoplayer2.util.RepeatModeUtil @SuppressLint("ClickableViewAccessibility") internal class CustomExoPlayerView( context: Context, - attributeSet: AttributeSet? = null + attributeSet: AttributeSet? = null, ) : StyledPlayerView(context, attributeSet), PlayerOptions, PlayerGestureOptions { val binding: ExoStyledPlayerControlViewBinding = ExoStyledPlayerControlViewBinding.bind(this) @@ -105,7 +105,7 @@ internal class CustomExoPlayerView( playerGestureControlsViewBinding: PlayerGestureControlsViewBinding, trackSelector: TrackSelector?, playerViewModel: PlayerViewModel? = null, - viewLifecycleOwner: LifecycleOwner? = null + viewLifecycleOwner: LifecycleOwner? = null, ) { this.playerOptionsInterface = playerViewInterface this.doubleTapOverlayBinding = doubleTapOverlayBinding @@ -137,7 +137,7 @@ internal class CustomExoPlayerView( R.drawable.ic_locked } else { R.drawable.ic_unlocked - } + }, ) // show/hide all the controls @@ -175,7 +175,7 @@ internal class CustomExoPlayerView( if (events.containsAny( Player.EVENT_PLAYBACK_STATE_CHANGED, Player.EVENT_IS_PLAYING_CHANGED, - Player.EVENT_PLAY_WHEN_READY_CHANGED + Player.EVENT_PLAY_WHEN_READY_CHANGED, ) ) { updatePlayPauseButton() @@ -213,10 +213,10 @@ internal class CustomExoPlayerView( // Show status bar only not navigation bar if the player controls are visible and hide it otherwise activity.toggleSystemBars( types = WindowInsetsCompat.Type.statusBars(), - showBars = visibility == View.VISIBLE + showBars = visibility == View.VISIBLE, ) } - } + }, ) playerViewModel?.isFullscreen?.observe(viewLifecycleOwner!!) { isFullscreen -> @@ -231,7 +231,7 @@ internal class CustomExoPlayerView( player?.isPlaying == true -> R.drawable.ic_pause player?.playbackState == Player.STATE_ENDED -> R.drawable.ic_restart else -> R.drawable.ic_play - } + }, ) } @@ -277,7 +277,7 @@ internal class CustomExoPlayerView( doubleTapOverlayBinding?.rewindTV, doubleTapOverlayBinding?.forwardTV, binding.forwardTV, - binding.rewindTV + binding.rewindTV, ).forEach { it?.text = seekIncrementText } @@ -306,7 +306,7 @@ internal class CustomExoPlayerView( } else { context.getString(R.string.repeat_mode_current) } - } + }, ) { onRepeatModeClicked() }, @@ -316,14 +316,14 @@ internal class CustomExoPlayerView( { when (resizeMode) { AspectRatioFrameLayout.RESIZE_MODE_FIT -> context.getString( - R.string.resize_mode_fit + R.string.resize_mode_fit, ) AspectRatioFrameLayout.RESIZE_MODE_FILL -> context.getString( - R.string.resize_mode_fill + R.string.resize_mode_fill, ) else -> context.getString(R.string.resize_mode_zoom) } - } + }, ) { onResizeModeClicked() }, @@ -332,10 +332,10 @@ internal class CustomExoPlayerView( R.drawable.ic_speed, { "${player?.playbackParameters?.speed?.round(2)}x" - } + }, ) { onPlaybackSpeedClicked() - } + }, ) playerOptionsInterface?.let { @@ -344,7 +344,7 @@ internal class CustomExoPlayerView( BottomSheetItem( context.getString(R.string.quality), R.drawable.ic_hd, - { "${player?.videoSize?.height}p" } + { "${player?.videoSize?.height}p" }, ) { it.onQualityClicked() }, @@ -353,7 +353,7 @@ internal class CustomExoPlayerView( R.drawable.ic_audio, { trackSelector?.parameters?.preferredAudioLanguages?.firstOrNull() - } + }, ) { it.onAudioStreamClicked() }, @@ -366,17 +366,17 @@ internal class CustomExoPlayerView( } else { context.getString(R.string.none) } - } + }, ) { it.onCaptionsClicked() }, BottomSheetItem( context.getString(R.string.stats_for_nerds), - R.drawable.ic_info + R.drawable.ic_info, ) { it.onStatsClicked() - } - ) + }, + ), ) } @@ -405,11 +405,11 @@ internal class CustomExoPlayerView( if (isLocked) { ContextCompat.getColor( context, - com.google.android.exoplayer2.R.color.exo_black_opacity_60 + com.google.android.exoplayer2.R.color.exo_black_opacity_60, ) } else { Color.TRANSPARENT - } + }, ) // disable tap and swipe gesture if the player is locked @@ -450,7 +450,7 @@ internal class CustomExoPlayerView( container: FrameLayout, imageView: ImageView, textView: TextView, - isRewind: Boolean + isRewind: Boolean, ) { container.visibility = View.VISIBLE // the direction of the action @@ -514,7 +514,7 @@ internal class CustomExoPlayerView( if (distance <= 0) { brightnessHelper.resetToSystemBrightness() gestureViewBinding.brightnessImageView.setImageResource( - R.drawable.ic_brightness_auto + R.drawable.ic_brightness_auto, ) gestureViewBinding.brightnessTextView.text = resources.getString(R.string.auto) return @@ -543,7 +543,7 @@ internal class CustomExoPlayerView( when { distance > 0 -> R.drawable.ic_volume_up else -> R.drawable.ic_volume_off - } + }, ) } bar.incrementProgressBy(distance.toInt()) @@ -566,7 +566,7 @@ internal class CustomExoPlayerView( val aspectRatioModes = listOf( AspectRatioFrameLayout.RESIZE_MODE_FIT, AspectRatioFrameLayout.RESIZE_MODE_ZOOM, - AspectRatioFrameLayout.RESIZE_MODE_FILL + AspectRatioFrameLayout.RESIZE_MODE_FILL, ) BaseBottomSheet() @@ -580,7 +580,7 @@ internal class CustomExoPlayerView( val repeatModeNames = listOf( context.getString(R.string.repeat_mode_none), context.getString(R.string.repeat_mode_current), - context.getString(R.string.all) + context.getString(R.string.all), ) // repeat mode options dialog BaseBottomSheet() diff --git a/app/src/main/java/com/github/libretube/ui/views/CustomSwipeToRefresh.kt b/app/src/main/java/com/github/libretube/ui/views/CustomSwipeToRefresh.kt index 8d2d7d1f24..5296cb4ea9 100644 --- a/app/src/main/java/com/github/libretube/ui/views/CustomSwipeToRefresh.kt +++ b/app/src/main/java/com/github/libretube/ui/views/CustomSwipeToRefresh.kt @@ -20,7 +20,7 @@ class CustomSwipeToRefresh(context: Context?, attrs: AttributeSet?) : init { setColorSchemeColors(ThemeHelper.getThemeColor(this.context, R.attr.colorPrimary)) setProgressBackgroundColorSchemeColor( - SurfaceColors.getColorForElevation(this.context, 20f) + SurfaceColors.getColorForElevation(this.context, 20f), ) } diff --git a/app/src/main/java/com/github/libretube/ui/views/DoubleTapOverlay.kt b/app/src/main/java/com/github/libretube/ui/views/DoubleTapOverlay.kt index 1c98462ff3..c66ef4612b 100644 --- a/app/src/main/java/com/github/libretube/ui/views/DoubleTapOverlay.kt +++ b/app/src/main/java/com/github/libretube/ui/views/DoubleTapOverlay.kt @@ -8,7 +8,7 @@ import com.github.libretube.databinding.DoubleTapOverlayBinding class DoubleTapOverlay( context: Context, - attrs: AttributeSet? = null + attrs: AttributeSet? = null, ) : LinearLayout(context, attrs) { var binding: DoubleTapOverlayBinding diff --git a/app/src/main/java/com/github/libretube/ui/views/DrawableTextView.kt b/app/src/main/java/com/github/libretube/ui/views/DrawableTextView.kt index 0d59093101..ae5cf42eb6 100644 --- a/app/src/main/java/com/github/libretube/ui/views/DrawableTextView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/DrawableTextView.kt @@ -14,7 +14,7 @@ import com.github.libretube.R */ class DrawableTextView( context: Context, - attrs: AttributeSet? = null + attrs: AttributeSet? = null, ) : AppCompatTextView(context, attrs) { private var drawableStartDimen = 0F @@ -32,11 +32,11 @@ class DrawableTextView( gravity = ta.getInt( R.styleable.DrawableTextView_android_gravity, - Gravity.CENTER_VERTICAL + Gravity.CENTER_VERTICAL, ) compoundDrawablePadding = ta.getDimensionPixelOffset( R.styleable.DrawableTextView_android_drawablePadding, - 20 + 20, ) } finally { ta.recycle() @@ -54,7 +54,7 @@ class DrawableTextView( relDrawables[0], relDrawables[1], relDrawables[2], - relDrawables[3] + relDrawables[3], ) } diff --git a/app/src/main/java/com/github/libretube/ui/views/DropdownMenu.kt b/app/src/main/java/com/github/libretube/ui/views/DropdownMenu.kt index 23c386e3a8..4e457eaf8d 100644 --- a/app/src/main/java/com/github/libretube/ui/views/DropdownMenu.kt +++ b/app/src/main/java/com/github/libretube/ui/views/DropdownMenu.kt @@ -13,7 +13,7 @@ import com.github.libretube.databinding.DropdownMenuBinding */ class DropdownMenu( context: Context, - attributeSet: AttributeSet + attributeSet: AttributeSet, ) : FrameLayout(context, attributeSet) { var binding: DropdownMenuBinding @@ -26,7 +26,7 @@ class DropdownMenu( } val selectedItemPosition: Int get() = adapter.getPosition( - binding.autoCompleteTextView.text.toString() + binding.autoCompleteTextView.text.toString(), ) init { @@ -38,7 +38,7 @@ class DropdownMenu( try { binding.textInputLayout.hint = ta.getString(R.styleable.DropdownMenu_hint) binding.textInputLayout.startIconDrawable = ta.getDrawable( - R.styleable.DropdownMenu_icon + R.styleable.DropdownMenu_icon, ) } finally { ta.recycle() diff --git a/app/src/main/java/com/github/libretube/ui/views/MarkableTimeBar.kt b/app/src/main/java/com/github/libretube/ui/views/MarkableTimeBar.kt index 36615a2650..234fc751ef 100644 --- a/app/src/main/java/com/github/libretube/ui/views/MarkableTimeBar.kt +++ b/app/src/main/java/com/github/libretube/ui/views/MarkableTimeBar.kt @@ -21,7 +21,7 @@ import com.google.android.exoplayer2.ui.DefaultTimeBar */ class MarkableTimeBar( context: Context, - attributeSet: AttributeSet? = null + attributeSet: AttributeSet? = null, ) : DefaultTimeBar(context, attributeSet) { private var segments: List = listOf() @@ -53,11 +53,11 @@ class MarkableTimeBar( (it.segment.first() + horizontalOffset).toLength(), marginY, (it.segment.last() + horizontalOffset).toLength(), - canvas.height - marginY + canvas.height - marginY, ), Paint().apply { color = ThemeHelper.getThemeColor(context, R.attr.colorOnSecondary) - } + }, ) } canvas.restore() diff --git a/app/src/main/java/com/github/libretube/ui/views/PlayerGestureControlsView.kt b/app/src/main/java/com/github/libretube/ui/views/PlayerGestureControlsView.kt index 7478b5997c..6700e0f493 100644 --- a/app/src/main/java/com/github/libretube/ui/views/PlayerGestureControlsView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/PlayerGestureControlsView.kt @@ -9,7 +9,7 @@ import com.github.libretube.extensions.normalize class PlayerGestureControlsView( context: Context, - attrs: AttributeSet? = null + attrs: AttributeSet? = null, ) : ConstraintLayout(context, attrs) { var binding: PlayerGestureControlsViewBinding diff --git a/app/src/main/java/com/github/libretube/ui/views/SingleViewTouchableMotionLayout.kt b/app/src/main/java/com/github/libretube/ui/views/SingleViewTouchableMotionLayout.kt index 3866542738..31cfff8e93 100644 --- a/app/src/main/java/com/github/libretube/ui/views/SingleViewTouchableMotionLayout.kt +++ b/app/src/main/java/com/github/libretube/ui/views/SingleViewTouchableMotionLayout.kt @@ -61,7 +61,7 @@ class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeS e1: MotionEvent, e2: MotionEvent, distanceX: Float, - distanceY: Float + distanceY: Float, ): Boolean { if (progress != 0F || distanceY < 30F) return false swipeUpListener.forEach { diff --git a/app/src/main/java/com/github/libretube/ui/views/SliderPreference.kt b/app/src/main/java/com/github/libretube/ui/views/SliderPreference.kt index 0fed92d656..d6359b1566 100644 --- a/app/src/main/java/com/github/libretube/ui/views/SliderPreference.kt +++ b/app/src/main/java/com/github/libretube/ui/views/SliderPreference.kt @@ -15,10 +15,10 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder */ class SliderPreference( context: Context, - attributeSet: AttributeSet + attributeSet: AttributeSet, ) : Preference( context, - attributeSet + attributeSet, ) { private lateinit var sliderBinding: DialogSliderBinding private var defValue = 0f @@ -26,18 +26,18 @@ class SliderPreference( private var prefValue: Float get() = PreferenceHelper.getString( key, - defValue.toString() + defValue.toString(), ).toFloat() set(value) { PreferenceHelper.putString( key, - value.toString() + value.toString(), ) } private val typedArray = context.obtainStyledAttributes( attributeSet, - R.styleable.SliderPreference + R.styleable.SliderPreference, ) override fun onAttached() { @@ -56,7 +56,7 @@ class SliderPreference( val stepSize = typedArray.getFloat(R.styleable.SliderPreference_stepSize, 1.0f) sliderBinding = DialogSliderBinding.inflate( - LayoutInflater.from(context) + LayoutInflater.from(context), ) sliderBinding.slider.apply { diff --git a/app/src/main/java/com/github/libretube/ui/views/TimePickerPreference.kt b/app/src/main/java/com/github/libretube/ui/views/TimePickerPreference.kt index 248f527a38..be05fe235e 100644 --- a/app/src/main/java/com/github/libretube/ui/views/TimePickerPreference.kt +++ b/app/src/main/java/com/github/libretube/ui/views/TimePickerPreference.kt @@ -12,7 +12,7 @@ import java.time.LocalTime class TimePickerPreference( context: Context, - attributeSet: AttributeSet + attributeSet: AttributeSet, ) : Preference(context, attributeSet) { override fun getSummary(): CharSequence { return PreferenceHelper.getString(key, DEFAULT_VALUE) diff --git a/app/src/main/java/com/github/libretube/util/ExceptionHandler.kt b/app/src/main/java/com/github/libretube/util/ExceptionHandler.kt index e6ab250df7..5665d5c464 100644 --- a/app/src/main/java/com/github/libretube/util/ExceptionHandler.kt +++ b/app/src/main/java/com/github/libretube/util/ExceptionHandler.kt @@ -3,7 +3,7 @@ package com.github.libretube.util import com.github.libretube.helpers.PreferenceHelper class ExceptionHandler( - private val defaultExceptionHandler: Thread.UncaughtExceptionHandler? + private val defaultExceptionHandler: Thread.UncaughtExceptionHandler?, ) : Thread.UncaughtExceptionHandler { override fun uncaughtException(thread: Thread, exc: Throwable) { // save the error log diff --git a/app/src/main/java/com/github/libretube/util/HtmlParser.kt b/app/src/main/java/com/github/libretube/util/HtmlParser.kt index 8fb69ea4ba..90d4ad260c 100644 --- a/app/src/main/java/com/github/libretube/util/HtmlParser.kt +++ b/app/src/main/java/com/github/libretube/util/HtmlParser.kt @@ -8,7 +8,7 @@ import org.xml.sax.Locator import org.xml.sax.XMLReader class HtmlParser( - private val handler: LinkHandler + private val handler: LinkHandler, ) : Html.TagHandler, ContentHandler { private val tagStatus = ArrayDeque() private var wrapped: ContentHandler? = null @@ -30,7 +30,7 @@ class HtmlParser( uri: String, localName: String, qName: String, - attributes: Attributes + attributes: Attributes, ) { val isHandled = handler.handleTag(true, localName, text, attributes) tagStatus.addLast(isHandled) diff --git a/app/src/main/java/com/github/libretube/util/LinkHandler.kt b/app/src/main/java/com/github/libretube/util/LinkHandler.kt index f7e424568a..53193e525d 100644 --- a/app/src/main/java/com/github/libretube/util/LinkHandler.kt +++ b/app/src/main/java/com/github/libretube/util/LinkHandler.kt @@ -8,7 +8,7 @@ import android.view.View import org.xml.sax.Attributes class LinkHandler( - private val clickCallback: (String) -> Unit + private val clickCallback: (String) -> Unit, ) { private var linkTagStartIndex = -1 private var link: String? = null @@ -17,7 +17,7 @@ class LinkHandler( opening: Boolean, tag: String?, output: Editable?, - attributes: Attributes? + attributes: Attributes?, ): Boolean { // if the tag is not an anchor link, ignore for the default handler if (output == null || tag != "a") { @@ -49,7 +49,7 @@ class LinkHandler( }, start, end, - Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE, ) } } diff --git a/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt b/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt index 0c584c6b40..16a36e00cb 100644 --- a/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt +++ b/app/src/main/java/com/github/libretube/util/NowPlayingNotification.kt @@ -38,7 +38,7 @@ import com.google.android.exoplayer2.ui.PlayerNotificationManager.CustomActionRe class NowPlayingNotification( private val context: Context, private val player: ExoPlayer, - private val isBackgroundPlayerNotification: Boolean + private val isBackgroundPlayerNotification: Boolean, ) { private var videoId: String? = null private var notificationData: PlayerNotificationData? = null @@ -100,7 +100,7 @@ class NowPlayingNotification( */ override fun getCurrentLargeIcon( player: Player, - callback: PlayerNotificationManager.BitmapCallback + callback: PlayerNotificationManager.BitmapCallback, ): Bitmap? { if (DataSaverMode.isEnabled(context)) return null @@ -140,13 +140,13 @@ class NowPlayingNotification( private val customActionReceiver = object : CustomActionReceiver { override fun createCustomActions( context: Context, - instanceId: Int + instanceId: Int, ): MutableMap { return mutableMapOf( PREV to createNotificationAction(R.drawable.ic_prev_outlined, PREV, instanceId), NEXT to createNotificationAction(R.drawable.ic_next_outlined, NEXT, instanceId), REWIND to createNotificationAction(R.drawable.ic_rewind_md, REWIND, instanceId), - FORWARD to createNotificationAction(R.drawable.ic_forward_md, FORWARD, instanceId) + FORWARD to createNotificationAction(R.drawable.ic_forward_md, FORWARD, instanceId), ) } @@ -203,16 +203,16 @@ class NowPlayingNotification( setQueueNavigator(object : TimelineQueueNavigator(mediaSession) { override fun getMediaDescription( player: Player, - windowIndex: Int + windowIndex: Int, ): MediaDescriptionCompat { val appIcon = BitmapFactory.decodeResource( context.resources, - R.drawable.ic_launcher_monochrome + R.drawable.ic_launcher_monochrome, ) val extras = bundleOf( MediaMetadataCompat.METADATA_KEY_DISPLAY_ICON to appIcon, MediaMetadataCompat.METADATA_KEY_TITLE to notificationData?.title, - MediaMetadataCompat.METADATA_KEY_ARTIST to notificationData?.uploaderName + MediaMetadataCompat.METADATA_KEY_ARTIST to notificationData?.uploaderName, ) return MediaDescriptionCompat.Builder() .setTitle(notificationData?.title) @@ -230,7 +230,7 @@ class NowPlayingNotification( createMediaSessionAction(R.drawable.ic_prev_outlined, PREV), createMediaSessionAction(R.drawable.ic_next_outlined, NEXT), createMediaSessionAction(R.drawable.ic_rewind_md, REWIND), - createMediaSessionAction(R.drawable.ic_forward_md, FORWARD) + createMediaSessionAction(R.drawable.ic_forward_md, FORWARD), ) } } @@ -240,14 +240,14 @@ class NowPlayingNotification( NEXT -> { if (PlayingQueue.hasNext()) { PlayingQueue.onQueueItemSelected( - PlayingQueue.currentIndex() + 1 + PlayingQueue.currentIndex() + 1, ) } } PREV -> { if (PlayingQueue.hasPrev()) { PlayingQueue.onQueueItemSelected( - PlayingQueue.currentIndex() - 1 + PlayingQueue.currentIndex() - 1, ) } } @@ -265,7 +265,7 @@ class NowPlayingNotification( */ fun updatePlayerNotification( videoId: String, - data: PlayerNotificationData + data: PlayerNotificationData, ) { this.videoId = videoId this.notificationData = data diff --git a/app/src/main/java/com/github/libretube/util/PlayingQueue.kt b/app/src/main/java/com/github/libretube/util/PlayingQueue.kt index 457b90fb12..ba53759c8d 100644 --- a/app/src/main/java/com/github/libretube/util/PlayingQueue.kt +++ b/app/src/main/java/com/github/libretube/util/PlayingQueue.kt @@ -42,7 +42,7 @@ object PlayingQueue { if (queue.contains(streamItem)) queue.remove(streamItem) queue.add( currentIndex() + 1, - streamItem + streamItem, ) } @@ -101,10 +101,10 @@ object PlayingQueue { while (playlistNextPage != null) { RetrofitInstance.authApi.getPlaylistNextPage( playlistId, - playlistNextPage!! + playlistNextPage!!, ).apply { add( - *this.relatedStreams.toTypedArray() + *this.relatedStreams.toTypedArray(), ) playlistNextPage = this.nextpage } 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 5bb5f4f7b2..c0a258ef0e 100644 --- a/app/src/main/java/com/github/libretube/util/TextUtils.kt +++ b/app/src/main/java/com/github/libretube/util/TextUtils.kt @@ -5,6 +5,8 @@ import android.icu.text.RelativeDateTimeFormatter import android.os.Build import android.text.format.DateUtils import com.github.libretube.R +import kotlinx.datetime.toJavaLocalDate +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull import java.time.Instant import java.time.LocalDate import java.time.LocalDateTime @@ -14,8 +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 -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull object TextUtils { /** 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 6da93819fd..eca1a4d7d8 100644 --- a/app/src/main/java/com/github/libretube/workers/NotificationWorker.kt +++ b/app/src/main/java/com/github/libretube/workers/NotificationWorker.kt @@ -24,9 +24,9 @@ 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.withContext +import java.time.LocalTime /** * The notification worker which checks for new streams in a certain frequency @@ -64,7 +64,7 @@ class NotificationWorker(appContext: Context, parameters: WorkerParameters) : private fun getTimePickerPref(key: String): LocalTime { return LocalTime.parse( - PreferenceHelper.getString(key, TimePickerPreference.DEFAULT_VALUE) + PreferenceHelper.getString(key, TimePickerPreference.DEFAULT_VALUE), ) } @@ -164,7 +164,7 @@ class NotificationWorker(appContext: Context, parameters: WorkerParameters) : private suspend fun showStreamNotification( group: String, stream: StreamItem, - isSingleNotification: Boolean + isSingleNotification: Boolean, ) { val videoId = stream.url!!.toID() val intent = Intent(applicationContext, MainActivity::class.java) @@ -192,7 +192,7 @@ class NotificationWorker(appContext: Context, parameters: WorkerParameters) : .setStyle( NotificationCompat.BigPictureStyle() .bigPicture(thumbnail) - .bigLargeIcon(null as Bitmap?) // Hides the icon when expanding + .bigLargeIcon(null as Bitmap?), // Hides the icon when expanding ) }