fix COURSE tab lateinit crash: guard refreshCurrentUi by module and loadRemoteVideo

This commit is contained in:
2026-08-31 15:24:19 +08:00
parent a652a39b6c
commit e80a770847

View File

@@ -1678,6 +1678,7 @@ class MainActivity : Activity() {
}
private fun refreshCurrentUi() {
if (activeModule != Module.TRAIN && activeModule != Module.TEST) return
if (!::lessonTitleText.isInitialized) return
val item = controller.currentTrainingItem()
lessonTitleText.text = item?.title ?: "未选择课程"
@@ -1916,10 +1917,10 @@ class MainActivity : Activity() {
private fun loadRemoteVideo(video: TrainingVideoSummary) {
activeItemId = video.videoHash
lessonTitleText.text = video.title
sentenceMetaText.text = "句子边界加载中"
sentenceText.text = video.title
statusText.text = "正在加载云端课程..."
if (::lessonTitleText.isInitialized) lessonTitleText.text = video.title
if (::sentenceMetaText.isInitialized) sentenceMetaText.text = "句子边界加载中"
if (::sentenceText.isInitialized) sentenceText.text = video.title
if (::statusText.isInitialized) statusText.text = "正在加载云端课程..."
renderCatalog()
val loadingItem = video.toTrainingMediaItem()