-
Notifications
You must be signed in to change notification settings - Fork 44
Infer resource kinds from support annotations #22
Conversation
- Restructure project, make API a proper AAR and pull shared things into barber-annotations - Start resolved attr work - Ditch bintray-release and move entirely to standard mavencentral structure (with snapshots!) - Start 1.4.0-SNAPSHOT
Aside from public class A {
@StyledAttr(R.styleable.BarberView_stripeWidth)
@DimenRes
int stripeWidth; // The IDE will now think this is a resId but code will use it as the evaluated dimen value?
} |
This is only avoiding duplicating info between a Kind.RES_ID annotation parameter and a @res support annotation.
Without the changes case A is broken (even though it semantically makes sense) and you have to add the explicit Kind.RES_ID parameter as in case B to get it to work with Barber. |
Ahhhh I see what you mean now. In that case, yeah this looks good. I'm to think if there's any case where they might want a non- |
e4a623e
to
79c200a
Compare
Rebased |
This PR is still pointing to master, you'll have to close this and open a separate one pointing to the branch I mentioned to merge into that one. |
oh sorry... will do. |
I thought this might be a good feature to have while using the library. Android support annotations provide similar functionality to the
kind
annotation parameter so instead of duplicating the info, this change-set enables looking at the support annotation (which people should be using anyways) and setting kind to resource type if the support annotation used is one of the @res types.The one additional special case is the @ColorInt annotation. Which this also checks for and sets kind to COLOR if it's used.
What are your thoughts?