Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Text and icons adjustment #266

Merged
merged 10 commits into from
Mar 27, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
36 changes: 6 additions & 30 deletions auth/src/main/res/drawable/auth_ic_email.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="100dp"
android:viewportWidth="100"
android:viewportHeight="100">
android:width="85dp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires auto-format.

android:height="66dp"
android:viewportWidth="85"
android:viewportHeight="66">
<path
android:pathData="M41.41,45.06C42.8,44.69 44.26,45.41 44.81,46.74L46.9,51.76C47.22,52.52 46.89,53.39 46.16,53.77L43.86,54.95C43.45,55.16 43.02,55.19 42.59,55.03C42.16,54.87 41.84,54.57 41.67,54.14L39.5,48.96C38.82,47.35 39.72,45.51 41.41,45.06ZM66.59,63.48C64.74,65.07 64.73,67.94 66.58,69.53L88.94,88.9C89.36,89.26 90,89.07 90,88.52V44.59C90,44.05 89.36,43.86 88.95,44.22L66.59,63.48ZM47.49,70.81C48.99,72.11 51.22,72.12 52.73,70.82L86.67,41.59C86.86,41.42 86.78,41.12 86.52,41.12H81.41C79.15,41.12 77.41,43.12 76.25,45.06C75.32,46.62 73.81,47.83 71.94,48.33C69.36,49.02 66.69,48.22 64.92,46.42C64.36,45.85 63.74,45.31 62.98,45.06C59.79,44 56.27,43.45 52.75,43.3C50.02,43.18 48.27,45.99 49.32,48.52L50.11,50.42C51.12,52.85 50.08,55.66 47.75,56.86L45.45,58.04C44.18,58.7 42.73,58.78 41.39,58.29C40.05,57.8 39.01,56.8 38.46,55.49L35.95,49.48C35.26,47.84 33.55,46.92 31.79,46.65C29.14,46.25 26.69,44.93 24.9,42.95C23.95,41.9 22.68,41.12 21.27,41.12H13.48C13.47,41.12 13.47,41.13 13.47,41.13L47.49,70.81ZM51.23,76.7L57.8,71.05C59.3,69.76 61.53,69.76 63.03,71.06L86.67,91.53C86.86,91.7 86.77,92 86.52,92H13.48C13.48,92 13.47,92 13.48,91.99L37.28,71.11C38.79,69.79 41.04,69.79 42.55,71.11L48.95,76.69C49.28,76.98 49.69,77.12 50.1,77.12C50.5,77.12 50.91,76.98 51.23,76.7ZM33.82,63.5C35.65,65.09 35.65,67.92 33.83,69.52L11.6,89.02C10.98,89.56 10,89.35 10,88.52V44.59C10,43.78 10.97,43.56 11.59,44.1L33.82,63.5ZM78.86,33.02L84.33,34.48C85.2,34.71 86.1,34.19 86.33,33.32C86.57,32.44 86.04,31.55 85.17,31.31L79.7,29.85C78.83,29.61 77.93,30.14 77.7,31.01C77.46,31.89 77.99,32.78 78.86,33.02ZM76.23,16.9L80.23,12.9C80.87,12.26 80.87,11.22 80.24,10.58C79.6,9.94 78.56,9.94 77.92,10.58L73.92,14.57C73.28,15.21 73.27,16.25 73.91,16.89C74.55,17.53 75.59,17.54 76.23,16.9ZM81.03,24.26L86.22,22.87C87.1,22.63 87.62,21.73 87.38,20.85C87.15,19.97 86.24,19.45 85.36,19.69L80.18,21.07C79.3,21.31 78.78,22.21 79.01,23.09C79.25,23.97 80.15,24.49 81.03,24.26ZM71,30.4C70.92,30.09 71.13,29.78 71.43,29.7C73.79,29.07 75.2,26.64 74.56,24.28C73.93,21.92 71.5,20.52 69.14,21.16C68.83,21.24 68.5,21.08 68.42,20.77L65.74,10.77C65.2,8.78 63.14,7.59 61.16,8.13C59.87,8.47 58.9,9.47 58.54,10.68C58.23,11.71 58.08,12.85 57.39,13.68C54.4,17.25 50.06,20.72 44.85,23.53C43.13,24.46 42.2,26.41 42.71,28.29L44.97,36.74C45.47,38.61 47.25,39.84 49.2,39.79C55.14,39.63 60.65,40.48 65.04,42.1C66.04,42.47 66.73,43.36 67.5,44.08C68.42,44.94 69.74,45.32 71.04,44.98C73.02,44.45 74.21,42.37 73.68,40.4L71,30.4ZM41.52,37.29C42.09,39.43 40.82,41.62 38.69,42.19L35.54,43.04C31.27,44.18 26.85,41.63 25.71,37.37C24.57,33.1 27.12,28.68 31.38,27.54L34.54,26.7C36.67,26.13 38.86,27.39 39.44,29.53C40.13,32.11 40.83,34.7 41.52,37.29Z"
android:fillColor="#19212F"
android:pathData="M6.827,3.795L32.372,29.433C37.944,35.011 47.051,35.016 52.628,29.433L78.173,3.795C78.43,3.537 78.393,3.112 78.094,2.903C75.489,1.081 72.319,0 68.904,0H16.096C12.681,0 9.511,1.081 6.905,2.903C6.607,3.112 6.569,3.537 6.827,3.795ZM0,16.146C0,13.453 0.666,10.908 1.839,8.67C2.022,8.32 2.487,8.25 2.765,8.529L27.988,33.831C35.975,41.855 49.021,41.859 57.012,33.831L82.234,8.529C82.513,8.25 82.978,8.32 83.161,8.67C84.334,10.908 85,13.453 85,16.146V49.853C85,58.763 77.775,66 68.904,66H16.096C7.225,66 0,58.763 0,49.853V16.146Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
<path
android:pathData="M11.03,30.46C12.16,30.46 13.11,29.51 13.11,28.4C13.11,27.29 12.14,26.34 11.03,26.34C9.93,26.34 8.96,27.29 8.96,28.4C9.12,29.51 9.93,30.46 11.03,30.46Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M32.43,11.6C34.99,11.6 36.9,9.54 36.9,7.17C36.9,4.8 34.83,2.74 32.43,2.74C30.02,2.74 27.95,4.8 27.95,7.17C27.95,9.54 30.02,11.6 32.43,11.6Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M17.62,5.69C18.41,5.69 19.06,6.32 19.06,7.11C19.06,7.9 18.41,8.53 17.62,8.53C16.83,8.53 16.18,7.9 16.18,7.11C16.18,6.32 16.83,5.69 17.62,5.69Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M36.44,5.64C37.23,5.64 37.88,6.27 37.88,7.06C37.88,7.85 37.23,8.48 36.44,8.48C35.65,8.48 35,7.85 35,7.06C35,6.27 35.65,5.64 36.44,5.64Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M92.45,5.6C93.24,5.6 93.89,6.24 93.89,7.03C93.89,7.82 93.24,8.45 92.45,8.45C91.66,8.45 91.01,7.82 91.01,7.03C91.01,6.24 91.66,5.6 92.45,5.6Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M26.51,15.27C27.3,15.27 27.95,15.91 27.95,16.7C27.95,17.49 27.3,18.12 26.51,18.12C25.71,18.12 25.07,17.49 25.07,16.7C25.07,15.91 25.71,15.27 26.51,15.27Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M13.59,76.93C14.39,76.93 15.03,77.57 15.03,78.36C15.03,79.15 14.39,79.78 13.59,79.78C12.8,79.78 12.15,79.15 12.15,78.36C12.15,77.57 12.8,76.93 13.59,76.93Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M39.48,88.8C40.27,88.8 40.92,89.43 40.92,90.22C40.92,91.01 40.27,91.65 39.48,91.65C38.69,91.65 38.04,91.01 38.04,90.22C38.04,89.43 38.69,88.8 39.48,88.8Z"
android:fillColor="#ffffff"/>
</vector>
79 changes: 46 additions & 33 deletions core/src/main/java/org/openedx/core/ui/ComposeCommon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1045,40 +1044,48 @@ 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),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use imageVector = Icons.Filled.Close, instead, and remove this drawable.

