File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -342,8 +342,15 @@ public void setImageResource(int resId) {
342342 updateDrawable (null );
343343 mResource = resId ;
344344 mUri = null ;
345+
346+ final int oldWidth = mDrawableWidth ;
347+ final int oldHeight = mDrawableHeight ;
348+
345349 resolveUri ();
346- requestLayout ();
350+
351+ if (oldWidth != mDrawableWidth || oldHeight != mDrawableHeight ) {
352+ requestLayout ();
353+ }
347354 invalidate ();
348355 }
349356 }
@@ -367,8 +374,15 @@ public void setImageURI(Uri uri) {
367374 updateDrawable (null );
368375 mResource = 0 ;
369376 mUri = uri ;
377+
378+ final int oldWidth = mDrawableWidth ;
379+ final int oldHeight = mDrawableHeight ;
380+
370381 resolveUri ();
371- requestLayout ();
382+
383+ if (oldWidth != mDrawableWidth || oldHeight != mDrawableHeight ) {
384+ requestLayout ();
385+ }
372386 invalidate ();
373387 }
374388 }
@@ -383,8 +397,8 @@ public void setImageDrawable(Drawable drawable) {
383397 mResource = 0 ;
384398 mUri = null ;
385399
386- int oldWidth = mDrawableWidth ;
387- int oldHeight = mDrawableHeight ;
400+ final int oldWidth = mDrawableWidth ;
401+ final int oldHeight = mDrawableHeight ;
388402
389403 updateDrawable (drawable );
390404
You can’t perform that action at this time.
0 commit comments