fixed a bug
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -45,9 +45,9 @@ internal class TrainScreen(
|
||||
meta = if (enrolled) {
|
||||
"已选修 · ${video.sentenceCount} 句"
|
||||
} else {
|
||||
"未选修 · 点击选修"
|
||||
"未选修 · 点击选修并进入"
|
||||
},
|
||||
onClick = { actions.onTrainCatalogVideoClick(video, enrolled) },
|
||||
onClick = { actions.onTrainCatalogVideoClick(video) },
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user