Closed dbachelder closed 9 years ago
for injected drawable resources
http://developer.android.com/reference/android/content/res/Resources.html#getDrawable(int)
Ah, maybe we should move to Context.getDrawable() instead.
that was added in api 21
Shoot, you're correct. I wonder if we could annotate the invocation directly:
@SuppressWarnings("depreciated")
resources.getDrawable(1234);
That way if anything else is depreciated we would know about it. Supressing all depreciated warnings feels a little heavy handed to me.
unfortunately annotations aren't allowed in method bodies
SuppressWarnings is, at least for local variables:
@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
@Retention(RetentionPolicy.SOURCE)
public @interface SuppressWarnings {
That is for the variable declaration. This would only be useful if we created a temporary variable to assign the resource to then assigned that to the property on the component delegate.
Ah, you're right... hmm, with some of the newer rules I feel like we're supporting a specific version of Android anyways. Are you not compiling against version > 21?
We are compiling against 23. What do you think makes it specific? those new annotations I added are optional...
I'm sorry, I think I was a little quick to answer and too short. Im thinking that we fix this issue instead of masking it with suppressing the depreciation warning. It would be fairly easy to migrate to use Context.getDrawable() instead. Would this work for you or is there some other issue I'm not seeing?
That won't work for people not targeting >= 21.. how about using ContextCompat?
http://developer.android.com/reference/android/support/v4/content/ContextCompat.html
Is transfuse using depreciated methods on the Android api?