StepView

March 16, 2017 · View on GitHub

introduce

StepView is extracted from the software developed by my company and do the reinforcement, divided into horizontal and vertical version, color size freely adjustable, flexible to use!

中文版在这里

UI

Download Demo

1 2

How to use

Gradle

compile 'com.xyz.step:step:1.0.4'

Maven

<dependency>
  <groupId>com.xyz.step</groupId>
  <artifactId>step</artifactId>
  <version>1.0.4</version>
  <type>pom</type>
</dependency>

Horizontal View

Attribute is introduced

AttributeDescribeTypeDefault valueWhether must
h_bg_radiusBackground circle radiusdimension5No
h_pro_radiusHas completed the radius of the circlesdimension2No
h_bg_widthBackground line widthdimension3No
h_bg_colorBackground Colorcolor#cdcbccNo
h_pro_widthThe width of the line has been completeddimension2No
h_pro_colorThe completed colorcolor#029dd5No
h_text_paddingText and distance of the circledimension10No
h_time_paddingTime and distance of the circledimension15No
h_max_stepTotal stepsint5No
h_pro_stepStep has been completedint1No
h_textsizetextsizedimension10No

layout

<com.xyz.step.FlowViewHorizontal
        android:id="@+id/hflowview4"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:paddingLeft="30dp"
        app:h_bg_radius="6dp"
        app:h_bg_width='4dp'
        app:h_pro_radius='4dp'
        app:h_pro_width="2dp"
        app:h_text_padding='10dp'
        app:h_textsize='10dp'
        app:h_time_padding='17dp' />

Code

    /**
     * Progress Settings
     * @param progress  Have completed a few steps
     * @param maxStep  Total steps
     * @param titles   	    Step name
     * @param times      Every step of the completion time
     */
    public void setProgress(int progress, int maxStep, String[] titles, String[] times);
    
    /**
     * Color Settings
     * @param map <text,color>
     */
    public void setKeyColor(Map<String, String> map);

Vertical View

Attribute is introduced

AttributeDescribeTypeDefault valueWhether must
v_bg_radiusBackground circle radiusdimension5No
v_pro_radiusHas completed the radius of the circledimension2No
v_bg_widthBackground line widthdimension3No
v_bg_colorBackground Colorcolor#cdcbccNo
v_pro_widthThe width of the line has been completeddimension2No
v_pro_colorThe completed colorcolor#029dd5No
v_intervalintervaldimension80No
v_bgPositionXIn a horizontal positiondimension100No
v_textPaddingLeftThe distance of text and linesdimension10No
v_timePaddingRightThe distance of time and linesdimension15No
v_max_stepTotal stepsint5No
v_pro_stepStep has been completedint1No
v_textsizeText sizedimension10No
v_textMoveTopThe text on the vertical distancedimension5No
v_timeMoveTopThe time on the vertical distancedimension4No

layout

<com.xyz.step.FlowViewVertical
        android:id="@+id/vflow"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="10dp"
        android:paddingRight="10dp"
        android:paddingTop="10dp"
        app:v_bgPositionX="40dp"
        app:v_bg_color="#029dd5"
        app:v_bg_radius="8dp"
        app:v_bg_width="4dp"
        app:v_interval="80dp"
        app:v_max_step="10"
        app:v_pro_color="#cdcbcc"
        app:v_pro_radius="8dp"
        app:v_pro_step="9"
        app:v_pro_width="4dp"
        app:v_textMoveTop="7dp"
        app:v_textsize="14dp" />

Code

    /**
     * Progress Settings
     * @param progress Have completed a few steps
     * @param maxStep  Total steps
     * @param titles    Step description
     * @param times    Time description
     */
    public void setProgress(int progress, int maxStep, String[] titles, String[] times);
    
    
    /**
     *  Color Settings
     * @param map <text,color>
     */
    public void setKeyColor(Map<String, String> map);
    

Use attention

###All directions

  • When title[] and time[] uploading the null does not show the indicator、words and time.

  • Min steps sum(max_step)>=2 and >= finished steps(pro_step)

  • The unit of the font’s size is dp

  • The color setting of the concrete steps is according to the key from the map whether title[] contain or not to make a decision whether change or not

  • Only finished steps can set color individually, unfinished steps all use the color from bg_color

Transverse

  • Lateral indicator counts intervals between steps automatically
  • Lateral indicator is placed in the middle automatically, when you set paddingLeft ,you do not need to set paddingRight
  • Lateral indicator can not slide transversely

###Vertical

  • Vertical indicator need to set the intervals between steps(v_interval)
  • Vertical indicator can combine with ScrollView to get slide
  • Vertical indicator doesn’t use item reusing, you’d better use listview if the date size is bigger
  • Vertical indicator’s word drawing is different, which leads to words and *
  • steps nodes(O) not in the same horizontal, you can adapt v_textMove Top with v_timeMove Top

LICENSE 开源协议

Apache License Version 2.0