diff --git a/auth/src/main/java/org/openedx/auth/presentation/restore/RestorePasswordFragment.kt b/auth/src/main/java/org/openedx/auth/presentation/restore/RestorePasswordFragment.kt
index dd530bfa0..9b0740652 100644
--- a/auth/src/main/java/org/openedx/auth/presentation/restore/RestorePasswordFragment.kt
+++ b/auth/src/main/java/org/openedx/auth/presentation/restore/RestorePasswordFragment.kt
@@ -289,7 +289,7 @@ private fun RestorePasswordScreen(
}
} else {
OpenEdXButton(
- width = buttonWidth.testTag("btn_reset_password"),
+ modifier = buttonWidth.testTag("btn_reset_password"),
text = stringResource(id = authR.string.auth_reset_password),
onClick = {
onRestoreButtonClick(email)
@@ -337,7 +337,7 @@ private fun RestorePasswordScreen(
)
Spacer(Modifier.height(48.dp))
OpenEdXButton(
- width = buttonWidth,
+ modifier = buttonWidth,
text = stringResource(id = R.string.core_sign_in),
onClick = {
onBackClick()
diff --git a/auth/src/main/java/org/openedx/auth/presentation/signin/compose/SignInView.kt b/auth/src/main/java/org/openedx/auth/presentation/signin/compose/SignInView.kt
index c40884d6f..77e290994 100644
--- a/auth/src/main/java/org/openedx/auth/presentation/signin/compose/SignInView.kt
+++ b/auth/src/main/java/org/openedx/auth/presentation/signin/compose/SignInView.kt
@@ -273,7 +273,7 @@ private fun AuthForm(
CircularProgressIndicator(color = MaterialTheme.appColors.primary)
} else {
OpenEdXButton(
- width = buttonWidth.testTag("btn_sign_in"),
+ modifier = buttonWidth.testTag("btn_sign_in"),
text = stringResource(id = coreR.string.core_sign_in),
onClick = {
onEvent(AuthEvent.SignIn(login = login, password = password))
diff --git a/auth/src/main/java/org/openedx/auth/presentation/signup/compose/SignUpView.kt b/auth/src/main/java/org/openedx/auth/presentation/signup/compose/SignUpView.kt
index 2852ab5fe..2e2180d83 100644
--- a/auth/src/main/java/org/openedx/auth/presentation/signup/compose/SignUpView.kt
+++ b/auth/src/main/java/org/openedx/auth/presentation/signup/compose/SignUpView.kt
@@ -435,7 +435,7 @@ internal fun SignUpView(
}
} else {
OpenEdXButton(
- width = buttonWidth.testTag("btn_create_account"),
+ modifier = buttonWidth.testTag("btn_create_account"),
text = stringResource(id = R.string.auth_create_account),
onClick = {
showErrorMap.clear()
diff --git a/auth/src/main/java/org/openedx/auth/presentation/ui/SocialAuthView.kt b/auth/src/main/java/org/openedx/auth/presentation/ui/SocialAuthView.kt
index c9d73662b..336c09f8f 100644
--- a/auth/src/main/java/org/openedx/auth/presentation/ui/SocialAuthView.kt
+++ b/auth/src/main/java/org/openedx/auth/presentation/ui/SocialAuthView.kt
@@ -74,7 +74,7 @@ internal fun SocialAuthView(
R.string.auth_continue_facebook
}
OpenEdXButton(
- width = Modifier
+ modifier = Modifier
.testTag("btn_facebook_auth")
.padding(top = 12.dp)
.fillMaxWidth(),
@@ -106,7 +106,7 @@ internal fun SocialAuthView(
R.string.auth_continue_microsoft
}
OpenEdXButton(
- width = Modifier
+ modifier = Modifier
.testTag("btn_microsoft_auth")
.padding(top = 12.dp)
.fillMaxWidth(),
diff --git a/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt b/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt
index afa8d7b12..7961e6d46 100644
--- a/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt
+++ b/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt
@@ -40,7 +40,6 @@ import androidx.compose.material.TextFieldDefaults
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Search
-import androidx.compose.material.icons.filled.Wifi
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.NonRestartableComposable
@@ -1045,32 +1044,40 @@ fun OfflineModeDialog(
Row(
Modifier
.fillMaxWidth()
- .padding(16.dp),
+ .padding(vertical = 10.dp, horizontal = 24.dp),
horizontalArrangement = Arrangement.SpaceBetween
) {
- Text(
- modifier = Modifier.testTag("txt_offline_label"),
+ IconText(
text = stringResource(id = R.string.core_offline),
- style = MaterialTheme.appTypography.labelMedium,
- color = MaterialTheme.appColors.textDark
+ painter = painterResource(id = R.drawable.core_ic_offline),
+ color = Color.Black,
+ textStyle = MaterialTheme.appTypography.titleSmall
)
- Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
- Text(
- modifier = Modifier
- .testTag("txt_dismiss")
- .clickable { onDismissCLick() },
- text = stringResource(id = R.string.core_dismiss),
- style = MaterialTheme.appTypography.labelMedium,
- color = MaterialTheme.appColors.primary
- )
- Text(
- modifier = Modifier
- .testTag("txt_reload")
- .clickable { onReloadClick() },
- text = stringResource(id = R.string.core_reload),
- style = MaterialTheme.appTypography.labelMedium,
- color = MaterialTheme.appColors.primary
- )
+ Row(horizontalArrangement = Arrangement.spacedBy(36.dp)) {
+ IconButton(
+ modifier = Modifier.size(20.dp),
+ onClick = {
+ onReloadClick()
+ }) {
+ Icon(
+ modifier = Modifier.size(20.dp),
+ painter = painterResource(R.drawable.core_ic_reload),
+ contentDescription = null,
+ tint = MaterialTheme.appColors.primary
+ )
+ }
+ IconButton(
+ modifier = Modifier.size(20.dp),
+ onClick = {
+ onDismissCLick()
+ }) {
+ Icon(
+ modifier = Modifier.size(20.dp),
+ painter = painterResource(R.drawable.core_ic_close),
+ contentDescription = null,
+ tint = Color.Black
+ )
+ }
}
}
}
@@ -1078,7 +1085,7 @@ fun OfflineModeDialog(
@Composable
fun OpenEdXButton(
- width: Modifier = Modifier.fillMaxWidth(),
+ modifier: Modifier = Modifier.fillMaxWidth(),
text: String = "",
onClick: () -> Unit,
enabled: Boolean = true,
@@ -1088,7 +1095,7 @@ fun OpenEdXButton(
Button(
modifier = Modifier
.testTag("btn_${text.tagId()}")
- .then(width)
+ .then(modifier)
.height(42.dp),
shape = MaterialTheme.appShapes.buttonShape,
colors = ButtonDefaults.buttonColors(
@@ -1171,23 +1178,29 @@ fun ConnectionErrorView(
) {
Icon(
modifier = Modifier.size(100.dp),
- imageVector = Icons.Filled.Wifi,
+ painter = painterResource(id = R.drawable.core_no_internet_connection),
contentDescription = null,
tint = MaterialTheme.appColors.onSurface
)
+ Spacer(Modifier.height(28.dp))
+ Text(
+ modifier = Modifier.fillMaxWidth(0.8f),
+ text = stringResource(id = R.string.core_not_internet_connection),
+ color = MaterialTheme.appColors.textPrimary,
+ style = MaterialTheme.appTypography.titleLarge,
+ textAlign = TextAlign.Center
+ )
Spacer(Modifier.height(16.dp))
Text(
- modifier = Modifier
- .testTag("txt_connection_error_label")
- .fillMaxWidth(0.6f),
- text = stringResource(id = R.string.core_not_connected_to_internet),
+ modifier = Modifier.fillMaxWidth(0.8f),
+ text = stringResource(id = R.string.core_not_internet_connection_description),
color = MaterialTheme.appColors.textPrimary,
- style = MaterialTheme.appTypography.titleMedium,
+ style = MaterialTheme.appTypography.bodyLarge,
textAlign = TextAlign.Center
)
Spacer(Modifier.height(16.dp))
OpenEdXButton(
- width = Modifier
+ modifier = Modifier
.widthIn(Dp.Unspecified, 162.dp),
text = stringResource(id = R.string.core_reload),
onClick = onReloadClick
@@ -1202,7 +1215,7 @@ fun AuthButtonsPanel(
) {
Row {
OpenEdXButton(
- width = Modifier
+ modifier = Modifier
.testTag("btn_register")
.width(0.dp)
.weight(1f),
diff --git a/core/src/main/res/drawable/core_ic_close.xml b/core/src/main/res/drawable/core_ic_close.xml
new file mode 100644
index 000000000..edfd3eb3f
--- /dev/null
+++ b/core/src/main/res/drawable/core_ic_close.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
diff --git a/core/src/main/res/drawable/core_ic_offline.xml b/core/src/main/res/drawable/core_ic_offline.xml
new file mode 100644
index 000000000..226f1dfae
--- /dev/null
+++ b/core/src/main/res/drawable/core_ic_offline.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/core/src/main/res/drawable/core_ic_reload.xml b/core/src/main/res/drawable/core_ic_reload.xml
new file mode 100644
index 000000000..00af32593
--- /dev/null
+++ b/core/src/main/res/drawable/core_ic_reload.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
diff --git a/core/src/main/res/drawable/core_no_internet_connection.xml b/core/src/main/res/drawable/core_no_internet_connection.xml
new file mode 100644
index 000000000..89af2f689
--- /dev/null
+++ b/core/src/main/res/drawable/core_no_internet_connection.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/core/src/main/res/values-uk/strings.xml b/core/src/main/res/values-uk/strings.xml
index 5287ad2ea..b012036fb 100644
--- a/core/src/main/res/values-uk/strings.xml
+++ b/core/src/main/res/values-uk/strings.xml
@@ -58,7 +58,6 @@
Оцінити нас
Дякуємо за надання відгуку. Чи бажаєте ви поділитися своєю оцінкою цього додатка з іншими користувачами в магазині додатків?
Ми отримали ваш відгук і використовуватимемо його, щоб покращити ваш досвід навчання в майбутньому. Дякуємо, що поділилися!
- Ви не підключені до Інтернету. Будь ласка, перевірте ваше підключення до Інтернету.
Зареєструватися
Увійти
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 10ed72367..6e242f0e4 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -73,7 +73,8 @@
Rate Us
Thank you for sharing your feedback with us. Would you like to share your review of this app with other users on the app store?
We received your feedback and will use it to help improve your learning experience going forward. Thank you for sharing!
- You are not connected to the Internet. Please check your Internet connection.
+ No internet connection
+ Please connect to the internet to view this content.
OK
Continue
Leaving the app
diff --git a/course/src/main/java/org/openedx/course/presentation/detail/CourseDetailsFragment.kt b/course/src/main/java/org/openedx/course/presentation/detail/CourseDetailsFragment.kt
index 8b031fc4f..15e936a84 100644
--- a/course/src/main/java/org/openedx/course/presentation/detail/CourseDetailsFragment.kt
+++ b/course/src/main/java/org/openedx/course/presentation/detail/CourseDetailsFragment.kt
@@ -169,7 +169,7 @@ internal fun CourseDetailsScreen(
val scaffoldState = rememberScaffoldState()
val configuration = LocalConfiguration.current
- var isInternetConnectionShown by rememberSaveable {
+ val isInternetConnectionShown = rememberSaveable {
mutableStateOf(false)
}
@@ -262,6 +262,8 @@ internal fun CourseDetailsScreen(
CourseDetailNativeContentLandscape(
windowSize = windowSize,
apiHostUrl = apiHostUrl,
+ hasInternetConnection = hasInternetConnection,
+ isInternetConnectionShown = isInternetConnectionShown,
course = uiState.course,
onButtonClick = {
onButtonClick()
@@ -271,6 +273,8 @@ internal fun CourseDetailsScreen(
CourseDetailNativeContent(
windowSize = windowSize,
apiHostUrl = apiHostUrl,
+ hasInternetConnection = hasInternetConnection,
+ isInternetConnectionShown = isInternetConnectionShown,
course = uiState.course,
onButtonClick = {
onButtonClick()
@@ -285,7 +289,7 @@ internal fun CourseDetailsScreen(
.padding(all = 20.dp),
)
} else {
- var webViewAlpha by remember { mutableStateOf(0f) }
+ var webViewAlpha by remember { mutableFloatStateOf(0f) }
if (webViewAlpha == 0f) {
Box(
modifier = Modifier
@@ -315,16 +319,16 @@ internal fun CourseDetailsScreen(
}
}
}
- if (!isInternetConnectionShown && !hasInternetConnection) {
+ if (!isInternetConnectionShown.value && !hasInternetConnection) {
OfflineModeDialog(
Modifier
.fillMaxWidth()
.align(Alignment.BottomCenter),
onDismissCLick = {
- isInternetConnectionShown = true
+ isInternetConnectionShown.value = true
},
onReloadClick = {
- isInternetConnectionShown = true
+ isInternetConnectionShown.value = true
onReloadClick()
}
)
@@ -341,6 +345,8 @@ private fun CourseDetailNativeContent(
windowSize: WindowSize,
apiHostUrl: String,
course: Course,
+ hasInternetConnection: Boolean,
+ isInternetConnectionShown: MutableState,
onButtonClick: () -> Unit,
) {
val uriHandler = LocalUriHandler.current
@@ -402,7 +408,11 @@ private fun CourseDetailNativeContent(
.padding(horizontal = contentHorizontalPadding)
) {
val enrollmentEnd = course.enrollmentEnd
- if (enrollmentEnd != null && Date() > enrollmentEnd) {
+ if (!hasInternetConnection) {
+ isInternetConnectionShown.value = true
+ NoInternetLabel()
+ Spacer(Modifier.height(24.dp))
+ } else if (enrollmentEnd != null && Date() > enrollmentEnd) {
EnrollOverLabel()
Spacer(Modifier.height(24.dp))
}
@@ -429,7 +439,7 @@ private fun CourseDetailNativeContent(
if (!(enrollmentEnd != null && Date() > enrollmentEnd)) {
Spacer(Modifier.height(32.dp))
OpenEdXButton(
- width = buttonWidth,
+ modifier = buttonWidth,
text = buttonText,
onClick = onButtonClick
)
@@ -444,6 +454,8 @@ private fun CourseDetailNativeContentLandscape(
windowSize: WindowSize,
apiHostUrl: String,
course: Course,
+ hasInternetConnection: Boolean,
+ isInternetConnectionShown: MutableState,
onButtonClick: () -> Unit,
) {
val uriHandler = LocalUriHandler.current
@@ -496,12 +508,16 @@ private fun CourseDetailNativeContentLandscape(
Spacer(Modifier.height(42.dp))
}
val enrollmentEnd = course.enrollmentEnd
- if (enrollmentEnd != null && Date() > enrollmentEnd) {
- Spacer(Modifier.height(4.dp))
+ if (!hasInternetConnection) {
+ isInternetConnectionShown.value = true
+ NoInternetLabel()
+ Spacer(Modifier.height(24.dp))
+ } else if (enrollmentEnd != null && Date() > enrollmentEnd) {
EnrollOverLabel()
+ Spacer(Modifier.height(24.dp))
} else {
OpenEdXButton(
- width = buttonWidth,
+ modifier = buttonWidth,
text = buttonText,
onClick = onButtonClick
)
@@ -586,6 +602,55 @@ private fun EnrollOverLabel() {
}
}
+@Composable
+private fun NoInternetLabel() {
+ val borderColor = if (!isSystemInDarkTheme()) {
+ MaterialTheme.appColors.cardViewBorder
+ } else {
+ MaterialTheme.appColors.surface
+ }
+ Box(
+ Modifier
+ .fillMaxWidth()
+ .shadow(
+ 0.dp,
+ MaterialTheme.appShapes.material.medium
+ )
+ .background(
+ MaterialTheme.appColors.surface,
+ MaterialTheme.appShapes.material.medium
+ )
+ .border(
+ 1.dp,
+ borderColor,
+ MaterialTheme.appShapes.material.medium
+ )
+ ) {
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(
+ horizontal = 16.dp,
+ vertical = 12.dp
+ ),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Icon(
+ painter = painterResource(id = org.openedx.core.R.drawable.core_ic_offline),
+ contentDescription = null,
+ tint = MaterialTheme.appColors.warning
+ )
+ Spacer(Modifier.width(12.dp))
+ Text(
+ modifier = Modifier.testTag("txt_enroll_internet_error"),
+ text = stringResource(id = courseR.string.course_no_internet_label),
+ color = MaterialTheme.appColors.textPrimaryVariant,
+ style = MaterialTheme.appTypography.titleSmall
+ )
+ }
+ }
+}
+
@Composable
@SuppressLint("SetJavaScriptEnabled")
private fun CourseDescription(
diff --git a/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineFragment.kt b/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineFragment.kt
index f00055fa9..e8af61b51 100644
--- a/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineFragment.kt
+++ b/course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineFragment.kt
@@ -598,7 +598,7 @@ private fun ResumeCourseTablet(
}
}
OpenEdXButton(
- width = Modifier.width(210.dp),
+ modifier = Modifier.width(210.dp),
text = stringResource(id = org.openedx.course.R.string.course_resume),
onClick = {
onResumeClick(block.id)
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 051466d25..cd2512cc2 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
@@ -1149,7 +1149,7 @@ fun CourseDatesBannerTablet(
}
banner.bannerType.buttonResId.nonZero()?.let {
OpenEdXButton(
- width = Modifier.width(210.dp),
+ modifier = Modifier.width(210.dp),
text = stringResource(id = it),
onClick = resetDates,
)
diff --git a/course/src/main/res/values/strings.xml b/course/src/main/res/values/strings.xml
index a7ab325b3..adc75f32f 100644
--- a/course/src/main/res/values/strings.xml
+++ b/course/src/main/res/values/strings.xml
@@ -32,6 +32,7 @@
Back to outline
Next section
You cannot enroll in this course because the enrollment date is over.
+ To enroll in this course, please make sure you are connected to the internet.
This course hasn’t started yet.
You are not connected to the Internet. Please check your Internet connection.
Course
diff --git a/dashboard/src/main/java/org/openedx/dashboard/presentation/dashboard/DashboardFragment.kt b/dashboard/src/main/java/org/openedx/dashboard/presentation/dashboard/DashboardFragment.kt
index 0582f663e..85cd83d5d 100644
--- a/dashboard/src/main/java/org/openedx/dashboard/presentation/dashboard/DashboardFragment.kt
+++ b/dashboard/src/main/java/org/openedx/dashboard/presentation/dashboard/DashboardFragment.kt
@@ -513,16 +513,6 @@ private fun EmptyState() {
tint = MaterialTheme.appColors.textFieldBorder
)
Spacer(Modifier.height(16.dp))
- Text(
- modifier = Modifier
- .testTag("txt_empty_state_title")
- .fillMaxWidth(),
- text = stringResource(id = R.string.dashboard_its_empty),
- color = MaterialTheme.appColors.textPrimary,
- style = MaterialTheme.appTypography.titleMedium,
- textAlign = TextAlign.Center
- )
- Spacer(Modifier.height(8.dp))
Text(
modifier = Modifier
.testTag("txt_empty_state_description")
diff --git a/dashboard/src/main/res/values-uk/strings.xml b/dashboard/src/main/res/values-uk/strings.xml
index 4217c5d50..048b62203 100644
--- a/dashboard/src/main/res/values-uk/strings.xml
+++ b/dashboard/src/main/res/values-uk/strings.xml
@@ -3,6 +3,5 @@
Мої курси
Курси
Ласкаво просимо назад. Продовжуймо навчатися.
- It\'s empty
You are not enrolled in any courses yet.
\ No newline at end of file
diff --git a/dashboard/src/main/res/values/strings.xml b/dashboard/src/main/res/values/strings.xml
index 5eb61aadc..4ba7b2f24 100644
--- a/dashboard/src/main/res/values/strings.xml
+++ b/dashboard/src/main/res/values/strings.xml
@@ -4,7 +4,6 @@
Courses
Programs
Welcome back. Let\'s keep learning.
- It\'s empty
You are not enrolled in any courses yet.
You have been successfully enrolled in this course.
diff --git a/discussion/src/main/java/org/openedx/discussion/presentation/threads/DiscussionAddThreadFragment.kt b/discussion/src/main/java/org/openedx/discussion/presentation/threads/DiscussionAddThreadFragment.kt
index dda5a41f4..7604b1927 100644
--- a/discussion/src/main/java/org/openedx/discussion/presentation/threads/DiscussionAddThreadFragment.kt
+++ b/discussion/src/main/java/org/openedx/discussion/presentation/threads/DiscussionAddThreadFragment.kt
@@ -385,7 +385,7 @@ private fun DiscussionAddThreadScreen(
CircularProgressIndicator(color = MaterialTheme.appColors.primary)
} else {
OpenEdXButton(
- width = buttonWidth,
+ modifier = buttonWidth,
text = stringResource(id = discussionR.string.discussion_create_post),
onClick = {
onPostDiscussionClick(
diff --git a/profile/src/main/java/org/openedx/profile/presentation/edit/EditProfileFragment.kt b/profile/src/main/java/org/openedx/profile/presentation/edit/EditProfileFragment.kt
index fc64eb733..b885ce22c 100644
--- a/profile/src/main/java/org/openedx/profile/presentation/edit/EditProfileFragment.kt
+++ b/profile/src/main/java/org/openedx/profile/presentation/edit/EditProfileFragment.kt
@@ -135,6 +135,7 @@ import org.openedx.core.ui.theme.OpenEdXTheme
import org.openedx.core.ui.theme.appColors
import org.openedx.core.ui.theme.appShapes
import org.openedx.core.ui.theme.appTypography
+import org.openedx.core.ui.theme.light_text_dark
import org.openedx.core.ui.windowSizeValue
import org.openedx.core.utils.LocaleUtils
import org.openedx.profile.R
@@ -763,6 +764,7 @@ private fun LimitedProfileDialog(
modifier: Modifier,
onCloseClick: () -> Unit
) {
+ val tint = light_text_dark
Column(
modifier
.shadow(
@@ -784,14 +786,14 @@ private fun LimitedProfileDialog(
Icon(
imageVector = Icons.Outlined.Report,
contentDescription = null,
- tint = MaterialTheme.appColors.textDark
+ tint = tint
)
Text(
modifier = Modifier
.testTag("txt_edit_profile_limited_profile_message")
.weight(1f),
text = stringResource(id = R.string.profile_must_be_over),
- color = MaterialTheme.appColors.textDark,
+ color = tint,
style = MaterialTheme.appTypography.labelLarge
)
Icon(
@@ -800,7 +802,7 @@ private fun LimitedProfileDialog(
.clickable { onCloseClick() },
imageVector = Icons.Filled.Close,
contentDescription = null,
- tint = MaterialTheme.appColors.textDark
+ tint = tint
)
}
}