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/auth/src/main/res/drawable/auth_ic_email.xml b/auth/src/main/res/drawable/auth_ic_email.xml index c76bdb4c0..3fdb37de2 100644 --- a/auth/src/main/res/drawable/auth_ic_email.xml +++ b/auth/src/main/res/drawable/auth_ic_email.xml @@ -1,34 +1,10 @@ - - - - - - - - - + android:width="85dp" + android:height="66dp" + android:viewportWidth="85" + android:viewportHeight="66"> + 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 7114426c1..17ac1524b 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 @@ -1046,32 +1045,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), + imageVector = Icons.Filled.Close, + contentDescription = null, + tint = Color.Black + ) + } } } } @@ -1079,7 +1086,7 @@ fun OfflineModeDialog( @Composable fun OpenEdXButton( - width: Modifier = Modifier.fillMaxWidth(), + modifier: Modifier = Modifier.fillMaxWidth(), text: String = "", onClick: () -> Unit, enabled: Boolean = true, @@ -1089,7 +1096,7 @@ fun OpenEdXButton( Button( modifier = Modifier .testTag("btn_${text.tagId()}") - .then(width) + .then(modifier) .height(42.dp), shape = MaterialTheme.appShapes.buttonShape, colors = ButtonDefaults.buttonColors( @@ -1172,23 +1179,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_no_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_no_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 @@ -1203,7 +1216,7 @@ fun AuthButtonsPanel( ) { Row { OpenEdXButton( - width = Modifier + modifier = Modifier .testTag("btn_register") .width(0.dp) .weight(1f), diff --git a/core/src/main/java/org/openedx/core/ui/theme/AppColors.kt b/core/src/main/java/org/openedx/core/ui/theme/AppColors.kt index 3a540d9fa..9db8faa60 100644 --- a/core/src/main/java/org/openedx/core/ui/theme/AppColors.kt +++ b/core/src/main/java/org/openedx/core/ui/theme/AppColors.kt @@ -11,6 +11,7 @@ data class AppColors( val textSecondary: Color, val textDark: Color, val textAccent: Color, + val textWarning: Color, val textFieldBackground: Color, val textFieldBackgroundVariant: Color, diff --git a/core/src/main/java/org/openedx/core/ui/theme/Theme.kt b/core/src/main/java/org/openedx/core/ui/theme/Theme.kt index e5e7a00d3..01ae95110 100644 --- a/core/src/main/java/org/openedx/core/ui/theme/Theme.kt +++ b/core/src/main/java/org/openedx/core/ui/theme/Theme.kt @@ -30,6 +30,7 @@ private val DarkColorPalette = AppColors( textSecondary = dark_text_secondary, textDark = dark_text_dark, textAccent = dark_text_accent, + textWarning = dark_text_warning, textFieldBackground = dark_text_field_background, textFieldBackgroundVariant = dark_text_field_background_variant, @@ -92,6 +93,7 @@ private val LightColorPalette = AppColors( textSecondary = light_text_secondary, textDark = light_text_dark, textAccent = light_text_accent, + textWarning = light_text_warning, textFieldBackground = light_text_field_background, textFieldBackgroundVariant = light_text_field_background_variant, 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..020f42218 --- /dev/null +++ b/core/src/main/res/drawable/core_ic_offline.xml @@ -0,0 +1,44 @@ + + + + + + + + + + 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..d2f423f05 --- /dev/null +++ b/core/src/main/res/drawable/core_ic_reload.xml @@ -0,0 +1,23 @@ + + + + + + + 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..11d9f58f0 --- /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 fdeefc411..c2c9927c3 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/core/src/openedx/org/openedx/core/ui/theme/Colors.kt b/core/src/openedx/org/openedx/core/ui/theme/Colors.kt index 29f09b21b..35d695cc1 100644 --- a/core/src/openedx/org/openedx/core/ui/theme/Colors.kt +++ b/core/src/openedx/org/openedx/core/ui/theme/Colors.kt @@ -19,6 +19,7 @@ val light_text_primary_variant = Color(0xFF3D4964) val light_text_secondary = Color(0xFFB3B3B3) val light_text_dark = Color(0xFF19212F) val light_text_accent = Color(0xFF3C68FF) +val light_text_warning= Color(0xFF19212F) val light_text_field_background = Color(0xFFF7F7F8) val light_text_field_background_variant = Color.White val light_text_field_border = Color(0xFF97A5BB) @@ -68,6 +69,7 @@ val dark_text_primary_variant = Color(0xFF79889F) val dark_text_secondary = Color(0xFFB3B3B3) val dark_text_dark = Color.White val dark_text_accent = Color(0xFF879FF5) +val dark_text_warning= Color(0xFF19212F) val dark_text_field_background = Color(0xFF273346) val dark_text_field_background_variant = Color(0xFF273346) val dark_text_field_border = Color(0xFF4E5A70) diff --git a/course/src/main/java/org/openedx/course/presentation/ChapterEndFragmentDialog.kt b/course/src/main/java/org/openedx/course/presentation/ChapterEndFragmentDialog.kt index cdedd3424..e84766780 100644 --- a/course/src/main/java/org/openedx/course/presentation/ChapterEndFragmentDialog.kt +++ b/course/src/main/java/org/openedx/course/presentation/ChapterEndFragmentDialog.kt @@ -189,7 +189,7 @@ private fun ChapterEndDialogScreen( ) Spacer(Modifier.height(36.dp)) Text( - text = stringResource(id = R.string.course_good_work), + text = stringResource(id = R.string.course_good_job), color = MaterialTheme.appColors.textPrimary, style = MaterialTheme.appTypography.titleLarge ) @@ -300,7 +300,7 @@ private fun ChapterEndDialogScreenLandscape( Spacer(Modifier.height(36.dp)) Text( modifier = Modifier.fillMaxWidth(), - text = stringResource(id = R.string.course_good_work), + text = stringResource(id = R.string.course_good_job), color = MaterialTheme.appColors.textPrimary, style = MaterialTheme.appTypography.titleLarge, textAlign = TextAlign.Center diff --git a/course/src/main/java/org/openedx/course/presentation/container/CourseContainerAdapter.kt b/course/src/main/java/org/openedx/course/presentation/container/CourseContainerAdapter.kt index d9447487c..defa6b8a7 100644 --- a/course/src/main/java/org/openedx/course/presentation/container/CourseContainerAdapter.kt +++ b/course/src/main/java/org/openedx/course/presentation/container/CourseContainerAdapter.kt @@ -27,5 +27,5 @@ enum class CourseContainerTab(val itemId: Int, val titleResId: Int) { VIDEOS(itemId = R.id.videos, titleResId = R.string.course_navigation_videos), DISCUSSION(itemId = R.id.discussions, titleResId = R.string.course_navigation_discussions), DATES(itemId = R.id.dates, titleResId = R.string.course_navigation_dates), - HANDOUTS(itemId = R.id.resources, titleResId = R.string.course_navigation_handouts), + HANDOUTS(itemId = R.id.resources, titleResId = R.string.course_navigation_more), } 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..5e3b852ce 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 @@ -2,7 +2,10 @@ package org.openedx.course.presentation.detail import android.annotation.SuppressLint import android.content.Intent -import android.content.res.Configuration.* +import android.content.res.Configuration.ORIENTATION_LANDSCAPE +import android.content.res.Configuration.ORIENTATION_PORTRAIT +import android.content.res.Configuration.UI_MODE_NIGHT_NO +import android.content.res.Configuration.UI_MODE_NIGHT_YES import android.net.Uri import android.os.Bundle import android.view.LayoutInflater @@ -10,21 +13,56 @@ import android.view.ViewGroup import android.webkit.WebResourceRequest import android.webkit.WebView import android.webkit.WebViewClient -import androidx.compose.foundation.* -import androidx.compose.foundation.layout.* -import androidx.compose.material.* +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.aspectRatio +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.navigationBarsPadding +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.widthIn +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.CircularProgressIndicator +import androidx.compose.material.Icon +import androidx.compose.material.IconButton +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Scaffold +import androidx.compose.material.Surface +import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Report -import androidx.compose.runtime.* +import androidx.compose.material.rememberScaffoldState +import androidx.compose.runtime.Composable +import androidx.compose.runtime.MutableState +import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState +import androidx.compose.runtime.mutableFloatStateOf +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha -import androidx.compose.ui.draw.shadow import androidx.compose.ui.graphics.Color -import androidx.compose.ui.platform.* +import androidx.compose.ui.graphics.vector.rememberVectorPainter +import androidx.compose.ui.platform.ComposeView +import androidx.compose.ui.platform.LocalConfiguration +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalUriHandler +import androidx.compose.ui.platform.ViewCompositionStrategy +import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.semantics @@ -44,17 +82,28 @@ import org.openedx.core.UIMessage import org.openedx.core.domain.model.Course import org.openedx.core.domain.model.Media import org.openedx.core.extension.isEmailValid -import org.openedx.core.ui.* +import org.openedx.core.ui.AuthButtonsPanel +import org.openedx.core.ui.HandleUIMessage +import org.openedx.core.ui.OfflineModeDialog +import org.openedx.core.ui.OpenEdXButton +import org.openedx.core.ui.Toolbar +import org.openedx.core.ui.WindowSize +import org.openedx.core.ui.WindowType +import org.openedx.core.ui.displayCutoutForLandscape +import org.openedx.core.ui.isPreview +import org.openedx.core.ui.rememberWindowSize +import org.openedx.core.ui.statusBarsInset 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.windowSizeValue import org.openedx.core.utils.EmailUtil import org.openedx.course.R import org.openedx.course.presentation.CourseRouter import org.openedx.course.presentation.ui.CourseImageHeader +import org.openedx.course.presentation.ui.WarningLabel import java.nio.charset.StandardCharsets -import java.util.* +import java.util.Date import org.openedx.course.R as courseR class CourseDetailsFragment : Fragment() { @@ -169,7 +218,7 @@ internal fun CourseDetailsScreen( val scaffoldState = rememberScaffoldState() val configuration = LocalConfiguration.current - var isInternetConnectionShown by rememberSaveable { + val isInternetConnectionShown = rememberSaveable { mutableStateOf(false) } @@ -262,6 +311,8 @@ internal fun CourseDetailsScreen( CourseDetailNativeContentLandscape( windowSize = windowSize, apiHostUrl = apiHostUrl, + hasInternetConnection = hasInternetConnection, + isInternetConnectionShown = isInternetConnectionShown, course = uiState.course, onButtonClick = { onButtonClick() @@ -271,6 +322,8 @@ internal fun CourseDetailsScreen( CourseDetailNativeContent( windowSize = windowSize, apiHostUrl = apiHostUrl, + hasInternetConnection = hasInternetConnection, + isInternetConnectionShown = isInternetConnectionShown, course = uiState.course, onButtonClick = { onButtonClick() @@ -285,7 +338,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 +368,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 +394,8 @@ private fun CourseDetailNativeContent( windowSize: WindowSize, apiHostUrl: String, course: Course, + hasInternetConnection: Boolean, + isInternetConnectionShown: MutableState, onButtonClick: () -> Unit, ) { val uriHandler = LocalUriHandler.current @@ -402,7 +457,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 +488,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 +503,8 @@ private fun CourseDetailNativeContentLandscape( windowSize: WindowSize, apiHostUrl: String, course: Course, + hasInternetConnection: Boolean, + isInternetConnectionShown: MutableState, onButtonClick: () -> Unit, ) { val uriHandler = LocalUriHandler.current @@ -496,12 +557,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 ) @@ -539,51 +604,18 @@ private fun CourseDetailNativeContentLandscape( @Composable private fun EnrollOverLabel() { - 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( - imageVector = Icons.Outlined.Report, - contentDescription = null, - tint = MaterialTheme.appColors.warning - ) - Spacer(Modifier.width(12.dp)) - Text( - modifier = Modifier.testTag("txt_enroll_error"), - text = stringResource(id = courseR.string.course_you_cant_enroll), - color = MaterialTheme.appColors.textPrimaryVariant, - style = MaterialTheme.appTypography.titleSmall - ) - } - } + WarningLabel( + painter = rememberVectorPainter(Icons.Outlined.Report), + text = stringResource(id = courseR.string.course_you_cant_enroll) + ) +} + +@Composable +private fun NoInternetLabel() { + WarningLabel( + painter = painterResource(id = org.openedx.core.R.drawable.core_ic_offline), + text = stringResource(id = courseR.string.course_no_internet_label) + ) } @Composable 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 c55d622cf..4d9dfc54b 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 @@ -613,7 +613,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 e28b7b1cf..23c31e843 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 @@ -9,6 +9,7 @@ import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.clickable +import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -59,7 +60,9 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.rotate +import androidx.compose.ui.draw.shadow import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext @@ -1150,7 +1153,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, ) @@ -1211,6 +1214,70 @@ fun DatesShiftedSnackBar( } } +@Composable +fun WarningLabel( + painter: Painter, + text: String +) { + 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 = painter, + contentDescription = null, + tint = MaterialTheme.appColors.warning + ) + Spacer(Modifier.width(12.dp)) + Text( + modifier = Modifier.testTag("txt_enroll_internet_error"), + text = text, + color = MaterialTheme.appColors.textPrimaryVariant, + style = MaterialTheme.appTypography.titleSmall + ) + } + } +} + +@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO) +@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) +@Composable +private fun WarningLabelPreview() { + OpenEdXTheme { + WarningLabel( + painter = painterResource(id = org.openedx.core.R.drawable.core_ic_offline), + text = stringResource(id = R.string.course_no_internet_label) + ) + } +} + @Preview(uiMode = Configuration.UI_MODE_NIGHT_NO) @Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) @Composable diff --git a/course/src/main/res/drawable/course_ic_not_supported_block.xml b/course/src/main/res/drawable/course_ic_not_supported_block.xml index 474a658b0..470876362 100644 --- a/course/src/main/res/drawable/course_ic_not_supported_block.xml +++ b/course/src/main/res/drawable/course_ic_not_supported_block.xml @@ -3,31 +3,16 @@ android:height="100dp" android:viewportWidth="100" android:viewportHeight="100"> - - - - - - - - - + + + + diff --git a/course/src/main/res/menu/bottom_course_container_menu.xml b/course/src/main/res/menu/bottom_course_container_menu.xml index 97529a580..a8a77e606 100644 --- a/course/src/main/res/menu/bottom_course_container_menu.xml +++ b/course/src/main/res/menu/bottom_course_container_menu.xml @@ -27,7 +27,7 @@ diff --git a/course/src/main/res/values-uk/strings.xml b/course/src/main/res/values-uk/strings.xml index 28f5a4628..7ac53f4da 100644 --- a/course/src/main/res/values-uk/strings.xml +++ b/course/src/main/res/values-uk/strings.xml @@ -27,7 +27,7 @@ Оголошення Знайдіть важливу інформацію про курс Будьте в курсі останніх новин - Гарна робота! + Гарна робота! Секція \"%s\" завершена. Наступний розділ Повернутись до модуля @@ -37,7 +37,7 @@ Курс Відео Обговорення - Матеріали + Матеріали Ви можете завантажувати контент тільки через Wi-Fi Ця інтерактивна компонента ще не доступна Досліджуйте інші частини цього курсу або перегляньте це на веб-сайті. diff --git a/course/src/main/res/values/strings.xml b/course/src/main/res/values/strings.xml index d05d97808..4a4ef80ed 100644 --- a/course/src/main/res/values/strings.xml +++ b/course/src/main/res/values/strings.xml @@ -9,7 +9,7 @@ Course subsections Videos You have passed the course! Now you can get the certificate - You’ve passed the course + You’ve completed the course Congratulations! View the certificate You can get a certificate after completing the course (earn required grade) @@ -27,19 +27,20 @@ Announcements Find important course information Keep up with the latest news - Good work! - Section \"%s\" is finished. + Good job! + You\'ve completed \"%s\". 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 Videos Discussions - Handouts + More You can download content only from Wi-fi - This interactive component isn’t yet available + This interactive component isn\'t available on mobile. Explore other parts of this course or view this on web. Open in browser Subtitles 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..a7b3ef9d3 100644 --- a/dashboard/src/main/res/values-uk/strings.xml +++ b/dashboard/src/main/res/values-uk/strings.xml @@ -3,6 +3,6 @@ Мої курси Курси Ласкаво просимо назад. Продовжуймо навчатися. - 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 1efdc094e..c09294c5b 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 @@ -763,6 +763,7 @@ private fun LimitedProfileDialog( modifier: Modifier, onCloseClick: () -> Unit ) { + val tint = MaterialTheme.appColors.textWarning Column( modifier .shadow( @@ -774,43 +775,33 @@ private fun LimitedProfileDialog( MaterialTheme.appShapes.material.medium ) ) { - Column( - Modifier + Row( + modifier = Modifier .fillMaxWidth() - .padding(16.dp) + .padding(16.dp), + verticalAlignment = Alignment.Top, + horizontalArrangement = Arrangement.spacedBy(8.dp) ) { - Row(verticalAlignment = Alignment.CenterVertically) { - Icon( - imageVector = Icons.Outlined.Report, - contentDescription = null, - tint = MaterialTheme.appColors.textDark - ) - Spacer(modifier = Modifier.width(8.dp)) - Text( - modifier = Modifier - .testTag("txt_edit_profile_limited_profile_title") - .weight(1f), - text = stringResource(id = R.string.profile_oh_sorry), - color = MaterialTheme.appColors.textDark, - style = MaterialTheme.appTypography.titleMedium - ) - Icon( - modifier = Modifier - .testTag("ic_edit_profile_limited_profile_close") - .clickable { onCloseClick() }, - imageVector = Icons.Filled.Close, - contentDescription = null, - tint = MaterialTheme.appColors.textDark - ) - } - Spacer(modifier = Modifier.height(8.dp)) + Icon( + imageVector = Icons.Outlined.Report, + contentDescription = null, + tint = tint + ) Text( modifier = Modifier .testTag("txt_edit_profile_limited_profile_message") - .fillMaxWidth(), + .weight(1f), text = stringResource(id = R.string.profile_must_be_over), - color = MaterialTheme.appColors.textDark, - style = MaterialTheme.appTypography.bodyMedium + color = tint, + style = MaterialTheme.appTypography.labelLarge + ) + Icon( + modifier = Modifier + .testTag("ic_edit_profile_limited_profile_close") + .clickable { onCloseClick() }, + imageVector = Icons.Filled.Close, + contentDescription = null, + tint = tint ) } } @@ -1112,8 +1103,9 @@ private fun LeaveProfile( ) { Icon( modifier = Modifier - .size(100.dp), + .size(60.dp), painter = painterResource(R.drawable.profile_ic_save), + tint = MaterialTheme.appColors.textPrimary, contentDescription = null ) Spacer(Modifier.size(48.dp)) @@ -1145,7 +1137,7 @@ private fun LeaveProfile( .testTag("txt_leave") .fillMaxWidth(), text = stringResource(id = R.string.profile_leave), - color = MaterialTheme.appColors.textDark, + color = MaterialTheme.appColors.textWarning, style = MaterialTheme.appTypography.labelLarge, textAlign = TextAlign.Center ) diff --git a/profile/src/main/java/org/openedx/profile/presentation/profile/compose/ProfileView.kt b/profile/src/main/java/org/openedx/profile/presentation/profile/compose/ProfileView.kt index 9ae81cc05..d8af99f72 100644 --- a/profile/src/main/java/org/openedx/profile/presentation/profile/compose/ProfileView.kt +++ b/profile/src/main/java/org/openedx/profile/presentation/profile/compose/ProfileView.kt @@ -484,7 +484,7 @@ private fun LogoutDialog( .testTag("txt_logout") .fillMaxWidth(), text = stringResource(id = org.openedx.profile.R.string.profile_logout), - color = MaterialTheme.appColors.textDark, + color = MaterialTheme.appColors.textWarning, style = MaterialTheme.appTypography.labelLarge, textAlign = TextAlign.Center ) diff --git a/profile/src/main/res/drawable-night/profile_ic_save.xml b/profile/src/main/res/drawable-night/profile_ic_save.xml deleted file mode 100644 index 71c48539c..000000000 --- a/profile/src/main/res/drawable-night/profile_ic_save.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/profile/src/main/res/drawable/profile_ic_exit.xml b/profile/src/main/res/drawable/profile_ic_exit.xml index 7278b1b70..515e3091f 100644 --- a/profile/src/main/res/drawable/profile_ic_exit.xml +++ b/profile/src/main/res/drawable/profile_ic_exit.xml @@ -1,42 +1,10 @@ - - - - - - - - - - - - + android:width="63dp" + android:height="70dp" + android:viewportWidth="63" + android:viewportHeight="70"> + diff --git a/profile/src/main/res/drawable/profile_ic_save.xml b/profile/src/main/res/drawable/profile_ic_save.xml index 068e2956f..9132d406c 100644 --- a/profile/src/main/res/drawable/profile_ic_save.xml +++ b/profile/src/main/res/drawable/profile_ic_save.xml @@ -1,40 +1,9 @@ + android:width="62dp" + android:height="61dp" + android:viewportWidth="62" + android:viewportHeight="61"> - - - - - - - - - - - - + android:pathData="M60.05,47.443L38.893,5.162C38.113,3.61 36.916,2.306 35.437,1.394C33.959,0.483 32.256,0 30.518,0C28.781,0 27.078,0.483 25.599,1.394C24.121,2.306 22.924,3.61 22.143,5.162L0.987,47.443C0.273,48.874 -0.064,50.464 0.01,52.061C0.083,53.658 0.564,55.21 1.407,56.57C2.249,57.929 3.425,59.05 4.823,59.826C6.221,60.603 7.794,61.009 9.393,61.006H51.643C53.243,61.009 54.816,60.603 56.214,59.826C57.612,59.05 58.788,57.929 59.63,56.57C60.473,55.21 60.954,53.658 61.027,52.061C61.1,50.464 60.764,48.874 60.05,47.443ZM32.737,47.599C32.138,48.171 31.346,48.494 30.518,48.506C30.11,48.501 29.707,48.416 29.331,48.256C28.947,48.107 28.597,47.884 28.3,47.599C28.007,47.309 27.774,46.963 27.616,46.583C27.457,46.202 27.375,45.793 27.375,45.381C27.375,44.968 27.457,44.56 27.616,44.179C27.774,43.798 28.007,43.452 28.3,43.162C28.597,42.877 28.947,42.654 29.331,42.506C29.9,42.266 30.527,42.201 31.133,42.318C31.74,42.435 32.298,42.728 32.737,43.162C33.03,43.452 33.263,43.798 33.421,44.179C33.58,44.56 33.662,44.968 33.662,45.381C33.662,45.793 33.58,46.202 33.421,46.583C33.263,46.963 33.03,47.309 32.737,47.599ZM33.643,36.006C33.643,36.834 33.314,37.629 32.728,38.215C32.142,38.801 31.347,39.131 30.518,39.131C29.69,39.131 28.895,38.801 28.309,38.215C27.723,37.629 27.393,36.834 27.393,36.006V20.381C27.393,19.552 27.723,18.757 28.309,18.171C28.895,17.585 29.69,17.256 30.518,17.256C31.347,17.256 32.142,17.585 32.728,18.171C33.314,18.757 33.643,19.552 33.643,20.381V36.006Z" + android:fillColor="#ffffff"/> diff --git a/profile/src/main/res/values-uk/strings.xml b/profile/src/main/res/values-uk/strings.xml index 7d617f734..498440ba8 100644 --- a/profile/src/main/res/values-uk/strings.xml +++ b/profile/src/main/res/values-uk/strings.xml @@ -6,7 +6,6 @@ Вийти Біо: %1$s Рік народження: %1$s - Вийти з профілю? Ви впевнені, що хочете вийти з профілю? Повний профіль Обмежений профіль @@ -21,7 +20,6 @@ Мова Перейти до повного профілю Перейти до обмеженого профілю - Ох, вибачте Готово Змінити зображення профілю Вибрати з галереї diff --git a/profile/src/main/res/values/strings.xml b/profile/src/main/res/values/strings.xml index ac4b4cbf3..ecc88ac6b 100644 --- a/profile/src/main/res/values/strings.xml +++ b/profile/src/main/res/values/strings.xml @@ -6,7 +6,6 @@ Log out Bio: %1$s Year of birth: %1$s - Log out? Are you sure you want to log out? Full profile Limited profile @@ -14,18 +13,17 @@ Edit Save Delete account - You must be over 13 years old to have a profile with full access to information + You must be over 13 years old to have a profile with full access to information. Year of birth Location About me Spoken language Switch to full profile Switch to limited profile - Oh, sorry Delete account Are you sure you want to delete your account? - To confirm this action you need to enter you account password + To confirm this action, please enter your account password. Yes, delete account Back to profile The password is incorrect. Please try again. @@ -38,9 +36,9 @@ Video settings Wi-fi only download Only download content when wi-fi is turned on - Leave profile? + Leave without saving? Leave Keep editing - Changes you have made may not be saved. + Changes you have made will be discarded.