/** * The constructor for the ProgressWheel */ public ProgressWheel(Context context) { super(context); setAnimationEnabled(); }
/** * Turn off spin mode */ public void stopSpinning() { isSpinning = false; mProgress = 0.0f; mTargetProgress = 0.0f; invalidate(); }
/** * Show empty view when there are not data to show * * @param emptyImageDrawable Drawable to show * @param emptyTextContent Content of the empty view to show * @param skipIds Ids of views to not hide */ public void showEmpty(Drawable emptyImageDrawable, String emptyTextContent, List<Integer> skipIds) { switchState(EMPTY, emptyImageDrawable, emptyTextContent, null, null, skipIds); }
/** * Sets the color of the spinning bar * * @param barColor The spinning bar color */ public void setBarColor(int barColor) { this.barColor = barColor; setupPaints(); if (!isSpinning) { invalidate(); } }
public ProgressLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(attrs); }
private void runCallback(float value) { if (callback != null) { callback.onProgressUpdate(value); } }
public void setCallback(ProgressCallback progressCallback) { callback = progressCallback; if (!isSpinning) { runCallback(); } }
public WheelSavedState createFromParcel(Parcel in) { return new WheelSavedState(in); }
private void hideErrorView() { if (errorStateRelativeLayout != null) { errorStateRelativeLayout.setVisibility(GONE); //Restore the background color if not TRANSPARENT if (errorStateBackgroundColor != Color.TRANSPARENT) { this.setBackgroundDrawable(currentBackground); } } }
/** * Sets the color of the wheel's contour * * @param rimColor the color for the wheel */ public void setRimColor(int rimColor) { this.rimColor = rimColor; setupPaints(); if (!isSpinning) { invalidate(); } }
/** * Sets the radius of the wheel * * @param circleRadius the expected radius, in pixels */ public void setCircleRadius(int circleRadius) { this.circleRadius = circleRadius; if (!isSpinning) { invalidate(); } }
/** * Hide all other states and show content * * @param skipIds Ids of views not to show */ public void showContent(List<Integer> skipIds) { switchState(CONTENT, null, null, null, null, skipIds); }
public ProgressLayout(Context context, AttributeSet attrs) { super(context, attrs); init(attrs); }
/** * Sets the determinate progress mode * * @param isLinear if the progress should increase linearly */ public void setLinearProgress(boolean isLinear) { linearProgress = isLinear; if (!isSpinning) { invalidate(); } }
/** * Hide content and show the progress bar * * @param skipIds Ids of views to not hide */ public void showLoading(List<Integer> skipIds) { switchState(LOADING, null, null, null, null, skipIds); }
/** * Reset the count (in increment mode) */ public void resetCount() { mProgress = 0.0f; mTargetProgress = 0.0f; invalidate(); }
/** * Show error view with a button when something goes wrong and prompting the user to try again * * @param errorImageDrawable Drawable to show * @param errorTextContent Content of the error view to show * @param errorButtonText Text on the error view button to show * @param onClickListener Listener of the error view button * @param skipIds Ids of views to not hide */ public void showError(Drawable errorImageDrawable, String errorTextContent, String errorButtonText, OnClickListener onClickListener, List<Integer> skipIds) { switchState(ERROR, errorImageDrawable, errorTextContent, errorButtonText, onClickListener, skipIds); }
/** * Sets the width of the spinning bar * * @param barWidth the spinning bar width in pixels */ public void setBarWidth(int barWidth) { this.barWidth = barWidth; if (!isSpinning) { invalidate(); } }
/** * Show empty view when there are not data to show * * @param emptyImageDrawable Drawable to show * @param emptyTextContent Content of the empty view to show */ public void showEmpty(Drawable emptyImageDrawable, String emptyTextContent) { switchState(EMPTY, emptyImageDrawable, emptyTextContent, null, null, Collections.<Integer>emptyList()); }
/** * Sets the width of the wheel's contour * * @param rimWidth the width in pixels */ public void setRimWidth(int rimWidth) { this.rimWidth = rimWidth; if (!isSpinning) { invalidate(); } }