Class FixedSizeDrawable


  • public class FixedSizeDrawable
    extends android.graphics.drawable.Drawable
    A wrapper drawable to square the wrapped drawable so that it expands to fill a square with exactly the given side length. The goal of this drawable is to ensure that square thumbnail drawables always match the size of the view they will be displayed in to avoid a costly requestLayout call. This class should not be used with views or drawables that are not square.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class android.graphics.drawable.Drawable

        android.graphics.drawable.Drawable.Callback, android.graphics.drawable.Drawable.ConstantState
    • Constructor Summary

      Constructors 
      Constructor Description
      FixedSizeDrawable​(android.graphics.drawable.Drawable wrapped, int width, int height)  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void clearColorFilter()  
      void draw​(android.graphics.Canvas canvas)  
      int getAlpha()  
      android.graphics.drawable.Drawable.Callback getCallback()  
      int getChangingConfigurations()  
      android.graphics.drawable.Drawable.ConstantState getConstantState()  
      android.graphics.drawable.Drawable getCurrent()  
      int getIntrinsicHeight()  
      int getIntrinsicWidth()  
      int getMinimumHeight()  
      int getMinimumWidth()  
      int getOpacity()  
      boolean getPadding​(android.graphics.Rect padding)  
      void invalidateSelf()  
      android.graphics.drawable.Drawable mutate()  
      void scheduleSelf​(java.lang.Runnable what, long when)  
      void setAlpha​(int i)  
      void setBounds​(int left, int top, int right, int bottom)  
      void setBounds​(android.graphics.Rect bounds)  
      void setChangingConfigurations​(int configs)  
      void setColorFilter​(int color, android.graphics.PorterDuff.Mode mode)  
      void setColorFilter​(android.graphics.ColorFilter colorFilter)  
      void setDither​(boolean dither)
      Deprecated.
      void setFilterBitmap​(boolean filter)  
      boolean setVisible​(boolean visible, boolean restart)  
      void unscheduleSelf​(java.lang.Runnable what)  
      • Methods inherited from class android.graphics.drawable.Drawable

        applyTheme, canApplyTheme, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getBounds, getColorFilter, getDirtyBounds, getHotspotBounds, getLayoutDirection, getLevel, getOpticalInsets, getOutline, getState, getTransparentRegion, hasFocusStateSpecified, inflate, inflate, isAutoMirrored, isFilterBitmap, isProjected, isStateful, isVisible, jumpToCurrentState, onBoundsChange, onLayoutDirectionChanged, onLevelChange, onStateChange, resolveOpacity, setAutoMirrored, setCallback, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setTintBlendMode, setTintList, setTintMode
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FixedSizeDrawable

        public FixedSizeDrawable​(android.graphics.drawable.Drawable wrapped,
                                 int width,
                                 int height)
    • Method Detail

      • setBounds

        public void setBounds​(int left,
                              int top,
                              int right,
                              int bottom)
        Overrides:
        setBounds in class android.graphics.drawable.Drawable
      • setBounds

        public void setBounds​(@NonNull
                              android.graphics.Rect bounds)
        Overrides:
        setBounds in class android.graphics.drawable.Drawable
      • setChangingConfigurations

        public void setChangingConfigurations​(int configs)
        Overrides:
        setChangingConfigurations in class android.graphics.drawable.Drawable
      • getChangingConfigurations

        public int getChangingConfigurations()
        Overrides:
        getChangingConfigurations in class android.graphics.drawable.Drawable
      • setDither

        @Deprecated
        public void setDither​(boolean dither)
        Deprecated.
        Overrides:
        setDither in class android.graphics.drawable.Drawable
      • setFilterBitmap

        public void setFilterBitmap​(boolean filter)
        Overrides:
        setFilterBitmap in class android.graphics.drawable.Drawable
      • getCallback

        public android.graphics.drawable.Drawable.Callback getCallback()
        Overrides:
        getCallback in class android.graphics.drawable.Drawable
      • getAlpha

        @RequiresApi(19)
        public int getAlpha()
        Overrides:
        getAlpha in class android.graphics.drawable.Drawable
      • setColorFilter

        public void setColorFilter​(int color,
                                   @NonNull
                                   android.graphics.PorterDuff.Mode mode)
        Overrides:
        setColorFilter in class android.graphics.drawable.Drawable
      • clearColorFilter

        public void clearColorFilter()
        Overrides:
        clearColorFilter in class android.graphics.drawable.Drawable
      • getCurrent

        @NonNull
        public android.graphics.drawable.Drawable getCurrent()
        Overrides:
        getCurrent in class android.graphics.drawable.Drawable
      • setVisible

        public boolean setVisible​(boolean visible,
                                  boolean restart)
        Overrides:
        setVisible in class android.graphics.drawable.Drawable
      • getIntrinsicWidth

        public int getIntrinsicWidth()
        Overrides:
        getIntrinsicWidth in class android.graphics.drawable.Drawable
      • getIntrinsicHeight

        public int getIntrinsicHeight()
        Overrides:
        getIntrinsicHeight in class android.graphics.drawable.Drawable
      • getMinimumWidth

        public int getMinimumWidth()
        Overrides:
        getMinimumWidth in class android.graphics.drawable.Drawable
      • getMinimumHeight

        public int getMinimumHeight()
        Overrides:
        getMinimumHeight in class android.graphics.drawable.Drawable
      • getPadding

        public boolean getPadding​(@NonNull
                                  android.graphics.Rect padding)
        Overrides:
        getPadding in class android.graphics.drawable.Drawable
      • invalidateSelf

        public void invalidateSelf()
        Overrides:
        invalidateSelf in class android.graphics.drawable.Drawable
      • unscheduleSelf

        public void unscheduleSelf​(@NonNull
                                   java.lang.Runnable what)
        Overrides:
        unscheduleSelf in class android.graphics.drawable.Drawable
      • scheduleSelf

        public void scheduleSelf​(@NonNull
                                 java.lang.Runnable what,
                                 long when)
        Overrides:
        scheduleSelf in class android.graphics.drawable.Drawable
      • draw

        public void draw​(@NonNull
                         android.graphics.Canvas canvas)
        Specified by:
        draw in class android.graphics.drawable.Drawable
      • setAlpha

        public void setAlpha​(int i)
        Specified by:
        setAlpha in class android.graphics.drawable.Drawable
      • setColorFilter

        public void setColorFilter​(android.graphics.ColorFilter colorFilter)
        Specified by:
        setColorFilter in class android.graphics.drawable.Drawable
      • getOpacity

        public int getOpacity()
        Specified by:
        getOpacity in class android.graphics.drawable.Drawable
      • mutate

        @NonNull
        public android.graphics.drawable.Drawable mutate()
        Overrides:
        mutate in class android.graphics.drawable.Drawable
      • getConstantState

        public android.graphics.drawable.Drawable.ConstantState getConstantState()
        Overrides:
        getConstantState in class android.graphics.drawable.Drawable