From dc02f22b6e0c2fa4edb64950a6b32f7b61a7b525 Mon Sep 17 00:00:00 2001 From: Farhan Arshad Date: Tue, 3 Dec 2024 14:01:52 +0500 Subject: [PATCH] refactor: download icon configurable - Minor UI improvements. fixes: LEARNER-10140 --- .../main/java/org/openedx/core/ui/theme/AppColors.kt | 3 +++ core/src/main/java/org/openedx/core/ui/theme/Theme.kt | 6 ++++++ core/src/openedx/org/openedx/core/ui/theme/Colors.kt | 6 ++++++ .../course/presentation/outline/CourseOutlineScreen.kt | 7 ++++--- .../org/openedx/course/presentation/ui/CourseUI.kt | 10 +++++----- .../courses/presentation/DashboardGalleryView.kt | 2 +- 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/openedx/core/ui/theme/AppColors.kt b/core/src/main/java/org/openedx/core/ui/theme/AppColors.kt index 4c960061e..b5a715131 100644 --- a/core/src/main/java/org/openedx/core/ui/theme/AppColors.kt +++ b/core/src/main/java/org/openedx/core/ui/theme/AppColors.kt @@ -35,6 +35,9 @@ data class AppColors( val secondaryButtonBorderedText: Color, val secondaryButtonBorderedBackground: Color, + val downloadingSuccess: Color, + val downloadingNotStarted: Color, + val cardViewBackground: Color, val cardViewBorder: Color, val divider: Color, diff --git a/core/src/main/java/org/openedx/core/ui/theme/Theme.kt b/core/src/main/java/org/openedx/core/ui/theme/Theme.kt index 41579c906..4f2e3419a 100644 --- a/core/src/main/java/org/openedx/core/ui/theme/Theme.kt +++ b/core/src/main/java/org/openedx/core/ui/theme/Theme.kt @@ -52,6 +52,9 @@ private val DarkColorPalette = AppColors( secondaryButtonBorderedText = dark_secondary_button_bordered_text, secondaryButtonBorderedBackground = dark_secondary_button_bordered_background, + downloadingSuccess = dark_downloading_success, + downloadingNotStarted = dark_downloading_not_started, + cardViewBackground = dark_card_view_background, cardViewBorder = dark_card_view_border, divider = dark_divider, @@ -142,6 +145,9 @@ private val LightColorPalette = AppColors( secondaryButtonBorderedBackground = light_secondary_button_bordered_background, secondaryButtonBorderedText = light_secondary_button_bordered_text, + downloadingSuccess = light_downloading_success, + downloadingNotStarted = light_downloading_not_started, + cardViewBackground = light_card_view_background, cardViewBorder = light_card_view_border, divider = light_divider, diff --git a/core/src/openedx/org/openedx/core/ui/theme/Colors.kt b/core/src/openedx/org/openedx/core/ui/theme/Colors.kt index b848237f8..8714dbf2a 100644 --- a/core/src/openedx/org/openedx/core/ui/theme/Colors.kt +++ b/core/src/openedx/org/openedx/core/ui/theme/Colors.kt @@ -43,6 +43,9 @@ val light_secondary_button_border = light_primary_button_border val light_secondary_button_bordered_text = light_primary_button_bordered_text val light_secondary_button_bordered_background = light_primary_button_bordered_background +val light_downloading_success = Color(0xFF198571) +val light_downloading_not_started = Color(0xFF3C68FF) + val light_card_view_background = Color(0xFFF9FAFB) val light_card_view_border = Color(0xFFCCD4E0) val light_divider = Color(0xFFCCD4E0) @@ -114,6 +117,9 @@ val dark_secondary_button_border = dark_primary_button_border val dark_secondary_button_bordered_text = dark_primary_button_bordered_text val dark_secondary_button_bordered_background = dark_primary_button_bordered_background +val dark_downloading_success = Color(0xFF198571) +val dark_downloading_not_started = Color(0xFF879FF5) + val dark_card_view_background = Color(0xFF273346) val dark_card_view_border = Color(0xFF4E5A70) val dark_divider = Color(0xFF4E5A70) 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 755e2b114..394166a80 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 @@ -59,6 +59,7 @@ import org.openedx.core.ui.CircularProgress import org.openedx.core.ui.HandleUIMessage import org.openedx.core.ui.NoContentScreen import org.openedx.core.ui.OpenEdXPrimaryButton +import org.openedx.core.ui.OpenEdXSecondaryButton import org.openedx.core.ui.TextIcon import org.openedx.core.ui.displayCutoutForLandscape import org.openedx.core.ui.theme.OpenEdXTheme @@ -389,7 +390,7 @@ private fun ResumeCourse( ) } Spacer(Modifier.height(24.dp)) - OpenEdXPrimaryButton( + OpenEdXSecondaryButton( text = stringResource(id = R.string.course_resume), onClick = { onResumeClick(block.id) @@ -398,7 +399,7 @@ private fun ResumeCourse( TextIcon( text = stringResource(id = R.string.course_resume), painter = painterResource(id = CoreR.drawable.core_ic_forward), - color = MaterialTheme.appColors.primaryButtonText, + color = MaterialTheme.appColors.secondaryButtonText, textStyle = MaterialTheme.appTypography.labelLarge ) } @@ -457,7 +458,7 @@ private fun ResumeCourseTablet( TextIcon( text = stringResource(id = R.string.course_resume), painter = painterResource(id = CoreR.drawable.core_ic_forward), - color = MaterialTheme.appColors.primaryButtonText, + color = MaterialTheme.appColors.secondaryButtonText, textStyle = MaterialTheme.appTypography.labelLarge ) } diff --git a/course/src/main/java/org/openedx/course/presentation/ui/CourseUI.kt b/course/src/main/java/org/openedx/course/presentation/ui/CourseUI.kt index 4ed43680f..50da42e04 100644 --- a/course/src/main/java/org/openedx/course/presentation/ui/CourseUI.kt +++ b/course/src/main/java/org/openedx/course/presentation/ui/CourseUI.kt @@ -89,8 +89,8 @@ import org.openedx.core.module.db.DownloadedState import org.openedx.core.module.db.FileType import org.openedx.core.ui.BackBtn import org.openedx.core.ui.IconText -import org.openedx.core.ui.OpenEdXPrimaryButton import org.openedx.core.ui.OpenEdXPrimaryOutlinedButton +import org.openedx.core.ui.OpenEdXSecondaryButton import org.openedx.core.ui.displayCutoutForLandscape import org.openedx.core.ui.noRippleClickable import org.openedx.core.ui.theme.OpenEdXTheme @@ -725,9 +725,9 @@ fun CourseExpandableChapterCard( stringResource(id = R.string.course_accessibility_download_course_section) } val downloadIconTint = if (downloadedState == DownloadedState.DOWNLOADED) { - MaterialTheme.appColors.successGreen + MaterialTheme.appColors.downloadingSuccess } else { - MaterialTheme.appColors.textAccent + MaterialTheme.appColors.downloadingNotStarted } IconButton( modifier = iconModifier, @@ -1061,7 +1061,7 @@ fun CourseDatesBanner( } banner.bannerType.buttonResId.nonZero()?.let { - OpenEdXPrimaryButton( + OpenEdXSecondaryButton( text = stringResource(id = it), onClick = resetDates, ) @@ -1115,7 +1115,7 @@ fun CourseDatesBannerTablet( } } banner.bannerType.buttonResId.nonZero()?.let { - OpenEdXPrimaryButton( + OpenEdXSecondaryButton( modifier = Modifier.width(210.dp), text = stringResource(id = it), onClick = resetDates, diff --git a/dashboard/src/main/java/org/openedx/courses/presentation/DashboardGalleryView.kt b/dashboard/src/main/java/org/openedx/courses/presentation/DashboardGalleryView.kt index 137c615ce..5894c834d 100644 --- a/dashboard/src/main/java/org/openedx/courses/presentation/DashboardGalleryView.kt +++ b/dashboard/src/main/java/org/openedx/courses/presentation/DashboardGalleryView.kt @@ -662,7 +662,7 @@ private fun ResumeButton( .fillMaxWidth() .clickable { onClick() } .heightIn(min = 60.dp) - .background(MaterialTheme.appColors.primary) + .background(MaterialTheme.appColors.primaryButtonBackground) .padding(12.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)