public class

EnhancedProgressBar

extends ProgressBar
java.lang.Object
   ↳ android.view.View
     ↳ android.widget.ProgressBar
       ↳ com.droidux.pack.commons.widget.progress.EnhancedProgressBar

Class Overview

A custom ProgressBar that allows easy customization, such as changing the progress colors, clipping, pattern overlay, etc.

Note: If you plan to change the color of progress bar at runtime, it's more effective to use a gray-scale drawables for the progress, secondary progress, and indeterminate drawables.

See Also

Summary

XML Attributes
Attribute Name Related Method Description
dux_clipProgress setClipProgress(boolean) Controls whether the progress drawable is clipped. 
dux_clipSecondaryProgress setClipSecondaryProgress(boolean) Controls whether the secondary progress drawable is clipped. 
dux_indeterminateProgressColor setIndeterminateProgressColor(int) Specifies the tint color of the indeterminate progress drawable. 
dux_progressColor setProgressColor(int) Specifies the tint color of the progress drawable. 
dux_secondaryProgressColor setSecondaryProgressColor(ColorStateList) Specifies the tint color of the secondary progress drawable. 
[Expand]
Inherited Constants
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
EnhancedProgressBar(Context context)
EnhancedProgressBar(Context context, AttributeSet attrs)
EnhancedProgressBar(Context context, AttributeSet attrs, int defStyle)
Public Methods
boolean isProgressClipped()
Returns true if the progress drawable is clipped.
boolean isSecondaryProgressClipped()
Returns true if the secondary progress drawable is clipped.
void setClipProgress(boolean clip)
Sets whether to clip the progress drawable.
void setClipSecondaryProgress(boolean clip)
Sets whether to clip the secondary progress drawable.
void setIndeterminateProgressColor(int color)
Sets the tint color of the indeterminate progress drawable
void setProgressColor(ColorStateList colors)
Sets the tint color of the default progress drawable
void setProgressColor(int color)
Sets the tint color of the default progress drawable
void setProgressPatternOffset(int offset)
If the progress has a pattern overlay, calling this method will shift the pattern by the specified offset.
void setProgressPatternOverlay(Bitmap pattern, boolean animate, int offset)
Sets the pattern bitmap to overlay the progress drawable.
void setProgressPatternOverlay(Bitmap pattern, boolean animate)
Sets the pattern bitmap to overlay the progress drawable.
void setSecondaryProgressColor(int color)
Sets the tint color of the secondary progress drawable
void setSecondaryProgressColor(ColorStateList colors)
Sets the tint color of the secondary progress drawable
void setSecondaryProgressPatternOffset(int offset)
If the secondary progress has a pattern overlay, calling this method will shift the pattern by the specified offset.
void setSecondaryProgressPatternOverlay(Bitmap pattern, boolean animate)
Sets the pattern bitmap to overlay the secondary progress drawable.
void setSecondaryProgressPatternOverlay(Bitmap pattern, boolean animate, int offset)
Sets the pattern bitmap to overlay the secondary progress drawable.
void setVisibility(int v)
Set the enabled state of this view.
Protected Methods
ProgressBarHelper.IColorizeWrapperFactory createColorizeWrapperFactory()
[Expand]
Inherited Methods
From class android.widget.ProgressBar
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

XML Attributes

dux_clipProgress

Since: API Level

Controls whether the progress drawable is clipped. The progress drawable should be a ClipDrawable, otherwise it will have no effect. Default is true.

Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

Related Methods

dux_clipSecondaryProgress

Since: API Level

Controls whether the secondary progress drawable is clipped. The progress drawable should be a ClipDrawable, otherwise it will have no effect. Default is true.

Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

dux_indeterminateProgressColor

Since: API Level

Specifies the tint color of the indeterminate progress drawable.

May be a reference to another resource, in the form "@[+][package:]type:name" or to a theme attribute in the form "?[package:][type:]name".

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

dux_progressColor

Since: API Level

Specifies the tint color of the progress drawable.

May be a reference to another resource, in the form "@[+][package:]type:name" or to a theme attribute in the form "?[package:][type:]name".

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

Related Methods

dux_secondaryProgressColor

Since: API Level

Specifies the tint color of the secondary progress drawable.

May be a reference to another resource, in the form "@[+][package:]type:name" or to a theme attribute in the form "?[package:][type:]name".

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

Public Constructors

public EnhancedProgressBar (Context context)

Since: API Level 2.5

public EnhancedProgressBar (Context context, AttributeSet attrs)

Since: API Level 2.5

public EnhancedProgressBar (Context context, AttributeSet attrs, int defStyle)

Since: API Level 2.5

Public Methods

public boolean isProgressClipped ()

