com.bumptech.glide.request.target
Class SquaringDrawable

java.lang.Object
  extended by android.graphics.drawable.Drawable
      extended by com.bumptech.glide.load.resource.drawable.GlideDrawable
          extended by com.bumptech.glide.request.target.SquaringDrawable
All Implemented Interfaces:
Animatable

public class SquaringDrawable
extends GlideDrawable

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
Drawable.Callback, Drawable.ConstantState
 
Field Summary
 
Fields inherited from class com.bumptech.glide.load.resource.drawable.GlideDrawable
LOOP_FOREVER, LOOP_INTRINSIC
 
Constructor Summary
SquaringDrawable(GlideDrawable wrapped, int side)
           
 
Method Summary
 void clearColorFilter()
           
 void draw(Canvas canvas)
           
 int getAlpha()
           
 Drawable.Callback getCallback()
           
 int getChangingConfigurations()
           
 Drawable.ConstantState getConstantState()
           
 Drawable getCurrent()
           
 int getIntrinsicHeight()
           
 int getIntrinsicWidth()
           
 int getMinimumHeight()
           
 int getMinimumWidth()
           
 int getOpacity()
           
 boolean getPadding(Rect padding)
           
 void invalidateSelf()
           
 boolean isAnimated()
          Returns true if this drawable is animated.
 boolean isRunning()
           
 Drawable mutate()
           
 void scheduleSelf(Runnable what, long when)
           
 void setAlpha(int i)
           
 void setBounds(int left, int top, int right, int bottom)
           
 void setBounds(Rect bounds)
           
 void setChangingConfigurations(int configs)
           
 void setColorFilter(ColorFilter colorFilter)
           
 void setColorFilter(int color, PorterDuff.Mode mode)
           
 void setDither(boolean dither)
           
 void setFilterBitmap(boolean filter)
           
 void setLoopCount(int loopCount)
          Sets the number of times the animation should loop.
 boolean setVisible(boolean visible, boolean restart)
           
 void start()
           
 void stop()
           
 void unscheduleSelf(Runnable what)
           
 
Methods inherited from class android.graphics.drawable.Drawable
copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXmlInner, getBounds, getLevel, getState, getTransparentRegion, inflate, isAutoMirrored, isStateful, isVisible, jumpToCurrentState, onBoundsChange, onLevelChange, onStateChange, resolveOpacity, setAutoMirrored, setCallback, setLevel, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SquaringDrawable

public SquaringDrawable(GlideDrawable wrapped,
                        int side)
Method Detail

setBounds

public void setBounds(int left,
                      int top,
                      int right,
                      int bottom)
Overrides:
setBounds in class Drawable

setBounds

public void setBounds(Rect bounds)
Overrides:
setBounds in class Drawable

setChangingConfigurations

public void setChangingConfigurations(int configs)
Overrides:
setChangingConfigurations in class Drawable

getChangingConfigurations

public int getChangingConfigurations()
Overrides:
getChangingConfigurations in class Drawable

setDither

public void setDither(boolean dither)
Overrides:
setDither in class Drawable

setFilterBitmap

public void setFilterBitmap(boolean filter)
Overrides:
setFilterBitmap in class Drawable

getCallback

public Drawable.Callback getCallback()
Overrides:
getCallback in class Drawable

getAlpha

public int getAlpha()
Overrides:
getAlpha in class Drawable

setColorFilter

public void setColorFilter(int color,
                           PorterDuff.Mode mode)
Overrides:
setColorFilter in class Drawable

clearColorFilter

public void clearColorFilter()
Overrides:
clearColorFilter in class Drawable

getCurrent

public Drawable getCurrent()
Overrides:
getCurrent in class Drawable

setVisible

public boolean setVisible(boolean visible,
                          boolean restart)
Overrides:
setVisible in class Drawable

getIntrinsicWidth

public int getIntrinsicWidth()
Overrides:
getIntrinsicWidth in class Drawable

getIntrinsicHeight

public int getIntrinsicHeight()
Overrides:
getIntrinsicHeight in class Drawable

getMinimumWidth

public int getMinimumWidth()
Overrides:
getMinimumWidth in class Drawable

getMinimumHeight

public int getMinimumHeight()
Overrides:
getMinimumHeight in class Drawable

getPadding

public boolean getPadding(Rect padding)
Overrides:
getPadding in class Drawable

invalidateSelf

public void invalidateSelf()
Overrides:
invalidateSelf in class Drawable

unscheduleSelf

public void unscheduleSelf(Runnable what)
Overrides:
unscheduleSelf in class Drawable

scheduleSelf

public void scheduleSelf(Runnable what,
                         long when)
Overrides:
scheduleSelf in class Drawable

draw

public void draw(Canvas canvas)
Specified by:
draw in class Drawable

setAlpha

public void setAlpha(int i)
Specified by:
setAlpha in class Drawable

setColorFilter

public void setColorFilter(ColorFilter colorFilter)
Specified by:
setColorFilter in class Drawable

getOpacity

public int getOpacity()
Specified by:
getOpacity in class Drawable

isAnimated

public boolean isAnimated()
Description copied from class: GlideDrawable
Returns true if this drawable is animated.

Specified by:
isAnimated in class GlideDrawable

setLoopCount

public void setLoopCount(int loopCount)
Description copied from class: GlideDrawable
Sets the number of times the animation should loop. This method will only have an affect if ()} returns true. A loop count of <=0 indicates loop forever.

Specified by:
setLoopCount in class GlideDrawable

start

public void start()

stop

public void stop()

isRunning

public boolean isRunning()

mutate

public Drawable mutate()
Overrides:
mutate in class Drawable

getConstantState

public Drawable.ConstantState getConstantState()
Overrides:
getConstantState in class Drawable