Class ProgressBar
- All Implemented Interfaces:
Drawable.Callback
- Direct Known Subclasses:
AbsSeekBar
-
Nested Class Summary
Nested classes/interfaces inherited from class icyllis.modernui.view.View
View.DragShadow, View.Focusable, View.FocusableMode, View.FocusDirection, View.FocusRealDirection, View.LayoutDir, View.NestedScrollType, View.OnAttachStateChangeListener, View.OnClickListener, View.OnContextClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnScrollChangeListener, View.OnTouchListener, View.ResolvedLayoutDir, View.ScrollAxis, View.ScrollBarStyle, View.ScrollIndicators, View.TextAlignment, View.Visibility
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final FloatProperty
<ProgressBar> Property wrapper around the visual state of theprogress
functionality handled by thesetProgress(int, boolean)
method.Fields inherited from class icyllis.modernui.view.View
ALPHA, BOTTOM, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLE, FOCUSABLE_AUTO, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, INVISIBLE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, LAYOUT_DIRECTION_UNDEFINED, LEFT, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mScrollX, mScrollY, NO_ID, NOT_FOCUSABLE, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, RIGHT, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLL_X, SCROLL_Y, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TOP, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, TYPE_NON_TOUCH, TYPE_TOUCH, VIEW_MARKER, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z
-
Constructor Summary
ConstructorDescriptionProgressBar
(Context context) Create a new progress bar with range 0...10000 and initial progress of 0. -
Method Summary
Modifier and TypeMethodDescriptionvoid
drawableHotspotChanged
(float x, float y) This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view.protected void
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.Returns the drawable currently used to draw the progress bar.Get the drawable used to draw the progress bar in indeterminate mode.Returns the blending mode used to apply the tint to the indeterminate drawable, if specified.int
getMax()
Return the upper limit of this progress bar's range.int
int
int
getMin()
Return the lower limit of this progress bar's range.int
Get the progress bar's current level of progress.Returns the tint applied to the progress background, if specified.Get the drawable used to draw the progress bar in progress mode.Returns the blending mode used to apply the tint to the progress drawable, if specified.Returns the tint applied to the progress drawable, if specified.int
Get the progress bar's current level of secondary progress.Returns the blending mode used to apply the tint to the secondary progress drawable, if specified.Returns the tint applied to the secondary progress drawable, if specified.final void
incrementProgressBy
(int diff) Increase the progress bar's progress by the specified amount.final void
incrementSecondaryProgressBy
(int diff) Increase the progress bar's secondary progress by the specified amount.boolean
Indicate whether this progress bar is in indeterminate mode.void
CallDrawable.jumpToCurrentState()
on all Drawable objects associated with this view.protected void
Draw the content of this view, implement this to do your drawing.protected void
onMeasure
(int widthMeasureSpec, int heightMeasureSpec) Measure the view and its content to determine the measured width and the measured height.void
onResolveDrawables
(int layoutDirection) Called when layout direction has been resolved.protected void
onSizeChanged
(int w, int h, int oldw, int oldh) Called when width or height changedvoid
setIndeterminate
(boolean indeterminate) Change the indeterminate mode for this progress bar.void
Define the drawable used to draw the progress bar in indeterminate mode.void
setIndeterminateTintBlendMode
(BlendMode blendMode) Specifies the blending mode used to apply the tint specified bysetIndeterminateTintList(ColorStateList)
to the indeterminate drawable.void
Applies a tint to the indeterminate drawable.void
setMax
(int max) Set the upper range of the progress bar max.void
setMaximumHeight
(int maxHeight) Sets the maximum height the progress bar can have.void
setMaximumWidth
(int maxWidth) Sets the maximum width the progress bar can have.void
setMin
(int min) Set the lower range of the progress bar to min.void
setProgress
(int progress) Sets the current progress to the specified value.void
setProgress
(int progress, boolean animate) Sets the current progress to the specified value, optionally animating the visual position between the current and target values.void
setProgressBackgroundTintBlendMode
(BlendMode blendMode) Specifies the blending mode used to apply the tint specified bysetProgressBackgroundTintList(ColorStateList)
} to the progress background.void
Applies a tint to the progress background, if one exists.void
Define the drawable used to draw the progress bar in progress mode.void
setProgressTintBlendMode
(BlendMode blendMode) Specifies the blending mode used to apply the tint specified bysetProgressTintList(ColorStateList)
} to the progress indicator.void
Applies a tint to the progress indicator, if one exists, or to the entire progress drawable otherwise.void
setSecondaryProgress
(int secondaryProgress) Set the current secondary progress to the specified value.void
setSecondaryProgressTintBlendMode
(BlendMode blendMode) Specifies the blending mode used to apply the tint specified bysetSecondaryProgressTintList(ColorStateList)
} to the secondary progress indicator.void
Applies a tint to the secondary progress indicator, if one exists.protected boolean
verifyDrawable
(Drawable who) If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying.Methods inherited from class icyllis.modernui.view.View
addFocusables, addFocusables, addKeyboardNavigationClusters, addOnAttachStateChangeListener, addOnLayoutChangeListener, addTouchables, awakenScrollBars, awakenScrollBars, callOnClick, cancelLongPress, cancelPendingInputEvents, canReceivePointerEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, clearFocus, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchGenericMotionEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerEvent, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchTouchEvent, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, dp, draw, findFocus, findViewById, findViewByPredicate, findViewByPredicateInsideOut, findViewByPredicateTraversal, findViewTraversal, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAlpha, getAnimationMatrix, getBackground, getBaseline, getBottom, getBoundsOnScreen, getBoundsOnScreen, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingRect, getElevation, getFadingEdge, getFadingEdgeLength, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getInverseMatrix, getKeyDispatcherState, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOnLongClickListener, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getPivotX, getPivotY, getRawLayoutDirection, getRawTextAlignment, getRawTextDirection, getRevealOnFocusHint, getRight, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTextAlignment, getTextDirection, getTooltipText, getTooltipView, getTop, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewRoot, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowVisibility, getX, getY, getZ, handleScrollBarDragging, hasExplicitFocusable, hasFocus, hasFocusable, hasIdentityMatrix, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasTransientState, hasTranslationTransientState, hasWindowFocus, internalSetPadding, invalidate, invalidateDrawable, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForegroundInsidePadding, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInLayout, isInScrollingContainer, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionInherited, isLayoutDirectionResolved, isLayoutRequested, isLayoutRtl, isLongClickable, isNestedScrollingEnabled, isPaddingRelative, isPivotSet, isPressed, isRootNamespace, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentInherited, isTextAlignmentResolved, isTextDirectionInherited, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVerticalScrollBarHidden, keyboardNavigationClusterSearch, layout, mapRectFromViewToScreenCoords, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCancelPendingInputEvents, onCreateContextMenu, onCreateDrawableState, onDetachedFromWindow, onDragEvent, onDrawForeground, onDrawScrollBars, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onKeyDown, onKeyShortcut, onKeyUp, onLayout, onOverScrolled, onResolvePointerIcon, onRtlPropertiesChanged, onScrollChanged, onStartTemporaryDetach, onTouchEvent, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowVisibilityChanged, overScrollBy, performButtonActionOnTouchDown, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, pointInView, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestFocus, requestFocus, requestFocus, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, requireViewById, resetPivot, resetResolvedDrawables, resolveDrawables, resolveLayoutDirection, resolveLayoutParams, resolvePadding, resolveRtlPropertiesIfNeeded, resolveSize, resolveSizeAndState, resolveTextAlignment, resolveTextDirection, restoreDefaultFocus, scheduleDrawable, scrollBy, scrollTo, setActivated, setAlpha, setAnimationMatrix, setBackground, setBottom, setClickable, setContextClickable, setDuplicateParentStateEnabled, setElevation, setEnabled, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setFocusedInCluster, setForeground, setForegroundGravity, setFrame, setHapticFeedbackEnabled, setHasTransientState, setHasTranslationTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setIsRootNamespace, setKeyboardNavigationCluster, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnTouchListener, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setVisibility, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, sp, startActionMode, startActionMode, startDragAndDrop, startNestedScroll, stopNestedScroll, toGlobalMotionEvent, toLocalMotionEvent, toString, transformFromViewToWindowSpace, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, willNotDraw
-
Field Details
-
VISUAL_PROGRESS
Property wrapper around the visual state of theprogress
functionality handled by thesetProgress(int, boolean)
method. This does not correspond directly to the actual progress -- only the visual state.
-
-
Constructor Details
-
ProgressBar
Create a new progress bar with range 0...10000 and initial progress of 0.- Parameters:
context
- the application environment
-
-
Method Details
-
setMaximumWidth
public void setMaximumWidth(int maxWidth) Sets the maximum width the progress bar can have.- Parameters:
maxWidth
- the maximum width to be set, in pixels
-
getMaximumWidth
public int getMaximumWidth()- Returns:
- the maximum width the progress bar can have, in pixels
-
setMaximumHeight
public void setMaximumHeight(int maxHeight) Sets the maximum height the progress bar can have.- Parameters:
maxHeight
- the maximum height to be set, in pixels
-
getMaximumHeight
public int getMaximumHeight()- Returns:
- the maximum height the progress bar can have, in pixels
-
onMeasure
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) Description copied from class:View
Measure the view and its content to determine the measured width and the measured height. This method is invoked byView.measure(int, int)
and should be overridden by subclasses to provide accurate and efficient measurement of their contents.CONTRACT: When overriding this method, you must call
View.setMeasuredDimension(int, int)
to store the measured width and height of this view. Failure to do so will trigger anIllegalStateException
, thrown byView.measure(int, int)
. Calling super.onMeasure() is a valid use.The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override the base one to provide better measurements of their content.
- Overrides:
onMeasure
in classView
- Parameters:
widthMeasureSpec
- width measure specification imposed by the parentMeasureSpec
heightMeasureSpec
- height measure specification imposed by the parentMeasureSpec
-
isIndeterminate
public boolean isIndeterminate()Indicate whether this progress bar is in indeterminate mode.
- Returns:
- true if the progress bar is in indeterminate mode
-
setIndeterminate
public void setIndeterminate(boolean indeterminate) Change the indeterminate mode for this progress bar. In indeterminate mode, the progress is ignored and the progress bar shows an infinite animation instead.
If this progress bar's style only supports indeterminate mode (such as the circular progress bars), then this will be ignored.
- Parameters:
indeterminate
- true to enable the indeterminate mode
-
getIndeterminateDrawable
Get the drawable used to draw the progress bar in indeterminate mode.
- Returns:
- a
Drawable
instance - See Also:
-
setIndeterminateDrawable
Define the drawable used to draw the progress bar in indeterminate mode.For the Drawable to animate, it must implement
invalid reference
Animatable
Drawable.onLevelChange(int)
. A Drawable that implements Animatable will be animated via that interface and therefore provides the greatest amount of customization. A Drawable that only overrides onLevelChange(int) is animated directly by ProgressBar and only the animationinvalid reference
duration
invalid reference
repeating behavior
invalid reference
interpolator
- Parameters:
d
- the new drawable- See Also:
-
setIndeterminateTintList
Applies a tint to the indeterminate drawable. Does not modify the current tint mode, which isBlendMode.SRC_IN
by default.Subsequent calls to
setIndeterminateDrawable(Drawable)
will automatically mutate the drawable and apply the specified tint and tint mode usingDrawable.setTintList(ColorStateList)
.- Parameters:
tint
- the tint to apply, may benull
to clear tint- See Also:
-
getIndeterminateTintList
- Returns:
- the tint applied to the indeterminate drawable
- See Also:
-
setIndeterminateTintBlendMode
Specifies the blending mode used to apply the tint specified bysetIndeterminateTintList(ColorStateList)
to the indeterminate drawable. The default mode isBlendMode.SRC_IN
.- Parameters:
blendMode
- the blending mode used to apply the tint, may benull
to clear tint- See Also:
-
getIndeterminateTintBlendMode
Returns the blending mode used to apply the tint to the indeterminate drawable, if specified.- Returns:
- the blending mode used to apply the tint to the indeterminate drawable
- See Also:
-
getProgressDrawable
Get the drawable used to draw the progress bar in progress mode.
- Returns:
- a
Drawable
instance - See Also:
-
setProgressDrawable
Define the drawable used to draw the progress bar in progress mode.- Parameters:
d
- the new drawable- See Also:
-
setProgressTintList
Applies a tint to the progress indicator, if one exists, or to the entire progress drawable otherwise. Does not modify the current tint mode, which isinvalid reference
PorterDuff.Mode#SRC_IN
The progress indicator should be specified as a layer with id
invalid reference
android.R.id#progress
LayerDrawable
used as the progress drawable.Subsequent calls to
setProgressDrawable(Drawable)
will automatically mutate the drawable and apply the specified tint and tint mode usingDrawable.setTintList(ColorStateList)
.- Parameters:
tint
- the tint to apply, may benull
to clear tint- See Also:
-
getProgressTintList
Returns the tint applied to the progress drawable, if specified.- Returns:
- the tint applied to the progress drawable
- See Also:
-
setProgressTintBlendMode
Specifies the blending mode used to apply the tint specified bysetProgressTintList(ColorStateList)
} to the progress indicator. The default mode isinvalid reference
PorterDuff.Mode#SRC_IN
- Parameters:
blendMode
- the blending mode used to apply the tint, may benull
to clear tint- See Also:
-
getProgressTintBlendMode
Returns the blending mode used to apply the tint to the progress drawable, if specified.- Returns:
- the blending mode used to apply the tint to the progress drawable
- See Also:
-
setProgressBackgroundTintList
Applies a tint to the progress background, if one exists. Does not modify the current tint mode, which isinvalid reference
PorterDuff.Mode#SRC_ATOP
The progress background must be specified as a layer with id
invalid reference
android.R.id#background
LayerDrawable
used as the progress drawable.Subsequent calls to
setProgressDrawable(Drawable)
where the drawable contains a progress background will automatically mutate the drawable and apply the specified tint and tint mode usingDrawable.setTintList(ColorStateList)
.- Parameters:
tint
- the tint to apply, may benull
to clear tint- See Also:
-
getProgressBackgroundTintList
Returns the tint applied to the progress background, if specified.- Returns:
- the tint applied to the progress background
- See Also:
-
setProgressBackgroundTintBlendMode
Specifies the blending mode used to apply the tint specified bysetProgressBackgroundTintList(ColorStateList)
} to the progress background. The default mode isBlendMode.SRC_IN
.- Parameters:
blendMode
- the blending mode used to apply the tint, may benull
to clear tint- See Also:
-
getProgressBackgroundTintBlendMode
- Returns:
- the blending mode used to apply the tint to the progress background
- See Also:
-
setSecondaryProgressTintList
Applies a tint to the secondary progress indicator, if one exists. Does not modify the current tint mode, which isinvalid reference
PorterDuff.Mode#SRC_ATOP
The secondary progress indicator must be specified as a layer with id
invalid reference
android.R.id#secondaryProgress
LayerDrawable
used as the progress drawable.Subsequent calls to
setProgressDrawable(Drawable)
where the drawable contains a secondary progress indicator will automatically mutate the drawable and apply the specified tint and tint mode usingDrawable.setTintList(ColorStateList)
.- Parameters:
tint
- the tint to apply, may benull
to clear tint- See Also:
-
getSecondaryProgressTintList
Returns the tint applied to the secondary progress drawable, if specified.- Returns:
- the tint applied to the secondary progress drawable
- See Also:
-
setSecondaryProgressTintBlendMode
Specifies the blending mode used to apply the tint specified bysetSecondaryProgressTintList(ColorStateList)
} to the secondary progress indicator. The default mode isinvalid reference
PorterDuff.Mode#SRC_ATOP
- Parameters:
blendMode
- the blending mode used to apply the tint, may benull
to clear tint- See Also:
-
getSecondaryProgressTintBlendMode
Returns the blending mode used to apply the tint to the secondary progress drawable, if specified.- Returns:
- the blending mode used to apply the tint to the secondary progress drawable
- See Also:
-
setProgress
public void setProgress(int progress) Sets the current progress to the specified value. Does not do anything if the progress bar is in indeterminate mode.This method will immediately update the visual position of the progress indicator. To animate the visual position to the target value, use
setProgress(int, boolean)
}. -
setProgress
public void setProgress(int progress, boolean animate) Sets the current progress to the specified value, optionally animating the visual position between the current and target values.Animation does not affect the result of
getProgress()
, which will return the target value immediately after this method is called. -
setSecondaryProgress
public void setSecondaryProgress(int secondaryProgress) Set the current secondary progress to the specified value. Does not do anything if the progress bar is in indeterminate mode.
-
getSecondaryProgress
public int getSecondaryProgress()Get the progress bar's current level of secondary progress. Return 0 when the progress bar is in indeterminate mode.
-
getProgress
public int getProgress()Get the progress bar's current level of progress. Return 0 when the progress bar is in indeterminate mode.
-
incrementProgressBy
public final void incrementProgressBy(int diff) Increase the progress bar's progress by the specified amount.
- Parameters:
diff
- the amount by which the progress must be increased- See Also:
-
incrementSecondaryProgressBy
public final void incrementSecondaryProgressBy(int diff) Increase the progress bar's secondary progress by the specified amount.
- Parameters:
diff
- the amount by which the secondary progress must be increased- See Also:
-
getMin
public int getMin()Return the lower limit of this progress bar's range.
- Returns:
- a positive integer
- See Also:
-
getMax
public int getMax()Return the upper limit of this progress bar's range.
- Returns:
- a positive integer
- See Also:
-
setMin
public void setMin(int min) Set the lower range of the progress bar to min.
- Parameters:
min
- the lower range of this progress bar- See Also:
-
setMax
public void setMax(int max) Set the upper range of the progress bar max.
- Parameters:
max
- the upper range of this progress bar- See Also:
-
getCurrentDrawable
Returns the drawable currently used to draw the progress bar. This will be eithergetProgressDrawable()
orgetIndeterminateDrawable()
depending on whether the progress bar is in determinate or indeterminate mode.- Returns:
- the drawable currently used to draw the progress bar
-
verifyDrawable
Description copied from class:View
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying. This allows animations for those drawables to be scheduled.Be sure to call through to the super class when overriding this function.
- Overrides:
verifyDrawable
in classView
- Parameters:
who
- The Drawable to verify. Return true if it is one you are displaying, else return the result of calling through to the super class.- Returns:
- boolean If true then the Drawable is being displayed in the view; else false and it is not allowed to animate.
- See Also:
-
jumpDrawablesToCurrentState
public void jumpDrawablesToCurrentState()Description copied from class:View
CallDrawable.jumpToCurrentState()
on all Drawable objects associated with this view.Also calls
StateListAnimator.jumpToCurrentState()
if there is a StateListAnimator attached to this view.- Overrides:
jumpDrawablesToCurrentState
in classView
-
onResolveDrawables
public void onResolveDrawables(int layoutDirection) Description copied from class:View
Called when layout direction has been resolved.The default implementation does nothing.
- Overrides:
onResolveDrawables
in classView
- Parameters:
layoutDirection
- The resolved layout direction.- See Also:
-
onDraw
Description copied from class:View
Draw the content of this view, implement this to do your drawing.Note that (0, 0) will be the top left of the bounds, and (width, height) will be the bottom right of the bounds.
-
onSizeChanged
protected void onSizeChanged(int w, int h, int oldw, int oldh) Description copied from class:View
Called when width or height changed- Overrides:
onSizeChanged
in classView
- Parameters:
w
- new widthh
- new heightoldw
- previous widtholdh
- previous height
-
drawableStateChanged
protected void drawableStateChanged()Description copied from class:View
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.If the View has a StateListAnimator, it will also be called to run necessary state change animations.
Be sure to call through to the superclass when overriding this function.
- Overrides:
drawableStateChanged
in classView
- See Also:
-
drawableHotspotChanged
public void drawableHotspotChanged(float x, float y) Description copied from class:View
This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view.Dispatching to child views is handled by
View.dispatchDrawableHotspotChanged(float, float)
.Be sure to call through to the superclass when overriding this function.
- Overrides:
drawableHotspotChanged
in classView
- Parameters:
x
- hotspot x coordinatey
- hotspot y coordinate
-