From 2d7784b53a66e60c12b588eba636a61b042dfe66 Mon Sep 17 00:00:00 2001 From: Lambada10 <62511588+Lambada10@users.noreply.github.com> Date: Fri, 1 Nov 2024 11:29:14 +0100 Subject: [PATCH 1/3] Fix no results when release date is null in apple --- .../songsync/domain/model/lyrics_providers/others/Apple.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/pl/lambada/songsync/domain/model/lyrics_providers/others/Apple.kt b/app/src/main/java/pl/lambada/songsync/domain/model/lyrics_providers/others/Apple.kt index 67fab85..22fcda3 100644 --- a/app/src/main/java/pl/lambada/songsync/domain/model/lyrics_providers/others/Apple.kt +++ b/app/src/main/java/pl/lambada/songsync/domain/model/lyrics_providers/others/Apple.kt @@ -9,7 +9,7 @@ data class AppleSearchResponse( val artistName: String, val albumName: String, val artwork: String, - val releaseDate: String, + val releaseDate: String?, val duration: Int, val isrc: String, val url: String, From 5269e12ee584a5e6a164c3829599cc63abc60eb7 Mon Sep 17 00:00:00 2001 From: Lambada10 <62511588+Lambada10@users.noreply.github.com> Date: Fri, 1 Nov 2024 11:37:32 +0100 Subject: [PATCH 2/3] Apple can try again now --- .../data/remote/lyrics_providers/LyricsProviderService.kt | 2 +- .../data/remote/lyrics_providers/others/AppleAPI.kt | 8 ++++++-- .../songsync/ui/screens/lyricsFetch/LyricsFetchScreen.kt | 1 - 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/pl/lambada/songsync/data/remote/lyrics_providers/LyricsProviderService.kt b/app/src/main/java/pl/lambada/songsync/data/remote/lyrics_providers/LyricsProviderService.kt index 87de702..53a129b 100644 --- a/app/src/main/java/pl/lambada/songsync/data/remote/lyrics_providers/LyricsProviderService.kt +++ b/app/src/main/java/pl/lambada/songsync/data/remote/lyrics_providers/LyricsProviderService.kt @@ -64,7 +64,7 @@ class LyricsProviderService { neteaseID = it?.neteaseID ?: 0 } ?: throw NoTrackFoundException() - Providers.APPLE -> AppleAPI().getSongInfo(query).also { + Providers.APPLE -> AppleAPI().getSongInfo(query, offset).also { appleID = it?.appleID ?: 0 } ?: throw NoTrackFoundException() diff --git a/app/src/main/java/pl/lambada/songsync/data/remote/lyrics_providers/others/AppleAPI.kt b/app/src/main/java/pl/lambada/songsync/data/remote/lyrics_providers/others/AppleAPI.kt index 3a796ea..ed6d3a3 100644 --- a/app/src/main/java/pl/lambada/songsync/data/remote/lyrics_providers/others/AppleAPI.kt +++ b/app/src/main/java/pl/lambada/songsync/data/remote/lyrics_providers/others/AppleAPI.kt @@ -16,7 +16,7 @@ import java.net.URLEncoder class AppleAPI { private val baseURL = "https://paxsenix.alwaysdata.net/" - suspend fun getSongInfo(query: SongInfo): SongInfo? { + suspend fun getSongInfo(query: SongInfo, offset: Int = 0): SongInfo? { val search = withContext(Dispatchers.IO) { URLEncoder.encode( "${query.songName} ${query.artistName}", @@ -41,7 +41,11 @@ class AppleAPI { return null } - val result = json[0] + val result = try { + json[offset] + } catch (e: IndexOutOfBoundsException) { + return null + } return SongInfo( songName = result.songName, diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/lyricsFetch/LyricsFetchScreen.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/lyricsFetch/LyricsFetchScreen.kt index 6881148..d22ea08 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/lyricsFetch/LyricsFetchScreen.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/lyricsFetch/LyricsFetchScreen.kt @@ -184,7 +184,6 @@ fun SharedTransitionScope.LyricsFetchScreen( animatedVisibilityScope = animatedVisibilityScope, disableMarquee = viewModel.userSettingsController.disableMarquee, allowTryingAgain = - viewModel.userSettingsController.selectedProvider != Providers.APPLE && viewModel.userSettingsController.selectedProvider != Providers.MUSIXMATCH ) From 7fb1a85a22550e8d677c169844dc492248151d76 Mon Sep 17 00:00:00 2001 From: Lambada10 <62511588+Lambada10@users.noreply.github.com> Date: Fri, 1 Nov 2024 11:56:33 +0100 Subject: [PATCH 3/3] Finally rename About -> Settings --- .../java/pl/lambada/songsync/ui/Navigator.kt | 12 +++---- .../{AboutItem.kt => SettingsItem.kt} | 2 +- .../songsync/ui/screens/home/HomeScreen.kt | 9 ++--- .../ui/screens/home/components/HomeAppBar.kt | 4 +-- .../home/components/HomeTopAppBarDropDown.kt | 6 ++-- .../SettingsScreen.kt} | 36 +++++++++---------- .../SettingsViewModel.kt} | 4 +-- .../components/AppInfoSection.kt | 6 ++-- .../components/ContributorsSection.kt | 6 ++-- .../components/CreditsSection.kt | 6 ++-- .../components/ExternalLinkSection.kt | 6 ++-- .../components/MarqueeSwitch.kt | 6 ++-- .../components/MultiPersonSwitch.kt | 6 ++-- .../components/PureBlackThemeSwitch.kt | 6 ++-- .../components/SdCardPathSetting.kt | 6 ++-- .../components/SettingsScreenTopBar.kt} | 6 ++-- .../components/ShowPathSwitch.kt | 6 ++-- .../components/SupportSection.kt | 6 ++-- .../components/SyncedLyricsSwitch.kt | 6 ++-- .../components/TranslationSwitch.kt | 6 ++-- .../components/UpdateAvailableDialog.kt | 2 +- .../{about => settings}/components/Utils.kt | 2 +- app/src/main/res/values/strings.xml | 1 + 23 files changed, 76 insertions(+), 80 deletions(-) rename app/src/main/java/pl/lambada/songsync/ui/components/{AboutItem.kt => SettingsItem.kt} (98%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about/AboutScreen.kt => settings/SettingsScreen.kt} (80%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about/AboutViewModel.kt => settings/SettingsViewModel.kt} (96%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/AppInfoSection.kt (89%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/ContributorsSection.kt (88%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/CreditsSection.kt (91%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/ExternalLinkSection.kt (87%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/MarqueeSwitch.kt (70%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/MultiPersonSwitch.kt (69%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/PureBlackThemeSwitch.kt (71%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/SdCardPathSetting.kt (95%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about/components/AboutScreenTopBar.kt => settings/components/SettingsScreenTopBar.kt} (85%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/ShowPathSwitch.kt (71%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/SupportSection.kt (90%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/SyncedLyricsSwitch.kt (70%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/TranslationSwitch.kt (70%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/UpdateAvailableDialog.kt (95%) rename app/src/main/java/pl/lambada/songsync/ui/screens/{about => settings}/components/Utils.kt (95%) diff --git a/app/src/main/java/pl/lambada/songsync/ui/Navigator.kt b/app/src/main/java/pl/lambada/songsync/ui/Navigator.kt index 8cc706a..6839247 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/Navigator.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/Navigator.kt @@ -11,8 +11,8 @@ import androidx.navigation.toRoute import kotlinx.serialization.Serializable import pl.lambada.songsync.data.remote.UserSettingsController import pl.lambada.songsync.data.remote.lyrics_providers.LyricsProviderService -import pl.lambada.songsync.ui.screens.about.AboutScreen -import pl.lambada.songsync.ui.screens.about.AboutViewModel +import pl.lambada.songsync.ui.screens.settings.SettingsScreen +import pl.lambada.songsync.ui.screens.settings.SettingsViewModel import pl.lambada.songsync.ui.screens.home.HomeScreen import pl.lambada.songsync.ui.screens.home.HomeViewModel import pl.lambada.songsync.ui.screens.lyricsFetch.LyricsFetchScreen @@ -61,9 +61,9 @@ fun Navigator( animatedVisibilityScope = this, ) } - composable { - AboutScreen( - viewModel = viewModel { AboutViewModel() }, + composable { + SettingsScreen( + viewModel = viewModel { SettingsViewModel() }, userSettingsController, navController = navController ) @@ -96,4 +96,4 @@ data class LocalSong( ) @Serializable -object ScreenAbout \ No newline at end of file +object ScreenSettings \ No newline at end of file diff --git a/app/src/main/java/pl/lambada/songsync/ui/components/AboutItem.kt b/app/src/main/java/pl/lambada/songsync/ui/components/SettingsItem.kt similarity index 98% rename from app/src/main/java/pl/lambada/songsync/ui/components/AboutItem.kt rename to app/src/main/java/pl/lambada/songsync/ui/components/SettingsItem.kt index 24b91ae..f0d77be 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/components/AboutItem.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/components/SettingsItem.kt @@ -10,7 +10,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp @Composable -fun AboutItem( +fun SettingsItem( label: String, modifier: Modifier = Modifier, content: @Composable () -> Unit, diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/home/HomeScreen.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/home/HomeScreen.kt index 9a08427..10a463b 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/home/HomeScreen.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/home/HomeScreen.kt @@ -15,17 +15,14 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Search -import androidx.compose.material3.Button import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon import androidx.compose.material3.Scaffold -import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.SideEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf @@ -39,10 +36,8 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel import androidx.navigation.NavHostController -import pl.lambada.songsync.domain.model.SortOrders -import pl.lambada.songsync.domain.model.SortValues import pl.lambada.songsync.ui.LyricsFetchScreen -import pl.lambada.songsync.ui.ScreenAbout +import pl.lambada.songsync.ui.ScreenSettings import pl.lambada.songsync.ui.screens.home.components.BatchDownloadLyrics import pl.lambada.songsync.ui.screens.home.components.FilterAndSongCount import pl.lambada.songsync.ui.screens.home.components.FiltersDialog @@ -98,7 +93,7 @@ fun HomeScreen( showing = showing, scrollBehavior = scrollBehavior, onSelectedClearAction = viewModel.selectedSongs::clear, - onNavigateToAboutSectionRequest = { navController.navigate(ScreenAbout) }, + onNavigateToSettingsSectionRequest = { navController.navigate(ScreenSettings) }, onProviderSelectRequest = viewModel.userSettingsController::updateSelectedProviders, onBatchDownloadRequest = { isBatchDownload = true }, selectedProvider = viewModel.userSettingsController.selectedProvider, diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/home/components/HomeAppBar.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/home/components/HomeAppBar.kt index 58b2075..c7a6333 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/home/components/HomeAppBar.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/home/components/HomeAppBar.kt @@ -35,7 +35,7 @@ fun HomeAppBar( scrollBehavior: TopAppBarScrollBehavior, selectedProvider: Providers, onSelectedClearAction: () -> Unit, - onNavigateToAboutSectionRequest: () -> Unit, + onNavigateToSettingsSectionRequest: () -> Unit, onProviderSelectRequest: (Providers) -> Unit, onBatchDownloadRequest: () -> Unit, onSelectAllSongsRequest: () -> Unit, @@ -120,7 +120,7 @@ fun HomeAppBar( } } else { HomeTopAppBarDropDown( - onNavigateToAboutSectionRequest = onNavigateToAboutSectionRequest, + onNavigateToSettingsSectionRequest = onNavigateToSettingsSectionRequest, selectedProvider = selectedProvider, onProviderSelectRequest = onProviderSelectRequest, onBatchDownloadRequest = onBatchDownloadRequest, diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/home/components/HomeTopAppBarDropDown.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/home/components/HomeTopAppBarDropDown.kt index cf29fb5..dd1274d 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/home/components/HomeTopAppBarDropDown.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/home/components/HomeTopAppBarDropDown.kt @@ -31,7 +31,7 @@ import pl.lambada.songsync.util.set @Composable fun HomeTopAppBarDropDown( - onNavigateToAboutSectionRequest: () -> Unit, + onNavigateToSettingsSectionRequest: () -> Unit, selectedProvider: Providers, onProviderSelectRequest: (Providers) -> Unit, embedLyrics: Boolean, @@ -98,12 +98,12 @@ fun HomeTopAppBarDropDown( DropdownMenuItem( text = { Text( - text = stringResource(id = R.string.about), + text = stringResource(id = R.string.settings), modifier = Modifier.padding(horizontal = 6.dp), ) }, onClick = { - onNavigateToAboutSectionRequest() + onNavigateToSettingsSectionRequest() expanded = false } ) diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/AboutScreen.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/SettingsScreen.kt similarity index 80% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/AboutScreen.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/SettingsScreen.kt index bb17264..40ad607 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/AboutScreen.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/SettingsScreen.kt @@ -1,6 +1,6 @@ @file:Suppress("SpellCheckingInspection") -package pl.lambada.songsync.ui.screens.about +package pl.lambada.songsync.ui.screens.settings import android.os.Build import androidx.compose.foundation.isSystemInDarkTheme @@ -19,20 +19,20 @@ import androidx.navigation.NavController import pl.lambada.songsync.R import pl.lambada.songsync.data.remote.UpdateState import pl.lambada.songsync.data.remote.UserSettingsController -import pl.lambada.songsync.ui.screens.about.components.AboutScreenTopBar -import pl.lambada.songsync.ui.screens.about.components.AppInfoSection -import pl.lambada.songsync.ui.screens.about.components.ContributorsSection -import pl.lambada.songsync.ui.screens.about.components.CreditsSection -import pl.lambada.songsync.ui.screens.about.components.ExternalLinkSection -import pl.lambada.songsync.ui.screens.about.components.MarqueeSwitch -import pl.lambada.songsync.ui.screens.about.components.MultiPersonSwitch -import pl.lambada.songsync.ui.screens.about.components.PureBlackThemeSwitch -import pl.lambada.songsync.ui.screens.about.components.SdCardPathSetting -import pl.lambada.songsync.ui.screens.about.components.ShowPathSwitch -import pl.lambada.songsync.ui.screens.about.components.SupportSection -import pl.lambada.songsync.ui.screens.about.components.SyncedLyricsSwitch -import pl.lambada.songsync.ui.screens.about.components.TranslationSwitch -import pl.lambada.songsync.ui.screens.about.components.UpdateAvailableDialog +import pl.lambada.songsync.ui.screens.settings.components.SettingsScreenTopBar +import pl.lambada.songsync.ui.screens.settings.components.AppInfoSection +import pl.lambada.songsync.ui.screens.settings.components.ContributorsSection +import pl.lambada.songsync.ui.screens.settings.components.CreditsSection +import pl.lambada.songsync.ui.screens.settings.components.ExternalLinkSection +import pl.lambada.songsync.ui.screens.settings.components.MarqueeSwitch +import pl.lambada.songsync.ui.screens.settings.components.MultiPersonSwitch +import pl.lambada.songsync.ui.screens.settings.components.PureBlackThemeSwitch +import pl.lambada.songsync.ui.screens.settings.components.SdCardPathSetting +import pl.lambada.songsync.ui.screens.settings.components.ShowPathSwitch +import pl.lambada.songsync.ui.screens.settings.components.SupportSection +import pl.lambada.songsync.ui.screens.settings.components.SyncedLyricsSwitch +import pl.lambada.songsync.ui.screens.settings.components.TranslationSwitch +import pl.lambada.songsync.ui.screens.settings.components.UpdateAvailableDialog import pl.lambada.songsync.util.ext.getVersion /** @@ -40,8 +40,8 @@ import pl.lambada.songsync.util.ext.getVersion */ @OptIn(ExperimentalMaterial3Api::class) @Composable -fun AboutScreen( - viewModel: AboutViewModel, +fun SettingsScreen( + viewModel: SettingsViewModel, userSettingsController: UserSettingsController, navController: NavController ) { @@ -53,7 +53,7 @@ fun AboutScreen( Scaffold( modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection), topBar = { - AboutScreenTopBar( + SettingsScreenTopBar( navController = navController, scrollBehavior = scrollBehavior ) diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/AboutViewModel.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/SettingsViewModel.kt similarity index 96% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/AboutViewModel.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/SettingsViewModel.kt index bee339b..a868645 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/AboutViewModel.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/SettingsViewModel.kt @@ -1,4 +1,4 @@ -package pl.lambada.songsync.ui.screens.about +package pl.lambada.songsync.ui.screens.settings import android.content.Context import androidx.compose.runtime.getValue @@ -17,7 +17,7 @@ import pl.lambada.songsync.util.showToast /** * ViewModel class for the main functionality of the app. */ -class AboutViewModel( +class SettingsViewModel( private val updateService: UpdateService = UpdateService() ) : ViewModel() { var updateState by mutableStateOf(UpdateState.Idle) diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/AppInfoSection.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/AppInfoSection.kt similarity index 89% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/AppInfoSection.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/AppInfoSection.kt index ab57ecf..1a7bd08 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/AppInfoSection.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/AppInfoSection.kt @@ -1,4 +1,4 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -10,11 +10,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem @Composable fun AppInfoSection(version: String, onCheckForUpdates: () -> Unit) { - AboutItem( + SettingsItem( label = stringResource(R.string.about_songsync), modifier = Modifier.padding(horizontal = 22.dp, vertical = 16.dp) ) { diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/ContributorsSection.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/ContributorsSection.kt similarity index 88% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/ContributorsSection.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/ContributorsSection.kt index a3f3d2e..0d5468b 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/ContributorsSection.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/ContributorsSection.kt @@ -1,4 +1,4 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column @@ -13,11 +13,11 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem @Composable fun ContributorsSection(uriHandler: UriHandler) { - AboutItem(stringResource(R.string.contributors)) { + SettingsItem(stringResource(R.string.contributors)) { Contributor.entries.forEach { val additionalInfo = stringResource(id = it.contributionLevel.stringResource) Column( diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/CreditsSection.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/CreditsSection.kt similarity index 91% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/CreditsSection.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/CreditsSection.kt index c43cfd3..18945a4 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/CreditsSection.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/CreditsSection.kt @@ -1,4 +1,4 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Row @@ -18,12 +18,12 @@ import androidx.compose.ui.platform.UriHandler import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem @Composable fun CreditsSection(uriHandler: UriHandler) { - AboutItem(label = stringResource(id = R.string.thanks_to)) { + SettingsItem(label = stringResource(id = R.string.thanks_to)) { val credits = mapOf( stringResource(R.string.spotify_api) to "https://developer.spotify.com/documentation/web-api", stringResource(R.string.spotifylyrics_api) to "https://github.com/akashrchandran/spotify-lyrics-api", diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/ExternalLinkSection.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/ExternalLinkSection.kt similarity index 87% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/ExternalLinkSection.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/ExternalLinkSection.kt index 119bb6f..cf2f564 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/ExternalLinkSection.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/ExternalLinkSection.kt @@ -1,4 +1,4 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.padding @@ -11,12 +11,12 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem @Composable fun ExternalLinkSection(label: String, description: String, url: String, uriHandler: UriHandler) { - AboutItem( + SettingsItem( label, modifier = Modifier .clickable { uriHandler.openUri(url) } diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/MarqueeSwitch.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/MarqueeSwitch.kt similarity index 70% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/MarqueeSwitch.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/MarqueeSwitch.kt index 4886542..3e46157 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/MarqueeSwitch.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/MarqueeSwitch.kt @@ -1,15 +1,15 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem import pl.lambada.songsync.ui.components.SwitchItem @Composable fun MarqueeSwitch(selected: Boolean, onToggle: (Boolean) -> Unit) { - AboutItem(label = stringResource(R.string.disable_marquee)) { + SettingsItem(label = stringResource(R.string.disable_marquee)) { SwitchItem( label = stringResource(R.string.disable_marquee_summary), selected = selected, diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/MultiPersonSwitch.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/MultiPersonSwitch.kt similarity index 69% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/MultiPersonSwitch.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/MultiPersonSwitch.kt index de08faf..75e1ecd 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/MultiPersonSwitch.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/MultiPersonSwitch.kt @@ -1,14 +1,14 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem import pl.lambada.songsync.ui.components.SwitchItem @Composable fun MultiPersonSwitch(selected: Boolean, onToggle: (Boolean) -> Unit) { - AboutItem(label = stringResource(id = R.string.multi_person_word_by_word)) { + SettingsItem(label = stringResource(id = R.string.multi_person_word_by_word)) { SwitchItem( label = stringResource(id = R.string.multi_person_word_by_word_summary), selected = selected, diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/PureBlackThemeSwitch.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/PureBlackThemeSwitch.kt similarity index 71% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/PureBlackThemeSwitch.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/PureBlackThemeSwitch.kt index 40a39c5..ffb053f 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/PureBlackThemeSwitch.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/PureBlackThemeSwitch.kt @@ -1,15 +1,15 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem import pl.lambada.songsync.ui.components.SwitchItem @Composable fun PureBlackThemeSwitch(selected: Boolean, onToggle: (Boolean) -> Unit) { - AboutItem(label = stringResource(R.string.theme)) { + SettingsItem(label = stringResource(R.string.theme)) { SwitchItem( label = stringResource(R.string.pure_black_theme), selected = selected, diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/SdCardPathSetting.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SdCardPathSetting.kt similarity index 95% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/SdCardPathSetting.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SdCardPathSetting.kt index 9d82881..d44b4ce 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/SdCardPathSetting.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SdCardPathSetting.kt @@ -1,4 +1,4 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import android.net.Uri import android.os.Environment @@ -24,13 +24,13 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem @Composable fun SdCardPathSetting(sdPath: String?, onClearPath: () -> Unit, onUpdatePath: (String) -> Unit) { var picker by remember { mutableStateOf(false) } - AboutItem( + SettingsItem( label = stringResource(R.string.sd_card), modifier = Modifier.padding(horizontal = 22.dp, vertical = 16.dp) ) { diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/AboutScreenTopBar.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SettingsScreenTopBar.kt similarity index 85% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/AboutScreenTopBar.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SettingsScreenTopBar.kt index ba7993b..97c6a17 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/AboutScreenTopBar.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SettingsScreenTopBar.kt @@ -1,4 +1,4 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons @@ -18,7 +18,7 @@ import pl.lambada.songsync.R @OptIn(ExperimentalMaterial3Api::class) @Composable -fun AboutScreenTopBar(navController: NavController, scrollBehavior: TopAppBarScrollBehavior) { +fun SettingsScreenTopBar(navController: NavController, scrollBehavior: TopAppBarScrollBehavior) { MediumTopAppBar( navigationIcon = { IconButton( @@ -35,7 +35,7 @@ fun AboutScreenTopBar(navController: NavController, scrollBehavior: TopAppBarScr title = { Text( modifier = Modifier.padding(start = 6.dp), - text = stringResource(id = R.string.about) + text = stringResource(id = R.string.settings) ) }, scrollBehavior = scrollBehavior diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/ShowPathSwitch.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/ShowPathSwitch.kt similarity index 71% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/ShowPathSwitch.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/ShowPathSwitch.kt index 3bcc143..9193712 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/ShowPathSwitch.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/ShowPathSwitch.kt @@ -1,14 +1,14 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem import pl.lambada.songsync.ui.components.SwitchItem @Composable fun ShowPathSwitch(selected: Boolean, onToggle: (Boolean) -> Unit) { - AboutItem(label = stringResource(R.string.song_path)) { + SettingsItem(label = stringResource(R.string.song_path)) { SwitchItem( label = stringResource(R.string.song_path_description), selected = selected, diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/SupportSection.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SupportSection.kt similarity index 90% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/SupportSection.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SupportSection.kt index dad70a7..0084406 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/SupportSection.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SupportSection.kt @@ -1,4 +1,4 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column @@ -12,12 +12,12 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem @Composable fun SupportSection(uriHandler: UriHandler) { - AboutItem( + SettingsItem( stringResource(R.string.support), ) { Column( diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/SyncedLyricsSwitch.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SyncedLyricsSwitch.kt similarity index 70% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/SyncedLyricsSwitch.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SyncedLyricsSwitch.kt index 3c0aa1d..b954657 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/SyncedLyricsSwitch.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/SyncedLyricsSwitch.kt @@ -1,14 +1,14 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem import pl.lambada.songsync.ui.components.SwitchItem @Composable fun SyncedLyricsSwitch(selected: Boolean, onToggle: (Boolean) -> Unit) { - AboutItem(label = stringResource(id = R.string.synced_lyrics)) { + SettingsItem(label = stringResource(id = R.string.synced_lyrics)) { SwitchItem( label = stringResource(id = R.string.synced_lyrics_summary), selected = selected, diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/TranslationSwitch.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/TranslationSwitch.kt similarity index 70% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/TranslationSwitch.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/TranslationSwitch.kt index 11d9391..6b76b1c 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/TranslationSwitch.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/TranslationSwitch.kt @@ -1,15 +1,15 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import pl.lambada.songsync.R -import pl.lambada.songsync.ui.components.AboutItem +import pl.lambada.songsync.ui.components.SettingsItem import pl.lambada.songsync.ui.components.SwitchItem @Composable fun TranslationSwitch(selected: Boolean, onToggle: (Boolean) -> Unit) { - AboutItem(label = stringResource(id = R.string.include_translation)) { + SettingsItem(label = stringResource(id = R.string.include_translation)) { SwitchItem( label = stringResource(id = R.string.include_translation_summary), selected = selected, diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/UpdateAvailableDialog.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/UpdateAvailableDialog.kt similarity index 95% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/UpdateAvailableDialog.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/UpdateAvailableDialog.kt index 0cee09d..69a607e 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/UpdateAvailableDialog.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/UpdateAvailableDialog.kt @@ -1,4 +1,4 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import androidx.compose.foundation.layout.Column import androidx.compose.foundation.rememberScrollState diff --git a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/Utils.kt b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/Utils.kt similarity index 95% rename from app/src/main/java/pl/lambada/songsync/ui/screens/about/components/Utils.kt rename to app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/Utils.kt index 5a7ac86..c1aa67f 100644 --- a/app/src/main/java/pl/lambada/songsync/ui/screens/about/components/Utils.kt +++ b/app/src/main/java/pl/lambada/songsync/ui/screens/settings/components/Utils.kt @@ -1,4 +1,4 @@ -package pl.lambada.songsync.ui.screens.about.components +package pl.lambada.songsync.ui.screens.settings.components import pl.lambada.songsync.R diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c32d78e..fc8ad93 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -138,4 +138,5 @@ Ascending Descending Sort + Settings