Introducci贸n a Jetpack Compose
Qu茅 es Jetpack Compose
Configuraci贸n inicial del proyecto
Personalizaci贸n de la UI con Material Design
Colores, Fuentes y Material Theme
Creaci贸n de Componentes de UI
Compose: Fases y Recomposici贸n
Quiz: Personalizaci贸n de la UI con Material Design
Composici贸n de layouts en Jetpack Compose
Creaci贸n y abstracci贸n modelos de dominio
Layouts: Column, Row y Box
C贸mo utilizar Scaffold, TopAppBar, FAB y Listas
Vista de progreso personalizada con Canvas
Arquitectura de Acci贸n - Estado - Evento en ViewModel
Ajustes en pantalla de lista de tareas
Quiz: Composici贸n de layouts en Jetpack Compose
Construcci贸n de funcionalidades
Pantalla de creaci贸n de tareas
Creaci贸n de Viewmodel para CreateTaskScreen
Quiz: Construcci贸n de funcionalidades
Navegaci贸n en Jetpack Compose
Introducci贸n a la navegaci贸n en Compose
Manejo de navegaci贸n con argumentos
Quiz: Navegaci贸n en Jetpack Compose
Creaci贸n de Bases de datos y dependencias
Creaci贸n de la base de datos con Room
Inyecci贸n de dependencias con Hilt
Quiz: Creaci贸n de Bases de datos y dependencias
Finalizaci贸n de la app
Ajustes finales de UI para tu App
Demostraci贸n final de tu App
You don't have access to this class
Keep learning! Join and start boosting your career
Many times, when developing an application, small errors may appear that affect its overall functionality. In this case, one of those errors is that our application does not save the task category correctly. The problem lies in the mapping of our task
to taskentity
classes, where we forgot to include the field referring to the category. This problem is solved by entering that field in the database and performing a proper conversion from ordinal
.
We can follow these steps:
Make sure to map the category field correctly when configuring the classes.
Use the ordinal
in the category enum declaration to store its corresponding number.
Implement a fromOrdinal
function that allows the conversion from the ordinal
to the desired category.
Make the necessary adjustments to our database, which may require clearing the cache or uninstalling and reinstalling the application for the changes to take effect.
companyum object { fun fromOrdinal(ordinal: Int?): Category? { return enumValues().getOrNull(ordinal ?: return null) } } }
A crucial aspect of the user experience is how the interface adapts when the keyboard appears. On real devices, the keyboard usually resizes the available space, and our layout must reflect this correctly. To achieve this functionality, we can employ the adjustResize
attribute in our Android activity settings. This setting ensures that our interface elements move according to the space taken up by the keyboard.
Update the AndroidManifest.xml
in this way:
By implementing this, it ensures that content is properly accommodated as the keyboard disappears or appears. Also, add imePadding
to the main composable so that it reacts properly when the keyboard is invoked.
When editing a text field with multiple lines, it is important to manage the focus and boundaries so that the interface is not adversely affected. Because the 'Save' button can scroll, we must limit the growth of the text field. We can use isDescriptionFocus
to detect when the description field is active and set maximum and minimum line limits.
if (isDescriptionFocus) { textFieldLimits = TextFieldLimits(multiline = true, minLines = 1, maxLines = 5)} else { textFieldLimits = TextFieldLimits.Default}
To improve the clarity and functionality of the application, it is essential to adjust the messages of important events. For example, when selecting 'delete all' from the menu, it is good to show a clear and relevant message like 'all tasks deleted' instead of 'task updated'.
Modify the homeScreenViewModel
to reflect accurate changes:
fun onDeleteAllTasks() { // Change update message when deleting all tasks. postMessage("All tasks deleted")}
Also, adjust display to not show unnecessary sections like 'pending' or 'completed' when there are no pending tasks. Implement an empty status to improve the overall presentation and ensure a more intuitive and clearer layout for the user.
Finally, reducing the length of the name of the day of the week to three letters helps prevent visual elements from overlapping unnecessarily.
Remember, it is always possible to continue enriching your application, either by adding new colors, components or even new functionalities. Don't stop experimenting and learning with every tweak you implement. Any challenge is a new learning opportunity.
Contributions 1
Questions 0
Want to see more contributions, questions and answers from the community?