Skip to content

Commit 8451c05

Browse files
fix: detekt fix and changes according PR review
1 parent a408106 commit 8451c05

File tree

13 files changed

+49
-25
lines changed

13 files changed

+49
-25
lines changed

app/src/main/java/org/openedx/app/AppActivity.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package org.openedx.app
22

33
import android.content.Intent
44
import android.content.res.Configuration
5+
import android.graphics.Color
56
import android.net.Uri
7+
import android.os.Build
68
import android.os.Bundle
79
import android.view.View
810
import android.view.WindowManager
@@ -158,8 +160,12 @@ class AppActivity : AppCompatActivity(), InsetHolder, WindowSizeHolder {
158160
WindowCompat.setDecorFitsSystemWindows(this, false)
159161
val insetsController = WindowInsetsControllerCompat(this, binding.root)
160162
insetsController.isAppearanceLightStatusBars = !isUsingNightModeResources()
161-
insetsController.systemBarsBehavior =
162-
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
163+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
164+
insetsController.systemBarsBehavior =
165+
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
166+
} else {
167+
window.statusBarColor = Color.TRANSPARENT
168+
}
163169
}
164170
}
165171

core/src/main/java/org/openedx/core/ui/theme/AppColors.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ data class AppColors(
8080
val progressBarColor: Color,
8181
val progressBarBackgroundColor: Color,
8282
val gradeProgressBarBorder: Color,
83+
val gradeProgressBarBackground: Color,
84+
val assignmentCardBorder: Color,
8385
) {
8486
val primary: Color get() = material.primary
8587
val primaryVariant: Color get() = material.primaryVariant

core/src/main/java/org/openedx/core/ui/theme/Theme.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ private val DarkColorPalette = AppColors(
9797

9898
progressBarColor = dark_progress_bar_color,
9999
progressBarBackgroundColor = dark_progress_bar_background_color,
100-
gradeProgressBarBorder = dark_grade_progress_bar_color
100+
gradeProgressBarBorder = dark_grade_progress_bar_color,
101+
gradeProgressBarBackground = dark_grade_progress_bar_background,
102+
assignmentCardBorder = dark_assignment_card_border,
101103
)
102104

103105
private val LightColorPalette = AppColors(
@@ -187,7 +189,9 @@ private val LightColorPalette = AppColors(
187189

188190
progressBarColor = light_progress_bar_color,
189191
progressBarBackgroundColor = light_progress_bar_background_color,
190-
gradeProgressBarBorder = light_grade_progress_bar_color
192+
gradeProgressBarBorder = light_grade_progress_bar_color,
193+
gradeProgressBarBackground = light_grade_progress_bar_background,
194+
assignmentCardBorder = light_assignment_card_border,
191195
)
192196

193197
val MaterialTheme.appColors: AppColors

core/src/main/java/org/openedx/core/utils/TimeUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ object TimeUtils {
9797
}
9898
}
9999

100-
fun formatToDayMonth(date: Date): String {
100+
fun formatToMonthDay(date: Date): String {
101101
val sdf = SimpleDateFormat("MMM dd", Locale.getDefault())
102102
return sdf.format(date)
103103
}

core/src/openedx/org/openedx/core/ui/theme/Colors.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ val light_settings_title_content = Color.White
7575
val light_progress_bar_color = light_success_green
7676
val light_progress_bar_background_color = Color(0xFFCCD4E0)
7777
val light_grade_progress_bar_color = Color.Black
78+
val light_grade_progress_bar_background = light_background
79+
val light_assignment_card_border = Color(0xFFCCD4E0)
7880

7981
val dark_primary = Color(0xFF3F68F8)
8082
val dark_primary_variant = Color(0xFF3700B3)
@@ -149,3 +151,5 @@ val dark_settings_title_content = Color.White
149151
val dark_progress_bar_color = dark_success_green
150152
val dark_progress_bar_background_color = Color(0xFF8E9BAE)
151153
val dark_grade_progress_bar_color = Color.Transparent
154+
val dark_grade_progress_bar_background = Color(0xFF8E9BAE)
155+
val dark_assignment_card_border = Color(0xFF8E9BAE)

course/src/main/java/org/openedx/course/presentation/assignments/CourseContentAssignmentScreen.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private fun AssignmentGroupSection(
268268
if (isCompletedShown || progress.value != 1f) {
269269
if (assignments.size > 1) {
270270
LazyRow(
271-
horizontalArrangement = Arrangement.spacedBy(8.dp),
271+
horizontalArrangement = Arrangement.spacedBy(12.dp),
272272
modifier = Modifier.padding(vertical = 8.dp),
273273
contentPadding = PaddingValues(horizontal = 24.dp)
274274
) {
@@ -303,7 +303,7 @@ private fun AssignmentGroupSection(
303303
AssignmentDetails(
304304
modifier = Modifier
305305
.padding(horizontal = 24.dp)
306-
.padding(top = 8.dp),
306+
.padding(top = 12.dp),
307307
assignment = assignment,
308308
sectionName = sectionNames[assignment.id] ?: "",
309309
onAssignmentClick = onAssignmentClick
@@ -429,7 +429,7 @@ private fun AssignmentDetails(
429429
val color = when {
430430
assignment.isCompleted() -> MaterialTheme.appColors.successGreen
431431
isDuePast -> MaterialTheme.appColors.warning
432-
else -> MaterialTheme.appColors.cardViewBorder
432+
else -> MaterialTheme.appColors.assignmentCardBorder
433433
}
434434
val label = assignment.assignmentProgress?.label
435435
val description = when {
@@ -495,12 +495,14 @@ private fun AssignmentDetails(
495495
color = MaterialTheme.appColors.textDark
496496
)
497497
Text(
498+
modifier = Modifier.padding(top = 4.dp),
498499
text = assignment.displayName,
499500
style = MaterialTheme.appTypography.bodyLarge,
500501
color = MaterialTheme.appColors.textDark
501502
)
502503
if (description.isNotEmpty()) {
503504
Text(
505+
modifier = Modifier.padding(top = 6.dp),
504506
text = description,
505507
style = MaterialTheme.appTypography.bodySmall,
506508
color = MaterialTheme.appColors.textDark

course/src/main/java/org/openedx/course/presentation/container/CourseContainerFragment.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,18 +483,18 @@ private fun DashboardPager(
483483
onNavigateToContent = { contentTab ->
484484
scope.launch {
485485
// First scroll to CONTENT tab
486-
pagerState.animateScrollToPage(
486+
pagerState.scrollToPage(
487487
CourseContainerTab.entries.indexOf(CourseContainerTab.CONTENT)
488488
)
489489
// Then scroll to the specified content tab
490-
contentTabPagerState.animateScrollToPage(
490+
contentTabPagerState.scrollToPage(
491491
CourseContentTab.entries.indexOf(contentTab)
492492
)
493493
}
494494
},
495495
onNavigateToProgress = {
496496
scope.launch {
497-
pagerState.animateScrollToPage(
497+
pagerState.scrollToPage(
498498
CourseContainerTab.entries.indexOf(CourseContainerTab.PROGRESS)
499499
)
500500
}
@@ -582,7 +582,7 @@ private fun DashboardPager(
582582
onTabSelected = onContentTabSelected,
583583
onNavigateToHome = {
584584
scope.launch {
585-
pagerState.animateScrollToPage(
585+
pagerState.scrollToPage(
586586
CourseContainerTab.entries.indexOf(
587587
CourseContainerTab.HOME
588588
)
@@ -711,14 +711,14 @@ private fun SetupCourseAccessErrorButtons(
711711
@OptIn(ExperimentalFoundationApi::class)
712712
private fun scrollToDates(scope: CoroutineScope, pagerState: PagerState) {
713713
scope.launch {
714-
pagerState.animateScrollToPage(CourseContainerTab.entries.indexOf(CourseContainerTab.DATES))
714+
pagerState.scrollToPage(CourseContainerTab.entries.indexOf(CourseContainerTab.DATES))
715715
}
716716
}
717717

718718
@OptIn(ExperimentalFoundationApi::class)
719719
private fun scrollToProgress(scope: CoroutineScope, pagerState: PagerState) {
720720
scope.launch {
721-
pagerState.animateScrollToPage(CourseContainerTab.entries.indexOf(CourseContainerTab.PROGRESS))
721+
pagerState.scrollToPage(CourseContainerTab.entries.indexOf(CourseContainerTab.PROGRESS))
722722
}
723723
}
724724

@@ -734,6 +734,7 @@ private fun HomeNavigationRow(homePagerState: PagerState) {
734734
) {
735735
val isPreviousPageEnabled = homePagerState.currentPage > 0
736736
IconButton(
737+
modifier = Modifier.size(60.dp),
737738
enabled = homePagerState.currentPage > 0,
738739
onClick = {
739740
homeCoroutineScope.launch {
@@ -762,6 +763,7 @@ private fun HomeNavigationRow(homePagerState: PagerState) {
762763
)
763764
val isNextPageEnabled = homePagerState.currentPage < CourseHomePagerTab.entries.size - 1
764765
IconButton(
766+
modifier = Modifier.size(60.dp),
765767
enabled = isNextPageEnabled,
766768
onClick = {
767769
homeCoroutineScope.launch {

course/src/main/java/org/openedx/course/presentation/home/AssignmentsHomePagerCardContent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ private fun AssignmentCard(
163163

164164
// Due date status text
165165
val dueDateStatusText = assignment.due?.let { due ->
166-
val formattedDate = TimeUtils.formatToDayMonth(due)
166+
val formattedDate = TimeUtils.formatToMonthDay(due)
167167
val daysDifference = ((due.time - Date().time) / MILLISECONDS_PER_DAY).toInt()
168168
when {
169169
daysDifference < 0 -> {

course/src/main/java/org/openedx/course/presentation/home/CourseHomeScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,14 @@ fun ViewAllButton(
397397
Icon(
398398
imageVector = Icons.AutoMirrored.Filled.List,
399399
contentDescription = null,
400-
tint = MaterialTheme.appColors.primary,
400+
tint = MaterialTheme.appColors.textAccent,
401401
modifier = Modifier.size(20.dp)
402402
)
403403
Spacer(modifier = Modifier.width(8.dp))
404404
Text(
405405
text = text,
406406
style = MaterialTheme.appTypography.labelLarge,
407-
color = MaterialTheme.appColors.primary
407+
color = MaterialTheme.appColors.textAccent
408408
)
409409
}
410410
}

course/src/main/java/org/openedx/course/presentation/progress/CourseProgressScreen.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ fun GradeProgressBar(
519519
Box(
520520
modifier = Modifier
521521
.weight(notCompletedWeightedGradePercent)
522+
.background(MaterialTheme.appColors.gradeProgressBarBackground)
522523
.fillMaxHeight()
523524
)
524525
}

0 commit comments

Comments
 (0)