Skip to content

Commit

Permalink
fix: Video Subtitles on Native and Youtube Player (openedx#349)
Browse files Browse the repository at this point in the history
* fix: Video Subtitles on Native and Youtube Player

* chore: UI Changes
  • Loading branch information
HamzaIsrar12 authored Jul 8, 2024
1 parent ba305a0 commit 02a83ed
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.text.style.TextOverflow
Expand Down Expand Up @@ -562,6 +563,11 @@ fun VideoSubtitles(
} else {
MaterialTheme.appColors.textFieldBorder
}
val fontWeight = if (currentIndex == index) {
FontWeight.SemiBold
} else {
FontWeight.Normal
}
Text(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -570,7 +576,8 @@ fun VideoSubtitles(
},
text = Jsoup.parse(item.content).text(),
color = textColor,
style = MaterialTheme.appTypography.bodyMedium
style = MaterialTheme.appTypography.bodyMedium,
fontWeight = fontWeight,
)
Spacer(Modifier.height(16.dp))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class VideoUnitFragment : Fragment(R.layout.fragment_video_unit) {
viewModel.isDownloaded = getBoolean(ARG_DOWNLOADED)
}
viewModel.downloadSubtitles()
handler.removeCallbacks(videoTimeRunnable)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ open class VideoUnitViewModel(


open fun markBlockCompleted(blockId: String, medium: String) {
logLoadedCompletedEvent(videoUrl, false, getCurrentVideoTime(), medium)
if (!isBlockAlreadyCompleted) {
logLoadedCompletedEvent(videoUrl, false, getCurrentVideoTime(), medium)
viewModelScope.launch {
try {
isBlockAlreadyCompleted = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class VideoViewModel(
}

fun markBlockCompleted(blockId: String, medium: String) {
logLoadedCompletedEvent(videoUrl, false, currentVideoTime, medium)
if (!isBlockAlreadyCompleted) {
logLoadedCompletedEvent(videoUrl, false, currentVideoTime, medium)
viewModelScope.launch {
try {
isBlockAlreadyCompleted = true
Expand Down

0 comments on commit 02a83ed

Please sign in to comment.