-
Notifications
You must be signed in to change notification settings - Fork 170
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
New details screen using Jetpack compose #50
base: master
Are you sure you want to change the base?
New details screen using Jetpack compose #50
Conversation
# Conflicts: # app/build.gradle
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.
Thanks for your contribution. It's really amazing work 🏅
I left a few comments to improve upon 😄
app/build.gradle
Outdated
@@ -102,13 +116,22 @@ dependencies { | |||
|
|||
// Coil | |||
implementation "io.coil-kt:coil:$coilVersion" | |||
implementation "dev.chrisbanes.accompanist:accompanist-coil:0.3.1" |
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.
It's best to keep the version as a constant in project/build.gradle
@@ -27,6 +27,13 @@ import javax.inject.Singleton | |||
*/ | |||
interface NewsRepository { | |||
|
|||
/** | |||
* Gets the particular article from database for | |||
* the give articleId |
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.
Minor typo
* the give articleId | |
* the given [articleId] |
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.
You can skip the @param
code comment
// 1. Start with loading | ||
emit(ViewState.loading()) | ||
|
||
// 2. Fetch and update state particular article from database |
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.
// 2. Fetch and update state particular article from database | |
// 2. Fetch the news article |
/** | ||
* Get News article for given articleId | ||
*/ | ||
@Query("SELECT * FROM news_article WHERE id = :articleId") |
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.
Minor suggestion to use constant
@Query("SELECT * FROM news_article WHERE id = :articleId") | |
@Query("SELECT * FROM ${NewsArticles.tableName} WHERE id = :articleId") |
@@ -28,6 +28,12 @@ interface NewsArticlesDao { | |||
insertArticles(articles) | |||
} | |||
|
|||
/** | |||
* Get News article for given articleId |
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.
* Get News article for given articleId | |
* Get news article for the specified [articleId] |
Column(modifier = Modifier.fillMaxWidth().fillMaxHeight(), | ||
verticalArrangement = Arrangement.Center, | ||
horizontalAlignment = Alignment.CenterHorizontally) { |
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.
Minor suggestion to put all parameters on new line for cleaner look
Column(modifier = Modifier.fillMaxWidth().fillMaxHeight(), | |
verticalArrangement = Arrangement.Center, | |
horizontalAlignment = Alignment.CenterHorizontally) { | |
Column( | |
modifier = Modifier.fillMaxWidth().fillMaxHeight(), | |
verticalArrangement = Arrangement.Center, | |
horizontalAlignment = Alignment.CenterHorizontally | |
) { |
Column(modifier = Modifier.fillMaxWidth().fillMaxHeight(), | ||
verticalArrangement = Arrangement.Center, | ||
horizontalAlignment = Alignment.CenterHorizontally) { |
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.
Same suggestion as above to put all parameters on new line
app/src/main/res/values/styles.xml
Outdated
@@ -8,6 +8,14 @@ | |||
<item name="colorAccent">@color/colorAccent</item> | |||
</style> | |||
|
|||
<!-- Base application theme. --> |
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.
Could we use the base AppTheme
instead of creating this new one 🤔
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.
In the NewsDetailsActivity
the ActionBar
is set using compose, so I wanted to hide the default ActionBar
which the activity provides from the theme. Can we can use the same theme and hide the ActionBar
from the theme in onCreate
using supportActionBar?.hide()
?
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.
Ah I see. Got it now, in that case it's best to keep to have new theme like you did and perhaps update the code comment above it saying "Base theme for Compose"
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.
Great work, thank you so much 🙌
@rohithThammaiah Can you resolve the merge conflicts and make the PR ready for review? So I can review it and merge it |
Master to Fork
# Conflicts: # app/build.gradle # app/src/main/java/com/akshay/newsapp/news/ui/activity/NewsActivity.kt
Fetching details from the database (Not sure if it's the right way). Had to migrate to ViewBinding because of some issue with synthetics in Kotlin version
1.4.10
.#47