You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
Context.getDrawable(): use the current theme
This commit is contained in:
@@ -637,7 +637,7 @@ public class Context extends Object {
|
||||
}
|
||||
|
||||
public final Drawable getDrawable(int resId) {
|
||||
return getResources().getDrawable(resId);
|
||||
return getResources().getDrawable(resId, getTheme());
|
||||
}
|
||||
|
||||
public boolean isRestricted() { return false; }
|
||||
|
||||
@@ -710,6 +710,10 @@ public class Resources {
|
||||
* @return Drawable An object that can be used to draw this resource.
|
||||
*/
|
||||
public Drawable getDrawable(int id) throws NotFoundException {
|
||||
return getDrawable(id, null);
|
||||
}
|
||||
|
||||
public Drawable getDrawable(int id, Theme theme) throws NotFoundException {
|
||||
TypedValue value;
|
||||
synchronized (mAccessLock) {
|
||||
value = mTmpValue;
|
||||
@@ -722,7 +726,7 @@ public class Resources {
|
||||
}
|
||||
Drawable res = null;
|
||||
try {
|
||||
res = loadDrawable(value, id);
|
||||
res = loadDrawable(value, id, theme);
|
||||
} catch (NotFoundException e) { e.printStackTrace(); }
|
||||
synchronized (mAccessLock) {
|
||||
if (mTmpValue == null) {
|
||||
@@ -732,10 +736,6 @@ public class Resources {
|
||||
return res;
|
||||
}
|
||||
|
||||
public Drawable getDrawable(int id, Theme theme) throws NotFoundException {
|
||||
return getDrawable(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a drawable object associated with a particular resource ID for the
|
||||
* given screen density in DPI. This will set the drawable's density to be
|
||||
|
||||
Reference in New Issue
Block a user