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) {
|
public final Drawable getDrawable(int resId) {
|
||||||
return getResources().getDrawable(resId);
|
return getResources().getDrawable(resId, getTheme());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRestricted() { return false; }
|
public boolean isRestricted() { return false; }
|
||||||
|
|||||||
@@ -710,6 +710,10 @@ public class Resources {
|
|||||||
* @return Drawable An object that can be used to draw this resource.
|
* @return Drawable An object that can be used to draw this resource.
|
||||||
*/
|
*/
|
||||||
public Drawable getDrawable(int id) throws NotFoundException {
|
public Drawable getDrawable(int id) throws NotFoundException {
|
||||||
|
return getDrawable(id, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Drawable getDrawable(int id, Theme theme) throws NotFoundException {
|
||||||
TypedValue value;
|
TypedValue value;
|
||||||
synchronized (mAccessLock) {
|
synchronized (mAccessLock) {
|
||||||
value = mTmpValue;
|
value = mTmpValue;
|
||||||
@@ -722,7 +726,7 @@ public class Resources {
|
|||||||
}
|
}
|
||||||
Drawable res = null;
|
Drawable res = null;
|
||||||
try {
|
try {
|
||||||
res = loadDrawable(value, id);
|
res = loadDrawable(value, id, theme);
|
||||||
} catch (NotFoundException e) { e.printStackTrace(); }
|
} catch (NotFoundException e) { e.printStackTrace(); }
|
||||||
synchronized (mAccessLock) {
|
synchronized (mAccessLock) {
|
||||||
if (mTmpValue == null) {
|
if (mTmpValue == null) {
|
||||||
@@ -732,10 +736,6 @@ public class Resources {
|
|||||||
return res;
|
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
|
* 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
|
* given screen density in DPI. This will set the drawable's density to be
|
||||||
|
|||||||
Reference in New Issue
Block a user