contentDescription = null,
tint = Color.Black
)
}
}
}
}
}

@Composable
fun OpenEdXButton(
width: Modifier = Modifier.fillMaxWidth(),
modifier: Modifier = Modifier.fillMaxWidth(),
text: String = "",
onClick: () -> Unit,
enabled: Boolean = true,
Expand All @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -1202,7 +1215,7 @@ fun AuthButtonsPanel(
) {
Row {
OpenEdXButton(
width = Modifier
modifier = Modifier
.testTag("btn_register")
.width(0.dp)
.weight(1f),
Expand Down
24 changes: 24 additions & 0 deletions core/src/main/res/drawable/core_ic_close.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove this and use imageVector = Icons.Filled.Close,

android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<group>
<clip-path
android:pathData="M0,0h20v20h-20z"/>
<path
android:pathData="M15,5L5,15"
android:strokeLineJoin="round"
android:strokeWidth="1.45833"
android:fillColor="#00000000"
android:strokeColor="#313131"
android:strokeLineCap="round"/>
<path
android:pathData="M5,5L15,15"
android:strokeLineJoin="round"
android:strokeWidth="1.45833"
android:fillColor="#00000000"
android:strokeColor="#313131"
android:strokeLineCap="round"/>
</group>
</vector>
45 changes: 45 additions & 0 deletions core/src/main/res/drawable/core_ic_offline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1- can we use white color as a strokeColor to make it more generic?
2- requires auto-format

android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<group>
<clip-path
android:pathData="M0,0h20v20h-20z"/>
<path
android:pathData="M10,15H10.008"
android:strokeLineJoin="round"
android:strokeWidth="1.45833"
android:fillColor="#00000000"
android:strokeColor="#313131"
android:strokeLineCap="round"/>
<path
android:pathData="M7.643,12.643C8.268,12.018 9.116,11.667 10,11.667C10.884,11.667 11.732,12.018 12.357,12.643"
android:strokeLineJoin="round"
android:strokeWidth="1.45833"
android:fillColor="#00000000"
android:strokeColor="#313131"
android:strokeLineCap="round"/>
<path
android:pathData="M5.286,10.286C6.17,9.4 7.286,8.781 8.506,8.502M11.975,8.632C13.011,8.955 13.951,9.527 14.714,10.298"
android:strokeLineJoin="round"
android:strokeWidth="1.45833"
android:fillColor="#00000000"
android:strokeColor="#313131"
android:strokeLineCap="round"/>
<path
android:pathData="M2.929,7.929C3.782,7.075 4.783,6.381 5.883,5.883M8.467,5.117C10.021,4.876 11.61,5.005 13.105,5.493C14.6,5.982 15.959,6.816 17.071,7.928"
android:strokeLineJoin="round"
android:strokeWidth="1.45833"
android:fillColor="#00000000"
android:strokeColor="#313131"
android:strokeLineCap="round"/>
<path
android:pathData="M2.5,2.5L17.5,17.5"
android:strokeLineJoin="round"
android:strokeWidth="1.45833"
android:fillColor="#00000000"
android:strokeColor="#313131"
android:strokeLineCap="round"/>
</group>
</vector>
24 changes: 24 additions & 0 deletions core/src/main/res/drawable/core_ic_reload.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1- can we use white color as a strokeColor to make it more generic?
2- requires auto-format

android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<group>
<clip-path
android:pathData="M0,0h20v20h-20z"/>
<path
android:pathData="M16.611,10.868C16.454,12.067 15.972,13.202 15.219,14.149C14.466,15.097 13.469,15.821 12.336,16.245C11.202,16.669 9.975,16.776 8.785,16.556C7.595,16.335 6.487,15.794 5.581,14.992C4.675,14.19 4.005,13.156 3.641,12.001C3.278,10.847 3.236,9.615 3.52,8.439C3.803,7.262 4.402,6.185 5.251,5.323C6.1,4.46 7.168,3.846 8.34,3.544C11.589,2.711 14.953,4.383 16.194,7.5"
android:strokeLineJoin="round"
android:strokeWidth="1.45833"
android:fillColor="#00000000"
android:strokeColor="#506EFF"
android:strokeLineCap="round"/>
<path
android:pathData="M16.667,3.333V7.5H12.5"
android:strokeLineJoin="round"
android:strokeWidth="1.45833"
android:fillColor="#00000000"
android:strokeColor="#506EFF"
android:strokeLineCap="round"/>
</group>
</vector>
9 changes: 9 additions & 0 deletions core/src/main/res/drawable/core_no_internet_connection.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires auto-format.

android:width="86dp"
android:height="86dp"
android:viewportWidth="86"
android:viewportHeight="86">
<path
android:pathData="M43,78C36.928,78 32.285,73.357 32.285,67.286C32.285,64.428 33.357,61.571 35.5,59.786C39.785,55.857 46.571,55.857 50.5,59.786C54.785,64.071 54.785,70.857 50.5,74.786C48.714,76.928 45.857,78 43,78ZM65.143,50.143L84.785,30.5C86.214,29.071 86.214,26.928 84.785,25.5C69.428,10.143 46.571,4.429 25.857,10.5L65.143,50.143ZM84.785,79.786L6.214,1.214C4.785,-0.214 2.643,-0.214 1.214,1.214C-0.215,2.643 -0.215,4.786 1.214,6.214L11.928,16.928C8,19.428 4.428,22.286 1.214,25.5C-0.215,26.928 -0.215,29.071 1.214,30.5L24.071,53.357C25.5,54.786 27.643,54.786 29.071,53.357C32.643,49.786 37.643,47.643 42.643,47.643L79.785,84.786C81.214,86.214 83.357,86.214 84.785,84.786C86.214,83.357 86.214,81.214 84.785,79.786Z"
android:fillColor="#ffffff"/>
</vector>
1 change: 0 additions & 1 deletion core/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
<string name="core_rate_us">Оцінити нас</string>
<string name="core_thank_you_dialog_positive_description">Дякуємо за надання відгуку. Чи бажаєте ви поділитися своєю оцінкою цього додатка з іншими користувачами в магазині додатків?</string>
<string name="core_thank_you_dialog_negative_description">Ми отримали ваш відгук і використовуватимемо його, щоб покращити ваш досвід навчання в майбутньому. Дякуємо, що поділилися!</string>
<string name="core_not_connected_to_internet">Ви не підключені до Інтернету. Будь ласка, перевірте ваше підключення до Інтернету.</string>

<string name="core_register">Зареєструватися</string>
<string name="core_sign_in">Увійти</string>
Expand Down
Loading
Loading