Skip to content

Commit

Permalink
Accessibility Enhancements (#43)
Browse files Browse the repository at this point in the history
* Accessibility enhancements
---------
Signed-off-by: starry-shivam <[email protected]>
  • Loading branch information
starry-shivam authored Jun 21, 2023
1 parent 3dfd589 commit 366303f
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ class Converters {
}

@TypeConverter
fun fromGoalPriority(value: GoalPriority) = value.ordinal
fun fromGoalPriority(value: GoalPriority) = value.value

@TypeConverter
fun toGoalPriority(value: Int) = when (value) {
GoalPriority.High.ordinal -> GoalPriority.High
GoalPriority.Low.ordinal -> GoalPriority.Low
GoalPriority.High.value -> GoalPriority.High
GoalPriority.Low.value -> GoalPriority.Low
else -> GoalPriority.Normal
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fun GoalItem(
modifier = Modifier.padding(end = 2.dp)
) {
Text(
text = stringResource(id = R.string.deposit_btn).uppercase(),
text = stringResource(id = R.string.deposit_button).uppercase(),
fontWeight = FontWeight.SemiBold,
color = MaterialTheme.colorScheme.onSurface
)
Expand All @@ -155,7 +155,7 @@ fun GoalItem(
onClick = { onWithdrawClicked() },
) {
Text(
text = stringResource(id = R.string.withdraw_btn).uppercase(),
text = stringResource(id = R.string.withdraw_button).uppercase(),
fontWeight = FontWeight.SemiBold,
color = MaterialTheme.colorScheme.onSurface
)
Expand All @@ -171,23 +171,23 @@ fun GoalItem(
Icon(
modifier = Modifier.size(24.dp),
imageVector = ImageVector.vectorResource(id = R.drawable.ic_goal_info),
contentDescription = null,
contentDescription = stringResource(id = R.string.info_button_description),
tint = MaterialTheme.colorScheme.onSurface
)
}
IconButton(onClick = { onEditClicked() }) {
Icon(
modifier = Modifier.size(24.dp),
imageVector = ImageVector.vectorResource(id = R.drawable.ic_goal_edit),
contentDescription = null,
contentDescription = stringResource(id = R.string.edit_button_description),
tint = MaterialTheme.colorScheme.onSurface
)
}
IconButton(onClick = { onDeleteClicked() }) {
Icon(
modifier = Modifier.size(24.dp),
imageVector = ImageVector.vectorResource(id = R.drawable.ic_goal_delete),
contentDescription = null,
contentDescription = stringResource(id = R.string.delete_button_description),
tint = MaterialTheme.colorScheme.onSurface
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fun GoalLazyColumnItem(
onWithdrawClicked = {
if (item.getCurrentlySavedAmount() == 0f.toDouble()) {
coroutineScope.launch {
snackBarHostState.showSnackbar(context.getString(R.string.withdraw_btn_error))
snackBarHostState.showSnackbar(context.getString(R.string.withdraw_button_error))
}
} else {
openWithdrawDialog.value = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,22 @@ fun DefaultAppBar(
}, navigationIcon = {
IconButton(onClick = { onMenuClicked() }) {
Icon(
imageVector = Icons.Filled.Menu, contentDescription = null
imageVector = Icons.Filled.Menu,
contentDescription = stringResource(id = R.string.menu_button_desc)
)
}
}, actions = {
IconButton(onClick = { onFilterClicked() }) {
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_menu_filter),
contentDescription = null, modifier = Modifier.size(22.dp)
contentDescription = stringResource(id = R.string.filter_button_desc),
modifier = Modifier.size(22.dp)
)
}
IconButton(onClick = { onSearchClicked() }) {
Icon(
imageVector = Icons.Filled.Search, contentDescription = null
imageVector = Icons.Filled.Search,
contentDescription = stringResource(id = R.string.search_button_desc)
)
}
}, colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -125,6 +127,7 @@ import java.time.format.DateTimeFormatter
@Composable
fun InputScreen(editGoalId: String?, navController: NavController) {
val context = LocalContext.current
val haptic = LocalHapticFeedback.current
val viewModel: InputViewModel = hiltViewModel()
val coroutineScope = rememberCoroutineScope()

Expand Down Expand Up @@ -444,7 +447,12 @@ fun InputScreen(editGoalId: String?, navController: NavController) {
.fillMaxWidth(0.8f)
.combinedClickable(
onClick = { calenderState.show() },
onLongClick = { showRemoveDeadlineDialog.value = true },
onLongClick = {
haptic.performHapticFeedback(
HapticFeedbackType.LongPress
)
showRemoveDeadlineDialog.value = true
},
interactionSource = interactionSource,
indication = null
),
Expand Down
13 changes: 9 additions & 4 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

<!-- Home Screen -->
<string name="home_screen_header">Metas de Ahorro</string>
<string name="menu_button_desc">Open side menu</string>
<string name="filter_button_desc">Filter your saving goals</string>
<string name="search_button_desc">Search for specific saving goal.</string>
<string name="new_goal_fab">Nueva Meta</string>
<string name="filter_menu_title">Filter By</string>
<string name="home_search_label">Busca aquí…</string>
Expand All @@ -31,18 +34,20 @@
<!-- Strings used for dashboard saving goals cards -->
<string name="no_goal_set">No hay metas aún.</string>
<string name="transaction_dialog_amount_label">Ingresa la cantidad</string>
<string name="deposit_btn">Depositar</string>
<string name="deposit_button">Depositar</string>
<string name="deposit_dialog_title">¡Excelente! Ingresa la cantidad</string>
<string name="deposit_successful">¡Depósito exitoso!</string>
<string name="goal_already_achieved">Ya has completado esta meta.</string>
<string name="withdraw_btn">Retirar</string>
<string name="withdraw_button">Retirar</string>
<string name="withdraw_dialog_title">¡Bien! Ingresa la cantidad</string>
<string name="withdraw_btn_error">No has depositado nada aún.</string>
<string name="withdraw_button_error">No has depositado nada aún.</string>
<string name="withdraw_overflow_error">¡La cantidad supera lo depositado!</string>
<string name="withdraw_successful">¡Retiro exitoso!</string>
<string name="goal_delete_confirmation">¿Estás seguro/a?</string>
<string name="goal_delete_success">Eliminación exitosa.</string>
<string name="info_btn_description">Ver información de la meta.</string>
<string name="info_button_description">Ver información de la meta.</string>
<string name="edit_button_description">Edit this goal</string>
<string name="delete_button_description">Delete This Goal</string>
<string name="add_fab_button_title">Nueva meta</string>
<string name="progress_greet1">¡Que buén comienzo!</string>
<string name="progress_greet2">¡Sigue así, sigue así!</string>
Expand Down
13 changes: 9 additions & 4 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

<!-- Home Screen -->
<string name="home_screen_header">Saving Goals</string>
<string name="menu_button_desc">Open side menu</string>
<string name="filter_button_desc">Filter your saving goals</string>
<string name="search_button_desc">Search for specific saving goal.</string>
<string name="new_goal_fab">New Goal</string>
<string name="filter_menu_title">Filter By</string>
<string name="home_search_label">Search here…</string>
Expand All @@ -31,18 +34,20 @@
<!-- Strings used for dashboard saving goals cards -->
<string name="no_goal_set">No Saving Goals Set.</string>
<string name="transaction_dialog_amount_label">Enter Amount</string>
<string name="deposit_btn">Deposit</string>
<string name="deposit_button">Deposit</string>
<string name="deposit_dialog_title">Awesome! enter amount</string>
<string name="deposit_successful">Deposited Successfully!</string>
<string name="goal_already_achieved">You\'ve already achieved this goal.</string>
<string name="withdraw_btn">withdraw</string>
<string name="withdraw_button">withdraw</string>
<string name="withdraw_dialog_title">Cool! enter amount</string>
<string name="withdraw_btn_error">You haven\'t deposited any amount yet.</string>
<string name="withdraw_button_error">You haven\'t deposited any amount yet.</string>
<string name="withdraw_overflow_error">Amount is more than current deposited amount!</string>
<string name="withdraw_successful">Withdrawn Successfully!</string>
<string name="goal_delete_confirmation">You sure?</string>
<string name="goal_delete_success">Deleted Successfully.</string>
<string name="info_btn_description">View goal information.</string>
<string name="info_button_description">View goal information.</string>
<string name="edit_button_description">Edit this goal</string>
<string name="delete_button_description">Delete This Goal</string>
<string name="add_fab_button_title">New goal</string>
<string name="progress_greet1">You’re off to great start!</string>
<string name="progress_greet2">Keep on keeping on!</string>
Expand Down

0 comments on commit 366303f

Please sign in to comment.