-
Notifications
You must be signed in to change notification settings - Fork 55
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
First delivery #42
base: main
Are you sure you want to change the base?
First delivery #42
Conversation
- Uses permission enabled Gradle - Adding Dependencies MainActivity - Setting up content container
- Adding Screens and Navigation MainActivity - Setting up navHost
- Adding Data Transfer Object (DTO) Interface for Retrofit - Adding AppModule and its provider for RetrofitInstance - Adding Models for Available Book, Ticker and Order Book - Adding New Class which extends from Application for Hilt annotation HiltAndroidApp - Name registration in Manifest MainActivity - Adding entry point Hilt annotation
- Generic Card component - New SVG Image for app Icon and PlaceHolder - Building up the Principal screen
- Setting up the Navigation flow in order to pass the book name as argument to Description Screen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hola Samuel!
Quisiera felicitarte porque me parece muy bueno tu primer entregable! implementaste features que no eran requisitos para este entregable como inyeccion de dependencias y Compose, lo cual hizo tu código mucho mas legible. Te deje algunos comentarios que podrian hacer tu código un poco mas limpio como extraer valores constantes al archivo de dimens y en la parte de compose podrias pasar solo los datos que vas a mostrar por medio del constructor en lugar de todo el viewModel, asi la logica queda mejor encapsulada y tu composable solo se encarga de la parte visual. Tambien la pantalla de detalles la podrias mejorar ya que solo se muestra la respuesta de los servicios en forma de texto.
Sigue asi, por los avances que me has mostrado del siguiente entregable estoy seguro que sera igual de bueno.
Saludos!!
.padding(16.dp), | ||
horizontalArrangement = Arrangement.Start, | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
GlideImage( | ||
modifier = Modifier | ||
.padding(16.dp) | ||
.clip(shape = CircleShape) | ||
.size(40.dp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trata de separar estos valores constantes en un archivo de dimens.
interface GenericCardInterface { | ||
val glideModel: GlideModel | ||
val background: Color | ||
val title: String? | ||
val subtitle: String? | ||
val helper: String? | ||
} | ||
|
||
data class GenericCardPresentation( | ||
override val glideModel: GlideModel, | ||
override val background: Color, | ||
override val title: String?, | ||
override val subtitle: String? = null, | ||
override val helper: String? = null, | ||
val onClick: () -> Unit = {} | ||
) : GenericCardInterface | ||
|
||
data class GenericCardDescription( | ||
val border: Color? = null, | ||
override val glideModel: GlideModel, | ||
override val background: Color, | ||
override val title: String, | ||
override val subtitle: String?, | ||
override val helper: String? | ||
) : GenericCardInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muy buena forma de extraer la lógica en una interfaz principal!
.padding(16.dp) | ||
.clip(shape = RoundedCornerShape(size = 14.dp)) | ||
.size(100.dp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Igual que el anterior, pasa estos valores a un archivo de dimens
) { | ||
items(elements) { element -> | ||
GenericCard(genericCardInterface = element) | ||
Spacer(modifier = Modifier.height(16.dp)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Igual que el anterior, pasa estos valores a un archivo de dimens
package com.example.baz_android_capstone.data.models.ticker | ||
|
||
data class RollingAverageChange( | ||
val `6`: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seria mejor cambiar el nombre de la variable a una mas legible, puedes usar la notación @SerializedName para esto
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object AppModule { | ||
@Singleton | ||
@Provides | ||
fun provideBookRepository(api: BookAPI) : BookRepositoryInterface = BookRepository(api) | ||
|
||
@Singleton | ||
@Provides | ||
fun provideBookApi(): BookAPI { | ||
return Retrofit.Builder() | ||
.baseUrl(Constants.AVAILABLE_BOOK_URL) | ||
.addConverterFactory(GsonConverterFactory.create()) | ||
.build() | ||
.create(BookAPI::class.java) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muy buena forma de usar inyección de dependencias, aun cuando no era requerimiento para este entregable lo implementaste correctamente!
slideInHorizontally( | ||
initialOffsetX = { 500 }, | ||
animationSpec = tween(1300) | ||
) + | ||
fadeIn( | ||
initialAlpha = 0.0f, | ||
animationSpec = tween(1300) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Igual pasar estos valores constantes a un archivo dimens
@Composable | ||
fun Principal( | ||
navController: NavController, | ||
viewModel: BookViewModel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Podrías optimizar esta parte pasando al constructor solo los datos que se van a usar en el composable en lugar de pasar el viewModel, de esa forma tu código en compose solo se encargar de la vista y la lógica la dejas aparte
} | ||
Box(contentAlignment = Alignment.Center) { | ||
Text( | ||
text = "Aquí va un\nSplash Screen", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me parece que esto solo es de forma temporal, de otro forma pasa estos al archivo de strings
GenericCardPresentation( | ||
background = Color.LightGray, | ||
title = it.book, | ||
glideModel = GlideModel( | ||
url = "https://cryptoicons.org/api/icon/${it.book.substring(startIndex = 0, endIndex = it.book.length - 4)}/200", | ||
isRoundedShape = true, | ||
contentScale = ContentScale.Crop | ||
) | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si estas usando las imágenes de esta api seria bueno que checaras el caso en que no se encuentre imagen de la moneda ya que al correr la app son varios los casos en que esto pasa y solo se ve la imagen genérica
First delivery with the set up, navigation, retrofit adapter and dependency injection.