Skip to content
This repository was archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
Add developed points in README.md and add "Use of unit tests" into im…
Browse files Browse the repository at this point in the history
…plementation.md
  • Loading branch information
RicardoLopez9908 committed Oct 21, 2021
1 parent f08c855 commit 409f170
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 20 deletions.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Como el IDE de Android Studio no permite tener una herramienta similar a Live Sh
> password | email | phone | text
* ScrollView en Register y Login para hacerlo responsivo en modo Portrait
* RecyclerView para los Productos
> presentados como CardView
> presentados como CardView
* Build Variants
* Por tema (dark/light)
* Por release/debug
Expand All @@ -88,16 +88,27 @@ Como el IDE de Android Studio no permite tener una herramienta similar a Live Sh

## Puntos desarrollados en la demo N°1

* Toast al no ingresar los datos en el Login y el Register
* Snackbar al no ingresar los datos en el Login y el Register
* Marcado de errores individuales al iniciar sesión o registrarse
> campo incompleto
> contraseña menor a 8 caracteres
* Consumo de API a partir de metodos POST y GET, para verificar el inicio de sesión (usando Corrutinas y Retrofit 2)
* Manejo de SharedPreferences para acceso rapido de usuario registrado
* Consumo de API a partir de metodo GET, para la carga de productos en pantalla de inicio (usando Corrutinas y Retrofit 2)
* Actualizacion real de la ubicación a partir de GPS (se almacenan hasta 3 ubicaciones con SharedPreferences)
* Posibilidad de cerrar sesión
* Icono personalizado para la app
* Lista de productos a partir de una base de datos
* Lista de productos almacenados y modificados en base de datos (usando Realm)
* Añadir productos al carrito
* Realizar pagos
* Notificación con redirección al comprar un producto

* Test Unitarios en JVM sin dependencia del framework de Android
* Test Unitarios con uso del framework de Android (no instrumentados)
* Cambio de idiomas según preferencias del usuario
* Switch para cambio de temas, disponible para usuarios registrados
---

**[Documentación](documents/root.md)** | **[Recursos de BEDU y Referencias](documents/resources.md)**

