From dd71c76a8f0b760ec806e71be77998bbc2da61a3 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 18 Feb 2023 17:04:32 -0500 Subject: [PATCH] Move more components --- .../presentation/browse/ExtensionsScreen.kt | 2 +- .../browse/MigrateSourceScreen.kt | 2 +- .../presentation/browse/SourcesScreen.kt | 2 +- .../ChangeCategoryDialog.kt | 3 +-- .../kanade/presentation/components/AppBar.kt | 22 +++++++++---------- .../presentation/components/TabbedDialog.kt | 2 ++ .../presentation/components/TabbedScreen.kt | 2 ++ .../DeleteLibraryMangaDialog.kt | 2 +- .../library/components/LibraryContent.kt | 2 +- .../library/components/LibraryPager.kt | 4 ++-- .../library/components/LibraryToolbar.kt | 2 +- .../dialogs => manga}/DuplicateMangaDialog.kt | 2 +- .../manga/components/MangaToolbar.kt | 2 +- .../presentation/theme/TachiyomiTheme.kt | 1 - .../source/browse/BrowseSourceScreen.kt | 4 ++-- .../kanade/tachiyomi/ui/library/LibraryTab.kt | 4 ++-- .../kanade/tachiyomi/ui/manga/MangaScreen.kt | 4 ++-- .../presentation/core}/components/Pager.kt | 3 +-- .../presentation/core}/theme/Color.kt | 2 +- .../presentation/core}/theme/Typography.kt | 2 +- 20 files changed, 34 insertions(+), 35 deletions(-) rename app/src/main/java/eu/kanade/presentation/{components/dialogs => category}/ChangeCategoryDialog.kt (98%) rename app/src/main/java/eu/kanade/presentation/{components/dialogs => library}/DeleteLibraryMangaDialog.kt (98%) rename app/src/main/java/eu/kanade/presentation/{components/dialogs => manga}/DuplicateMangaDialog.kt (96%) rename {app/src/main/java/eu/kanade/presentation => presentation-core/src/main/java/tachiyomi/presentation/core}/components/Pager.kt (98%) rename {app/src/main/java/eu/kanade/presentation => presentation-core/src/main/java/tachiyomi/presentation/core}/theme/Color.kt (88%) rename {app/src/main/java/eu/kanade/presentation => presentation-core/src/main/java/tachiyomi/presentation/core}/theme/Typography.kt (90%) diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt index 3cdda8a20a..60bd96ca61 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt @@ -39,7 +39,6 @@ import eu.kanade.presentation.browse.components.BaseBrowseItem import eu.kanade.presentation.browse.components.ExtensionIcon import eu.kanade.presentation.components.EmptyScreen import eu.kanade.presentation.manga.components.DotSeparatorNoSpaceText -import eu.kanade.presentation.theme.header import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.InstallStep @@ -51,6 +50,7 @@ import tachiyomi.presentation.core.components.LoadingScreen import tachiyomi.presentation.core.components.material.PullRefresh import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.topSmallPaddingValues +import tachiyomi.presentation.core.theme.header import tachiyomi.presentation.core.util.plus import tachiyomi.presentation.core.util.secondaryItemAlpha diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt index 1d61030b49..d19a66470b 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt @@ -26,7 +26,6 @@ import eu.kanade.domain.source.interactor.SetMigrateSorting import eu.kanade.presentation.browse.components.BaseSourceItem import eu.kanade.presentation.browse.components.SourceIcon import eu.kanade.presentation.components.EmptyScreen -import eu.kanade.presentation.theme.header import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrateSourceState import eu.kanade.tachiyomi.util.system.copyToClipboard @@ -38,6 +37,7 @@ import tachiyomi.presentation.core.components.ScrollbarLazyColumn import tachiyomi.presentation.core.components.Scroller.STICKY_HEADER_KEY_PREFIX import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.topSmallPaddingValues +import tachiyomi.presentation.core.theme.header import tachiyomi.presentation.core.util.plus import tachiyomi.presentation.core.util.secondaryItemAlpha diff --git a/app/src/main/java/eu/kanade/presentation/browse/SourcesScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/SourcesScreen.kt index f42a0e8a11..e3381b494e 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/SourcesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/SourcesScreen.kt @@ -23,7 +23,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import eu.kanade.presentation.browse.components.BaseSourceItem import eu.kanade.presentation.components.EmptyScreen -import eu.kanade.presentation.theme.header import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.ui.browse.source.SourcesState @@ -35,6 +34,7 @@ import tachiyomi.presentation.core.components.LoadingScreen import tachiyomi.presentation.core.components.ScrollbarLazyColumn import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.topSmallPaddingValues +import tachiyomi.presentation.core.theme.header import tachiyomi.presentation.core.util.plus @Composable diff --git a/app/src/main/java/eu/kanade/presentation/components/dialogs/ChangeCategoryDialog.kt b/app/src/main/java/eu/kanade/presentation/category/ChangeCategoryDialog.kt similarity index 98% rename from app/src/main/java/eu/kanade/presentation/components/dialogs/ChangeCategoryDialog.kt rename to app/src/main/java/eu/kanade/presentation/category/ChangeCategoryDialog.kt index 5aaa644878..ba59308a7f 100644 --- a/app/src/main/java/eu/kanade/presentation/components/dialogs/ChangeCategoryDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/category/ChangeCategoryDialog.kt @@ -1,4 +1,4 @@ -package eu.kanade.presentation.components.dialogs +package eu.kanade.presentation.category import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column @@ -22,7 +22,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import eu.kanade.core.prefs.CheckboxState -import eu.kanade.presentation.category.visualName import eu.kanade.tachiyomi.R import tachiyomi.domain.category.model.Category import tachiyomi.presentation.core.components.material.TextButton diff --git a/app/src/main/java/eu/kanade/presentation/components/AppBar.kt b/app/src/main/java/eu/kanade/presentation/components/AppBar.kt index 248ef7302d..fa1c217946 100644 --- a/app/src/main/java/eu/kanade/presentation/components/AppBar.kt +++ b/app/src/main/java/eu/kanade/presentation/components/AppBar.kt @@ -276,18 +276,16 @@ fun SearchToolbar( visualTransformation = visualTransformation, interactionSource = interactionSource, placeholder = { - (placeholderText ?: stringResource(R.string.action_search_hint)).let { placeholderText -> - Text( - modifier = Modifier.secondaryItemAlpha(), - text = placeholderText, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - style = MaterialTheme.typography.titleMedium.copy( - fontSize = 18.sp, - fontWeight = FontWeight.Normal, - ), - ) - } + Text( + modifier = Modifier.secondaryItemAlpha(), + text = (placeholderText ?: stringResource(R.string.action_search_hint)), + maxLines = 1, + overflow = TextOverflow.Ellipsis, + style = MaterialTheme.typography.titleMedium.copy( + fontSize = 18.sp, + fontWeight = FontWeight.Normal, + ), + ) }, ) }, diff --git a/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt b/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt index 1cce258d94..f7438e175b 100644 --- a/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt @@ -31,8 +31,10 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastForEachIndexed import eu.kanade.tachiyomi.R import kotlinx.coroutines.launch +import tachiyomi.presentation.core.components.HorizontalPager import tachiyomi.presentation.core.components.material.Divider import tachiyomi.presentation.core.components.material.TabIndicator +import tachiyomi.presentation.core.components.rememberPagerState object TabbedDialogPaddings { val Horizontal = 24.dp diff --git a/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt b/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt index 5495ec9278..d60a2dde25 100644 --- a/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt @@ -21,9 +21,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.res.stringResource import kotlinx.coroutines.launch +import tachiyomi.presentation.core.components.HorizontalPager import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.TabIndicator import tachiyomi.presentation.core.components.material.TabText +import tachiyomi.presentation.core.components.rememberPagerState @Composable fun TabbedScreen( diff --git a/app/src/main/java/eu/kanade/presentation/components/dialogs/DeleteLibraryMangaDialog.kt b/app/src/main/java/eu/kanade/presentation/library/DeleteLibraryMangaDialog.kt similarity index 98% rename from app/src/main/java/eu/kanade/presentation/components/dialogs/DeleteLibraryMangaDialog.kt rename to app/src/main/java/eu/kanade/presentation/library/DeleteLibraryMangaDialog.kt index cb691dcdb1..2cde52c0cf 100644 --- a/app/src/main/java/eu/kanade/presentation/components/dialogs/DeleteLibraryMangaDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/library/DeleteLibraryMangaDialog.kt @@ -1,4 +1,4 @@ -package eu.kanade.presentation.components.dialogs +package eu.kanade.presentation.library import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt index 1315ed2ce4..3b451f36f2 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt @@ -15,7 +15,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalLayoutDirection import eu.kanade.core.prefs.PreferenceMutableState -import eu.kanade.presentation.components.rememberPagerState import eu.kanade.tachiyomi.ui.library.LibraryItem import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -23,6 +22,7 @@ import tachiyomi.domain.category.model.Category import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.domain.library.model.LibraryManga import tachiyomi.presentation.core.components.material.PullRefresh +import tachiyomi.presentation.core.components.rememberPagerState import kotlin.time.Duration.Companion.seconds @Composable diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryPager.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryPager.kt index e60101ba05..b286fbde5b 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryPager.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryPager.kt @@ -18,12 +18,12 @@ import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.unit.dp import eu.kanade.core.prefs.PreferenceMutableState import eu.kanade.presentation.components.EmptyScreen -import eu.kanade.presentation.components.HorizontalPager -import eu.kanade.presentation.components.PagerState import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.library.LibraryItem import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.domain.library.model.LibraryManga +import tachiyomi.presentation.core.components.HorizontalPager +import tachiyomi.presentation.core.components.PagerState import tachiyomi.presentation.core.util.plus @Composable diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt index 8c569a3b7f..c5a73b6ff4 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt @@ -23,9 +23,9 @@ import androidx.compose.ui.unit.sp import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.OverflowMenu import eu.kanade.presentation.components.SearchToolbar -import eu.kanade.presentation.theme.active import eu.kanade.tachiyomi.R import tachiyomi.presentation.core.components.Pill +import tachiyomi.presentation.core.theme.active @Composable fun LibraryToolbar( diff --git a/app/src/main/java/eu/kanade/presentation/components/dialogs/DuplicateMangaDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/DuplicateMangaDialog.kt similarity index 96% rename from app/src/main/java/eu/kanade/presentation/components/dialogs/DuplicateMangaDialog.kt rename to app/src/main/java/eu/kanade/presentation/manga/DuplicateMangaDialog.kt index edab1002d1..9d2fc05777 100644 --- a/app/src/main/java/eu/kanade/presentation/components/dialogs/DuplicateMangaDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/DuplicateMangaDialog.kt @@ -1,4 +1,4 @@ -package eu.kanade.presentation.components.dialogs +package eu.kanade.presentation.manga import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt index 85171df817..6803a1bf6e 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt @@ -29,8 +29,8 @@ import androidx.compose.ui.unit.dp import eu.kanade.presentation.components.DownloadDropdownMenu import eu.kanade.presentation.components.OverflowMenu import eu.kanade.presentation.manga.DownloadAction -import eu.kanade.presentation.theme.active import eu.kanade.tachiyomi.R +import tachiyomi.presentation.core.theme.active @Composable fun MangaToolbar( diff --git a/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt b/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt index 4a9dd6dbb9..7edfb01328 100644 --- a/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt +++ b/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt @@ -9,7 +9,6 @@ import androidx.compose.ui.platform.LocalLayoutDirection import com.google.accompanist.themeadapter.material3.createMdc3Theme import eu.kanade.domain.ui.model.AppTheme import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate -import uy.kohesive.injekt.api.get @Composable fun TachiyomiTheme(content: @Composable () -> Unit) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt index b1425f1982..a1e6851604 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt @@ -42,8 +42,8 @@ import eu.kanade.presentation.browse.BrowseSourceContent import eu.kanade.presentation.browse.MissingSourceScreen import eu.kanade.presentation.browse.components.BrowseSourceToolbar import eu.kanade.presentation.browse.components.RemoveMangaDialog -import eu.kanade.presentation.components.dialogs.ChangeCategoryDialog -import eu.kanade.presentation.components.dialogs.DuplicateMangaDialog +import eu.kanade.presentation.category.ChangeCategoryDialog +import eu.kanade.presentation.manga.DuplicateMangaDialog import eu.kanade.presentation.util.AssistContentScreen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.CatalogueSource diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt index 124c0d7580..0e44d2d7b8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt @@ -29,10 +29,10 @@ import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.tab.LocalTabNavigator import cafe.adriel.voyager.navigator.tab.TabOptions import eu.kanade.domain.manga.model.isLocal +import eu.kanade.presentation.category.ChangeCategoryDialog import eu.kanade.presentation.components.EmptyScreen import eu.kanade.presentation.components.EmptyScreenAction -import eu.kanade.presentation.components.dialogs.ChangeCategoryDialog -import eu.kanade.presentation.components.dialogs.DeleteLibraryMangaDialog +import eu.kanade.presentation.library.DeleteLibraryMangaDialog import eu.kanade.presentation.library.components.LibraryContent import eu.kanade.presentation.library.components.LibraryToolbar import eu.kanade.presentation.manga.components.LibraryBottomActionMenu diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt index 19c94f1a4e..d02eb80a8d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt @@ -24,10 +24,10 @@ import cafe.adriel.voyager.navigator.Navigator import cafe.adriel.voyager.navigator.currentOrThrow import eu.kanade.domain.manga.model.hasCustomCover import eu.kanade.domain.manga.model.toSManga +import eu.kanade.presentation.category.ChangeCategoryDialog import eu.kanade.presentation.components.NavigatorAdaptiveSheet -import eu.kanade.presentation.components.dialogs.ChangeCategoryDialog -import eu.kanade.presentation.components.dialogs.DuplicateMangaDialog import eu.kanade.presentation.manga.ChapterSettingsDialog +import eu.kanade.presentation.manga.DuplicateMangaDialog import eu.kanade.presentation.manga.EditCoverAction import eu.kanade.presentation.manga.MangaScreen import eu.kanade.presentation.manga.components.DeleteChaptersDialog diff --git a/app/src/main/java/eu/kanade/presentation/components/Pager.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/Pager.kt similarity index 98% rename from app/src/main/java/eu/kanade/presentation/components/Pager.kt rename to presentation-core/src/main/java/tachiyomi/presentation/core/components/Pager.kt index a2b980fbc1..601974db41 100644 --- a/app/src/main/java/eu/kanade/presentation/components/Pager.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/Pager.kt @@ -1,4 +1,4 @@ -package eu.kanade.presentation.components +package tachiyomi.presentation.core.components import androidx.compose.foundation.gestures.FlingBehavior import androidx.compose.foundation.gestures.Orientation @@ -31,7 +31,6 @@ import androidx.compose.ui.util.fastForEach import androidx.compose.ui.util.fastMaxBy import androidx.compose.ui.util.fastSumBy import kotlinx.coroutines.flow.distinctUntilChanged -import tachiyomi.presentation.core.components.LazyColumn @Composable fun HorizontalPager( diff --git a/app/src/main/java/eu/kanade/presentation/theme/Color.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/theme/Color.kt similarity index 88% rename from app/src/main/java/eu/kanade/presentation/theme/Color.kt rename to presentation-core/src/main/java/tachiyomi/presentation/core/theme/Color.kt index ea12448dfb..bb62f18cb8 100644 --- a/app/src/main/java/eu/kanade/presentation/theme/Color.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/theme/Color.kt @@ -1,4 +1,4 @@ -package eu.kanade.presentation.theme +package tachiyomi.presentation.core.theme import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.ColorScheme diff --git a/app/src/main/java/eu/kanade/presentation/theme/Typography.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/theme/Typography.kt similarity index 90% rename from app/src/main/java/eu/kanade/presentation/theme/Typography.kt rename to presentation-core/src/main/java/tachiyomi/presentation/core/theme/Typography.kt index 537424e880..c875b6f1c6 100644 --- a/app/src/main/java/eu/kanade/presentation/theme/Typography.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/theme/Typography.kt @@ -1,4 +1,4 @@ -package eu.kanade.presentation.theme +package tachiyomi.presentation.core.theme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Typography