From 9e7dd72afae6402f8247b4bff5a1d9a1848198ff Mon Sep 17 00:00:00 2001 From: mikooomich Date: Fri, 28 Jun 2024 21:08:50 -0400 Subject: [PATCH 1/6] app: No unnecessary null checks --- .../java/com/dd3boh/outertune/utils/ImageCacheManager.kt | 5 +---- innertube/src/main/java/com/zionhuang/innertube/YouTube.kt | 6 +++--- .../main/java/com/zionhuang/innertube/pages/ArtistPage.kt | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/dd3boh/outertune/utils/ImageCacheManager.kt b/app/src/main/java/com/dd3boh/outertune/utils/ImageCacheManager.kt index d7e2e8968..508bfdd92 100644 --- a/app/src/main/java/com/dd3boh/outertune/utils/ImageCacheManager.kt +++ b/app/src/main/java/com/dd3boh/outertune/utils/ImageCacheManager.kt @@ -15,10 +15,7 @@ var bitmapCache = ArrayDeque() * Retrieves an image from the cache */ fun retrieveImage(path: String): CachedBitmap? { - return bitmapCache.firstOrNull { - // don't listen to Kotlin, if you remove the null check, you break images. - it?.path == path - } + return bitmapCache.firstOrNull { it.path == path } } /** diff --git a/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt b/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt index d6425a90c..bce7d4771 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt @@ -245,13 +245,13 @@ object YouTube { ?.tabRenderer?.content?.sectionListRenderer?.contents?.firstOrNull()?.musicShelfRenderer ?.contents?.firstOrNull()?.musicResponsiveListItemRenderer?.overlay?.musicItemThumbnailOverlayRenderer ?.content?.musicPlayButtonRenderer?.playNavigationEndpoint?.watchEndpoint, - shuffleEndpoint = response.header?.musicImmersiveHeaderRenderer?.playButton?.buttonRenderer?.navigationEndpoint?.watchEndpoint, - radioEndpoint = response.header?.musicImmersiveHeaderRenderer?.startRadioButton?.buttonRenderer?.navigationEndpoint?.watchEndpoint + shuffleEndpoint = response.header.musicImmersiveHeaderRenderer.playButton?.buttonRenderer?.navigationEndpoint?.watchEndpoint, + radioEndpoint = response.header.musicImmersiveHeaderRenderer.startRadioButton?.buttonRenderer?.navigationEndpoint?.watchEndpoint ), sections = response.contents?.singleColumnBrowseResultsRenderer?.tabs?.firstOrNull() ?.tabRenderer?.content?.sectionListRenderer?.contents ?.mapNotNull(ArtistPage::fromSectionListRendererContent)!!, - description = response.header?.musicImmersiveHeaderRenderer?.description?.runs?.firstOrNull()?.text + description = response.header.musicImmersiveHeaderRenderer.description?.runs?.firstOrNull()?.text ) } diff --git a/innertube/src/main/java/com/zionhuang/innertube/pages/ArtistPage.kt b/innertube/src/main/java/com/zionhuang/innertube/pages/ArtistPage.kt index 2a9087665..d2f9f5fce 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/pages/ArtistPage.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/pages/ArtistPage.kt @@ -154,7 +154,7 @@ data class ArtistPage( channelId = renderer.menu?.menuRenderer?.items?.find { it.toggleMenuServiceItemRenderer?.defaultIcon?.iconType == "SUBSCRIBE" }?.toggleMenuServiceItemRenderer?.defaultServiceEndpoint?.subscribeEndpoint?.channelIds?.firstOrNull() ?: return null, - shuffleEndpoint = renderer.menu?.menuRenderer?.items?.find { + shuffleEndpoint = renderer.menu.menuRenderer.items.find { it.menuNavigationItemRenderer?.icon?.iconType == "MUSIC_SHUFFLE" }?.menuNavigationItemRenderer?.navigationEndpoint?.watchPlaylistEndpoint ?: return null, radioEndpoint = renderer.menu.menuRenderer.items.find { From d5d56439092236101c8f9330f9e42fd24804a360 Mon Sep 17 00:00:00 2001 From: mikooomich Date: Fri, 28 Jun 2024 21:11:20 -0400 Subject: [PATCH 2/6] app: Remove unnecessary opt in --- app/src/main/java/com/dd3boh/outertune/ui/component/ChipsRow.kt | 1 - .../main/java/com/dd3boh/outertune/ui/component/SearchBar.kt | 2 +- .../com/dd3boh/outertune/ui/screens/search/LocalSearchScreen.kt | 2 +- .../dd3boh/outertune/ui/screens/search/OnlineSearchScreen.kt | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/dd3boh/outertune/ui/component/ChipsRow.kt b/app/src/main/java/com/dd3boh/outertune/ui/component/ChipsRow.kt index 0e8c0e54e..c05b310d5 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/component/ChipsRow.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/component/ChipsRow.kt @@ -22,7 +22,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp -@OptIn(ExperimentalMaterial3Api::class) @Composable fun ChipsRow( chips: List>, diff --git a/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt b/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt index 4c9949143..8de1fe859 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt @@ -228,7 +228,7 @@ fun SearchBar( } } -@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class) +@OptIn(ExperimentalMaterial3Api::class) @Composable private fun SearchBarInputField( query: TextFieldValue, diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/search/LocalSearchScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/search/LocalSearchScreen.kt index 550521191..446b84aab 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/search/LocalSearchScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/search/LocalSearchScreen.kt @@ -67,7 +67,7 @@ import com.dd3boh.outertune.viewmodels.LocalFilter import com.dd3boh.outertune.viewmodels.LocalSearchViewModel import kotlinx.coroutines.flow.drop -@OptIn(ExperimentalFoundationApi::class, ExperimentalComposeUiApi::class) +@OptIn(ExperimentalFoundationApi::class) @Composable fun LocalSearchScreen( query: String, diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchScreen.kt index 60d108937..57f886afd 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchScreen.kt @@ -63,7 +63,7 @@ import com.dd3boh.outertune.ui.component.YouTubeListItem import com.dd3boh.outertune.viewmodels.OnlineSearchSuggestionViewModel import kotlinx.coroutines.flow.drop -@OptIn(ExperimentalFoundationApi::class, ExperimentalComposeUiApi::class) +@OptIn(ExperimentalFoundationApi::class) @Composable fun OnlineSearchScreen( query: String, From 460ad9b54f507c6c78abed30f12c7dbed50524b6 Mon Sep 17 00:00:00 2001 From: mikooomich Date: Fri, 28 Jun 2024 21:07:40 -0400 Subject: [PATCH 3/6] app: Yeet unused imports --- .../java/com/dd3boh/outertune/MainActivity.kt | 122 +++++++++++++++--- .../com/dd3boh/outertune/db/DatabaseDao.kt | 9 +- .../com/dd3boh/outertune/db/MusicDatabase.kt | 35 +++-- .../outertune/db/entities/AlbumEntity.kt | 1 - .../outertune/db/entities/ArtistEntity.kt | 1 - .../outertune/db/entities/PlaylistEntity.kt | 2 - .../outertune/db/entities/SongEntity.kt | 1 - .../dd3boh/outertune/ui/component/Items.kt | 19 ++- .../outertune/ui/component/NavigationTitle.kt | 4 - .../outertune/ui/component/SearchBar.kt | 1 - .../outertune/ui/component/SortHeader.kt | 2 - .../com/dd3boh/outertune/ui/menu/AlbumMenu.kt | 6 - .../dd3boh/outertune/ui/menu/ArtistMenu.kt | 2 - .../dd3boh/outertune/ui/menu/LyricsMenu.kt | 3 - .../dd3boh/outertune/ui/menu/PlaylistMenu.kt | 6 +- .../com/dd3boh/outertune/ui/menu/SongMenu.kt | 3 - .../outertune/ui/menu/YouTubeAlbumMenu.kt | 3 - .../outertune/ui/menu/YouTubeArtistMenu.kt | 4 +- .../outertune/ui/menu/YouTubePlaylistMenu.kt | 10 +- .../outertune/ui/menu/YouTubeSongMenu.kt | 13 +- .../outertune/ui/player/PlaybackError.kt | 1 - .../com/dd3boh/outertune/ui/player/Player.kt | 2 - .../com/dd3boh/outertune/ui/player/Queue.kt | 1 - .../outertune/ui/screens/AccountScreen.kt | 2 - .../outertune/ui/screens/AlbumScreen.kt | 6 +- .../outertune/ui/screens/HistoryScreen.kt | 4 +- .../dd3boh/outertune/ui/screens/HomeScreen.kt | 9 +- .../outertune/ui/screens/LoginScreen.kt | 4 +- .../ui/screens/MoodAndGenresScreen.kt | 1 - .../outertune/ui/screens/NewReleaseScreen.kt | 1 - .../dd3boh/outertune/ui/screens/Screens.kt | 1 - .../outertune/ui/screens/StatsScreen.kt | 3 +- .../ui/screens/YouTubeBrowseScreen.kt | 12 +- .../ui/screens/artist/ArtistItemsScreen.kt | 13 +- .../ui/screens/artist/ArtistScreen.kt | 16 +-- .../ui/screens/artist/ArtistSongsScreen.kt | 1 - .../library/LibrarySongsFolderScreen.kt | 24 +++- .../ui/screens/playlist/AutoPlaylistScreen.kt | 6 +- .../screens/playlist/LocalPlaylistScreen.kt | 10 +- .../screens/playlist/OnlinePlaylistScreen.kt | 6 +- .../ui/screens/search/LocalSearchScreen.kt | 3 - .../ui/screens/search/OnlineSearchResult.kt | 26 ++-- .../ui/screens/search/OnlineSearchScreen.kt | 14 +- .../ui/screens/settings/AppearanceSettings.kt | 2 - .../ui/screens/settings/ContentSettings.kt | 4 +- .../ui/screens/settings/LyricsSettings.kt | 8 -- .../ui/screens/settings/PlayerSettings.kt | 5 - .../ui/screens/settings/PrivacySettings.kt | 4 - .../ui/screens/settings/SettingsScreen.kt | 2 - .../com/dd3boh/outertune/ui/utils/AppBar.kt | 16 ++- .../com/dd3boh/outertune/utils/SyncUtils.kt | 1 - .../outertune/viewmodels/HomeViewModel.kt | 8 +- .../viewmodels/OnlinePlaylistViewModel.kt | 4 +- .../java/com/zionhuang/innertube/YouTube.kt | 1 - .../zionhuang/innertube/models/Endpoint.kt | 1 - ...sicEditablePlaylistDetailHeaderRenderer.kt | 1 - .../innertube/models/SectionListRenderer.kt | 1 - .../innertube/models/body/EditPlaylistBody.kt | 1 - .../models/response/BrowseResponse.kt | 2 - .../com/zionhuang/innertube/utils/Utils.kt | 5 - 60 files changed, 222 insertions(+), 257 deletions(-) diff --git a/app/src/main/java/com/dd3boh/outertune/MainActivity.kt b/app/src/main/java/com/dd3boh/outertune/MainActivity.kt index b55a59be7..7568ce7fa 100644 --- a/app/src/main/java/com/dd3boh/outertune/MainActivity.kt +++ b/app/src/main/java/com/dd3boh/outertune/MainActivity.kt @@ -1,5 +1,6 @@ package com.dd3boh.outertune +import android.Manifest import android.annotation.SuppressLint import android.content.ComponentName import android.content.Context @@ -10,17 +11,33 @@ import android.graphics.drawable.BitmapDrawable import android.os.Build import android.os.Bundle import android.os.IBinder +import android.os.Looper +import android.widget.Toast import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.activity.result.contract.ActivityResultContracts +import androidx.annotation.RequiresApi import androidx.compose.animation.AnimatedContentTransitionScope import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.Crossfade -import androidx.compose.animation.core.* +import androidx.compose.animation.core.animateDpAsState +import androidx.compose.animation.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.background import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.BoxWithConstraints +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides +import androidx.compose.foundation.layout.add +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.navigationBarsPadding +import androidx.compose.foundation.layout.offset +import androidx.compose.foundation.layout.only +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.systemBars import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowBack @@ -29,9 +46,29 @@ import androidx.compose.material.icons.rounded.Language import androidx.compose.material.icons.rounded.LibraryMusic import androidx.compose.material.icons.rounded.Search import androidx.compose.material.icons.rounded.Settings -import androidx.compose.material3.* -import androidx.compose.runtime.* +import androidx.compose.material3.AlertDialogDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.NavigationBar +import androidx.compose.material3.NavigationBarItem +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.material3.contentColorFor +import androidx.compose.material3.rememberTopAppBarState +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.DisposableEffect +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.compositionLocalOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester @@ -51,11 +88,6 @@ import androidx.compose.ui.util.fastFirstOrNull import androidx.compose.ui.util.fastForEach import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties -import android.Manifest -import android.os.Looper -import android.widget.Toast -import androidx.activity.result.contract.ActivityResultContracts -import androidx.annotation.RequiresApi import androidx.core.net.toUri import androidx.core.util.Consumer import androidx.core.view.WindowCompat @@ -71,22 +103,53 @@ import androidx.navigation.compose.rememberNavController import androidx.navigation.navArgument import coil.imageLoader import coil.request.ImageRequest -import com.valentinilk.shimmer.LocalShimmerTheme -import com.zionhuang.innertube.YouTube -import com.zionhuang.innertube.models.SongItem -import com.dd3boh.outertune.constants.* +import com.dd3boh.outertune.constants.AppBarHeight +import com.dd3boh.outertune.constants.AutomaticScannerKey +import com.dd3boh.outertune.constants.DarkModeKey +import com.dd3boh.outertune.constants.DefaultOpenTabKey +import com.dd3boh.outertune.constants.DefaultOpenTabNewKey +import com.dd3boh.outertune.constants.DynamicThemeKey +import com.dd3boh.outertune.constants.ExcludedScanPathsKey +import com.dd3boh.outertune.constants.LibraryFilter +import com.dd3boh.outertune.constants.LibraryFilterKey +import com.dd3boh.outertune.constants.LookupYtmArtistsKey +import com.dd3boh.outertune.constants.MiniPlayerHeight +import com.dd3boh.outertune.constants.NavigationBarAnimationSpec +import com.dd3boh.outertune.constants.NavigationBarHeight +import com.dd3boh.outertune.constants.NewInterfaceKey +import com.dd3boh.outertune.constants.PauseSearchHistoryKey +import com.dd3boh.outertune.constants.PlayerBackgroundStyleKey +import com.dd3boh.outertune.constants.PureBlackKey +import com.dd3boh.outertune.constants.ScanPathsKey +import com.dd3boh.outertune.constants.ScannerMatchCriteria +import com.dd3boh.outertune.constants.ScannerSensitivityKey +import com.dd3boh.outertune.constants.ScannerStrictExtKey +import com.dd3boh.outertune.constants.SearchSource +import com.dd3boh.outertune.constants.SearchSourceKey import com.dd3boh.outertune.db.MusicDatabase import com.dd3boh.outertune.db.entities.SearchHistory -import com.dd3boh.outertune.extensions.* +import com.dd3boh.outertune.extensions.toEnum import com.dd3boh.outertune.playback.DownloadUtil import com.dd3boh.outertune.playback.MusicService import com.dd3boh.outertune.playback.MusicService.MusicBinder import com.dd3boh.outertune.playback.PlayerConnection -import com.dd3boh.outertune.ui.component.* +import com.dd3boh.outertune.ui.component.BottomSheetMenu +import com.dd3boh.outertune.ui.component.LocalMenuState +import com.dd3boh.outertune.ui.component.SearchBar +import com.dd3boh.outertune.ui.component.rememberBottomSheetState import com.dd3boh.outertune.ui.component.shimmer.ShimmerTheme import com.dd3boh.outertune.ui.menu.YouTubeSongMenu import com.dd3boh.outertune.ui.player.BottomSheetPlayer -import com.dd3boh.outertune.ui.screens.* +import com.dd3boh.outertune.ui.screens.AccountScreen +import com.dd3boh.outertune.ui.screens.AlbumScreen +import com.dd3boh.outertune.ui.screens.HistoryScreen +import com.dd3boh.outertune.ui.screens.HomeScreen +import com.dd3boh.outertune.ui.screens.LoginScreen +import com.dd3boh.outertune.ui.screens.MoodAndGenresScreen +import com.dd3boh.outertune.ui.screens.NewReleaseScreen +import com.dd3boh.outertune.ui.screens.Screens +import com.dd3boh.outertune.ui.screens.StatsScreen +import com.dd3boh.outertune.ui.screens.YouTubeBrowseScreen import com.dd3boh.outertune.ui.screens.artist.ArtistItemsScreen import com.dd3boh.outertune.ui.screens.artist.ArtistScreen import com.dd3boh.outertune.ui.screens.artist.ArtistSongsScreen @@ -102,12 +165,29 @@ import com.dd3boh.outertune.ui.screens.playlist.OnlinePlaylistScreen import com.dd3boh.outertune.ui.screens.search.LocalSearchScreen import com.dd3boh.outertune.ui.screens.search.OnlineSearchResult import com.dd3boh.outertune.ui.screens.search.OnlineSearchScreen -import com.dd3boh.outertune.ui.screens.settings.* -import com.dd3boh.outertune.ui.theme.* +import com.dd3boh.outertune.ui.screens.settings.AboutScreen +import com.dd3boh.outertune.ui.screens.settings.AppearanceSettings +import com.dd3boh.outertune.ui.screens.settings.BackupAndRestore +import com.dd3boh.outertune.ui.screens.settings.ContentSettings +import com.dd3boh.outertune.ui.screens.settings.DarkMode +import com.dd3boh.outertune.ui.screens.settings.ExperimentalSettings +import com.dd3boh.outertune.ui.screens.settings.LocalPlayerSettings +import com.dd3boh.outertune.ui.screens.settings.LyricsSettings +import com.dd3boh.outertune.ui.screens.settings.NavigationTab +import com.dd3boh.outertune.ui.screens.settings.NavigationTabNew +import com.dd3boh.outertune.ui.screens.settings.PlayerBackgroundStyle +import com.dd3boh.outertune.ui.screens.settings.PlayerSettings +import com.dd3boh.outertune.ui.screens.settings.PrivacySettings +import com.dd3boh.outertune.ui.screens.settings.SettingsScreen +import com.dd3boh.outertune.ui.screens.settings.StorageSettings +import com.dd3boh.outertune.ui.theme.ColorSaver +import com.dd3boh.outertune.ui.theme.DefaultThemeColor +import com.dd3boh.outertune.ui.theme.OuterTuneTheme +import com.dd3boh.outertune.ui.theme.extractThemeColor import com.dd3boh.outertune.ui.utils.DEFAULT_SCAN_PATH import com.dd3boh.outertune.ui.utils.appBarScrollBehavior -import com.dd3boh.outertune.ui.utils.getLocalThumbnail import com.dd3boh.outertune.ui.utils.cacheDirectoryTree +import com.dd3boh.outertune.ui.utils.getLocalThumbnail import com.dd3boh.outertune.ui.utils.resetHeightOffset import com.dd3boh.outertune.utils.SyncUtils import com.dd3boh.outertune.utils.dataStore @@ -119,13 +199,15 @@ import com.dd3boh.outertune.utils.reportException import com.dd3boh.outertune.utils.scanners.LocalMediaScanner import com.dd3boh.outertune.utils.scanners.LocalMediaScanner.Companion.unloadAdvancedScanner import com.dd3boh.outertune.utils.scanners.ScannerAbortException +import com.valentinilk.shimmer.LocalShimmerTheme +import com.zionhuang.innertube.YouTube +import com.zionhuang.innertube.models.SongItem import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import java.net.URLDecoder import java.net.URLEncoder import javax.inject.Inject diff --git a/app/src/main/java/com/dd3boh/outertune/db/DatabaseDao.kt b/app/src/main/java/com/dd3boh/outertune/db/DatabaseDao.kt index f0d3a4805..f24406516 100644 --- a/app/src/main/java/com/dd3boh/outertune/db/DatabaseDao.kt +++ b/app/src/main/java/com/dd3boh/outertune/db/DatabaseDao.kt @@ -10,9 +10,6 @@ import androidx.room.Transaction import androidx.room.Update import androidx.room.Upsert import androidx.sqlite.db.SupportSQLiteQuery -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.pages.AlbumPage -import com.zionhuang.innertube.pages.ArtistPage import com.dd3boh.outertune.constants.AlbumSortType import com.dd3boh.outertune.constants.ArtistSongSortType import com.dd3boh.outertune.constants.ArtistSortType @@ -48,12 +45,12 @@ import com.dd3boh.outertune.models.toMediaMetadata import com.dd3boh.outertune.ui.utils.resize import com.zionhuang.innertube.models.AlbumItem import com.zionhuang.innertube.models.PlaylistItem -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers +import com.zionhuang.innertube.models.SongItem +import com.zionhuang.innertube.pages.AlbumPage +import com.zionhuang.innertube.pages.ArtistPage import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.map -import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import java.time.LocalDateTime import java.time.ZoneOffset diff --git a/app/src/main/java/com/dd3boh/outertune/db/MusicDatabase.kt b/app/src/main/java/com/dd3boh/outertune/db/MusicDatabase.kt index e17f0e539..e4a2e03af 100644 --- a/app/src/main/java/com/dd3boh/outertune/db/MusicDatabase.kt +++ b/app/src/main/java/com/dd3boh/outertune/db/MusicDatabase.kt @@ -1,19 +1,30 @@ package com.dd3boh.outertune.db import android.content.Context -import android.database.sqlite.SQLiteDatabase -import androidx.core.content.contentValuesOf -import androidx.room.* -import androidx.room.migration.AutoMigrationSpec -import androidx.room.migration.Migration -import androidx.sqlite.db.SupportSQLiteDatabase +import androidx.room.Database +import androidx.room.Room +import androidx.room.RoomDatabase +import androidx.room.TypeConverters import androidx.sqlite.db.SupportSQLiteOpenHelper -import com.dd3boh.outertune.db.entities.* -import com.dd3boh.outertune.extensions.toSQLiteQuery -import java.time.Instant -import java.time.LocalDateTime -import java.time.ZoneOffset -import java.util.* +import com.dd3boh.outertune.db.entities.AlbumArtistMap +import com.dd3boh.outertune.db.entities.AlbumEntity +import com.dd3boh.outertune.db.entities.ArtistEntity +import com.dd3boh.outertune.db.entities.Event +import com.dd3boh.outertune.db.entities.FormatEntity +import com.dd3boh.outertune.db.entities.GenreEntity +import com.dd3boh.outertune.db.entities.LyricsEntity +import com.dd3boh.outertune.db.entities.PlayCountEntity +import com.dd3boh.outertune.db.entities.PlaylistEntity +import com.dd3boh.outertune.db.entities.PlaylistSongMap +import com.dd3boh.outertune.db.entities.PlaylistSongMapPreview +import com.dd3boh.outertune.db.entities.RelatedSongMap +import com.dd3boh.outertune.db.entities.SearchHistory +import com.dd3boh.outertune.db.entities.SongAlbumMap +import com.dd3boh.outertune.db.entities.SongArtistMap +import com.dd3boh.outertune.db.entities.SongEntity +import com.dd3boh.outertune.db.entities.SongGenreMap +import com.dd3boh.outertune.db.entities.SortedSongAlbumMap +import com.dd3boh.outertune.db.entities.SortedSongArtistMap class MusicDatabase( private val delegate: InternalDatabase, diff --git a/app/src/main/java/com/dd3boh/outertune/db/entities/AlbumEntity.kt b/app/src/main/java/com/dd3boh/outertune/db/entities/AlbumEntity.kt index 6975b95c6..cfc52cc92 100644 --- a/app/src/main/java/com/dd3boh/outertune/db/entities/AlbumEntity.kt +++ b/app/src/main/java/com/dd3boh/outertune/db/entities/AlbumEntity.kt @@ -1,7 +1,6 @@ package com.dd3boh.outertune.db.entities import androidx.compose.runtime.Immutable -import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey import com.zionhuang.innertube.YouTube diff --git a/app/src/main/java/com/dd3boh/outertune/db/entities/ArtistEntity.kt b/app/src/main/java/com/dd3boh/outertune/db/entities/ArtistEntity.kt index 2612d6b4d..d757467ac 100644 --- a/app/src/main/java/com/dd3boh/outertune/db/entities/ArtistEntity.kt +++ b/app/src/main/java/com/dd3boh/outertune/db/entities/ArtistEntity.kt @@ -1,7 +1,6 @@ package com.dd3boh.outertune.db.entities import androidx.compose.runtime.Immutable -import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey import com.zionhuang.innertube.YouTube diff --git a/app/src/main/java/com/dd3boh/outertune/db/entities/PlaylistEntity.kt b/app/src/main/java/com/dd3boh/outertune/db/entities/PlaylistEntity.kt index f78e80d25..ac1511575 100644 --- a/app/src/main/java/com/dd3boh/outertune/db/entities/PlaylistEntity.kt +++ b/app/src/main/java/com/dd3boh/outertune/db/entities/PlaylistEntity.kt @@ -1,11 +1,9 @@ package com.dd3boh.outertune.db.entities import androidx.compose.runtime.Immutable -import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey import com.zionhuang.innertube.YouTube -import com.zionhuang.innertube.models.WatchEndpoint import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.cancel diff --git a/app/src/main/java/com/dd3boh/outertune/db/entities/SongEntity.kt b/app/src/main/java/com/dd3boh/outertune/db/entities/SongEntity.kt index 156ec5e17..66ed345c4 100644 --- a/app/src/main/java/com/dd3boh/outertune/db/entities/SongEntity.kt +++ b/app/src/main/java/com/dd3boh/outertune/db/entities/SongEntity.kt @@ -1,7 +1,6 @@ package com.dd3boh.outertune.db.entities import androidx.compose.runtime.Immutable -import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.Index import androidx.room.PrimaryKey diff --git a/app/src/main/java/com/dd3boh/outertune/ui/component/Items.kt b/app/src/main/java/com/dd3boh/outertune/ui/component/Items.kt index b92e70811..da7552aee 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/component/Items.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/component/Items.kt @@ -22,7 +22,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width - import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons @@ -80,17 +79,10 @@ import androidx.navigation.NavController import coil.compose.AsyncImage import coil.compose.AsyncImagePainter import coil.request.ImageRequest -import com.zionhuang.innertube.YouTube -import com.zionhuang.innertube.models.AlbumItem -import com.zionhuang.innertube.models.ArtistItem -import com.zionhuang.innertube.models.PlaylistItem -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.models.YTItem import com.dd3boh.outertune.LocalDatabase import com.dd3boh.outertune.LocalDownloadUtil import com.dd3boh.outertune.LocalPlayerConnection import com.dd3boh.outertune.R -import com.dd3boh.outertune.constants.AlbumThumbnailSize import com.dd3boh.outertune.constants.GridThumbnailHeight import com.dd3boh.outertune.constants.ListItemHeight import com.dd3boh.outertune.constants.ListThumbnailSize @@ -100,17 +92,22 @@ import com.dd3boh.outertune.db.entities.Artist import com.dd3boh.outertune.db.entities.Playlist import com.dd3boh.outertune.db.entities.PlaylistEntity import com.dd3boh.outertune.db.entities.Song -import com.dd3boh.outertune.extensions.toMediaItem +import com.dd3boh.outertune.models.DirectoryTree import com.dd3boh.outertune.models.MediaMetadata +import com.dd3boh.outertune.models.toMediaMetadata import com.dd3boh.outertune.playback.queues.ListQueue import com.dd3boh.outertune.ui.menu.FolderMenu import com.dd3boh.outertune.ui.theme.extractThemeColor -import com.dd3boh.outertune.models.DirectoryTree -import com.dd3boh.outertune.models.toMediaMetadata import com.dd3boh.outertune.ui.utils.getLocalThumbnail import com.dd3boh.outertune.utils.joinByBullet import com.dd3boh.outertune.utils.makeTimeString import com.dd3boh.outertune.utils.reportException +import com.zionhuang.innertube.YouTube +import com.zionhuang.innertube.models.AlbumItem +import com.zionhuang.innertube.models.ArtistItem +import com.zionhuang.innertube.models.PlaylistItem +import com.zionhuang.innertube.models.SongItem +import com.zionhuang.innertube.models.YTItem import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.first diff --git a/app/src/main/java/com/dd3boh/outertune/ui/component/NavigationTitle.kt b/app/src/main/java/com/dd3boh/outertune/ui/component/NavigationTitle.kt index 5420d348a..c19e87913 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/component/NavigationTitle.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/component/NavigationTitle.kt @@ -11,18 +11,14 @@ import androidx.compose.foundation.layout.systemBars import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowForward -import androidx.compose.material.icons.rounded.ArrowForward -import androidx.compose.material.icons.rounded.OfflinePin import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp -import com.dd3boh.outertune.R @Composable fun NavigationTitle( diff --git a/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt b/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt index 8de1fe859..f002dfdff 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt @@ -34,7 +34,6 @@ import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Decoration -import androidx.compose.material3.Divider import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.LocalTextStyle diff --git a/app/src/main/java/com/dd3boh/outertune/ui/component/SortHeader.kt b/app/src/main/java/com/dd3boh/outertune/ui/component/SortHeader.kt index 9223b65bb..ee4b7ee61 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/component/SortHeader.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/component/SortHeader.kt @@ -24,12 +24,10 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.dd3boh.outertune.R import com.dd3boh.outertune.constants.PlaylistSongSortType @Composable diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/AlbumMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/AlbumMenu.kt index 433553668..916e3fc89 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/AlbumMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/AlbumMenu.kt @@ -17,13 +17,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.PlaylistAdd import androidx.compose.material.icons.automirrored.rounded.PlaylistPlay import androidx.compose.material.icons.automirrored.rounded.QueueMusic -import androidx.compose.material.icons.rounded.PlaylistAdd -import androidx.compose.material.icons.rounded.PlaylistPlay -import androidx.compose.material.icons.rounded.QueueMusic -import androidx.compose.material.icons.rounded.QueuePlayNext -import androidx.compose.material.icons.rounded.SelectAll import androidx.compose.material.icons.rounded.Share -import androidx.compose.material3.Divider import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/ArtistMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/ArtistMenu.kt index c780023a2..81100f583 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/ArtistMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/ArtistMenu.kt @@ -9,7 +9,6 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.PlayArrow import androidx.compose.material.icons.rounded.Share import androidx.compose.material.icons.rounded.Shuffle -import androidx.compose.material3.Divider import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -25,7 +24,6 @@ import com.dd3boh.outertune.LocalPlayerConnection import com.dd3boh.outertune.R import com.dd3boh.outertune.constants.ArtistSongSortType import com.dd3boh.outertune.db.entities.Artist -import com.dd3boh.outertune.extensions.toMediaItem import com.dd3boh.outertune.models.toMediaMetadata import com.dd3boh.outertune.playback.queues.ListQueue import com.dd3boh.outertune.ui.component.ArtistListItem diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/LyricsMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/LyricsMenu.kt index 69dce8af5..a1ef7bca0 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/LyricsMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/LyricsMenu.kt @@ -21,7 +21,6 @@ import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.rounded.Cached import androidx.compose.material.icons.rounded.Edit import androidx.compose.material.icons.rounded.ExpandLess import androidx.compose.material.icons.rounded.ExpandMore @@ -29,7 +28,6 @@ import androidx.compose.material.icons.rounded.Search import androidx.compose.material.icons.rounded.Sync import androidx.compose.material.icons.rounded.SyncAlt import androidx.compose.material3.CircularProgressIndicator -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme @@ -47,7 +45,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.style.TextAlign diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/PlaylistMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/PlaylistMenu.kt index 7df18883a..0963b02b5 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/PlaylistMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/PlaylistMenu.kt @@ -38,14 +38,10 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextRange import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp -import androidx.compose.ui.util.fastSumBy import androidx.core.net.toUri import androidx.media3.exoplayer.offline.Download import androidx.media3.exoplayer.offline.DownloadRequest import androidx.media3.exoplayer.offline.DownloadService -import com.zionhuang.innertube.YouTube -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.utils.completed import com.dd3boh.outertune.LocalDatabase import com.dd3boh.outertune.LocalDownloadUtil import com.dd3boh.outertune.LocalPlayerConnection @@ -65,11 +61,11 @@ import com.dd3boh.outertune.ui.component.GridMenu import com.dd3boh.outertune.ui.component.GridMenuItem import com.dd3boh.outertune.ui.component.PlaylistListItem import com.dd3boh.outertune.ui.component.TextFieldDialog +import com.zionhuang.innertube.YouTube import com.zionhuang.innertube.models.WatchEndpoint import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext @Composable fun PlaylistMenu( diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/SongMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/SongMenu.kt index 688ffda2f..bf189b4aa 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/SongMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/SongMenu.kt @@ -20,12 +20,9 @@ import androidx.compose.material.icons.automirrored.rounded.QueueMusic import androidx.compose.material.icons.rounded.Album import androidx.compose.material.icons.rounded.Delete import androidx.compose.material.icons.rounded.Edit -import androidx.compose.material.icons.rounded.PlaylistAdd -import androidx.compose.material.icons.rounded.PlaylistPlay import androidx.compose.material.icons.rounded.PlaylistRemove import androidx.compose.material.icons.rounded.Radio import androidx.compose.material.icons.rounded.Share -import androidx.compose.material3.Divider import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeAlbumMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeAlbumMenu.kt index 90fd83a74..0ed9e9802 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeAlbumMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeAlbumMenu.kt @@ -15,11 +15,8 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.PlaylistAdd import androidx.compose.material.icons.automirrored.rounded.PlaylistPlay import androidx.compose.material.icons.automirrored.rounded.QueueMusic -import androidx.compose.material.icons.rounded.PlaylistAdd -import androidx.compose.material.icons.rounded.PlaylistPlay import androidx.compose.material.icons.rounded.Radio import androidx.compose.material.icons.rounded.Share -import androidx.compose.material3.Divider import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeArtistMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeArtistMenu.kt index 6ecac6a63..b20ba70ba 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeArtistMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeArtistMenu.kt @@ -9,7 +9,6 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.Radio import androidx.compose.material.icons.rounded.Share import androidx.compose.material.icons.rounded.Shuffle -import androidx.compose.material3.Divider import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -21,7 +20,6 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp -import com.zionhuang.innertube.models.ArtistItem import com.dd3boh.outertune.LocalDatabase import com.dd3boh.outertune.LocalPlayerConnection import com.dd3boh.outertune.R @@ -30,7 +28,7 @@ import com.dd3boh.outertune.playback.queues.YouTubeQueue import com.dd3boh.outertune.ui.component.GridMenu import com.dd3boh.outertune.ui.component.GridMenuItem import com.dd3boh.outertune.ui.component.YouTubeListItem -import java.time.LocalDateTime +import com.zionhuang.innertube.models.ArtistItem @Composable fun YouTubeArtistMenu( diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubePlaylistMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubePlaylistMenu.kt index 10377a359..e9ab97746 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubePlaylistMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubePlaylistMenu.kt @@ -38,10 +38,6 @@ import androidx.core.net.toUri import androidx.media3.exoplayer.offline.Download import androidx.media3.exoplayer.offline.DownloadRequest import androidx.media3.exoplayer.offline.DownloadService -import com.zionhuang.innertube.YouTube -import com.zionhuang.innertube.models.PlaylistItem -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.utils.completed import com.dd3boh.outertune.LocalDatabase import com.dd3boh.outertune.LocalDownloadUtil import com.dd3boh.outertune.LocalPlayerConnection @@ -56,9 +52,11 @@ import com.dd3boh.outertune.ui.component.DefaultDialog import com.dd3boh.outertune.ui.component.DownloadGridMenu import com.dd3boh.outertune.ui.component.GridMenu import com.dd3boh.outertune.ui.component.GridMenuItem -import com.dd3boh.outertune.ui.component.IconButton import com.dd3boh.outertune.ui.component.YouTubeListItem -import com.zionhuang.innertube.models.Icon +import com.zionhuang.innertube.YouTube +import com.zionhuang.innertube.models.PlaylistItem +import com.zionhuang.innertube.models.SongItem +import com.zionhuang.innertube.utils.completed import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeSongMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeSongMenu.kt index 4d80e2774..09e148519 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeSongMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeSongMenu.kt @@ -18,15 +18,9 @@ import androidx.compose.material.icons.automirrored.rounded.PlaylistAdd import androidx.compose.material.icons.automirrored.rounded.PlaylistPlay import androidx.compose.material.icons.automirrored.rounded.QueueMusic import androidx.compose.material.icons.rounded.Album -import androidx.compose.material.icons.rounded.LibraryAdd -import androidx.compose.material.icons.rounded.LibraryAddCheck import androidx.compose.material.icons.rounded.Person -import androidx.compose.material.icons.rounded.PlaylistAdd -import androidx.compose.material.icons.rounded.PlaylistPlay -import androidx.compose.material.icons.rounded.QueueMusic import androidx.compose.material.icons.rounded.Radio import androidx.compose.material.icons.rounded.Share -import androidx.compose.material3.Divider import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -55,9 +49,6 @@ import androidx.media3.exoplayer.offline.DownloadRequest import androidx.media3.exoplayer.offline.DownloadService import androidx.navigation.NavController import coil.compose.AsyncImage -import com.zionhuang.innertube.YouTube -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.models.WatchEndpoint import com.dd3boh.outertune.LocalDatabase import com.dd3boh.outertune.LocalDownloadUtil import com.dd3boh.outertune.LocalPlayerConnection @@ -79,9 +70,11 @@ import com.dd3boh.outertune.ui.component.ListDialog import com.dd3boh.outertune.ui.component.ListItem import com.dd3boh.outertune.utils.joinByBullet import com.dd3boh.outertune.utils.makeTimeString +import com.zionhuang.innertube.YouTube +import com.zionhuang.innertube.models.SongItem +import com.zionhuang.innertube.models.WatchEndpoint import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -import java.time.LocalDateTime @Composable fun YouTubeSongMenu( diff --git a/app/src/main/java/com/dd3boh/outertune/ui/player/PlaybackError.kt b/app/src/main/java/com/dd3boh/outertune/ui/player/PlaybackError.kt index bd08289c1..ef4bd49b9 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/player/PlaybackError.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/player/PlaybackError.kt @@ -12,7 +12,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.input.pointer.pointerInput -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.media3.common.PlaybackException diff --git a/app/src/main/java/com/dd3boh/outertune/ui/player/Player.kt b/app/src/main/java/com/dd3boh/outertune/ui/player/Player.kt index 41bb1aa04..70ca04263 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/player/Player.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/player/Player.kt @@ -67,7 +67,6 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment @@ -111,7 +110,6 @@ import com.dd3boh.outertune.extensions.togglePlayPause import com.dd3boh.outertune.extensions.toggleRepeatMode import com.dd3boh.outertune.models.MediaMetadata import com.dd3boh.outertune.models.isShuffleEnabled -import com.dd3boh.outertune.playback.PlayerConnection import com.dd3boh.outertune.ui.component.AsyncLocalImage import com.dd3boh.outertune.ui.component.BottomSheet import com.dd3boh.outertune.ui.component.BottomSheetState diff --git a/app/src/main/java/com/dd3boh/outertune/ui/player/Queue.kt b/app/src/main/java/com/dd3boh/outertune/ui/player/Queue.kt index 5413a7f70..0e0aae5d7 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/player/Queue.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/player/Queue.kt @@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.add import androidx.compose.foundation.layout.asPaddingValues -import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/AccountScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/AccountScreen.kt index ba8baac6e..3e30af143 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/AccountScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/AccountScreen.kt @@ -8,7 +8,6 @@ import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.items import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowBack -import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.Text @@ -19,7 +18,6 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/AlbumScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/AlbumScreen.kt index b11e2a8be..5090cd02f 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/AlbumScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/AlbumScreen.kt @@ -22,12 +22,9 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.ClickableText import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowBack -import androidx.compose.material.icons.rounded.Close -import androidx.compose.material.icons.rounded.Deselect import androidx.compose.material.icons.rounded.Download import androidx.compose.material.icons.rounded.MoreVert import androidx.compose.material.icons.rounded.OfflinePin -import androidx.compose.material.icons.rounded.SelectAll import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.CircularProgressIndicator @@ -97,11 +94,10 @@ import com.dd3boh.outertune.ui.component.shimmer.ListItemPlaceHolder import com.dd3boh.outertune.ui.component.shimmer.ShimmerHost import com.dd3boh.outertune.ui.component.shimmer.TextPlaceholder import com.dd3boh.outertune.ui.menu.AlbumMenu -import com.dd3boh.outertune.ui.menu.SelectionSongMenu import com.dd3boh.outertune.ui.menu.SongMenu +import com.dd3boh.outertune.ui.utils.ItemWrapper import com.dd3boh.outertune.ui.utils.backToMain import com.dd3boh.outertune.viewmodels.AlbumViewModel -import com.dd3boh.outertune.ui.utils.ItemWrapper @OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class) @Composable diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/HistoryScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/HistoryScreen.kt index 317753147..41175ceb0 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/HistoryScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/HistoryScreen.kt @@ -12,7 +12,6 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowBack -import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material.icons.rounded.MoreVert import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon @@ -25,11 +24,9 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController -import com.zionhuang.innertube.models.WatchEndpoint import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.LocalPlayerConnection import com.dd3boh.outertune.R @@ -49,6 +46,7 @@ import com.dd3boh.outertune.ui.utils.backToMain import com.dd3boh.outertune.utils.rememberPreference import com.dd3boh.outertune.viewmodels.DateAgo import com.dd3boh.outertune.viewmodels.HistoryViewModel +import com.zionhuang.innertube.models.WatchEndpoint import com.zionhuang.innertube.utils.parseCookieString import java.time.format.DateTimeFormatter diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt index ad80082a2..3b6d59143 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt @@ -14,20 +14,14 @@ import androidx.compose.material.icons.rounded.Casino import androidx.compose.material.icons.rounded.History import androidx.compose.material.icons.rounded.MoreVert import androidx.compose.material.icons.rounded.Person -import androidx.compose.material.icons.rounded.TrendingUp import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController -import com.google.accompanist.swiperefresh.SwipeRefresh -import com.google.accompanist.swiperefresh.rememberSwipeRefreshState -import com.zionhuang.innertube.models.WatchEndpoint -import com.zionhuang.innertube.utils.parseCookieString import com.dd3boh.outertune.LocalDatabase import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.LocalPlayerConnection @@ -50,9 +44,12 @@ import com.dd3boh.outertune.ui.menu.YouTubeAlbumMenu import com.dd3boh.outertune.ui.utils.SnapLayoutInfoProvider import com.dd3boh.outertune.utils.rememberPreference import com.dd3boh.outertune.viewmodels.HomeViewModel +import com.google.accompanist.swiperefresh.SwipeRefresh import com.zionhuang.innertube.models.AlbumItem import com.zionhuang.innertube.models.ArtistItem import com.zionhuang.innertube.models.PlaylistItem +import com.zionhuang.innertube.models.WatchEndpoint +import com.zionhuang.innertube.utils.parseCookieString import kotlin.random.Random @Suppress("DEPRECATION") diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/LoginScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/LoginScreen.kt index 00c4b04c6..95c9cf7e8 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/LoginScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/LoginScreen.kt @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowBack -import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.Text @@ -19,11 +18,9 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.viewinterop.AndroidView import androidx.navigation.NavController -import com.zionhuang.innertube.YouTube import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.R import com.dd3boh.outertune.constants.AccountChannelHandleKey @@ -35,6 +32,7 @@ import com.dd3boh.outertune.ui.component.IconButton import com.dd3boh.outertune.ui.utils.backToMain import com.dd3boh.outertune.utils.rememberPreference import com.dd3boh.outertune.utils.reportException +import com.zionhuang.innertube.YouTube import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/MoodAndGenresScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/MoodAndGenresScreen.kt index aaf36040e..f75d8393b 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/MoodAndGenresScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/MoodAndGenresScreen.kt @@ -28,7 +28,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.platform.LocalConfiguration -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/NewReleaseScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/NewReleaseScreen.kt index 5773284b1..342e99d29 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/NewReleaseScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/NewReleaseScreen.kt @@ -18,7 +18,6 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/Screens.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/Screens.kt index 81a322d5c..b4387d73b 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/Screens.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/Screens.kt @@ -1,6 +1,5 @@ package com.dd3boh.outertune.ui.screens -import androidx.annotation.DrawableRes import androidx.annotation.StringRes import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.QueueMusic diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/StatsScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/StatsScreen.kt index 8ed97bbc7..482aca2b8 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/StatsScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/StatsScreen.kt @@ -23,12 +23,10 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.pluralStringResource import androidx.compose.ui.res.stringResource import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController -import com.zionhuang.innertube.models.WatchEndpoint import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.LocalPlayerConnection import com.dd3boh.outertune.R @@ -48,6 +46,7 @@ import com.dd3boh.outertune.ui.menu.ArtistMenu import com.dd3boh.outertune.ui.menu.SongMenu import com.dd3boh.outertune.ui.utils.backToMain import com.dd3boh.outertune.viewmodels.StatsViewModel +import com.zionhuang.innertube.models.WatchEndpoint @OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class) @Composable diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/YouTubeBrowseScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/YouTubeBrowseScreen.kt index 70adb4f1d..6a0541984 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/YouTubeBrowseScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/YouTubeBrowseScreen.kt @@ -19,17 +19,10 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController -import com.zionhuang.innertube.models.AlbumItem -import com.zionhuang.innertube.models.ArtistItem -import com.zionhuang.innertube.models.PlaylistItem -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.models.WatchEndpoint import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.LocalPlayerConnection -import com.dd3boh.outertune.R import com.dd3boh.outertune.extensions.togglePlayPause import com.dd3boh.outertune.models.toMediaMetadata import com.dd3boh.outertune.playback.queues.YouTubeQueue @@ -45,6 +38,11 @@ import com.dd3boh.outertune.ui.menu.YouTubePlaylistMenu import com.dd3boh.outertune.ui.menu.YouTubeSongMenu import com.dd3boh.outertune.ui.utils.backToMain import com.dd3boh.outertune.viewmodels.YouTubeBrowseViewModel +import com.zionhuang.innertube.models.AlbumItem +import com.zionhuang.innertube.models.ArtistItem +import com.zionhuang.innertube.models.PlaylistItem +import com.zionhuang.innertube.models.SongItem +import com.zionhuang.innertube.models.WatchEndpoint @OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class) @Composable diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistItemsScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistItemsScreen.kt index b90c1e4bc..809a98de9 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistItemsScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistItemsScreen.kt @@ -1,7 +1,6 @@ package com.dd3boh.outertune.ui.screens.artist import androidx.compose.foundation.ExperimentalFoundationApi -import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.asPaddingValues @@ -33,18 +32,11 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController -import com.zionhuang.innertube.models.AlbumItem -import com.zionhuang.innertube.models.ArtistItem -import com.zionhuang.innertube.models.PlaylistItem -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.models.WatchEndpoint import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.LocalPlayerConnection -import com.dd3boh.outertune.R import com.dd3boh.outertune.constants.GridThumbnailHeight import com.dd3boh.outertune.extensions.toMediaItem import com.dd3boh.outertune.extensions.togglePlayPause @@ -63,6 +55,11 @@ import com.dd3boh.outertune.ui.menu.YouTubePlaylistMenu import com.dd3boh.outertune.ui.menu.YouTubeSongMenu import com.dd3boh.outertune.ui.utils.backToMain import com.dd3boh.outertune.viewmodels.ArtistItemsViewModel +import com.zionhuang.innertube.models.AlbumItem +import com.zionhuang.innertube.models.ArtistItem +import com.zionhuang.innertube.models.PlaylistItem +import com.zionhuang.innertube.models.SongItem +import com.zionhuang.innertube.models.WatchEndpoint @OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class) @Composable diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistScreen.kt index d4748d3cc..7c9e84495 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistScreen.kt @@ -3,7 +3,6 @@ package com.dd3boh.outertune.ui.screens.artist import android.content.Intent import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background -import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -27,7 +26,6 @@ import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowBack -import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material.icons.rounded.Favorite import androidx.compose.material.icons.rounded.FavoriteBorder import androidx.compose.material.icons.rounded.MoreVert @@ -58,7 +56,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign @@ -69,12 +66,6 @@ import androidx.compose.ui.util.fastForEach import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController import coil.compose.AsyncImage -import com.valentinilk.shimmer.shimmer -import com.zionhuang.innertube.models.AlbumItem -import com.zionhuang.innertube.models.ArtistItem -import com.zionhuang.innertube.models.PlaylistItem -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.models.WatchEndpoint import com.dd3boh.outertune.LocalDatabase import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.LocalPlayerConnection @@ -108,7 +99,12 @@ import com.dd3boh.outertune.ui.utils.backToMain import com.dd3boh.outertune.ui.utils.fadingEdge import com.dd3boh.outertune.ui.utils.resize import com.dd3boh.outertune.viewmodels.ArtistViewModel -import java.time.LocalDateTime +import com.valentinilk.shimmer.shimmer +import com.zionhuang.innertube.models.AlbumItem +import com.zionhuang.innertube.models.ArtistItem +import com.zionhuang.innertube.models.PlaylistItem +import com.zionhuang.innertube.models.SongItem +import com.zionhuang.innertube.models.WatchEndpoint @OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class) @Composable diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistSongsScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistSongsScreen.kt index 557b44d39..b279707ae 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistSongsScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/artist/ArtistSongsScreen.kt @@ -33,7 +33,6 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.pluralStringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/library/LibrarySongsFolderScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/library/LibrarySongsFolderScreen.kt index 96ded206a..149c2bdb3 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/library/LibrarySongsFolderScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/library/LibrarySongsFolderScreen.kt @@ -6,15 +6,20 @@ import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.asPaddingValues +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.rounded.Close -import androidx.compose.material.icons.rounded.Deselect import androidx.compose.material.icons.rounded.MoreVert -import androidx.compose.material.icons.rounded.SelectAll import androidx.compose.material.icons.rounded.Shuffle import androidx.compose.material3.DividerDefaults import androidx.compose.material3.HorizontalDivider @@ -41,7 +46,13 @@ import androidx.navigation.NavController import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.LocalPlayerConnection import com.dd3boh.outertune.R -import com.dd3boh.outertune.constants.* +import com.dd3boh.outertune.constants.CONTENT_TYPE_FOLDER +import com.dd3boh.outertune.constants.CONTENT_TYPE_HEADER +import com.dd3boh.outertune.constants.CONTENT_TYPE_SONG +import com.dd3boh.outertune.constants.FlatSubfoldersKey +import com.dd3boh.outertune.constants.SongSortDescendingKey +import com.dd3boh.outertune.constants.SongSortType +import com.dd3boh.outertune.constants.SongSortTypeKey import com.dd3boh.outertune.db.entities.Song import com.dd3boh.outertune.extensions.toMediaItem import com.dd3boh.outertune.extensions.togglePlayPause @@ -54,13 +65,12 @@ import com.dd3boh.outertune.ui.component.SongFolderItem import com.dd3boh.outertune.ui.component.SongListItem import com.dd3boh.outertune.ui.component.SortHeader import com.dd3boh.outertune.ui.component.SwipeToQueueBox -import com.dd3boh.outertune.ui.menu.SelectionSongMenu import com.dd3boh.outertune.ui.menu.SongMenu +import com.dd3boh.outertune.ui.utils.ItemWrapper import com.dd3boh.outertune.ui.utils.getDirectoryTree import com.dd3boh.outertune.utils.rememberEnumPreference import com.dd3boh.outertune.utils.rememberPreference import com.dd3boh.outertune.viewmodels.LibrarySongsViewModel -import com.dd3boh.outertune.ui.utils.ItemWrapper import java.time.ZoneOffset import java.util.Stack diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/AutoPlaylistScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/AutoPlaylistScreen.kt index e283bdfb8..ab5b69b2d 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/AutoPlaylistScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/AutoPlaylistScreen.kt @@ -21,14 +21,11 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowBack import androidx.compose.material.icons.automirrored.rounded.QueueMusic -import androidx.compose.material.icons.rounded.Close -import androidx.compose.material.icons.rounded.Deselect import androidx.compose.material.icons.rounded.Download import androidx.compose.material.icons.rounded.MoreVert import androidx.compose.material.icons.rounded.MusicNote import androidx.compose.material.icons.rounded.OfflinePin import androidx.compose.material.icons.rounded.PlayArrow -import androidx.compose.material.icons.rounded.SelectAll import androidx.compose.material.icons.rounded.Shuffle import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -99,13 +96,12 @@ import com.dd3boh.outertune.ui.component.SelectHeader import com.dd3boh.outertune.ui.component.SongListItem import com.dd3boh.outertune.ui.component.SortHeader import com.dd3boh.outertune.ui.component.SwipeToQueueBox -import com.dd3boh.outertune.ui.menu.SelectionSongMenu import com.dd3boh.outertune.ui.menu.SongMenu +import com.dd3boh.outertune.ui.utils.ItemWrapper import com.dd3boh.outertune.utils.makeTimeString import com.dd3boh.outertune.utils.rememberEnumPreference import com.dd3boh.outertune.utils.rememberPreference import com.dd3boh.outertune.viewmodels.AutoPlaylistViewModel -import com.dd3boh.outertune.ui.utils.ItemWrapper import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/LocalPlaylistScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/LocalPlaylistScreen.kt index 09904a8d4..21ab90f85 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/LocalPlaylistScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/LocalPlaylistScreen.kt @@ -20,9 +20,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowBack import androidx.compose.material.icons.automirrored.rounded.QueueMusic -import androidx.compose.material.icons.rounded.Close import androidx.compose.material.icons.rounded.Delete -import androidx.compose.material.icons.rounded.Deselect import androidx.compose.material.icons.rounded.Download import androidx.compose.material.icons.rounded.DragHandle import androidx.compose.material.icons.rounded.Edit @@ -32,7 +30,6 @@ import androidx.compose.material.icons.rounded.MoreVert import androidx.compose.material.icons.rounded.MusicNote import androidx.compose.material.icons.rounded.OfflinePin import androidx.compose.material.icons.rounded.PlayArrow -import androidx.compose.material.icons.rounded.SelectAll import androidx.compose.material.icons.rounded.Shuffle import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -83,7 +80,6 @@ import androidx.media3.exoplayer.offline.DownloadRequest import androidx.media3.exoplayer.offline.DownloadService import androidx.navigation.NavController import coil.compose.AsyncImage -import com.zionhuang.innertube.YouTube import com.dd3boh.outertune.LocalDatabase import com.dd3boh.outertune.LocalDownloadUtil import com.dd3boh.outertune.LocalPlayerAwareWindowInsets @@ -117,14 +113,14 @@ import com.dd3boh.outertune.ui.component.SwipeToQueueBox import com.dd3boh.outertune.ui.component.TextFieldDialog import com.dd3boh.outertune.ui.menu.PlaylistMenu import com.dd3boh.outertune.ui.menu.SongMenu +import com.dd3boh.outertune.ui.utils.ItemWrapper import com.dd3boh.outertune.ui.utils.backToMain +import com.dd3boh.outertune.ui.utils.getLocalThumbnail import com.dd3boh.outertune.utils.makeTimeString import com.dd3boh.outertune.utils.rememberEnumPreference import com.dd3boh.outertune.utils.rememberPreference import com.dd3boh.outertune.viewmodels.LocalPlaylistViewModel -import com.dd3boh.outertune.ui.menu.SelectionSongMenu -import com.dd3boh.outertune.ui.utils.ItemWrapper -import com.dd3boh.outertune.ui.utils.getLocalThumbnail +import com.zionhuang.innertube.YouTube import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/OnlinePlaylistScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/OnlinePlaylistScreen.kt index 08cbbe329..d4371f5c3 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/OnlinePlaylistScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/playlist/OnlinePlaylistScreen.kt @@ -2,7 +2,6 @@ package com.dd3boh.outertune.ui.screens.playlist import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background -import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -73,8 +72,6 @@ import androidx.media3.exoplayer.offline.DownloadRequest import androidx.media3.exoplayer.offline.DownloadService import androidx.navigation.NavController import coil.compose.AsyncImage -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.models.WatchEndpoint import com.dd3boh.outertune.LocalDatabase import com.dd3boh.outertune.LocalDownloadUtil import com.dd3boh.outertune.LocalPlayerAwareWindowInsets @@ -85,7 +82,6 @@ import com.dd3boh.outertune.constants.AlbumThumbnailSize import com.dd3boh.outertune.constants.CONTENT_TYPE_HEADER import com.dd3boh.outertune.constants.ThumbnailCornerRadius import com.dd3boh.outertune.db.entities.PlaylistEntity -import com.dd3boh.outertune.db.entities.PlaylistSong import com.dd3boh.outertune.db.entities.PlaylistSongMap import com.dd3boh.outertune.extensions.toMediaItem import com.dd3boh.outertune.extensions.togglePlayPause @@ -109,6 +105,8 @@ import com.dd3boh.outertune.ui.menu.YouTubeSongMenu import com.dd3boh.outertune.ui.utils.ItemWrapper import com.dd3boh.outertune.ui.utils.backToMain import com.dd3boh.outertune.viewmodels.OnlinePlaylistViewModel +import com.zionhuang.innertube.models.SongItem +import com.zionhuang.innertube.models.WatchEndpoint import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/search/LocalSearchScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/search/LocalSearchScreen.kt index 446b84aab..1a9d25dee 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/search/LocalSearchScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/search/LocalSearchScreen.kt @@ -17,7 +17,6 @@ import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.NavigateNext import androidx.compose.material.icons.rounded.MoreVert -import androidx.compose.material.icons.rounded.NavigateNext import androidx.compose.material.icons.rounded.Search import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -32,11 +31,9 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalSoftwareKeyboardController -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchResult.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchResult.kt index 98a21341c..e6627ed85 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchResult.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchResult.kt @@ -1,7 +1,6 @@ package com.dd3boh.outertune.ui.screens.search import androidx.compose.foundation.ExperimentalFoundationApi -import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.WindowInsets @@ -34,22 +33,9 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController -import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_ALBUM -import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_ARTIST -import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_COMMUNITY_PLAYLIST -import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_FEATURED_PLAYLIST -import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_SONG -import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_VIDEO -import com.zionhuang.innertube.models.AlbumItem -import com.zionhuang.innertube.models.ArtistItem -import com.zionhuang.innertube.models.PlaylistItem -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.models.WatchEndpoint -import com.zionhuang.innertube.models.YTItem import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.LocalPlayerConnection import com.dd3boh.outertune.R @@ -73,6 +59,18 @@ import com.dd3boh.outertune.ui.menu.YouTubeArtistMenu import com.dd3boh.outertune.ui.menu.YouTubePlaylistMenu import com.dd3boh.outertune.ui.menu.YouTubeSongMenu import com.dd3boh.outertune.viewmodels.OnlineSearchViewModel +import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_ALBUM +import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_ARTIST +import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_COMMUNITY_PLAYLIST +import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_FEATURED_PLAYLIST +import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_SONG +import com.zionhuang.innertube.YouTube.SearchFilter.Companion.FILTER_VIDEO +import com.zionhuang.innertube.models.AlbumItem +import com.zionhuang.innertube.models.ArtistItem +import com.zionhuang.innertube.models.PlaylistItem +import com.zionhuang.innertube.models.SongItem +import com.zionhuang.innertube.models.WatchEndpoint +import com.zionhuang.innertube.models.YTItem import kotlinx.coroutines.launch @OptIn(ExperimentalFoundationApi::class) diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchScreen.kt index 57f886afd..29cc0a07e 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/search/OnlineSearchScreen.kt @@ -17,7 +17,6 @@ import androidx.compose.material.icons.rounded.ArrowOutward import androidx.compose.material.icons.rounded.Close import androidx.compose.material.icons.rounded.History import androidx.compose.material.icons.rounded.Search -import androidx.compose.material3.Divider import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -31,26 +30,18 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.platform.LocalSoftwareKeyboardController -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.TextRange import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController -import com.zionhuang.innertube.models.AlbumItem -import com.zionhuang.innertube.models.ArtistItem -import com.zionhuang.innertube.models.PlaylistItem -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.models.WatchEndpoint import com.dd3boh.outertune.LocalDatabase import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.LocalPlayerConnection -import com.dd3boh.outertune.R import com.dd3boh.outertune.constants.SuggestionItemHeight import com.dd3boh.outertune.extensions.toMediaItem import com.dd3boh.outertune.extensions.togglePlayPause @@ -61,6 +52,11 @@ import com.dd3boh.outertune.ui.component.SearchBarIconOffsetX import com.dd3boh.outertune.ui.component.SwipeToQueueBox import com.dd3boh.outertune.ui.component.YouTubeListItem import com.dd3boh.outertune.viewmodels.OnlineSearchSuggestionViewModel +import com.zionhuang.innertube.models.AlbumItem +import com.zionhuang.innertube.models.ArtistItem +import com.zionhuang.innertube.models.PlaylistItem +import com.zionhuang.innertube.models.SongItem +import com.zionhuang.innertube.models.WatchEndpoint import kotlinx.coroutines.flow.drop @OptIn(ExperimentalFoundationApi::class) diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/AppearanceSettings.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/AppearanceSettings.kt index 55b37ad95..be438f5dd 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/AppearanceSettings.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/AppearanceSettings.kt @@ -10,7 +10,6 @@ import androidx.compose.material.icons.automirrored.rounded.ArrowBack import androidx.compose.material.icons.rounded.BlurOn import androidx.compose.material.icons.rounded.Contrast import androidx.compose.material.icons.rounded.DarkMode -import androidx.compose.material.icons.rounded.Lyrics import androidx.compose.material.icons.rounded.Palette import androidx.compose.material.icons.rounded.Tab import androidx.compose.material3.ExperimentalMaterial3Api @@ -28,7 +27,6 @@ import com.dd3boh.outertune.constants.DarkModeKey import com.dd3boh.outertune.constants.DefaultOpenTabKey import com.dd3boh.outertune.constants.DefaultOpenTabNewKey import com.dd3boh.outertune.constants.DynamicThemeKey -import com.dd3boh.outertune.constants.LyricsTextPositionKey import com.dd3boh.outertune.constants.NewInterfaceKey import com.dd3boh.outertune.constants.PlayerBackgroundStyleKey import com.dd3boh.outertune.constants.PureBlackKey diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/ContentSettings.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/ContentSettings.kt index 995ab0413..aaa41ce62 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/ContentSettings.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/ContentSettings.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowBack -import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material.icons.rounded.Language import androidx.compose.material.icons.rounded.LocationOn import androidx.compose.material.icons.rounded.Lyrics @@ -20,10 +19,8 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.navigation.NavController -import com.zionhuang.innertube.utils.parseCookieString import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.R import com.dd3boh.outertune.constants.AccountChannelHandleKey @@ -48,6 +45,7 @@ import com.dd3boh.outertune.ui.component.SwitchPreference import com.dd3boh.outertune.ui.utils.backToMain import com.dd3boh.outertune.utils.rememberEnumPreference import com.dd3boh.outertune.utils.rememberPreference +import com.zionhuang.innertube.utils.parseCookieString import java.net.Proxy @OptIn(ExperimentalMaterial3Api::class) diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/LyricsSettings.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/LyricsSettings.kt index 1d36dbae6..8ef683f75 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/LyricsSettings.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/LyricsSettings.kt @@ -9,8 +9,6 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowBack import androidx.compose.material.icons.automirrored.rounded.Sort import androidx.compose.material.icons.rounded.ContentCut -import androidx.compose.material.icons.rounded.DeveloperMode -import androidx.compose.material.icons.rounded.FolderCopy import androidx.compose.material.icons.rounded.Lyrics import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon @@ -18,24 +16,18 @@ import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable - import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.navigation.NavController import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.R -import com.dd3boh.outertune.constants.DevSettingsKey import com.dd3boh.outertune.constants.EnableKugouKey -import com.dd3boh.outertune.constants.FlatSubfoldersKey import com.dd3boh.outertune.constants.LyricTrimKey import com.dd3boh.outertune.constants.LyricsTextPositionKey import com.dd3boh.outertune.constants.MultilineLrcKey -import com.dd3boh.outertune.db.MusicDatabase import com.dd3boh.outertune.ui.component.EnumListPreference import com.dd3boh.outertune.ui.component.IconButton -import com.dd3boh.outertune.ui.component.PreferenceGroupTitle import com.dd3boh.outertune.ui.component.SwitchPreference - import com.dd3boh.outertune.ui.utils.backToMain import com.dd3boh.outertune.utils.rememberEnumPreference import com.dd3boh.outertune.utils.rememberPreference diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/PlayerSettings.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/PlayerSettings.kt index eb0941a24..ca4a6bde4 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/PlayerSettings.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/PlayerSettings.kt @@ -8,14 +8,9 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.ArrowBack import androidx.compose.material.icons.automirrored.rounded.QueueMusic import androidx.compose.material.icons.automirrored.rounded.VolumeUp -import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material.icons.rounded.GraphicEq import androidx.compose.material.icons.rounded.Lyrics -import androidx.compose.material.icons.rounded.PlayArrow import androidx.compose.material.icons.rounded.PlaylistRemove -import androidx.compose.material.icons.rounded.QueueMusic -import androidx.compose.material.icons.rounded.SdCard -import androidx.compose.material.icons.rounded.VolumeUp import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.Text diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/PrivacySettings.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/PrivacySettings.kt index 968dd46fb..be4704ff2 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/PrivacySettings.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/PrivacySettings.kt @@ -10,8 +10,6 @@ import androidx.compose.material.icons.automirrored.rounded.ArrowBack import androidx.compose.material.icons.automirrored.rounded.ManageSearch import androidx.compose.material.icons.rounded.ClearAll import androidx.compose.material.icons.rounded.History -import androidx.compose.material.icons.rounded.Lyrics -import androidx.compose.material.icons.rounded.ManageSearch import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme @@ -25,14 +23,12 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.navigation.NavController import com.dd3boh.outertune.LocalDatabase import com.dd3boh.outertune.LocalPlayerAwareWindowInsets import com.dd3boh.outertune.R -import com.dd3boh.outertune.constants.EnableKugouKey import com.dd3boh.outertune.constants.PauseListenHistoryKey import com.dd3boh.outertune.constants.PauseSearchHistoryKey import com.dd3boh.outertune.ui.component.DefaultDialog diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/SettingsScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/SettingsScreen.kt index 536ea1faf..661f0fc7f 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/SettingsScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/settings/SettingsScreen.kt @@ -22,8 +22,6 @@ import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalUriHandler -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.navigation.NavController import com.dd3boh.outertune.LocalPlayerAwareWindowInsets diff --git a/app/src/main/java/com/dd3boh/outertune/ui/utils/AppBar.kt b/app/src/main/java/com/dd3boh/outertune/ui/utils/AppBar.kt index ec0dcd881..084a84e5d 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/utils/AppBar.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/utils/AppBar.kt @@ -1,14 +1,18 @@ package com.dd3boh.outertune.ui.utils -import androidx.compose.animation.* -import androidx.compose.animation.core.* -import androidx.compose.foundation.layout.* -import androidx.compose.material3.* -import androidx.compose.runtime.* +import androidx.compose.animation.core.AnimationSpec +import androidx.compose.animation.core.DecayAnimationSpec +import androidx.compose.animation.core.Spring +import androidx.compose.animation.core.animate +import androidx.compose.animation.core.spring +import androidx.compose.animation.rememberSplineBasedDecay +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.TopAppBarScrollBehavior +import androidx.compose.material3.TopAppBarState +import androidx.compose.runtime.Composable import androidx.compose.ui.geometry.Offset import androidx.compose.ui.input.nestedscroll.NestedScrollConnection import androidx.compose.ui.input.nestedscroll.NestedScrollSource -import com.dd3boh.outertune.constants.* @OptIn(ExperimentalMaterial3Api::class) @Composable diff --git a/app/src/main/java/com/dd3boh/outertune/utils/SyncUtils.kt b/app/src/main/java/com/dd3boh/outertune/utils/SyncUtils.kt index 9e17bb44a..e621ae5d6 100644 --- a/app/src/main/java/com/dd3boh/outertune/utils/SyncUtils.kt +++ b/app/src/main/java/com/dd3boh/outertune/utils/SyncUtils.kt @@ -4,7 +4,6 @@ import com.dd3boh.outertune.db.MusicDatabase import com.dd3boh.outertune.db.entities.ArtistEntity import com.dd3boh.outertune.db.entities.PlaylistEntity import com.dd3boh.outertune.db.entities.PlaylistSongMap -import com.dd3boh.outertune.db.entities.Song import com.dd3boh.outertune.db.entities.SongEntity import com.dd3boh.outertune.models.toMediaMetadata import com.zionhuang.innertube.YouTube diff --git a/app/src/main/java/com/dd3boh/outertune/viewmodels/HomeViewModel.kt b/app/src/main/java/com/dd3boh/outertune/viewmodels/HomeViewModel.kt index 88e36eed2..14baf37a4 100644 --- a/app/src/main/java/com/dd3boh/outertune/viewmodels/HomeViewModel.kt +++ b/app/src/main/java/com/dd3boh/outertune/viewmodels/HomeViewModel.kt @@ -3,22 +3,18 @@ package com.dd3boh.outertune.viewmodels import android.content.Context import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.dd3boh.outertune.constants.PlaylistSongSortDescendingKey -import com.dd3boh.outertune.constants.PlaylistSongSortType -import com.dd3boh.outertune.constants.PlaylistSongSortTypeKey import com.dd3boh.outertune.constants.YtmSyncKey -import com.zionhuang.innertube.YouTube -import com.zionhuang.innertube.pages.ExplorePage import com.dd3boh.outertune.db.MusicDatabase import com.dd3boh.outertune.db.entities.Artist import com.dd3boh.outertune.db.entities.Playlist import com.dd3boh.outertune.db.entities.Song -import com.dd3boh.outertune.extensions.toEnum import com.dd3boh.outertune.utils.SyncUtils import com.dd3boh.outertune.utils.dataStore import com.dd3boh.outertune.utils.reportException +import com.zionhuang.innertube.YouTube import com.zionhuang.innertube.models.PlaylistItem import com.zionhuang.innertube.models.YTItem +import com.zionhuang.innertube.pages.ExplorePage import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.Dispatchers diff --git a/app/src/main/java/com/dd3boh/outertune/viewmodels/OnlinePlaylistViewModel.kt b/app/src/main/java/com/dd3boh/outertune/viewmodels/OnlinePlaylistViewModel.kt index 86b2c99dc..43755230c 100644 --- a/app/src/main/java/com/dd3boh/outertune/viewmodels/OnlinePlaylistViewModel.kt +++ b/app/src/main/java/com/dd3boh/outertune/viewmodels/OnlinePlaylistViewModel.kt @@ -4,13 +4,11 @@ import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.dd3boh.outertune.db.MusicDatabase -import com.dd3boh.outertune.db.entities.Playlist -import com.dd3boh.outertune.db.entities.PlaylistEntity +import com.dd3boh.outertune.utils.reportException import com.zionhuang.innertube.YouTube import com.zionhuang.innertube.models.PlaylistItem import com.zionhuang.innertube.models.SongItem import com.zionhuang.innertube.utils.completed -import com.dd3boh.outertune.utils.reportException import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow diff --git a/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt b/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt index bce7d4771..6dbb4fcd0 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt @@ -54,7 +54,6 @@ import com.zionhuang.innertube.pages.SearchSummary import com.zionhuang.innertube.pages.SearchSummaryPage import io.ktor.client.call.body import io.ktor.client.statement.bodyAsText -import kotlinx.coroutines.delay import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonPrimitive import kotlinx.serialization.json.jsonArray diff --git a/innertube/src/main/java/com/zionhuang/innertube/models/Endpoint.kt b/innertube/src/main/java/com/zionhuang/innertube/models/Endpoint.kt index 1d64fa151..9bd5a330d 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/models/Endpoint.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/models/Endpoint.kt @@ -3,7 +3,6 @@ package com.zionhuang.innertube.models import com.zionhuang.innertube.models.BrowseEndpoint.BrowseEndpointContextSupportedConfigs.BrowseEndpointContextMusicConfig.Companion.MUSIC_PAGE_TYPE_ALBUM import com.zionhuang.innertube.models.BrowseEndpoint.BrowseEndpointContextSupportedConfigs.BrowseEndpointContextMusicConfig.Companion.MUSIC_PAGE_TYPE_ARTIST import com.zionhuang.innertube.models.BrowseEndpoint.BrowseEndpointContextSupportedConfigs.BrowseEndpointContextMusicConfig.Companion.MUSIC_PAGE_TYPE_PLAYLIST -import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable @Serializable diff --git a/innertube/src/main/java/com/zionhuang/innertube/models/MusicEditablePlaylistDetailHeaderRenderer.kt b/innertube/src/main/java/com/zionhuang/innertube/models/MusicEditablePlaylistDetailHeaderRenderer.kt index fc17faa01..0cac05ad1 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/models/MusicEditablePlaylistDetailHeaderRenderer.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/models/MusicEditablePlaylistDetailHeaderRenderer.kt @@ -1,6 +1,5 @@ import com.zionhuang.innertube.models.Menu import com.zionhuang.innertube.models.MusicResponsiveHeaderRenderer -import com.zionhuang.innertube.models.Run import com.zionhuang.innertube.models.Runs import com.zionhuang.innertube.models.ThumbnailRenderer import kotlinx.serialization.Serializable diff --git a/innertube/src/main/java/com/zionhuang/innertube/models/SectionListRenderer.kt b/innertube/src/main/java/com/zionhuang/innertube/models/SectionListRenderer.kt index ac4a61d40..f0bb8aaaa 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/models/SectionListRenderer.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/models/SectionListRenderer.kt @@ -1,7 +1,6 @@ package com.zionhuang.innertube.models import MusicEditablePlaylistDetailHeaderRenderer -import com.zionhuang.innertube.models.response.BrowseResponse import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonNames diff --git a/innertube/src/main/java/com/zionhuang/innertube/models/body/EditPlaylistBody.kt b/innertube/src/main/java/com/zionhuang/innertube/models/body/EditPlaylistBody.kt index 214ce10bb..bd35a8cf3 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/models/body/EditPlaylistBody.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/models/body/EditPlaylistBody.kt @@ -1,7 +1,6 @@ package com.zionhuang.innertube.models.body import com.zionhuang.innertube.models.Context -import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable diff --git a/innertube/src/main/java/com/zionhuang/innertube/models/response/BrowseResponse.kt b/innertube/src/main/java/com/zionhuang/innertube/models/response/BrowseResponse.kt index 699f51bfe..3e9fb5cda 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/models/response/BrowseResponse.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/models/response/BrowseResponse.kt @@ -6,7 +6,6 @@ import com.zionhuang.innertube.models.Button import com.zionhuang.innertube.models.Continuation import com.zionhuang.innertube.models.GridRenderer import com.zionhuang.innertube.models.Menu -import com.zionhuang.innertube.models.MusicResponsiveListItemRenderer import com.zionhuang.innertube.models.MusicShelfRenderer import com.zionhuang.innertube.models.ResponseContext import com.zionhuang.innertube.models.Runs @@ -15,7 +14,6 @@ import com.zionhuang.innertube.models.SubscriptionButton import com.zionhuang.innertube.models.Tabs import com.zionhuang.innertube.models.ThumbnailRenderer import com.zionhuang.innertube.models.TwoColumnBrowseResultsRenderer -import com.zionhuang.innertube.pages.LibraryContinuationPage import kotlinx.serialization.Serializable @Serializable diff --git a/innertube/src/main/java/com/zionhuang/innertube/utils/Utils.kt b/innertube/src/main/java/com/zionhuang/innertube/utils/Utils.kt index 8f6d5b593..20e7de824 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/utils/Utils.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/utils/Utils.kt @@ -1,11 +1,6 @@ package com.zionhuang.innertube.utils import com.zionhuang.innertube.YouTube -import com.zionhuang.innertube.models.AlbumItem -import com.zionhuang.innertube.models.ArtistItem -import com.zionhuang.innertube.models.PlaylistItem -import com.zionhuang.innertube.models.SongItem -import com.zionhuang.innertube.pages.LibraryContinuationPage import com.zionhuang.innertube.pages.LibraryPage import com.zionhuang.innertube.pages.PlaylistPage import java.security.MessageDigest From 801ea5f60302855e2b22eed9bcbf54c17667f089 Mon Sep 17 00:00:00 2001 From: mikooomich Date: Sat, 29 Jun 2024 21:46:16 -0400 Subject: [PATCH 4/6] app: Use typed mutableStateOf --- .../java/com/dd3boh/outertune/playback/SleepTimer.kt | 3 ++- .../com/dd3boh/outertune/ui/component/BigSeekBar.kt | 2 +- .../com/dd3boh/outertune/ui/component/BottomSheet.kt | 4 ++-- .../com/dd3boh/outertune/ui/component/ChipsRow.kt | 1 - .../com/dd3boh/outertune/ui/component/SearchBar.kt | 1 - .../java/com/dd3boh/outertune/ui/menu/AlbumMenu.kt | 3 ++- .../com/dd3boh/outertune/ui/menu/PlaylistMenu.kt | 3 ++- .../dd3boh/outertune/ui/menu/SelectionSongsMenu.kt | 3 ++- .../com/dd3boh/outertune/ui/menu/YouTubeAlbumMenu.kt | 3 ++- .../dd3boh/outertune/ui/menu/YouTubePlaylistMenu.kt | 3 ++- .../java/com/dd3boh/outertune/ui/player/Player.kt | 7 ++++--- .../com/dd3boh/outertune/ui/utils/ScrollUtils.kt | 12 ++++++------ .../com/dd3boh/outertune/utils/ComposeDebugUtils.kt | 4 ++-- .../MusicEditablePlaylistDetailHeaderRenderer.kt | 6 ++---- .../innertube/models/SectionListRenderer.kt | 1 - .../innertube/models/response/BrowseResponse.kt | 4 ++-- 16 files changed, 31 insertions(+), 29 deletions(-) diff --git a/app/src/main/java/com/dd3boh/outertune/playback/SleepTimer.kt b/app/src/main/java/com/dd3boh/outertune/playback/SleepTimer.kt index cb8e89d50..ec7c43681 100644 --- a/app/src/main/java/com/dd3boh/outertune/playback/SleepTimer.kt +++ b/app/src/main/java/com/dd3boh/outertune/playback/SleepTimer.kt @@ -1,6 +1,7 @@ package com.dd3boh.outertune.playback import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableLongStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.media3.common.MediaItem @@ -16,7 +17,7 @@ class SleepTimer( val player: Player, ) : Player.Listener { private var sleepTimerJob: Job? = null - var triggerTime by mutableStateOf(-1L) + var triggerTime by mutableLongStateOf(-1L) private set var pauseWhenSongEnd by mutableStateOf(false) private set diff --git a/app/src/main/java/com/dd3boh/outertune/ui/component/BigSeekBar.kt b/app/src/main/java/com/dd3boh/outertune/ui/component/BigSeekBar.kt index 8c48c344d..b9d9b52a2 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/component/BigSeekBar.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/component/BigSeekBar.kt @@ -23,7 +23,7 @@ fun BigSeekBar( color: Color = MaterialTheme.colorScheme.primary, ) { var width by remember { - mutableStateOf(0f) + mutableFloatStateOf(0f) } Canvas( diff --git a/app/src/main/java/com/dd3boh/outertune/ui/component/BottomSheet.kt b/app/src/main/java/com/dd3boh/outertune/ui/component/BottomSheet.kt index b4e0d64ee..49dc64bcc 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/component/BottomSheet.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/component/BottomSheet.kt @@ -26,7 +26,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable @@ -310,7 +310,7 @@ fun rememberBottomSheetState( val coroutineScope = rememberCoroutineScope() var previousAnchor by rememberSaveable { - mutableStateOf(initialAnchor) + mutableIntStateOf(initialAnchor) } val animatable = remember { Animatable(0.dp, Dp.VectorConverter) diff --git a/app/src/main/java/com/dd3boh/outertune/ui/component/ChipsRow.kt b/app/src/main/java/com/dd3boh/outertune/ui/component/ChipsRow.kt index c05b310d5..d704e0d34 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/component/ChipsRow.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/component/ChipsRow.kt @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items import androidx.compose.foundation.rememberScrollState -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FilterChip import androidx.compose.material3.FilterChipDefaults import androidx.compose.material3.MaterialTheme diff --git a/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt b/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt index f002dfdff..a487c6eb6 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/component/SearchBar.kt @@ -53,7 +53,6 @@ import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.focus.FocusRequester diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/AlbumMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/AlbumMenu.kt index 916e3fc89..4569cd677 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/AlbumMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/AlbumMenu.kt @@ -28,6 +28,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope @@ -96,7 +97,7 @@ fun AlbumMenu( } var downloadState by remember { - mutableStateOf(STATE_STOPPED) + mutableIntStateOf(STATE_STOPPED) } LaunchedEffect(songs) { diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/PlaylistMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/PlaylistMenu.kt index 0963b02b5..cbc77aa41 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/PlaylistMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/PlaylistMenu.kt @@ -27,6 +27,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable @@ -89,7 +90,7 @@ fun PlaylistMenu( } var downloadState by remember { - mutableStateOf(Download.STATE_STOPPED) + mutableIntStateOf(Download.STATE_STOPPED) } val editable: Boolean = playlist.playlist.isEditable diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/SelectionSongsMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/SelectionSongsMenu.kt index da9531008..9fb87b572 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/SelectionSongsMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/SelectionSongsMenu.kt @@ -14,6 +14,7 @@ import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable @@ -58,7 +59,7 @@ fun SelectionSongMenu( val playerConnection = LocalPlayerConnection.current ?: return var downloadState by remember { - mutableStateOf(Download.STATE_STOPPED) + mutableIntStateOf(Download.STATE_STOPPED) } LaunchedEffect(songSelection) { diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeAlbumMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeAlbumMenu.kt index 0ed9e9802..98c132f94 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeAlbumMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubeAlbumMenu.kt @@ -27,6 +27,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope @@ -93,7 +94,7 @@ fun YouTubeAlbumMenu( } var downloadState by remember { - mutableStateOf(Download.STATE_STOPPED) + mutableIntStateOf(Download.STATE_STOPPED) } LaunchedEffect(album) { diff --git a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubePlaylistMenu.kt b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubePlaylistMenu.kt index e9ab97746..4c76a97ec 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubePlaylistMenu.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/menu/YouTubePlaylistMenu.kt @@ -25,6 +25,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable @@ -117,7 +118,7 @@ fun YouTubePlaylistMenu( ) var downloadState by remember { - mutableStateOf(Download.STATE_STOPPED) + mutableIntStateOf(Download.STATE_STOPPED) } LaunchedEffect(songs) { diff --git a/app/src/main/java/com/dd3boh/outertune/ui/player/Player.kt b/app/src/main/java/com/dd3boh/outertune/ui/player/Player.kt index 70ca04263..15752672e 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/player/Player.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/player/Player.kt @@ -65,6 +65,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableLongStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable @@ -170,13 +171,13 @@ fun BottomSheetPlayer( MaterialTheme.colorScheme.onPrimary } - var showLyrics by rememberPreference(ShowLyricsKey, defaultValue = false) + val showLyrics by rememberPreference(ShowLyricsKey, defaultValue = false) var position by rememberSaveable(playbackState) { - mutableStateOf(playerConnection.player.currentPosition) + mutableLongStateOf(playerConnection.player.currentPosition) } var duration by rememberSaveable(playbackState) { - mutableStateOf(playerConnection.player.duration) + mutableLongStateOf(playerConnection.player.duration) } var sliderPosition by remember { mutableStateOf(null) diff --git a/app/src/main/java/com/dd3boh/outertune/ui/utils/ScrollUtils.kt b/app/src/main/java/com/dd3boh/outertune/ui/utils/ScrollUtils.kt index c6a798221..24328903f 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/utils/ScrollUtils.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/utils/ScrollUtils.kt @@ -6,14 +6,14 @@ import androidx.compose.foundation.lazy.grid.LazyGridState import androidx.compose.runtime.Composable import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @Composable fun LazyListState.isScrollingUp(): Boolean { - var previousIndex by remember(this) { mutableStateOf(firstVisibleItemIndex) } - var previousScrollOffset by remember(this) { mutableStateOf(firstVisibleItemScrollOffset) } + var previousIndex by remember(this) { mutableIntStateOf(firstVisibleItemIndex) } + var previousScrollOffset by remember(this) { mutableIntStateOf(firstVisibleItemScrollOffset) } return remember(this) { derivedStateOf { if (previousIndex != firstVisibleItemIndex) { @@ -30,8 +30,8 @@ fun LazyListState.isScrollingUp(): Boolean { @Composable fun LazyGridState.isScrollingUp(): Boolean { - var previousIndex by remember(this) { mutableStateOf(firstVisibleItemIndex) } - var previousScrollOffset by remember(this) { mutableStateOf(firstVisibleItemScrollOffset) } + var previousIndex by remember(this) { mutableIntStateOf(firstVisibleItemIndex) } + var previousScrollOffset by remember(this) { mutableIntStateOf(firstVisibleItemScrollOffset) } return remember(this) { derivedStateOf { if (previousIndex != firstVisibleItemIndex) { @@ -48,7 +48,7 @@ fun LazyGridState.isScrollingUp(): Boolean { @Composable fun ScrollState.isScrollingUp(): Boolean { - var previousScrollOffset by remember(this) { mutableStateOf(value) } + var previousScrollOffset by remember(this) { mutableIntStateOf(value) } return remember(this) { derivedStateOf { (previousScrollOffset >= value).also { diff --git a/app/src/main/java/com/dd3boh/outertune/utils/ComposeDebugUtils.kt b/app/src/main/java/com/dd3boh/outertune/utils/ComposeDebugUtils.kt index 723132983..57b6905b5 100644 --- a/app/src/main/java/com/dd3boh/outertune/utils/ComposeDebugUtils.kt +++ b/app/src/main/java/com/dd3boh/outertune/utils/ComposeDebugUtils.kt @@ -2,7 +2,7 @@ package com.dd3boh.outertune.utils import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.Stable -import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.mutableLongStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.composed @@ -37,7 +37,7 @@ private val recomposeModifier = totalCompositions[0]++ // The value of totalCompositions at the last timeout. - val totalCompositionsAtLastTimeout = remember { mutableStateOf(0L) } + val totalCompositionsAtLastTimeout = remember { mutableLongStateOf(0L) } // Start the timeout, and reset everytime there's a recomposition. (Using totalCompositions // as the key is really just to cause the timer to restart every composition). diff --git a/innertube/src/main/java/com/zionhuang/innertube/models/MusicEditablePlaylistDetailHeaderRenderer.kt b/innertube/src/main/java/com/zionhuang/innertube/models/MusicEditablePlaylistDetailHeaderRenderer.kt index 0cac05ad1..777e0d87e 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/models/MusicEditablePlaylistDetailHeaderRenderer.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/models/MusicEditablePlaylistDetailHeaderRenderer.kt @@ -1,7 +1,5 @@ -import com.zionhuang.innertube.models.Menu -import com.zionhuang.innertube.models.MusicResponsiveHeaderRenderer -import com.zionhuang.innertube.models.Runs -import com.zionhuang.innertube.models.ThumbnailRenderer +package com.zionhuang.innertube.models + import kotlinx.serialization.Serializable @Serializable diff --git a/innertube/src/main/java/com/zionhuang/innertube/models/SectionListRenderer.kt b/innertube/src/main/java/com/zionhuang/innertube/models/SectionListRenderer.kt index f0bb8aaaa..58d037509 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/models/SectionListRenderer.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/models/SectionListRenderer.kt @@ -1,6 +1,5 @@ package com.zionhuang.innertube.models -import MusicEditablePlaylistDetailHeaderRenderer import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonNames diff --git a/innertube/src/main/java/com/zionhuang/innertube/models/response/BrowseResponse.kt b/innertube/src/main/java/com/zionhuang/innertube/models/response/BrowseResponse.kt index 3e9fb5cda..9e23faca0 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/models/response/BrowseResponse.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/models/response/BrowseResponse.kt @@ -1,7 +1,7 @@ package com.zionhuang.innertube.models.response -import MusicDetailHeaderRenderer -import MusicEditablePlaylistDetailHeaderRenderer +import com.zionhuang.innertube.models.MusicDetailHeaderRenderer +import com.zionhuang.innertube.models.MusicEditablePlaylistDetailHeaderRenderer import com.zionhuang.innertube.models.Button import com.zionhuang.innertube.models.Continuation import com.zionhuang.innertube.models.GridRenderer From c449851e6a8a6a459afebc7a50c2d95dfe7e5094 Mon Sep 17 00:00:00 2001 From: mikooomich Date: Sat, 29 Jun 2024 22:05:47 -0400 Subject: [PATCH 5/6] gradle: Update dependencies to latest --- gradle/libs.versions.toml | 12 ++++++------ material-color-utilities/build.gradle.kts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6c1448d76..792930b87 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,8 @@ [versions] androidGradlePlugin = "8.3.2" kotlin = "2.0.0" -compose = "1.6.7" -lifecycle = "2.8.0" +compose = "1.6.8" +lifecycle = "2.8.2" material3 = "1.2.1" media3 = "1.3.1" room = "2.6.1" @@ -11,9 +11,9 @@ ktor = "2.3.11" ksp = "2.0.0-1.0.21" [libraries] -guava = { group = "com.google.guava", name = "guava", version = "33.2.0-android" } +guava = { group = "com.google.guava", name = "guava", version = "33.2.1-android" } coroutines-guava = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-guava", version = "1.8.1" } -concurrent-futures = { group = "androidx.concurrent", name = "concurrent-futures-ktx", version = "1.1.0" } +concurrent-futures = { group = "androidx.concurrent", name = "concurrent-futures-ktx", version = "1.2.0" } gradle = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } activity = { group = "androidx.activity", name = "activity-compose", version = "1.9.0" } @@ -22,13 +22,13 @@ hilt-navigation = { group = "androidx.hilt", name = "hilt-navigation-compose", v datastore = { group = "androidx.datastore", name = "datastore-preferences", version = "1.1.1" } compose-runtime = { group = "androidx.compose.runtime", name = "runtime", version.ref = "compose" } -compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version = "1.6.7" } +compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version = "1.6.8" } compose-ui = { group = "androidx.compose.ui", name = "ui", version.ref = "compose" } compose-ui-util = { group = "androidx.compose.ui", name = "ui-util", version.ref = "compose" } compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "compose" } compose-animation = { group = "androidx.compose.animation", name = "animation-graphics", version.ref = "compose" } compose-reorderable = { group = "org.burnoutcrew.composereorderable", name = "reorderable", version = "0.9.6" } -compose-icons-extended = { group = "androidx.compose.material", name = "material-icons-extended", version = "1.6.7" } +compose-icons-extended = { group = "androidx.compose.material", name = "material-icons-extended", version = "1.6.8" } viewmodel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle" } viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycle" } diff --git a/material-color-utilities/build.gradle.kts b/material-color-utilities/build.gradle.kts index 438159f13..1770f1c78 100644 --- a/material-color-utilities/build.gradle.kts +++ b/material-color-utilities/build.gradle.kts @@ -8,5 +8,5 @@ java { } dependencies { - compileOnly("com.google.errorprone:error_prone_core:2.27.1") + compileOnly("com.google.errorprone:error_prone_core:2.28.0") } \ No newline at end of file From 2f5bf6644a42e80c4ee33346e8bd8b0a9faef32c Mon Sep 17 00:00:00 2001 From: mikooomich Date: Sat, 29 Jun 2024 22:20:26 -0400 Subject: [PATCH 6/6] app: HomeScreen: Fix Building --- .../dd3boh/outertune/ui/screens/HomeScreen.kt | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt index 3b6d59143..768a5e2ef 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt @@ -1,21 +1,48 @@ package com.dd3boh.outertune.ui.screens -import androidx.compose.foundation.* +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.BoxWithConstraints +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides +import androidx.compose.foundation.layout.asPaddingValues +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.only +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.systemBars +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyHorizontalGrid import androidx.compose.foundation.lazy.grid.items import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.rounded.TrendingUp import androidx.compose.material.icons.rounded.Casino import androidx.compose.material.icons.rounded.History import androidx.compose.material.icons.rounded.MoreVert import androidx.compose.material.icons.rounded.Person -import androidx.compose.material3.* -import androidx.compose.runtime.* +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -45,6 +72,7 @@ import com.dd3boh.outertune.ui.utils.SnapLayoutInfoProvider import com.dd3boh.outertune.utils.rememberPreference import com.dd3boh.outertune.viewmodels.HomeViewModel import com.google.accompanist.swiperefresh.SwipeRefresh +import com.google.accompanist.swiperefresh.rememberSwipeRefreshState import com.zionhuang.innertube.models.AlbumItem import com.zionhuang.innertube.models.ArtistItem import com.zionhuang.innertube.models.PlaylistItem @@ -119,7 +147,7 @@ fun HomeScreen( NavigationTile( title = stringResource(R.string.stats), - icon = Icons.Rounded.TrendingUp, + icon = Icons.AutoMirrored.Rounded.TrendingUp, onClick = { navController.navigate("stats") }, modifier = Modifier.weight(1f) )