*[Decisiones de implementación](documents/implementation.md)* | *[Decisiones de diseño](documents/design.md)* | *[Extras](documents/extras.md)*
*[Decisiones de implementación](documents/implementation.md)* | *[Decisiones de diseño](documents/design.md)* | *[Extras](documents/extras.md)*
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ class ProductCartAdapter(
inner class ProductHolder(view: View): RecyclerView.ViewHolder(view) {
private val productCartTitle: TextView = view.findViewById(R.id.cart_contact_title)
private val productCartPrice: TextView = view.findViewById(R.id.cart_contact_price)
private val productCartTotalPrice: TextView = view.findViewById(R.id.cart_contact_total_price)
private val productCartImage: ImageView = view.findViewById(R.id.cart_contact_image)
private val productCartPlusSign: ImageView = view.findViewById(R.id.cart_contact_plus_sign)
private val productCartAmount: TextView = view.findViewById(R.id.cart_contact_cart_amount)
private val productCartRemoveSign: ImageView = view.findViewById(R.id.cart_contact_remove_sign)

fun render(product: Product, position: Int) {
productCartTitle.text = product.title
productCartPrice.text = "$ %.2f".format(product.amountAddedToCart?.let { product.price?.times(it)})
productCartPrice.text = product.price.toString()
productCartTotalPrice.text = "$ %.2f".format(product.amountAddedToCart?.let { product.price?.times(it)})
Picasso.get().load(product.image).into(productCartImage)
productCartAmount.text = product.amountAddedToCart.toString()
setListeners(product, position)
Expand All @@ -52,7 +54,7 @@ class ProductCartAdapter(
?.amountAddedToCart
.toString()
}
productCartPrice.text = "$ %.2f".format(product.amountAddedToCart?.let { product.price?.times(it)})
productCartTotalPrice.text = "$ %.2f".format(product.amountAddedToCart?.let { product.price?.times(it)})
}

productCartRemoveSign.setOnClickListener {
Expand All @@ -69,7 +71,7 @@ class ProductCartAdapter(
notifyItemRangeChanged(position, product_list.size)
}
}
productCartPrice.text = "$ %.2f".format(product.amountAddedToCart?.let { product.price?.times(it)})
productCartTotalPrice.text = "$ %.2f".format(product.amountAddedToCart?.let { product.price?.times(it)})
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/layout/fragment_product_cart_contact.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@
app:layout_constraintTop_toBottomOf="@+id/cart_contact_price"
tools:text="0" />

<TextView
android:id="@+id/cart_contact_total_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cart_contact_price"
tools:text="$ 9999.99" />


</androidx.constraintlayout.widget.ConstraintLayout>

Expand Down
Binary file added assets/JVMtestResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/JVMtestTree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/androidTestResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/androidTestTree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 60 additions & 4 deletions documents/implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
# Tabla de contenidos

- [Flujo](#flujo)
- [Main navigation](#main-navigation)
- [Menu navigation](#menu-navigation)
- [Main navigation](#main-navigation)
- [Menu navigation](#menu-navigation)
- [Dificultades y soluciones](#dificultades-y-soluciones)
- [Rating y votos random](#rating-y-votos-random)
- [Menú de navegación](#menú-de-navegación)
- [Rating y votos random](#rating-y-votos-random)
- [Menú de navegación](#menú-de-navegación)
- [Uso de tests unitarios](#uso-de-tests-unitarios)
- [Tests unitarios que corren en la JVM, sin dependencia del framework de Android](#tests-unitarios-que-corren-en-la-JVM,-sin-dependencia-del-framework-de-Android)
- [Tests que involucran el uso del framework de android en un test unitario local (no instrumentado)](#tests-que-involucran-el-uso-del-framework-de-android-en-un-test-unitario-local-(no-instrumentado))

# Flujo

Expand Down Expand Up @@ -137,6 +140,59 @@
- Solución:

Logramos implementar el uso de una función que nos permite asignar el `navController` del `navHostFragment` perteneciente a la `MenuActivity`, en el `BottomNavigationView`. Lo cual realiza completamente la identificación de cual Fragment se debería mostrar según el item seleccionado, con la única precaución de tener en cada uno de estos ítems el id exactamente igual que el nombre del Fragment que queremos mostrar para cada caso.


&nbsp;

# Uso de tests unitarios

&nbsp;

## Tests unitarios que corren en la JVM, sin dependencia del framework de Android

- Localizamos dentro de nuestro proyecto el archivo donde se encuentran los test

<div align="center">

<img src="../assets/JVMtestTree.png" width="500">

</div>

- Abrimos nuestro LoginCheckTest
- Seleccionamos el botón que se encuentra del lado izquierdo de la declaración de nuestra clase
- Elegimos la opción `Run LoginCheckTest`
- Finalmente vemos el resultado en nuestra pestaña `Run` (Ubicada en la parte inferior del proyecto)

<div align="center">

<img src="../assets/JVMtestResult.png" width="500">

</div>

&nbsp;

## Tests que involucran el uso del framework de android en un test unitario local (no instrumentado)

- Localizamos dentro de nuestro proyecto el archivo donde se encuentran los test de android

<div align="center">

<img src="../assets/androidTestTree.png" width="500">

</div>

- Abrimos nuestro ResourceComparerTest
- Seleccionamos el botón que se encuentra del lado izquierdo de la declaración de nuestra clase
- Elegimos la opción `Run ResourceComparerTest`
- Finalmente vemos el resultado en nuestra pestaña `Run` (Ubicada en la parte inferior del proyecto)

<div align="center">

<img src="../assets/androidTestResult.png" width="500">

</div>


---

**[README](../README.md)** | **[Documentación](root.md)** | **[Recursos de BEDU y Referencias](resources.md)**
16 changes: 8 additions & 8 deletions documents/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@

## [Kotlin Avanzado Bedu Naranaja X - GitHub](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021)

* [ ] [Sesión 1 Animaciones y Transiciones](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-01)
* [x] [Sesión 1 Animaciones y Transiciones](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-01)

* [ ] [Sesión 2 Networking](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-02)
* [x] [Sesión 2 Networking](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-02)

* [ ] [Sesión 3 Acceso a Hardware](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-03)
* [x] [Sesión 3 Acceso a Hardware](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-03)

* [ ] [Sesión 4 Persistencia y Bases de Datos](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-04)
* [x] [Sesión 4 Persistencia y Bases de Datos](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-04)

* [ ] [Sesión 5 App Components](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-05)
* [x] [Sesión 5 App Components](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-05)

* [ ] [Sesión 6 Firebase y Notifications](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-06)
* [x] [Sesión 6 Firebase y Notifications](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-06)

* [ ] [Sesión 7 Patrones de arquitectura](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-07)
* [x] [Sesión 7 Patrones de arquitectura](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-07)

* [ ] [Sesión 8 Testing](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-08)
* [x] [Sesión 8 Testing](https://github.com/beduExpert/Kotlin-Avanzado-NaranjaX-2021/tree/main/Sesion-08)

# Referencias

Expand Down

0 comments on commit 409f170

Please sign in to comment.