public class

ReflectionDrawable

extends DrawableWrapper
implements Drawable.Callback
java.lang.Object
   ↳ DrawableWrapper
     ↳ com.droidux.ui.widgets.layout.drawable.ReflectionDrawable

Class Overview

A Drawable that adds a reflection to another drawable.

Summary

Public Constructors
ReflectionDrawable(Drawable wrapped)
Construct a reflection drawable with default settings.
ReflectionDrawable(Drawable wrapped, boolean reflected, float heightFactor, float strength, int floorGap)
Construct a reflection drawable.
Public Methods
void cleanup()
Clean up the internal cache.
int getFloorGap()
Gets the gap/distance between the wrapped drawable to the "virtual" reflecting floor.
float getReflectionFactor()
Gets the factor used to calculate the height of the reflection.
float getReflectionStrength()
Gets the factor used to calculate the strength of the reflection.
boolean isReflected()
Returns whether the reflection is drawn or not.
void setFloorGap(int floorGap)
Sets the distance between the bottom of the wrapped drawable to a "virtual" reflecting floor.
void setReflected(boolean reflected)
Sets whether a reflection should be drawn.
void setReflectionFactor(float factor)
Sets the factor to calculate the height of the reflection.
void setReflectionStrength(float strength)
Sets the factor to calculate the strength of the reflection.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback

Public Constructors

public ReflectionDrawable (Drawable wrapped)

Since: API Level 3.0

Construct a reflection drawable with default settings.

Parameters
wrapped Drawable to add a reflection to.

public ReflectionDrawable (Drawable wrapped, boolean reflected, float heightFactor, float strength, int floorGap)

Since: API Level 3.0

Construct a reflection drawable.

Parameters
wrapped Drawable to add a reflection to.
reflected Whether the reflection should be added by default.
heightFactor The factor to calculate the height of the reflection. Must be between 0-1.
strength The strength of the reflection. This value determine the opacity of the reflection. Must be between 0-1.
floorGap The distance between the bottom of the wrapped drawable to a "virtual" reflecting floor.

Public Methods

public void cleanup ()

Since: API Level 3.0

Clean up the internal cache. Call this when the drawable is no longer needed to cleanup resources, e.g. in Activity's onDestroy() or onDetachedFromWindow().

public int getFloorGap ()

Since: API Level 3.0

Gets the gap/distance between the wrapped drawable to the "virtual" reflecting floor.

Returns
  • The gap/distance.

public float getReflectionFactor ()

Since: API Level 3.0

Gets the factor used to calculate the height of the reflection.

Returns
  • The height factor.

public float getReflectionStrength ()

Since: API Level 3.0

Gets the factor used to calculate the strength of the reflection.

Returns
  • The reflection strength factor.

public boolean isReflected ()

Since: API Level 3.0

Returns whether the reflection is drawn or not.

Returns
  • true if the reflection is drawn, false otherwise.

public void setFloorGap (int floorGap)

Since: API Level 3.0

Sets the distance between the bottom of the wrapped drawable to a "virtual" reflecting floor.

Parameters
floorGap The gap to the "virtual" floor.

public void setReflected (boolean reflected)

Since: API Level 3.0

Sets whether a reflection should be drawn.

Parameters
reflected If true, a reflection will be drawn.

public void setReflectionFactor (float factor)

Since: API Level 3.0

Sets the factor to calculate the height of the reflection. Must be between 0-1.

Parameters
factor The height factor.

public void setReflectionStrength (float strength)

Since: API Level 3.0

Sets the factor to calculate the strength of the reflection. This value will determine the opacity of the reflection. Must be between 0-1.

Parameters
strength The reflection strength.