Open sindrenm opened 8 years ago
Not entirely sure if I follow you, @jeantuffier. If you have a button with the ID “submitButton” in the layout file, surely you'd import that one like this?
import kotlinx.android.synthetic.<layout_file>.submitButton
How else would you do it?
And about the prefix for member variables, I personally think we can drop them. They don't really serve a purpose, in my opinion.
Is it actually a thing you want to do ? Camel case for IDs in the XML ?
I didn't do that previously, but after starting to use the synthetic imports, I've been doing that, yes.
So one thing I kinda disagree with you so far is on the naming of variable representing UI element we import with this
import kotlinx.android.synthetic.fragment_call.<id of UI element>
. In my opinion we should use the same string than the one we use in the xml.During the refactoring of the norge bank app, I was really confused at some point because I couldn't find out where the variable were declared and initialized. Once again, in my opinion those variables sementically do not represent the same thing : actual variable declared in the code .vs. UI element import by a kotlin extension.
Another point is the use of the "m" prefix for class member properties, do you want it as a rule ?