Skip to content

Conversation

@rumburake
Copy link
Contributor

#30

Copy link
Member

@nic0lette nic0lette 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 making this PR. Just one small change I'd like to see and then I can merge it.

supportsAutomotive = false;
if (features != null) {
for (FeatureInfo f : features) {
if ("android.hardware.type.automotive".equals(f.name)) {
Copy link
Member

Choose a reason for hiding this comment

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

Would you be able to either switch this (with a null check) or use TextUtils.equals()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, thanks for looking into this! I can change no problem.

The comment actually made me curious, and I searched around which form would be better, but I couldn't find general advice.

My preference was to avoid a verbose null check. The TextUtils would add an import, slighly less straightforward than String.equals(other). There should be some disadvantage on "literal".equals() too, perhaps readability?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, it just feels a bit odd to me. The check is really "Is f.name equal to ...", but the other way, written to avoid the null check, turns it around, and that doesn't seem as nice.

I kind of wish it were in Kotlin so we could avoid the whole question, but 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

me too, but the tool is nonetheless very usefull to me so thank you!

@nic0lette nic0lette merged commit 1667437 into googlesamples:master Feb 18, 2021
@nic0lette
Copy link
Member

Thank you very much for the PR =D

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