Skip to content

Commit ab8111f

Browse files
feat: all content tab
1 parent 12f3d75 commit ab8111f

File tree

18 files changed

+363
-492
lines changed

18 files changed

+363
-492
lines changed

app/src/main/java/org/openedx/app/di/ScreenModule.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ val screenModule = module {
338338
get(),
339339
get(),
340340
get(),
341-
get(),
342341
)
343342
}
344343
viewModel { (courseId: String) -> BaseVideoViewModel(courseId, get()) }

core/src/main/java/org/openedx/core/extension/ListExt.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ fun List<Block>.getVerticalBlocks(): List<Block> {
1010
fun List<Block>.getSequentialBlocks(): List<Block> {
1111
return this.filter { it.type == BlockType.SEQUENTIAL }
1212
}
13+
14+
fun List<Block>.getChapterBlocks(): List<Block> {
15+
return this.filter { it.type == BlockType.CHAPTER }
16+
}

core/src/main/java/org/openedx/core/ui/ComposeCommon.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,9 @@ fun OfflineModeDialog(
983983

984984
@Composable
985985
fun OpenEdXButton(
986-
modifier: Modifier = Modifier.fillMaxWidth(),
986+
modifier: Modifier = Modifier
987+
.fillMaxWidth()
988+
.height(42.dp),
987989
text: String = "",
988990
onClick: () -> Unit,
989991
enabled: Boolean = true,
@@ -994,8 +996,7 @@ fun OpenEdXButton(
994996
Button(
995997
modifier = Modifier
996998
.testTag("btn_${text.tagId()}")
997-
.then(modifier)
998-
.height(42.dp),
999+
.then(modifier),
9991000
shape = MaterialTheme.appShapes.buttonShape,
10001001
colors = ButtonDefaults.buttonColors(
10011002
backgroundColor = backgroundColor

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ data class AppShapes(
1313
val textFieldShape: CornerBasedShape,
1414
val screenBackgroundShape: CornerBasedShape,
1515
val cardShape: CornerBasedShape,
16+
val sectionCardShape: CornerBasedShape,
1617
val screenBackgroundShapeFull: CornerBasedShape,
1718
val courseImageShape: CornerBasedShape,
1819
val dialogShape: CornerBasedShape,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ val light_tab_selected_btn_content = Color.White
7272
val light_course_home_header_shade = Color(0xFFBABABA)
7373
val light_course_home_back_btn_background = Color.White
7474
val light_settings_title_content = Color.White
75-
val light_progress_bar_color = light_primary
75+
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
7878

@@ -146,6 +146,6 @@ val dark_tab_selected_btn_content = Color.White
146146
val dark_course_home_header_shade = Color(0xFF999999)
147147
val dark_course_home_back_btn_background = Color.Black
148148
val dark_settings_title_content = Color.White
149-
val dark_progress_bar_color = light_primary
149+
val dark_progress_bar_color = dark_success_green
150150
val dark_progress_bar_background_color = Color(0xFF8E9BAE)
151151
val dark_grade_progress_bar_color = Color.Transparent

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ internal val LocalShapes = staticCompositionLocalOf {
2020
cardShape = RoundedCornerShape(12.dp),
2121
screenBackgroundShapeFull = RoundedCornerShape(24.dp),
2222
courseImageShape = RoundedCornerShape(8.dp),
23-
dialogShape = RoundedCornerShape(24.dp)
23+
dialogShape = RoundedCornerShape(24.dp),
24+
sectionCardShape = RoundedCornerShape(6.dp),
2425
)
2526
}

course/src/main/java/org/openedx/course/presentation/CourseRouter.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package org.openedx.course.presentation
22

33
import androidx.fragment.app.FragmentManager
44
import org.openedx.core.presentation.course.CourseViewMode
5-
import org.openedx.core.presentation.settings.video.VideoQualityType
65
import org.openedx.course.presentation.handouts.HandoutsType
76

87
interface CourseRouter {
@@ -63,7 +62,5 @@ interface CourseRouter {
6362

6463
fun navigateToDownloadQueue(fm: FragmentManager, descendants: List<String> = arrayListOf())
6564

66-
fun navigateToVideoQuality(fm: FragmentManager, videoQualityType: VideoQualityType)
67-
6865
fun navigateToDiscover(fm: FragmentManager)
6966
}

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

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ import org.openedx.core.utils.TimeUtils
8383
import org.openedx.course.DatesShiftedSnackBar
8484
import org.openedx.course.R
8585
import org.openedx.course.databinding.FragmentCourseContainerBinding
86+
import org.openedx.course.presentation.contenttab.ContentScreen
8687
import org.openedx.course.presentation.dates.CourseDatesScreen
8788
import org.openedx.course.presentation.handouts.HandoutsScreen
8889
import org.openedx.course.presentation.handouts.HandoutsType
@@ -265,7 +266,6 @@ fun CourseDashboard(
265266
val uiMessage by viewModel.uiMessage.collectAsState(null)
266267
val requiredTab = when (openTab.uppercase()) {
267268
CourseContainerTab.HOME.name -> CourseContainerTab.HOME
268-
CourseContainerTab.VIDEOS.name -> CourseContainerTab.VIDEOS
269269
CourseContainerTab.DATES.name -> CourseContainerTab.DATES
270270
CourseContainerTab.DISCUSSIONS.name -> CourseContainerTab.DISCUSSIONS
271271
CourseContainerTab.PROGRESS.name -> CourseContainerTab.PROGRESS
@@ -365,8 +365,7 @@ fun CourseDashboard(
365365
)
366366
}
367367

368-
else -> {
369-
}
368+
else -> {}
370369
}
371370
}
372371
)
@@ -431,26 +430,7 @@ private fun DashboardPager(
431430
) { page ->
432431
when (CourseContainerTab.entries[page]) {
433432
CourseContainerTab.HOME -> {
434-
CourseOutlineScreen(
435-
windowSize = windowSize,
436-
viewModel = koinViewModel(
437-
parameters = { parametersOf(viewModel.courseId, viewModel.courseName) }
438-
),
439-
fragmentManager = fragmentManager,
440-
onResetDatesClick = {
441-
viewModel.onRefresh(CourseContainerTab.DATES)
442-
}
443-
)
444-
}
445433

446-
CourseContainerTab.VIDEOS -> {
447-
CourseVideosScreen(
448-
windowSize = windowSize,
449-
viewModel = koinViewModel(
450-
parameters = { parametersOf(viewModel.courseId, viewModel.courseName) }
451-
),
452-
fragmentManager = fragmentManager
453-
)
454434
}
455435

456436
CourseContainerTab.DATES -> {
@@ -519,6 +499,15 @@ private fun DashboardPager(
519499
}
520500
)
521501
}
502+
503+
CourseContainerTab.CONTENT -> {
504+
ContentScreen(
505+
windowSize = windowSize,
506+
fragmentManager = fragmentManager,
507+
courseId = viewModel.courseId,
508+
courseName = viewModel.courseName
509+
)
510+
}
522511
}
523512
}
524513
}

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package org.openedx.course.presentation.container
33
import androidx.annotation.StringRes
44
import androidx.compose.material.icons.Icons
55
import androidx.compose.material.icons.automirrored.filled.Chat
6+
import androidx.compose.material.icons.automirrored.filled.List
67
import androidx.compose.material.icons.automirrored.filled.TextSnippet
78
import androidx.compose.material.icons.filled.CloudDownload
89
import androidx.compose.material.icons.filled.Home
910
import androidx.compose.material.icons.filled.Moving
1011
import androidx.compose.material.icons.outlined.CalendarMonth
11-
import androidx.compose.material.icons.rounded.PlayCircleFilled
1212
import androidx.compose.ui.graphics.vector.ImageVector
1313
import org.openedx.core.ui.TabItem
1414
import org.openedx.course.R
@@ -19,10 +19,19 @@ enum class CourseContainerTab(
1919
override val icon: ImageVector,
2020
) : TabItem {
2121
HOME(R.string.course_container_nav_home, Icons.Default.Home),
22-
VIDEOS(R.string.course_container_nav_videos, Icons.Rounded.PlayCircleFilled),
22+
CONTENT(R.string.course_container_nav_content, Icons.AutoMirrored.Filled.List),
2323
PROGRESS(R.string.course_container_nav_progress, Icons.Default.Moving),
2424
DATES(R.string.course_container_nav_dates, Icons.Outlined.CalendarMonth),
2525
OFFLINE(R.string.course_container_nav_downloads, Icons.Filled.CloudDownload),
2626
DISCUSSIONS(R.string.course_container_nav_discussions, Icons.AutoMirrored.Filled.Chat),
2727
MORE(R.string.course_container_nav_more, Icons.AutoMirrored.Filled.TextSnippet),
2828
}
29+
30+
enum class CourseContentTab(
31+
@StringRes
32+
val labelResId: Int
33+
) {
34+
ALL(R.string.course_container_content_tab_all),
35+
VIDEOS(R.string.course_container_content_tab_video),
36+
ASSIGNMENTS(R.string.course_container_content_tab_assignment)
37+
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class CourseContainerViewModel(
284284
updateData()
285285
}
286286

287-
CourseContainerTab.VIDEOS -> {
287+
CourseContainerTab.CONTENT -> {
288288
updateData()
289289
}
290290

@@ -332,7 +332,8 @@ class CourseContainerViewModel(
332332
fun courseContainerTabClickedEvent(index: Int) {
333333
when (CourseContainerTab.entries[index]) {
334334
CourseContainerTab.HOME -> courseTabClickedEvent()
335-
CourseContainerTab.VIDEOS -> videoTabClickedEvent()
335+
CourseContainerTab.CONTENT -> { /* TODO log event */
336+
}
336337
CourseContainerTab.DISCUSSIONS -> discussionTabClickedEvent()
337338
CourseContainerTab.DATES -> datesTabClickedEvent()
338339
CourseContainerTab.PROGRESS -> progressTabClickedEvent()

0 commit comments

Comments
 (0)