Skip to content

Commit

Permalink
refactor: download icon configurable
Browse files Browse the repository at this point in the history
- Minor UI improvements.

fixes: LEARNER-10140
  • Loading branch information
farhan-arshad-dev committed Dec 4, 2024
1 parent 995d97c commit dc02f22
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 9 deletions.
3 changes: 3 additions & 0 deletions core/src/main/java/org/openedx/core/ui/theme/AppColors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/java/org/openedx/core/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions core/src/openedx/org/openedx/core/ui/theme/Colors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
)
}
Expand Down Expand Up @@ -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
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1061,7 +1061,7 @@ fun CourseDatesBanner(
}

banner.bannerType.buttonResId.nonZero()?.let {
OpenEdXPrimaryButton(
OpenEdXSecondaryButton(
text = stringResource(id = it),
onClick = resetDates,
)
Expand Down Expand Up @@ -1115,7 +1115,7 @@ fun CourseDatesBannerTablet(
}
}
banner.bannerType.buttonResId.nonZero()?.let {
OpenEdXPrimaryButton(
OpenEdXSecondaryButton(
modifier = Modifier.width(210.dp),
text = stringResource(id = it),
onClick = resetDates,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dc02f22

Please sign in to comment.