-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Vector drawable can't be used as error drawable #1267
Comments
A simple workaround would be to get the drawable yourself: Tip: you can save the request builder into a field and reuse it in an adapter to prevent continuously calling these (see |
I took a deeper look, checked the flow of You said there's no @sjudd what's your take on this? |
The /**
* Based on {@link android.support.v7.app.AppCompatActivity}
*/
public class AppCompatApplication extends MultiDexApplication {
private Resources resources;
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (resources != null) {
DisplayMetrics newMetrics = super.getResources().getDisplayMetrics();
resources.updateConfiguration(newConfig, newMetrics);
}
}
@Override
public Resources getResources() {
if (resources == null && VectorEnabledTintResources.shouldBeUsed()) {
resources = new VectorEnabledTintResources(this, super.getResources());
}
return resources == null ? super.getResources() : resources;
}
} |
Themes are a sign we ought to use the provided context to load placeholders, not the application. We will have to be careful to avoid leaking activities unnecessarily, but that already can happen (if you use something like SimpleTarget) and we do try to guard against it by cancelling/restarting requests when activities and fragments are destroyed/re-created, so hopefully it won't be too bad. |
So I think I have a more complete fix for this in 4.3 which will allow automatic application of themes and handle custom ContextWrappers for error/fallback/placeholder. The original issue I think was actually fixed a while ago in bd9e265. |
error
methodThe problem is that
GenericRequest
gets resources from the application context, not the provided context. All the AppCompat classes (likeAppCompatActivity
) can return theVectorEnabledTintResources
class, which supports vector drawable. Unfortunately, there's noAppCompatApplication
, so theApplication
class always returns just plainResources
class which doesn't support vector drawables before Android 5.0.Glide Version:
3.7.0
Integration libraries:
okhttp3-integration:1.4.0
Device/Android Version:
GT-P5210 Android 4.4.2
The text was updated successfully, but these errors were encountered: