public class DonutProgressView
| Modifier and Type | Class and Description |
|---|---|
static class |
DonutProgressView.Companion |
| Modifier and Type | Field and Description |
|---|---|
static DonutProgressView.Companion |
Companion |
| Constructor and Description |
|---|
DonutProgressView(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes) |
DonutProgressView(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr) |
DonutProgressView(android.content.Context context,
android.util.AttributeSet attrs) |
DonutProgressView(android.content.Context context) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAmount(java.lang.String sectionName,
float amount,
java.lang.Integer color)
Adds
amount to existing section specified by sectionName. If section does not exist and color is specified,
creates new section internally. |
void |
clear()
Clear data, removing all lines.
|
boolean |
getAnimateChanges()
If true, view will animate changes when new data is submitted.
If false, state change will happen instantly.
|
long |
getAnimationDurationMs()
Duration of state change animations.
|
android.view.animation.Interpolator |
getAnimationInterpolator()
Interpolator used for state change animations.
|
int |
getBgLineColor()
Color of background line.
|
float |
getCap()
Maximum value of sum of all entries in view, after which
all lines start to resize proportionally to amounts in their entry categories.
|
java.util.List<app.futured.donut.DonutSection> |
getData()
Returns current data.
|
float |
getGapAngleDegrees()
Angle in degrees, at which the gap will be displayed.
|
float |
getGapWidthDegrees()
Size of gap opening in degrees.
|
float |
getMasterProgress()
Percentage of progress shown for all lines.
|
float |
getStrokeWidth()
Stroke width of all lines in pixels.
|
protected void |
onDraw(android.graphics.Canvas canvas) |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec) |
protected void |
onSizeChanged(int w,
int h,
int oldw,
int oldh) |
void |
removeAmount(java.lang.String sectionName,
float amount)
Removes
amount from existing section specified by sectionName.
If amount gets below zero, removes the section from view. |
void |
setAmount(java.lang.String sectionName,
float amount)
Sets
amount for existing section specified by sectionName.
Removes section if amount is <= 0.
Does nothing if section does not exist. |
void |
setAnimateChanges(boolean p)
If true, view will animate changes when new data is submitted.
If false, state change will happen instantly.
|
void |
setAnimationDurationMs(long p)
Duration of state change animations.
|
void |
setAnimationInterpolator(android.view.animation.Interpolator p)
Interpolator used for state change animations.
|
void |
setBgLineColor(int value)
Color of background line.
|
void |
setCap(float value)
Maximum value of sum of all entries in view, after which
all lines start to resize proportionally to amounts in their entry categories.
|
void |
setGapAngleDegrees(float value)
Angle in degrees, at which the gap will be displayed.
|
void |
setGapWidthDegrees(float value)
Size of gap opening in degrees.
|
void |
setMasterProgress(float value)
Percentage of progress shown for all lines.
|
void |
setStrokeWidth(float value)
Stroke width of all lines in pixels.
|
void |
submitData(java.util.List<app.futured.donut.DonutSection> sections)
Submits new
sections to the view. |
public static DonutProgressView.Companion Companion
@JvmOverloads
public DonutProgressView(@NotNull
android.content.Context context,
@Nullable
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
@JvmOverloads
public DonutProgressView(@NotNull
android.content.Context context,
@Nullable
android.util.AttributeSet attrs,
int defStyleAttr)
@JvmOverloads
public DonutProgressView(@NotNull
android.content.Context context,
@Nullable
android.util.AttributeSet attrs)
@JvmOverloads
public DonutProgressView(@NotNull
android.content.Context context)
public float getMasterProgress()
Percentage of progress shown for all lines.
Eg. when one line has 50% of total graph length, setting this to 0.5f will result in that line being animated to 25% of total graph length.
public void setMasterProgress(float value)
Percentage of progress shown for all lines.
Eg. when one line has 50% of total graph length, setting this to 0.5f will result in that line being animated to 25% of total graph length.
public float getStrokeWidth()
Stroke width of all lines in pixels.
public void setStrokeWidth(float value)
Stroke width of all lines in pixels.
public float getCap()
Maximum value of sum of all entries in view, after which all lines start to resize proportionally to amounts in their entry categories.
public void setCap(float value)
Maximum value of sum of all entries in view, after which all lines start to resize proportionally to amounts in their entry categories.
public int getBgLineColor()
Color of background line.
public void setBgLineColor(int value)
Color of background line.
public float getGapWidthDegrees()
Size of gap opening in degrees.
public void setGapWidthDegrees(float value)
Size of gap opening in degrees.
public float getGapAngleDegrees()
Angle in degrees, at which the gap will be displayed.
public void setGapAngleDegrees(float value)
Angle in degrees, at which the gap will be displayed.
public boolean getAnimateChanges()
If true, view will animate changes when new data is submitted. If false, state change will happen instantly.
public void setAnimateChanges(boolean p)
If true, view will animate changes when new data is submitted. If false, state change will happen instantly.
@NotNull public android.view.animation.Interpolator getAnimationInterpolator()
Interpolator used for state change animations.
public void setAnimationInterpolator(@NotNull
android.view.animation.Interpolator p)
Interpolator used for state change animations.
public long getAnimationDurationMs()
Duration of state change animations.
public void setAnimationDurationMs(long p)
Duration of state change animations.
@NotNull public java.util.List<app.futured.donut.DonutSection> getData()
Returns current data.
public void submitData(@NotNull
java.util.List<app.futured.donut.DonutSection> sections)
Submits new sections to the view.
New progress line will be created for each non-existent section and view will be animated to new state. Additionally, existing lines with no data set will be removed when animation completes.
sectionspublic void addAmount(@NotNull
java.lang.String sectionName,
float amount,
@Nullable
java.lang.Integer color)
Adds amount to existing section specified by sectionName. If section does not exist and color is specified,
creates new section internally.
amount,
sectionName,
colorpublic void setAmount(@NotNull
java.lang.String sectionName,
float amount)
Sets amount for existing section specified by sectionName.
Removes section if amount is <= 0.
Does nothing if section does not exist.
amount,
sectionNamepublic void removeAmount(@NotNull
java.lang.String sectionName,
float amount)
Removes amount from existing section specified by sectionName.
If amount gets below zero, removes the section from view.
amount,
sectionNamepublic void clear()
Clear data, removing all lines.
protected void onSizeChanged(int w,
int h,
int oldw,
int oldh)
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
protected void onDraw(@NotNull
android.graphics.Canvas canvas)