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

[DISCUSSION] Use Kotlin Android Extensions instead of Butterknife #3530

Closed
macgills opened this issue Mar 16, 2020 · 12 comments
Closed

[DISCUSSION] Use Kotlin Android Extensions instead of Butterknife #3530

macgills opened this issue Mar 16, 2020 · 12 comments

Comments

@macgills
Copy link
Collaborator

Summary:

In kotlin we have the option of using Kotlin Android Extensions ViewBinding

I am in favour of their usage for their ease of use.

The alternatives are:

  1. Continue using butterknife
  2. Use ViewBinding for compile time safety
@maskaravivek
Copy link
Member

I am in favour of using Kotlin Android Extensions ViewBinding for all the Android components that are written in Kotlin.

IMO our goal should be to gradually remove all usages of Butterknife. Whenever an existing Android component which is written in Java is converted to Kotlin, we should ideally replace Butterknife with Kotlin Android Extensions ViewBinding.

Let's wait for what others think about this and then we can make this part of our contributor guidelines.

@misaochan
Copy link
Member

Whenever an existing Android component which is written in Java is converted to Kotlin, we should ideally replace Butterknife with Kotlin Android Extensions ViewBinding.

This sounds good to me.

@maskaravivek
Copy link
Member

@misaochan Do we need to wait for more opinions on this or if everyone agrees then we can unblock #3524.

@misaochan
Copy link
Member

Let's just get @ashishkumar468 's opinion, we should be good after that since this is a relatively minor policy.

@ashishkumar468
Copy link
Collaborator

ashishkumar468 commented Mar 16, 2020

Agree with @maskaravivek 's opinion, I am okay to go with this, read the docs, supports both View Caching and Layout Containers (so that classes like ViewHolders can also be used as an extension container).

@macgills
Copy link
Collaborator Author

A minor xml style point now that it seems we are all in agreement.

Should we start writing our ids in camelCase instead of snake_case seeing as they will be present in Kotlin classes?

@ashishkumar468
Copy link
Collaborator

I think that should be okay.

@macgills
Copy link
Collaborator Author

@maskaravivek if you are okay with it then I will consider this issue closed

@maskaravivek
Copy link
Member

Once the liked PR is merged, we can close this issue.

macgills pushed a commit to commons-app/commons-app-documentation that referenced this issue Mar 18, 2020
@macgills macgills reopened this Mar 18, 2020
@ashishkumar468
Copy link
Collaborator

I was reading the docs, and the layout container support is experimental, are we okay with that?

@macgills
Copy link
Collaborator Author

It has been experimental since it released and has seen no real change over the 2 years I have been using it in production. It is also not "experimental" in the same way they mark APIs experimental where it is a compiletime error to not also mark your caller experimental

@domdomegg
Copy link
Member

Kotlin Android extensions looks to be being deprecated in favour of view binding for Android. However, looks like support will only be dropped in September 2021

https://android-developers.googleblog.com/2020/11/the-future-of-kotlin-android-extensions.html

@nicolas-raoul nicolas-raoul closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants