private void initializeDrawableForDisplay ( Drawable d ) { if ( mBlockInvalidateCallback == null ) { mBlockInvalidateCallback = new BlockInvalidateCallback ( ) ; } // Temporary fix for suspending callbacks during initialization. We // don't want any of these setters causing an invalidate() since that // may call back into DrawableContainer. d . setCallback ( mBlockInvalidateCallback . wrap ( d . getCallback ( ) ) ) ; try { if ( mDrawableContainerState . mEnterFadeDuration <= 0 && mHasAlpha ) { d . setAlpha ( mAlpha ) ; } if ( mDrawableContainerState . mHasColorFilter ) { // Color filter always overrides tint. d . setColorFilter ( mDrawableContainerState . mColorFilter ) ; } else { if ( mDrawableContainerState . mHasTintList ) { DrawableCompat . setTintList ( d , mDrawableContainerState . mTintList ) ; } if ( mDrawableContainerState . mHasTintMode ) { DrawableCompat . setTintMode ( d , mDrawableContainerState . mTintMode ) ; } } d . setVisible ( isVisible ( ) , true ) ; d . setDither ( mDrawableContainerState . mDither ) ; d . setState ( getState ( ) ) ; d . setLevel ( getLevel ( ) ) ; d . setBounds ( getBounds ( ) ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . M ) { d . setLayoutDirection ( getLayoutDirection ( ) ) ; } if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . KITKAT ) { d . setAutoMirrored ( mDrawableContainerState . mAutoMirrored ) ; } final Rect hotspotBounds = mHotspotBounds ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP && hotspotBounds != null ) { d . setHotspotBounds ( hotspotBounds . left , hotspotBounds . top , hotspotBounds . right , hotspotBounds . bottom ) ; } } finally { d . setCallback ( mBlockInvalidateCallback . unwrap ( ) ) ; } }
Initializes a drawable for display in this container .