Skip to content

Commit

Permalink
Unify UI top-level screen names
Browse files Browse the repository at this point in the history
Page/Scene -> Screen
  • Loading branch information
Him188 committed Feb 1, 2025
1 parent 845fc58 commit 5f77b67
Show file tree
Hide file tree
Showing 28 changed files with 159 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
import me.him188.ani.app.navigation.MainScenePage
import me.him188.ani.app.navigation.MainScreenPage

@Serializable
@Immutable
data class UISettings(
/**
* 启动 App 时的初始页面
*/
val mainSceneInitialPage: MainScenePage = MainScenePage.Exploration,
val mainSceneInitialPage: MainScreenPage = MainScreenPage.Exploration,

@Suppress("DEPRECATION") @Deprecated(
"For migration. Use themeSettings instead",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ interface AniNavigator {
}

fun navigateMain(
page: MainScenePage,
page: MainScreenPage,
requestFocus: Boolean = false
) {
navigator.popBackStack<NavRoutes.Main>(inclusive = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sealed class NavRoutes {

@Serializable
data class Main(
val initialPage: MainScenePage,
val initialPage: MainScreenPage,
val requestSearchFocus: Boolean = false,
) : NavRoutes()

Expand Down Expand Up @@ -96,7 +96,7 @@ data class SubjectDetailPlaceholder(
}

@Serializable
enum class MainScenePage {
enum class MainScreenPage {
Exploration,
Collection,
CacheManagement,
Expand All @@ -108,7 +108,7 @@ enum class MainScenePage {

@Stable
val NavType by lazy(LazyThreadSafetyMode.PUBLICATION) {
EnumNavType(kotlin.enums.enumEntries<MainScenePage>())
EnumNavType(kotlin.enums.enumEntries<MainScreenPage>())
}
}
}
Expand Down Expand Up @@ -142,17 +142,17 @@ enum class SettingsTab {
}

@Stable
fun MainScenePage.getIcon() = when (this) {
MainScenePage.Exploration -> Icons.Rounded.TravelExplore
MainScenePage.Collection -> Icons.Rounded.Star
MainScenePage.CacheManagement -> Icons.Rounded.DownloadDone
MainScenePage.Search -> Icons.Rounded.Search
fun MainScreenPage.getIcon() = when (this) {
MainScreenPage.Exploration -> Icons.Rounded.TravelExplore
MainScreenPage.Collection -> Icons.Rounded.Star
MainScreenPage.CacheManagement -> Icons.Rounded.DownloadDone
MainScreenPage.Search -> Icons.Rounded.Search
}

@Stable
fun MainScenePage.getText(): String = when (this) {
MainScenePage.Exploration -> "探索"
MainScenePage.Collection -> "追番"
MainScenePage.CacheManagement -> "缓存"
MainScenePage.Search -> "搜索"
fun MainScreenPage.getText(): String = when (this) {
MainScreenPage.Exploration -> "探索"
MainScreenPage.Collection -> "追番"
MainScreenPage.CacheManagement -> "缓存"
MainScreenPage.Search -> "搜索"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 OpenAni and contributors.
* Copyright (C) 2024-2025 OpenAni and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link.
Expand Down Expand Up @@ -36,7 +36,7 @@ import me.him188.ani.utils.platform.annotations.TestOnly
@Composable
fun PreviewCacheManagementPage() {
ProvideCompositionLocalsForPreview {
CacheManagementPage(
CacheManagementScreen(
state = remember {
CacheManagementState(
stateOf(createTestMediaStats()),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 OpenAni and contributors.
* Copyright (C) 2024-2025 OpenAni and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link.
Expand All @@ -21,5 +21,5 @@ import me.him188.ani.utils.platform.annotations.TestOnly
@Composable
@Preview
fun PreviewMediaCacheDetailsPage() = ProvideCompositionLocalsForPreview {
MediaCacheDetailsPage(TestMediaList[0], MikanMediaSource.INFO, { BackNavigationIconButton({ }) })
MediaCacheDetailsScreen(TestMediaList[0], MikanMediaSource.INFO, { BackNavigationIconButton({ }) })
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 OpenAni and contributors.
* Copyright (C) 2024-2025 OpenAni and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link.
Expand Down Expand Up @@ -34,7 +34,7 @@ internal fun PreviewExplorationPage() {
ProvideFoundationCompositionLocalsForPreview {
val scope = rememberCoroutineScope()
val trendingSubjectInfoPager = createTestPager(TestTrendingSubjectInfos).collectAsLazyPagingItemsWithLifecycle()
ExplorationPage(
ExplorationScreen(
remember {
ExplorationPageState(
authState = createTestAuthState(scope),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright (C) 2024-2025 OpenAni and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link.
*
* https://github.com/open-ani/ani/blob/main/LICENSE
*/

package me.him188.ani.app.ui.subject.episode

import androidx.compose.foundation.layout.Box
Expand All @@ -20,7 +29,7 @@ import me.him188.ani.app.ui.foundation.ProvideCompositionLocalsForPreview
internal fun PreviewEpisodePage() {
ProvideCompositionLocalsForPreview {
val context = LocalContext.current
EpisodeScene(
EpisodeScreen(
remember {
EpisodeViewModel(
424663,
Expand All @@ -36,7 +45,7 @@ internal fun PreviewEpisodePage() {
@PreviewLightDark
fun PreviewEpisodeSceneContentPhoneScaffoldTabs() {
ProvideCompositionLocalsForPreview {
EpisodeSceneContentPhoneScaffold(
EpisodeScreenContentPhoneScaffold(
videoOnly = false,
commentCount = { 100 },
video = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 OpenAni and contributors.
* Copyright (C) 2024-2025 OpenAni and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link.
Expand Down Expand Up @@ -238,13 +238,13 @@ class CacheManagementState(
* 全局缓存管理页面
*/
@Composable
fun CacheManagementPage(
fun CacheManagementScreen(
vm: CacheManagementViewModel,
navigationIcon: @Composable () -> Unit,
modifier: Modifier = Modifier,
contentWindowInsets: WindowInsets = AniWindowInsets.forPageContent(),
) {
CacheManagementPage(
CacheManagementScreen(
vm.state,
navigationIcon = navigationIcon,
modifier = modifier,
Expand All @@ -255,7 +255,7 @@ fun CacheManagementPage(


@Composable
fun CacheManagementPage(
fun CacheManagementScreen(
state: CacheManagementState,
navigationIcon: @Composable () -> Unit,
modifier: Modifier = Modifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ class MediaCacheDetailsPageViewModel(
}

@Composable
fun MediaCacheDetailsPage(
fun MediaCacheDetailsScreen(
vm: MediaCacheDetailsPageViewModel,
navigationIcon: @Composable () -> Unit,
modifier: Modifier = Modifier,
windowInsets: WindowInsets = ScaffoldDefaults.contentWindowInsets,
) {
MediaCacheDetailsPage(
MediaCacheDetailsScreen(
media = vm.media,
sourceInfo = vm.sourceInfo,
navigationIcon = navigationIcon,
Expand All @@ -90,7 +90,7 @@ fun MediaCacheDetailsPage(
}

@Composable
fun MediaCacheDetailsPage(
fun MediaCacheDetailsScreen(
media: Media?,
sourceInfo: MediaSourceInfo?,
navigationIcon: @Composable () -> Unit,
Expand Down
Loading

0 comments on commit 5f77b67

Please sign in to comment.