diff --git a/dashboard/src/main/java/org/openedx/dashboard/presentation/DashboardListFragment.kt b/dashboard/src/main/java/org/openedx/dashboard/presentation/DashboardListFragment.kt
index fefcde867..eea1b9db1 100644
--- a/dashboard/src/main/java/org/openedx/dashboard/presentation/DashboardListFragment.kt
+++ b/dashboard/src/main/java/org/openedx/dashboard/presentation/DashboardListFragment.kt
@@ -24,7 +24,9 @@ import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
+import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.verticalScroll
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.Divider
import androidx.compose.material.ExperimentalMaterialApi
@@ -35,6 +37,7 @@ import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowForward
+import androidx.compose.material.icons.filled.AccessTime
import androidx.compose.material.pullrefresh.PullRefreshIndicator
import androidx.compose.material.pullrefresh.pullRefresh
import androidx.compose.material.pullrefresh.rememberPullRefreshState
@@ -305,7 +308,7 @@ internal fun DashboardListView(
is DashboardUIState.Empty -> {
Box(
modifier = Modifier.fillMaxSize(),
- contentAlignment = Alignment.Center
+ contentAlignment = Alignment.Center,
) {
Column(
Modifier
@@ -475,13 +478,18 @@ private fun CourseItem(
@Composable
private fun EmptyState() {
- Box(
- modifier = Modifier.fillMaxSize(),
- contentAlignment = Alignment.Center
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .verticalScroll(rememberScrollState()),
+ horizontalAlignment = Alignment.CenterHorizontally,
) {
Column(
- Modifier.width(185.dp),
- horizontalAlignment = Alignment.CenterHorizontally
+ Modifier
+ .fillMaxSize()
+ .weight(1f),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = Arrangement.Center,
) {
Icon(
painter = painterResource(id = R.drawable.dashboard_ic_empty),
@@ -499,6 +507,13 @@ private fun EmptyState() {
textAlign = TextAlign.Center
)
}
+ Text(
+ modifier = Modifier.fillMaxWidth(),
+ text = stringResource(id = R.string.dashboard_pull_to_refresh),
+ color = MaterialTheme.appColors.textSecondary,
+ style = MaterialTheme.appTypography.labelSmall,
+ textAlign = TextAlign.Center
+ )
}
}
@@ -577,6 +592,29 @@ private fun DashboardListViewTabletPreview() {
}
}
+
+@Preview(uiMode = UI_MODE_NIGHT_NO)
+@Preview(uiMode = UI_MODE_NIGHT_YES)
+@Composable
+private fun EmptyStatePreview() {
+ OpenEdXTheme {
+ DashboardListView(
+ windowSize = WindowSize(WindowType.Compact, WindowType.Compact),
+ apiHostUrl = "http://localhost:8000",
+ state = DashboardUIState.Empty,
+ uiMessage = null,
+ onSwipeRefresh = {},
+ onItemClick = {},
+ onReloadClick = {},
+ hasInternetConnection = true,
+ refreshing = false,
+ canLoadMore = false,
+ paginationCallback = {},
+ appUpgradeParameters = AppUpdateState.AppUpgradeParameters()
+ )
+ }
+}
+
private val mockCourseAssignments = CourseAssignments(null, emptyList())
private val mockCourseEnrolled = EnrolledCourse(
auditAccessExpires = Date(),
diff --git a/dashboard/src/main/res/values/strings.xml b/dashboard/src/main/res/values/strings.xml
index 80c05bc42..01979f21d 100644
--- a/dashboard/src/main/res/values/strings.xml
+++ b/dashboard/src/main/res/values/strings.xml
@@ -19,6 +19,7 @@
You are not currently enrolled in any courses, would you like to explore the course catalog?
Find a Course
No %1$s Courses
+ Swipe down to refresh
- %1$d Past Due Assignment