You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Which then generates this compiler warning for targetSdk=22 builds:
TheClass_.java:33: warning: [deprecation] getDrawable(int) in Resources has been deprecated
backgroundDrawable = resources_.getDrawable(drawable.bg_button_with_stroke_orange);
Instead, AndroidAnnoations should, given the class ContextCompat is available, generate this:
Having that said, @WonderCsabo how could one actually check if the class is available? We'd have to add the "compile" scope into the annotation processing scope (apt) and check there. Is that even possible?
We can just check whether it is on the classpath and that is working already. We do not know anything about whether it will be really packaged into the app or not, but we expect it will be. We already do this kind of check when we generate the Activity builders.
You can look at ActivityIntentBuilder. Minsdkversion is available in our
AndroidManifest API, compileSdkVersion is not, so you have to check that
the Context.getDrawable method is available or not (like
ActivityIntentBuilder.hasActivityOptions).
Activity
WonderCsabo commentedon May 20, 2015
Seems reasonable. Wanna contribute?
ened commentedon May 20, 2015
Would love to take care of it. Just no time right now. Keep it here for tracking, first.
ened commentedon May 20, 2015
Having that said, @WonderCsabo how could one actually check if the class is available? We'd have to add the "compile" scope into the annotation processing scope (
apt) and check there. Is that even possible?WonderCsabo commentedon May 20, 2015
We can just check whether it is on the classpath and that is working already. We do not know anything about whether it will be really packaged into the app or not, but we expect it will be. We already do this kind of check when we generate the
Activitybuilders.WonderCsabo commentedon May 23, 2015
@ened i forgot that we should handle the cases when
ContextCompatis not available.minSdkVersion => 21 && ContextCompat is not available:
minSdkVersion < 21 && compileSdkVersion >=21 && ContextCompat is not available:
Can you implement that?
ened commentedon May 24, 2015
Would that check be done during compile time or in a runtime switch? Probably generate the code like you showed it, right?
WonderCsabo commentedon May 24, 2015
Yeah generate that code, the compile time conditional is in italic.
ened commentedon May 24, 2015
Ok cool. Is there another component that's doing such a check?
WonderCsabo commentedon May 24, 2015
ened commentedon May 24, 2015
Now I got something like this:
But I can't find out why the resources_ variable is initialized AFTER the usage. :)
Heres the code that generates it:
@WonderCsabo Spontaneous idea?
ened commentedon May 24, 2015
OK I found it. Just had to get a hold of the resourcesRef earlier. PR coming. :)