am ce0bc264: am a9ba2cdf: Merge "Ensure ImageView.setImageResource() always resolves Drawable" into lmp-mr1-dev
* commit 'ce0bc26443bb61832ac59a0d367b9ec1a540301b': Ensure ImageView.setImageResource() always resolves Drawable
This commit is contained in:
@@ -386,21 +386,21 @@ public class ImageView extends View {
|
|||||||
*/
|
*/
|
||||||
@android.view.RemotableViewMethod
|
@android.view.RemotableViewMethod
|
||||||
public void setImageResource(int resId) {
|
public void setImageResource(int resId) {
|
||||||
if (mUri != null || mResource != resId) {
|
// The resource configuration may have changed, so we should always
|
||||||
final int oldWidth = mDrawableWidth;
|
// try to load the resource even if the resId hasn't changed.
|
||||||
final int oldHeight = mDrawableHeight;
|
final int oldWidth = mDrawableWidth;
|
||||||
|
final int oldHeight = mDrawableHeight;
|
||||||
|
|
||||||
updateDrawable(null);
|
updateDrawable(null);
|
||||||
mResource = resId;
|
mResource = resId;
|
||||||
mUri = null;
|
mUri = null;
|
||||||
|
|
||||||
resolveUri();
|
resolveUri();
|
||||||
|
|
||||||
if (oldWidth != mDrawableWidth || oldHeight != mDrawableHeight) {
|
if (oldWidth != mDrawableWidth || oldHeight != mDrawableHeight) {
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
|
||||||
invalidate();
|
|
||||||
}
|
}
|
||||||
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user