Since: API Level 2.5

Returns true if the progress drawable is clipped.

Related XML Attributes
Returns
  • true if the progress drawable is clipped.

public boolean isSecondaryProgressClipped ()

Since: API Level 2.5

Returns true if the secondary progress drawable is clipped.

Related XML Attributes
Returns
  • true if the secondary progress drawable is clipped.

public void setClipProgress (boolean clip)

Since: API Level 2.5

Sets whether to clip the progress drawable. If true, the drawable will be drawn clipped/cut at the level of the progress instead of stretched/scaled. The progress drawable must be a ClipDrawable, otherwise calling this method will have no effect. Default is true.

Related XML Attributes
Parameters
clip If true, the progress drawable will be clipped, otherwise it will be stretched.

public void setClipSecondaryProgress (boolean clip)

Since: API Level 2.5

Sets whether to clip the secondary progress drawable. If true, the drawable will be drawn clipped/cut at the level of the progress instead of stretched/scaled. The secondary progress drawable must be a ClipDrawable, otherwise calling this method will have no effect. Default is true.

Related XML Attributes
Parameters
clip If true, the progress drawable will be clipped, otherwise it will be stretched.

public void setIndeterminateProgressColor (int color)

Since: API Level

Sets the tint color of the indeterminate progress drawable

Related XML Attributes
Parameters
color The tint color.

public void setProgressColor (ColorStateList colors)

Since: API Level

Sets the tint color of the default progress drawable

Related XML Attributes
Parameters
colors The tint color.

public void setProgressColor (int color)

Since: API Level

Sets the tint color of the default progress drawable

Related XML Attributes
Parameters
color The tint color.

public void setProgressPatternOffset (int offset)

Since: API Level

If the progress has a pattern overlay, calling this method will shift the pattern by the specified offset. Otherwise calling this method has no effect.

Parameters
offset The amount of offset to shift the pattern overlay.

public void setProgressPatternOverlay (Bitmap pattern, boolean animate, int offset)

Since: API Level

Sets the pattern bitmap to overlay the progress drawable. Specify an offset if you want to shift the pattern horizontally. If pattern is null, the progress drawable will not be overlaid. Note: The pattern is applied to currently active progress drawables. If you change the progress drawable, you should reapply the pattern.

Parameters
pattern The bitmap used to overlay the progress drawable.
animate If true, the pattern will be animated.
offset The amount by which the pattern will be shifted horizontally.

public void setProgressPatternOverlay (Bitmap pattern, boolean animate)

Since: API Level

Sets the pattern bitmap to overlay the progress drawable. If pattern is null, the progress drawable will not be overlaid. Note: The pattern is applied to currently active progress drawables. If you change the progress drawable, you should reapply the pattern.

Parameters
pattern The bitmap used to overlay the progress drawable.
animate If true, the pattern will be animated.

public void setSecondaryProgressColor (int color)

Since: API Level

Sets the tint color of the secondary progress drawable

Related XML Attributes
Parameters
color The tint color.

public void setSecondaryProgressColor (ColorStateList colors)

Since: API Level

Sets the tint color of the secondary progress drawable

Related XML Attributes
Parameters
colors The tint color.

public void setSecondaryProgressPatternOffset (int offset)

Since: API Level

If the secondary progress has a pattern overlay, calling this method will shift the pattern by the specified offset. Otherwise calling this method has no effect.

Parameters
offset The amount of offset to shift the pattern overlay.

public void setSecondaryProgressPatternOverlay (Bitmap pattern, boolean animate)

Since: API Level

Sets the pattern bitmap to overlay the secondary progress drawable. If pattern is null, the progress drawable will not be overlaid. Note: The pattern is applied to currently active progress drawables. If you change the progress drawable, you should reapply the pattern.

Parameters
pattern The bitmap used to overlay the progress drawable.
animate If true, the pattern will be animated.

public void setSecondaryProgressPatternOverlay (Bitmap pattern, boolean animate, int offset)

Since: API Level

Sets the pattern bitmap to overlay the secondary progress drawable. Specify an offset if you want to shift the pattern horizontally. If pattern is null, the progress drawable will not be overlaid. Note: The pattern is applied to currently active progress drawables. If you change the progress drawable, you should reapply the pattern.

Parameters
pattern The bitmap used to overlay the progress drawable.
animate If true, the pattern will be animated.
offset The amount by which the pattern will be shifted horizontally.

public void setVisibility (int v)

Since: API Level

Set the enabled state of this view.

Parameters
v One of VISIBLE, INVISIBLE, or GONE.

Protected Methods

protected ProgressBarHelper.IColorizeWrapperFactory createColorizeWrapperFactory ()

Since: API Level