Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
683 changes: 683 additions & 0 deletions app/shared/app-lang/src/androidMain/res/values-zh-rCN/strings.xml

Large diffs are not rendered by default.

683 changes: 683 additions & 0 deletions app/shared/app-lang/src/androidMain/res/values-zh-rHK/strings.xml

Large diffs are not rendered by default.

683 changes: 683 additions & 0 deletions app/shared/app-lang/src/androidMain/res/values-zh-rTW/strings.xml

Large diffs are not rendered by default.

683 changes: 683 additions & 0 deletions app/shared/app-lang/src/androidMain/res/values/strings.xml

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion app/shared/src/commonMain/kotlin/ui/danmaku/DanmakuEditor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import kotlinx.coroutines.launch
import me.him188.ani.app.data.models.preference.VideoScaffoldConfig
import me.him188.ani.app.ui.foundation.text.ProvideContentColor
import me.him188.ani.app.ui.lang.Lang
import me.him188.ani.app.ui.lang.episode_send_danmaku
import me.him188.ani.app.videoplayer.ui.PlayerControllerState
import me.him188.ani.app.videoplayer.ui.progress.PlayerControllerDefaults
import me.him188.ani.app.videoplayer.ui.rememberAlwaysOnRequester
import me.him188.ani.danmaku.api.DanmakuContent
import me.him188.ani.danmaku.api.DanmakuLocation
import org.jetbrains.compose.resources.stringResource
import org.openani.mediamp.MediampPlayer
import org.openani.mediamp.isPlaying

