Skip to content
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

[CU-19bjtt] Rating text color is variable #89

Closed
wants to merge 9 commits into from
Closed

[CU-19bjtt] Rating text color is variable #89

wants to merge 9 commits into from

Conversation

sanyud24
Copy link
Contributor

@sanyud24 sanyud24 commented Sep 3, 2020

textview rating color changes on the basis of rating

textview rating color changes on the basis of rating
@@ -393,6 +393,22 @@ class PublicRestaurantProfileActivity : BaseActivity(), AppBarLayout.OnOffsetCha
} else "-"
} ?: "-"
tvRating.text = restaurantModel.formatRating()
val ratingtext: String = tvRating.text.toString();
Copy link
Member

Choose a reason for hiding this comment

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

Why don't you use restaurantModel.rating on RHS of assignment? Then you don't need to cover it back to float.

Copy link
Member

@shivanshs9 shivanshs9 left a comment

Choose a reason for hiding this comment

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

@sanyud24 please check that CI check is failing for this PR.
That means this PR code cannot even build. Please fix it by running your code on your phone locally before pushing the code.

@shivanshs9 shivanshs9 changed the title Update PublicRestaurantProfileActivity.kt [CU-19bjtt] Rating text color is variable Sep 8, 2020
@shivanshs9
Copy link
Member

Task linked: CU-19bjtt Rating text color is variable

Copy link
Member

@shivanshs9 shivanshs9 left a comment

Choose a reason for hiding this comment

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

What's the point of deduplicating code if you're still writing same if-else block twice? 🙄
Plus, I mentioned creating the extension functions on the data classes so you don't need to pass data.ratings explicitly. And the function will return the color integer value (like R.color.apple_green) rather than setting it on its own.

@shivanshs9
Copy link
Member

Superseded by #101

@shivanshs9 shivanshs9 closed this Oct 20, 2020
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