fixed a bug

This commit is contained in:
2026-09-04 16:35:03 +08:00
parent ff1341e191
commit f928dd5c68
5 changed files with 16 additions and 11 deletions

View File

@@ -85,7 +85,16 @@ internal class CourseCatalogController(
}
}
fun useCourseInPlace(video: TrainingVideoSummary) {
// Keep the current module (e.g. Train) while syncing course selection.
if (screenState.courseEnrollment[video.videoHash] != true) {
enrollCourse(video)
}
loadRemoteVideo(video)
}
fun loadRemoteVideo(video: TrainingVideoSummary) {
screenState.currentCourse = video
screenState.activeItemId = video.videoHash
host.onPlayerLoading(video)
host.onCatalogChanged()

View File

@@ -250,7 +250,7 @@ class MainActivity : Activity() {
sdk.config.userToken = null
screenState.clearCourse()
controller.pause()
screenState.activeModule = Module.TRAIN
screenState.activeModule = Module.COURSE
setRootView()
}
@@ -431,12 +431,8 @@ class MainActivity : Activity() {
catalogController.selectCourse(video)
}
override fun onTrainCatalogVideoClick(video: TrainingVideoSummary, enrolled: Boolean) {
if (enrolled) {
catalogController.loadRemoteVideo(video)
} else {
catalogController.enrollCourse(video)
}
override fun onTrainCatalogVideoClick(video: TrainingVideoSummary) {
catalogController.useCourseInPlace(video)
}
override fun onLogout() = logout()

View File

@@ -17,7 +17,7 @@ internal interface TrainScreenActions {
fun onSeekStart()
fun onSeekStop(progress: Int)
fun onContinuousPlaybackChanged(enabled: Boolean)
fun onTrainCatalogVideoClick(video: TrainingVideoSummary, enrolled: Boolean)
fun onTrainCatalogVideoClick(video: TrainingVideoSummary)
}
internal interface TestScreenActions {

View File

@@ -8,7 +8,7 @@ internal class TrainingScreenState {
var catalogVideos: List<TrainingVideoSummary> = emptyList()
val courseEnrollment = mutableMapOf<String, Boolean>()
var catalogStatus = "正在同步"
var activeModule = Module.TRAIN
var activeModule = Module.COURSE
var currentCourse: TrainingVideoSummary? = null
var continuousPlaybackEnabled = false
var testSubtitleVisible = false

View File

@@ -45,9 +45,9 @@ internal class TrainScreen(
meta = if (enrolled) {
"已选修 · ${video.sentenceCount} 句"
} else {
"未选修 · 点击选修"
"未选修 · 点击选修并进入"
},
onClick = { actions.onTrainCatalogVideoClick(video, enrolled) },
onClick = { actions.onTrainCatalogVideoClick(video) },
),
)
}