Expand Down Expand Up @@ -172,6 +175,7 @@ fun DummyDanmakuEditor(
modifier: Modifier = Modifier,
) {
val shape = MaterialTheme.shapes.medium
val sendDanmakuText = stringResource(Lang.episode_send_danmaku)
Row(
modifier,
horizontalArrangement = Arrangement.spacedBy(12.dp),
Expand All @@ -191,7 +195,7 @@ fun DummyDanmakuEditor(
) {
ProvideContentColor(MaterialTheme.colorScheme.onSurfaceVariant) {
Text(
"发送弹幕",
sendDanmakuText,
style = MaterialTheme.typography.labelLarge,
)

Expand Down
6 changes: 4 additions & 2 deletions app/shared/src/commonMain/kotlin/ui/main/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ import me.him188.ani.app.ui.foundation.theme.AniThemeDefaults
import me.him188.ani.app.ui.foundation.widgets.LocalToaster
import me.him188.ani.app.ui.foundation.widgets.showLoadError
import me.him188.ani.app.ui.lang.Lang
import me.him188.ani.app.ui.lang.exploration_search
import me.him188.ani.app.ui.lang.settings
import me.him188.ani.app.ui.lang.settings_update_version_expired_copied_to_clipboard
import me.him188.ani.app.ui.lang.settings_update_version_expired_export_settings
import me.him188.ani.app.ui.lang.settings_update_version_expired_import_settings_hint
Expand Down Expand Up @@ -181,7 +183,7 @@ private fun MainScreenContent(
},
elevation = FloatingActionButtonDefaults.elevation(0.dp, 0.dp, 0.dp, 0.dp),
) {
Icon(Icons.Rounded.Search, "搜索")
Icon(Icons.Rounded.Search, stringResource(Lang.exploration_search))
}
},
navigationRailFooter = {
Expand All @@ -195,7 +197,7 @@ private fun MainScreenContent(
onClick = { onNavigateToSettings(null) },
icon = { Icon(Icons.Rounded.Settings, null) },
enabled = true,
label = { Text("设置") },
label = { Text(stringResource(Lang.settings)) },
alwaysShowLabel = true,
colors = itemColors,
)
Expand Down
5 changes: 4 additions & 1 deletion app/shared/src/commonMain/kotlin/ui/profile/UserInfoRow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ import me.him188.ani.app.data.models.UserInfo
import me.him188.ani.app.ui.external.placeholder.placeholder
import me.him188.ani.app.ui.foundation.ProvideCompositionLocalsForPreview
import me.him188.ani.app.ui.foundation.avatar.AvatarImage
import me.him188.ani.app.ui.lang.Lang
import me.him188.ani.app.ui.lang.settings
import org.jetbrains.compose.resources.stringResource


@Composable
Expand Down Expand Up @@ -119,7 +122,7 @@ fun UserInfoRow(

Column(Modifier.align(Alignment.Top)) {
IconButton(onClickSettings) {
Icon(Icons.Rounded.Settings, "设置")
Icon(Icons.Rounded.Settings, stringResource(Lang.settings))
}
}
}
Expand Down
16 changes: 12 additions & 4 deletions app/shared/src/commonMain/kotlin/ui/profile/auth/AniContactList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ import me.him188.ani.app.ui.foundation.icons.AniIcons
import me.him188.ani.app.ui.foundation.icons.GithubMark
import me.him188.ani.app.ui.foundation.icons.QqRoundedOutline
import me.him188.ani.app.ui.foundation.icons.Telegram
import me.him188.ani.app.ui.lang.Lang
import me.him188.ani.app.ui.lang.settings_about_qq_group
import me.him188.ani.app.ui.lang.settings_about_website
import me.him188.ani.app.ui.settings.tabs.AniHelperDestination
import org.jetbrains.compose.resources.stringResource

private val ContactIconSize = 24.dp

Expand All @@ -38,6 +42,8 @@ fun AniContactList(
) {
val browserNavigator = rememberAsyncBrowserNavigator()
val context = LocalContext.current
val websiteText = stringResource(Lang.settings_about_website)
val qqGroupText = stringResource(Lang.settings_about_qq_group)

FlowRow(
modifier,
Expand All @@ -55,22 +61,24 @@ fun AniContactList(
{ browserNavigator.openBrowser(context, AniHelperDestination.ANI_WEBSITE) },
icon = {
Icon(
Icons.Rounded.Public, "官网",
Icons.Rounded.Public,
websiteText,
Modifier.size(ContactIconSize),
)
},
label = { Text("官网") },
label = { Text(websiteText) },
)

SuggestionChip(
{ browserNavigator.openJoinGroup(context) },
icon = {
Icon(
AniIcons.QqRoundedOutline, "QQ 群",
AniIcons.QqRoundedOutline,
qqGroupText,
Modifier.size(ContactIconSize),
)
},
label = { Text("QQ 群") },
label = { Text(qqGroupText) },
)

SuggestionChip(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import me.him188.ani.app.ui.external.placeholder.placeholder
import me.him188.ani.app.ui.lang.*
import me.him188.ani.app.ui.subject.collection.components.EditCollectionTypeDropDown
import me.him188.ani.app.ui.subject.collection.components.SubjectCollectionAction
import me.him188.ani.app.ui.subject.collection.components.SubjectCollectionActions
import me.him188.ani.datasources.api.topic.UnifiedCollectionType
import org.jetbrains.compose.resources.*


private val ACTIONS = listOf(
SubjectCollectionAction(
{ Text("取消看过") },
{ Text(stringResource(Lang.subject_episode_unwatch)) },
{ Icon(Icons.Rounded.AccessTime, null) },
UnifiedCollectionType.WISH,
),
Expand Down Expand Up @@ -89,18 +91,18 @@ fun EpisodeCollectionActionButton(
) {
when (collectionType) {
UnifiedCollectionType.DONE -> {
Text("已看过")
Text(stringResource(Lang.subject_episode_watched))
}

UnifiedCollectionType.DROPPED -> {
Text("已抛弃")
Text(stringResource(Lang.subject_episode_dropped))
}

else -> {
Box(Modifier.size(16.dp)) {
Icon(Icons.Rounded.Add, null)
}
Text("看过", Modifier.padding(start = 8.dp))
Text(stringResource(Lang.subject_episode_mark_watched), Modifier.padding(start = 8.dp))
}
}

Expand Down
39 changes: 28 additions & 11 deletions app/shared/src/commonMain/kotlin/ui/subject/episode/EpisodePage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ import me.him188.ani.app.ui.foundation.theme.LocalThemeSettings
import me.him188.ani.app.ui.foundation.theme.weaken
import me.him188.ani.app.ui.foundation.widgets.LocalToaster
import me.him188.ani.app.ui.foundation.widgets.showLoadError
import me.him188.ani.app.ui.lang.Lang
import me.him188.ani.app.ui.lang.episode_comments
import me.him188.ani.app.ui.lang.episode_comments_with_count
import me.him188.ani.app.ui.lang.episode_send_danmaku
import me.him188.ani.app.ui.lang.foundation_richtext_external_app_link_warning_prefix
import me.him188.ani.app.ui.lang.foundation_richtext_open_failed_prefix
import me.him188.ani.app.ui.lang.subject_details_tab_details
import me.him188.ani.app.ui.richtext.RichTextDefaults
import me.him188.ani.app.ui.subject.episode.comments.EpisodeCommentColumn
import me.him188.ani.app.ui.subject.episode.comments.EpisodeEditCommentSheet
Expand All @@ -148,7 +155,7 @@ import me.him188.ani.app.videoplayer.ui.gesture.LevelController
import me.him188.ani.app.videoplayer.ui.gesture.NoOpLevelController
import me.him188.ani.app.videoplayer.ui.gesture.asLevelController
import me.him188.ani.app.videoplayer.ui.progress.PlayerControllerDefaults
import me.him188.ani.app.videoplayer.ui.progress.PlayerControllerDefaults.randomDanmakuPlaceholder
import me.him188.ani.app.videoplayer.ui.progress.PlayerControllerDefaults.rememberRandomDanmakuPlaceholder
import me.him188.ani.app.videoplayer.ui.progress.rememberMediaProgressSliderState
import me.him188.ani.danmaku.api.DanmakuContent
import me.him188.ani.danmaku.api.DanmakuLocation
Expand All @@ -159,6 +166,7 @@ import me.him188.ani.utils.platform.isAndroid
import me.him188.ani.utils.platform.isDesktop
import me.him188.ani.utils.platform.isIos
import me.him188.ani.utils.platform.isMobile
import org.jetbrains.compose.resources.stringResource
import org.openani.mediamp.features.AudioLevelController
import org.openani.mediamp.features.PlaybackSpeed
import org.openani.mediamp.features.Screenshots
Expand Down Expand Up @@ -575,6 +583,7 @@ private fun TabRow(
modifier: Modifier = Modifier,
containerColor: Color = MaterialTheme.colorScheme.surface,
) {
val detailsText = stringResource(Lang.subject_details_tab_details)
ScrollableTabRow(
selectedTabIndex = pagerState.currentPage,
modifier,
Expand All @@ -591,19 +600,19 @@ private fun TabRow(
Tab(
selected = pagerState.currentPage == 0,
onClick = { scope.launch { pagerState.animateScrollToPage(0) } },
text = { Text("详情", softWrap = false) },
text = { Text(detailsText, softWrap = false) },
selectedContentColor = MaterialTheme.colorScheme.primary,
unselectedContentColor = MaterialTheme.colorScheme.onSurface,
)
Tab(
selected = pagerState.currentPage == 1,
onClick = { scope.launch { pagerState.animateScrollToPage(1) } },
text = {
val text by remember(commentCount) {
derivedStateOf {
val count = commentCount()
if (count == null) "评论" else "评论 $count"
}
val count = commentCount()
val text = if (count == null) {
stringResource(Lang.episode_comments)
} else {
stringResource(Lang.episode_comments_with_count, count)
}
Text(text, softWrap = false)
},
Expand Down Expand Up @@ -780,13 +789,13 @@ private fun DetachedDanmakuEditorLayout(
modifier: Modifier = Modifier,
) {
Column(modifier.padding(all = 16.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {
Text("发送弹幕", style = MaterialTheme.typography.titleMedium)
Text(stringResource(Lang.episode_send_danmaku), style = MaterialTheme.typography.titleMedium)
val isSending = danmakuEditorState.isSending.collectAsStateWithLifecycle()
PlayerDanmakuEditor(
text = danmakuEditorState.text,
onTextChange = { danmakuEditorState.text = it },
isSending = { isSending.value },
placeholderText = remember { randomDanmakuPlaceholder() },
placeholderText = rememberRandomDanmakuPlaceholder(),
onSend = onSend,
Modifier.fillMaxWidth().focusRequester(focusRequester),
colors = OutlinedTextFieldDefaults.colors(),
Expand Down Expand Up @@ -873,7 +882,7 @@ private fun EpisodeVideo(
}

// Refresh every time on configuration change (i.e. switching theme, entering fullscreen)
val danmakuTextPlaceholder = remember { randomDanmakuPlaceholder() }
val danmakuTextPlaceholder = rememberRandomDanmakuPlaceholder()
val window = LocalPlatformWindow.current

SideEffect {
Expand Down Expand Up @@ -1082,6 +1091,8 @@ private fun EpisodeCommentColumn(
) {
val toaster = LocalToaster.current
val browserNavigator = LocalUriHandler.current
val externalAppLinkWarningPrefix = stringResource(Lang.foundation_richtext_external_app_link_warning_prefix)
val openLinkFailedPrefix = stringResource(Lang.foundation_richtext_open_failed_prefix)

EpisodeCommentColumn(
state = commentState,
Expand All @@ -1098,7 +1109,13 @@ private fun EpisodeCommentColumn(
setShowEditCommentSheet(true)
},
onClickUrl = {
RichTextDefaults.checkSanityAndOpen(it, browserNavigator, toaster)
RichTextDefaults.checkSanityAndOpen(
it,
browserNavigator,
toaster,
externalAppLinkWarningPrefix,
openLinkFailedPrefix,
)
},
modifier = modifier.fillMaxSize(),
gridState = gridState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ import me.him188.ani.app.ui.foundation.ifThen
import me.him188.ani.app.ui.foundation.interaction.WindowDragArea
import me.him188.ani.app.ui.foundation.rememberDebugSettingsViewModel
import me.him188.ani.app.ui.foundation.theme.AniTheme
import me.him188.ani.app.ui.lang.Lang
import me.him188.ani.app.ui.lang.settings
import me.him188.ani.app.ui.lang.subject_episode_collapse_sidebar
import me.him188.ani.app.ui.lang.subject_episode_expand_sidebar
import me.him188.ani.app.ui.lang.subject_episode_fast_forward_85_seconds
import me.him188.ani.app.ui.lang.subject_episode_preview_mode
import me.him188.ani.app.ui.lang.subject_episode_select_media_source
import me.him188.ani.app.ui.mediafetch.TestMediaSourceResultListPresentation
import me.him188.ani.app.ui.mediafetch.ViewKind
import me.him188.ani.app.ui.mediafetch.rememberTestMediaSelectorState
Expand Down Expand Up @@ -116,6 +123,7 @@ import me.him188.ani.app.videoplayer.ui.top.SystemTime
import me.him188.ani.utils.platform.annotations.TestOnly
import me.him188.ani.utils.platform.isDesktop
import me.him188.ani.utils.platform.isMobile
import org.jetbrains.compose.resources.stringResource
import org.openani.mediamp.MediampPlayer
import org.openani.mediamp.features.audioTracks
import org.openani.mediamp.features.subtitleTracks
Expand Down Expand Up @@ -177,6 +185,12 @@ internal fun EpisodeVideoImpl(
var isLocked by remember { mutableStateOf(false) }
val sheetsController = rememberVideoSideSheetsController<EpisodeVideoSideSheetPage>()
val anySideSheetVisible by sheetsController.hasPageAsState()
val fastForward85SecondsText = stringResource(Lang.subject_episode_fast_forward_85_seconds)
val selectMediaSourceText = stringResource(Lang.subject_episode_select_media_source)
val settingsText = stringResource(Lang.settings)
val collapseSidebarText = stringResource(Lang.subject_episode_collapse_sidebar)
val expandSidebarText = stringResource(Lang.subject_episode_expand_sidebar)
val previewModeText = stringResource(Lang.subject_episode_preview_mode)

// auto hide cursor
val videoInteractionSource = remember { MutableInteractionSource() }
Expand Down Expand Up @@ -210,31 +224,31 @@ internal fun EpisodeVideoImpl(
},
actions = {
IconButton({ onClickSkip85(playerState.getCurrentPositionMillis()) }) {
Icon(AniIcons.Forward85, "快进 85 秒")
Icon(AniIcons.Forward85, fastForward85SecondsText)
}
if (expanded) {
IconButton(
{ sheetsController.navigateTo(EpisodeVideoSideSheetPage.MEDIA_SELECTOR) },
Modifier.testTag(TAG_SHOW_MEDIA_SELECTOR),
) {
Icon(Icons.Rounded.DisplaySettings, contentDescription = "数据源")
Icon(Icons.Rounded.DisplaySettings, contentDescription = selectMediaSourceText)
}
}
IconButton(
{ sheetsController.navigateTo(EpisodeVideoSideSheetPage.PLAYER_SETTINGS) },
Modifier.testTag(TAG_SHOW_SETTINGS),
) {
Icon(Icons.Rounded.Settings, contentDescription = "设置")
Icon(Icons.Rounded.Settings, contentDescription = settingsText)
}
if (expanded && LocalPlatform.current.isDesktop()) {
IconButton(
{ onToggleSidebar(!sidebarVisible) },
Modifier.testTag(TAG_COLLAPSE_SIDEBAR),
) {
if (sidebarVisible) {
Icon(AniIcons.RightPanelClose, contentDescription = "折叠侧边栏")
Icon(AniIcons.RightPanelClose, contentDescription = collapseSidebarText)
} else {
Icon(AniIcons.RightPanelOpen, contentDescription = "展开侧边栏")
Icon(AniIcons.RightPanelOpen, contentDescription = expandSidebarText)
}
}
}
Expand All @@ -252,7 +266,7 @@ internal fun EpisodeVideoImpl(
},
video = {
if (LocalIsPreviewing.current) {
Text("预览模式")
Text(previewModeText)
} else {
// Save the status bar height to offset the video player
val statusBarHeight by rememberStatusBarHeightAsState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ import me.him188.ani.app.ui.comment.rememberTestCommentState
import me.him188.ani.app.ui.foundation.LocalImageViewerHandler
import me.him188.ani.app.ui.foundation.ProvideCompositionLocalsForPreview
import me.him188.ani.app.ui.foundation.layout.plus
import me.him188.ani.app.ui.lang.Lang
import me.him188.ani.app.ui.lang.comment_send_comment
import me.him188.ani.app.ui.richtext.RichText
import me.him188.ani.app.ui.richtext.UIRichElement
import me.him188.ani.utils.platform.annotations.TestOnly
import org.jetbrains.compose.resources.stringResource

@Composable
fun EpisodeCommentColumn(
Expand All @@ -63,16 +66,16 @@ fun EpisodeCommentColumn(
gridState: LazyGridState = rememberLazyGridState(),
) {
val imageViewer = LocalImageViewerHandler.current
val writeCommentText = stringResource(Lang.comment_send_comment)

Scaffold(
modifier,
floatingActionButton = {
ExtendedFloatingActionButton(
text = { Text("写评论") },
text = { Text(writeCommentText) },
icon = {
Icon(Icons.Rounded.AddComment, null)
}
,
},
onClick = onNewCommentClick,
expanded = !gridState.canScrollBackward,
)
Expand Down
Loading