diff --git a/core/src/main/java/org/openedx/core/extension/ViewExt.kt b/core/src/main/java/org/openedx/core/extension/ViewExt.kt index ebd007d3d..498619480 100644 --- a/core/src/main/java/org/openedx/core/extension/ViewExt.kt +++ b/core/src/main/java/org/openedx/core/extension/ViewExt.kt @@ -66,23 +66,11 @@ fun WebView.loadUrl(url: String, scope: CoroutineScope, cookieManager: AppCookie } fun WebView.applyDarkModeIfEnabled(isDarkTheme: Boolean) { - if (isDarkTheme && WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - settings.setAlgorithmicDarkeningAllowed(true) - } else { - // Switch WebView to dark mode; uses default dark theme - if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) { - WebSettingsCompat.setForceDark( - settings, - WebSettingsCompat.FORCE_DARK_ON - ) - } - if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK_STRATEGY)) { - WebSettingsCompat.setForceDarkStrategy( - settings, - WebSettingsCompat.DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING - ) - } + if (isDarkTheme && WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) { + try { + WebSettingsCompat.setAlgorithmicDarkeningAllowed(settings, true) + } catch (e: Exception) { + e.printStackTrace() } } } diff --git a/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineScreen.kt b/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineScreen.kt index f0516a744..10ad4f932 100644 --- a/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineScreen.kt +++ b/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineScreen.kt @@ -79,7 +79,7 @@ fun CourseOutlineScreen( windowSize: WindowSize, viewModel: CourseOutlineViewModel, fragmentManager: FragmentManager, - onResetDatesClick: () -> Unit + onResetDatesClick: () -> Unit, ) { val uiState by viewModel.uiState.collectAsState() val uiMessage by viewModel.uiMessage.collectAsState(null) @@ -288,12 +288,14 @@ private fun CourseOutlineUI( ResumeCourseTablet( modifier = Modifier.padding(vertical = 16.dp), block = uiState.resumeComponent, + displayName = uiState.resumeUnitTitle, onResumeClick = onResumeClick ) } else { ResumeCourse( modifier = Modifier.padding(vertical = 16.dp), block = uiState.resumeComponent, + displayName = uiState.resumeUnitTitle, onResumeClick = onResumeClick ) } @@ -341,6 +343,7 @@ private fun CourseOutlineUI( private fun ResumeCourse( modifier: Modifier = Modifier, block: Block, + displayName: String, onResumeClick: (String) -> Unit, ) { Column( @@ -363,7 +366,7 @@ private fun ResumeCourse( tint = MaterialTheme.appColors.textPrimary ) Text( - text = block.displayName, + text = displayName, color = MaterialTheme.appColors.textPrimary, style = MaterialTheme.appTypography.titleMedium, maxLines = 1, @@ -393,6 +396,7 @@ private fun ResumeCourse( private fun ResumeCourseTablet( modifier: Modifier = Modifier, block: Block, + displayName: String, onResumeClick: (String) -> Unit, ) { Row( @@ -421,7 +425,7 @@ private fun ResumeCourseTablet( tint = MaterialTheme.appColors.textPrimary ) Text( - text = block.displayName, + text = displayName, color = MaterialTheme.appColors.textPrimary, style = MaterialTheme.appTypography.titleMedium, overflow = TextOverflow.Ellipsis, @@ -450,7 +454,7 @@ private fun ResumeCourseTablet( @Composable private fun CourseProgress( modifier: Modifier = Modifier, - progress: Progress + progress: Progress, ) { Column( modifier = modifier, @@ -498,6 +502,7 @@ private fun CourseOutlineScreenPreview() { mockCourseStructure, mapOf(), mockChapterBlock, + "Resumed Unit", mapOf(), mapOf(), mapOf(), @@ -532,6 +537,7 @@ private fun CourseOutlineScreenTabletPreview() { mockCourseStructure, mapOf(), mockChapterBlock, + "Resumed Unit", mapOf(), mapOf(), mapOf(), @@ -560,7 +566,7 @@ private fun CourseOutlineScreenTabletPreview() { @Composable private fun ResumeCoursePreview() { OpenEdXTheme { - ResumeCourse(block = mockChapterBlock) {} + ResumeCourse(block = mockChapterBlock, displayName = "Resumed Unit") {} } } diff --git a/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineUIState.kt b/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineUIState.kt index 381cb8401..55cf52137 100644 --- a/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineUIState.kt +++ b/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineUIState.kt @@ -10,6 +10,7 @@ sealed class CourseOutlineUIState { val courseStructure: CourseStructure, val downloadedState: Map, val resumeComponent: Block?, + val resumeUnitTitle: String, val courseSubSections: Map>, val courseSectionsState: Map, val subSectionsDownloadsCount: Map, diff --git a/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineViewModel.kt b/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineViewModel.kt index f59f6ec6e..006176b56 100644 --- a/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineViewModel.kt +++ b/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineViewModel.kt @@ -121,6 +121,7 @@ class CourseOutlineViewModel( courseStructure = state.courseStructure, downloadedState = it.toMap(), resumeComponent = state.resumeComponent, + resumeUnitTitle = resumeVerticalBlock?.displayName ?: "", courseSubSections = courseSubSections, courseSectionsState = state.courseSectionsState, subSectionsDownloadsCount = subSectionsDownloadsCount, @@ -155,6 +156,7 @@ class CourseOutlineViewModel( courseStructure = state.courseStructure, downloadedState = state.downloadedState, resumeComponent = state.resumeComponent, + resumeUnitTitle = resumeVerticalBlock?.displayName ?: "", courseSubSections = courseSubSections, courseSectionsState = courseSectionsState, subSectionsDownloadsCount = subSectionsDownloadsCount, @@ -213,6 +215,7 @@ class CourseOutlineViewModel( courseStructure = courseStructure, downloadedState = getDownloadModelsStatus(), resumeComponent = getResumeBlock(blocks, courseStatus.lastVisitedBlockId), + resumeUnitTitle = resumeVerticalBlock?.displayName ?: "", courseSubSections = courseSubSections, courseSectionsState = courseSectionsState, subSectionsDownloadsCount = subSectionsDownloadsCount, diff --git a/dashboard/src/main/java/org/openedx/courses/presentation/AllEnrolledCoursesView.kt b/dashboard/src/main/java/org/openedx/courses/presentation/AllEnrolledCoursesView.kt index 34409198c..7bd060bb5 100644 --- a/dashboard/src/main/java/org/openedx/courses/presentation/AllEnrolledCoursesView.kt +++ b/dashboard/src/main/java/org/openedx/courses/presentation/AllEnrolledCoursesView.kt @@ -186,6 +186,7 @@ private fun AllEnrolledCoursesView( scaffoldState = scaffoldState, modifier = Modifier .fillMaxSize() + .navigationBarsPadding() .semantics { testTagsAsResourceId = true }, @@ -262,7 +263,6 @@ private fun AllEnrolledCoursesView( Box( modifier = Modifier .fillMaxWidth() - .navigationBarsPadding() .pullRefresh(pullRefreshState), ) { Column( diff --git a/whatsnew/src/main/java/org/openedx/whatsnew/presentation/whatsnew/WhatsNewFragment.kt b/whatsnew/src/main/java/org/openedx/whatsnew/presentation/whatsnew/WhatsNewFragment.kt index da0458054..541877ee2 100644 --- a/whatsnew/src/main/java/org/openedx/whatsnew/presentation/whatsnew/WhatsNewFragment.kt +++ b/whatsnew/src/main/java/org/openedx/whatsnew/presentation/whatsnew/WhatsNewFragment.kt @@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.widthIn @@ -140,6 +141,7 @@ fun WhatsNewScreen( .semantics { testTagsAsResourceId = true } + .navigationBarsPadding() .fillMaxSize(), scaffoldState = scaffoldState, topBar = { @@ -247,26 +249,26 @@ private fun WhatsNewScreenPortrait( .background(MaterialTheme.appColors.background), contentAlignment = Alignment.TopCenter ) { - HorizontalPager( - modifier = Modifier.fillMaxSize(), - verticalAlignment = Alignment.Top, - state = pagerState - ) { page -> - val image = whatsNewItem.messages[page].image - Image( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 36.dp, vertical = 48.dp), - painter = painterResource(id = image), - contentDescription = null - ) - } - Box( + Column( modifier = Modifier - .fillMaxSize() - .padding(horizontal = 24.dp, vertical = 120.dp), - contentAlignment = Alignment.BottomCenter + .padding(horizontal = 24.dp, vertical = 36.dp), + verticalArrangement = Arrangement.spacedBy(24.dp), ) { + HorizontalPager( + modifier = Modifier + .fillMaxWidth() + .weight(1.0f), + verticalAlignment = Alignment.Top, + state = pagerState + ) { page -> + val image = whatsNewItem.messages[page].image + Image( + modifier = Modifier + .fillMaxWidth(), + painter = painterResource(id = image), + contentDescription = null + ) + } Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(20.dp),