Skip to content

Conversation

rohithThammaiah
Copy link
Contributor

@rohithThammaiah rohithThammaiah commented Oct 26, 2020

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

@rohithThammaiah rohithThammaiah changed the title New details screen using Jetpack compose #47 New details screen using Jetpack compose Oct 26, 2020
Copy link
Owner

@AkshayChordiya AkshayChordiya left a 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

// Coil
implementation "io.coil-kt:coil:$coilVersion"
implementation "dev.chrisbanes.accompanist:accompanist-coil:0.3.1"
Copy link
Owner

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


/**
* Gets the particular article from database for
* the give articleId
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor typo

Suggested change
* the give articleId
* the given [articleId]

Copy link
Owner

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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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")
Copy link
Owner

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

Suggested change
@Query("SELECT * FROM news_article WHERE id = :articleId")
@Query("SELECT * FROM ${NewsArticles.tableName} WHERE id = :articleId")

}

/**
* Get News article for given articleId
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Get News article for given articleId
* Get news article for the specified [articleId]

Comment on lines 92 to 94
Column(modifier = Modifier.fillMaxWidth().fillMaxHeight(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally) {
Copy link
Owner

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

Suggested change
Column(modifier = Modifier.fillMaxWidth().fillMaxHeight(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally) {
Column(
modifier = Modifier.fillMaxWidth().fillMaxHeight(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {

Comment on lines 105 to 107
Column(modifier = Modifier.fillMaxWidth().fillMaxHeight(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally) {
Copy link
Owner

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

<item name="colorAccent">@color/colorAccent</item>
</style>

<!-- Base application theme. -->
Copy link
Owner

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 🤔

Copy link
Contributor Author

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()?

Copy link
Owner

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"

Copy link
Owner

@AkshayChordiya AkshayChordiya left a 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 🙌

@AkshayChordiya
Copy link
Owner

@rohithThammaiah Can you resolve the merge conflicts and make the PR ready for review? So I can review it and merge it

rohithThammaiah and others added 2 commits November 3, 2020 08:46
# Conflicts:
#	app/build.gradle
#	app/src/main/java/com/akshay/newsapp/news/ui/activity/NewsActivity.kt
@rohithThammaiah rohithThammaiah marked this pull request as ready for review November 3, 2020 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants