├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── colors.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ └── layout
│ │ │ │ └── arrow_step_view_activity.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── sjl
│ │ │ └── activity
│ │ │ └── ArrowStepViewActivity.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── sjl
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── sjl
│ │ └── ApplicationTest.java
├── proguard-rules.pro
└── build.gradle
├── library
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ └── values
│ │ │ │ ├── strings.xml
│ │ │ │ └── attrs.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── sjl
│ │ │ └── stepview
│ │ │ ├── util
│ │ │ └── ViewUtils.java
│ │ │ └── widget
│ │ │ └── ArrowStepView.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── sjl
│ │ │ └── stepview
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── sjl
│ │ └── stepview
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── .idea
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── vcs.xml
├── modules.xml
├── runConfigurations.xml
├── compiler.xml
├── gradle.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── screenshot
└── Screenshot_2019-04-03-17-58-22-132_com.sjl.arrows.png
├── gradle.properties
├── README.md
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':library'
2 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | library
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellysong/ArrowStepView/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ArrowStepView-master
3 |
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellysong/ArrowStepView/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellysong/ArrowStepView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellysong/ArrowStepView/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellysong/ArrowStepView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellysong/ArrowStepView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/screenshot/Screenshot_2019-04-03-17-58-22-132_com.sjl.arrows.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellysong/ArrowStepView/HEAD/screenshot/Screenshot_2019-04-03-17-58-22-132_com.sjl.arrows.png
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/test/java/com/sjl/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.sjl;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/sjl/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.sjl;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/library/src/test/java/com/sjl/stepview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.sjl.stepview;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #fff
7 | #000
8 | #FF7F50
9 | #FF0000
10 |
11 | #00CD66
12 | #548B54
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in F:\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "26.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.sjl.arrowstepview"
9 | minSdkVersion 14
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(include: ['*.jar'], dir: 'libs')
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.4.0'
26 | implementation project(':library')
27 | }
28 |
--------------------------------------------------------------------------------
/library/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'//this
3 | group='com.github.kellysong'//this
4 |
5 | android {
6 | compileSdkVersion 23
7 | buildToolsVersion "26.0.2"
8 |
9 |
10 | defaultConfig {
11 | minSdkVersion 14
12 | targetSdkVersion 23
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 |
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 |
27 | }
28 |
29 | dependencies {
30 | compile 'com.android.support:appcompat-v7:23.4.0'
31 | testImplementation 'junit:junit:4.12'
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/library/src/androidTest/java/com/sjl/stepview/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.sjl.stepview;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.sjl.stepview.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/library/src/main/java/com/sjl/stepview/util/ViewUtils.java:
--------------------------------------------------------------------------------
1 | package com.sjl.stepview.util;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * TODO
7 | *
8 | * @author Kelly
9 | * @version 1.0.0
10 | * @filename ViewUtils.java
11 | * @time 2018/9/5 13:38
12 | * @copyright(C) song
13 | */
14 | public class ViewUtils {
15 | /**
16 | * 根据手机分辨率从DP转成PX
17 | *
18 | * @param context
19 | * @param dpValue
20 | * @return
21 | */
22 | public static int dip2px(Context context, float dpValue) {
23 | float scale = context.getResources().getDisplayMetrics().density;
24 | return (int) (dpValue * scale + 0.5f);
25 | }
26 |
27 | /**
28 | * 将sp值转换为px值,保证文字大小不变
29 | *
30 | * @param spValue
31 | * @return
32 | */
33 | public static int sp2px(Context context, float spValue) {
34 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
35 | return (int) (spValue * fontScale + 0.5f);
36 | }
37 |
38 | /**
39 | * 根据手机的分辨率PX(像素)转成DP
40 | *
41 | * @param context
42 | * @param pxValue
43 | * @return
44 | */
45 | public static int px2dip(Context context, float pxValue) {
46 | float scale = context.getResources().getDisplayMetrics().density;
47 | return (int) (pxValue / scale + 0.5f);
48 | }
49 |
50 | /**
51 | * 将px值转换为sp值,保证文字大小不变
52 | *
53 | * @param pxValue
54 | * @return
55 | */
56 |
57 | public static int px2sp(Context context, float pxValue) {
58 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
59 | return (int) (pxValue / fontScale + 0.5f);
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sjl/activity/ArrowStepViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.sjl.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 |
7 | import com.sjl.arrowstepview.R;
8 | import com.sjl.stepview.widget.ArrowStepView;
9 |
10 | import java.util.Arrays;
11 | import java.util.List;
12 |
13 | public class ArrowStepViewActivity extends AppCompatActivity {
14 |
15 | private ArrowStepView arrowStepView, arrowStepView2, arrowStepView3;
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.arrow_step_view_activity);
21 | arrowStepView = (ArrowStepView) findViewById(R.id.step_view);
22 | arrowStepView2 = (ArrowStepView) findViewById(R.id.step_view2);
23 | arrowStepView3 = (ArrowStepView) findViewById(R.id.step_view3);
24 | initSteps(arrowStepView, arrowStepView2, arrowStepView3);
25 |
26 | }
27 |
28 | private void initSteps(ArrowStepView... arrowStepViews) {
29 | List steps = Arrays.asList(new String[]{"选择金额", "支付", "贴卡充值"});
30 | for (ArrowStepView arrowStepView : arrowStepViews) {
31 | arrowStepView.setSteps(steps);
32 | }
33 | }
34 |
35 |
36 | public void onClick(View view) {
37 | if (view.getId() == R.id.next) {
38 | int nextStep = arrowStepView.getCurrentStep() + 1;
39 | if (nextStep > arrowStepView.getStepCount()) {
40 | nextStep = 1;
41 | }
42 | arrowStepView.selectedCurrentStep(nextStep);
43 | arrowStepView2.selectedCurrentStep(nextStep);
44 | arrowStepView3.selectedCurrentStep(nextStep);
45 | }
46 | }
47 |
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/arrow_step_view_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
16 |
17 |
18 |
27 |
28 |
37 |
38 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ArrowStepView-master
2 | [](http://www.apache.org/licenses/LICENSE-2.0.html)
3 |
4 | 自定义View之箭头步骤指示器,用于流程操作
5 | # 效果图
6 |
7 | # 引用
8 |
9 | ##Step 1. Add the JitPack repository to your build file
10 |
11 | Add it in your root build.gradle at the end of repositories:
12 |
13 | allprojects {
14 | repositories {
15 | ...
16 | maven { url "https://jitpack.io" }
17 | }
18 | }
19 |
20 | ##Step 2. Add the dependency
21 |
22 | dependencies {
23 | implementation 'com.github.kellysong:ArrowStepView-master:1.0.0'
24 | }
25 |
26 | 或者引用本地lib
27 |
28 | implementation project(':library')
29 |
30 | # 使用
31 | 1. 在布局文件中添加ArrowStepView,可以设置自定义属性
32 |
33 |
40 |
41 |
42 | ## Attributes属性(布局文件中调用)
43 |
44 | |Attributes|forma|describe
45 | |---|---|---|
46 | |asv_circle_radius| dimension|步骤指示器圆圈半径,默认6dp
47 | |asv_circle_text_size| dimension|步骤指示器圆圈文字大小,默认10sp
48 | |asv_title_size| dimension|步骤指示器标题文字大小,默认12sp
49 | |asv_text_color| color|步骤指示器题颜色
50 | |asv_height| dimension|步骤指示器高度,默认38dp
51 | |asv_triangle_width| dimension|步骤指示器箭头宽度,默认15dp
52 | |asv_text_margin_left| dimension|步骤指示器圆圈和标题左边距,默认8dp
53 | |asv_current_select_color| color|步骤指示器当前选中背景色(终止背景色)
54 | |asv_default_select_color| color|步骤指示器默认背景色(起始背景色)
55 | |asv_current_select_step| integer|步骤指示器当前选择步骤,默认1
56 |
57 |
58 | 2. 设置数据
59 |
60 | List steps = Arrays.asList(new String[]{"选择金额", "支付", "贴卡充值"});
61 | arrowStepView.setSteps(steps);
62 |
63 | 3. 设置当前选择步骤
64 |
65 | arrowStepView.selectedCurrentStep(nextStep);
66 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/library/src/main/java/com/sjl/stepview/widget/ArrowStepView.java:
--------------------------------------------------------------------------------
1 | package com.sjl.stepview.widget;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Paint;
8 | import android.graphics.Path;
9 | import android.util.AttributeSet;
10 | import android.util.Log;
11 | import android.view.View;
12 |
13 | import com.sjl.stepview.R;
14 | import com.sjl.stepview.util.ViewUtils;
15 |
16 | import java.util.ArrayList;
17 | import java.util.Arrays;
18 | import java.util.List;
19 |
20 |
21 | /**
22 | * 高仿鹏涛app的公交卡充值步骤条
23 | *
24 | * @author Kelly
25 | * @version 1.0.0
26 | * @filename ArrowStepView.java
27 | * @time 2019/4/1 11:03
28 | * @copyright(C) 2019 song
29 | */
30 | public class ArrowStepView extends View {
31 | private final List mSteps = new ArrayList<>();
32 |
33 | private static final int START_STEP = 1;
34 | /**
35 | * 指示器数量,最大4个,建议3个
36 | */
37 | private static final int MAX_STEP = 4;
38 |
39 |
40 | private int mCurrentStep = START_STEP;
41 |
42 | private Paint mPaint;
43 | private int mWidth, mHeight;
44 | /**
45 | * 指示器宽度
46 | */
47 | private int mStepWidth;
48 |
49 | /**
50 | * 指示器高度
51 | */
52 | private int mStepHeight;
53 | /**
54 | * 指示器三角形高度
55 | */
56 | private int mTriangleWidth;
57 |
58 | /**
59 | * 文字和左边数字距离
60 | */
61 | private int mTextMarginLeft;
62 |
63 | /**
64 | * 标题文本大小
65 | */
66 | private int mTextSize;
67 |
68 | /**
69 | * 圆圈文字大小
70 | */
71 | private int mCircleTextSize;
72 |
73 | /**
74 | * 圆圈文字颜色
75 | */
76 | private int mTextColor;
77 |
78 |
79 | /**
80 | * 圆圈半径
81 | */
82 | private int mCircleRadius;
83 |
84 |
85 | /**
86 | * 默认背景选中颜色
87 | */
88 | private int defaultSelectColor;
89 |
90 | /**
91 | * 当前选中背景颜色
92 | */
93 | private int currentSelectColor;
94 |
95 |
96 | public ArrowStepView(Context context, AttributeSet attrs) {
97 | super(context, attrs);
98 | TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ArrowStepView);
99 | mCircleRadius = ta.getDimensionPixelSize(R.styleable.ArrowStepView_asv_circle_radius, ViewUtils.dip2px(context, 6));
100 | mCircleTextSize = ta.getDimensionPixelSize(R.styleable.ArrowStepView_asv_circle_text_size, ViewUtils.sp2px(context, 10));
101 |
102 | mTextSize = ta.getDimensionPixelSize(R.styleable.ArrowStepView_asv_title_size, ViewUtils.dip2px(context, 12));
103 | mTextColor = ta.getColor(R.styleable.ArrowStepView_asv_text_color, Color.parseColor("#5B5C5C"));
104 |
105 | mStepHeight = ta.getDimensionPixelSize(R.styleable.ArrowStepView_asv_height, ViewUtils.dip2px(context, 38));
106 | mTriangleWidth = ta.getDimensionPixelSize(R.styleable.ArrowStepView_asv_triangle_width, ViewUtils.dip2px(context, 15));
107 | mTextMarginLeft = ta.getDimensionPixelSize(R.styleable.ArrowStepView_asv_text_margin_left, ViewUtils.dip2px(context, 8));
108 |
109 | defaultSelectColor = ta.getColor(R.styleable.ArrowStepView_asv_default_select_color, Color.parseColor("#63BCFF"));
110 | currentSelectColor = ta.getColor(R.styleable.ArrowStepView_asv_current_select_color, Color.parseColor("#0190FF"));
111 | mCurrentStep = ta.getInteger(R.styleable.ArrowStepView_asv_current_select_step, START_STEP);
112 | Log.i("SIMPLE_LOGGER", "mCurrentStep:" + mCurrentStep);
113 |
114 | ta.recycle();
115 |
116 | mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
117 | mPaint.setTextSize(mTextSize);
118 | mPaint.setTextAlign(Paint.Align.CENTER);
119 | mPaint.setColor(defaultSelectColor); //设置画笔颜色
120 | mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
121 | if (isInEditMode()) {
122 | String[] steps = {"操作1", "操作2", "操作3"};
123 | setSteps(Arrays.asList(steps));
124 | // selectedCurrentStep(mCurrentStep);
125 | }
126 | }
127 |
128 | @Override
129 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
130 | mWidth = MeasureSpec.getSize(widthMeasureSpec);
131 | mHeight = MeasureSpec.getSize(heightMeasureSpec);
132 | if (mHeight >= mStepHeight) {
133 | mHeight = mStepHeight;
134 | }
135 | setMeasuredDimension(mWidth, mHeight);
136 | }
137 |
138 | @Override
139 | protected void onDraw(Canvas canvas) {
140 | super.onDraw(canvas);
141 | final int stepSize = mSteps.size();
142 | if (stepSize == 0) {
143 | return;
144 | }
145 | canvas.drawColor(Color.WHITE);
146 | mStepWidth = mWidth / stepSize;
147 | float fraction = 0.0f;
148 |
149 | for (int i = 1; i <= mCurrentStep; i++) {
150 | final boolean isSelected = i == mCurrentStep;
151 | if (isSelected) {
152 | mPaint.setColor(currentSelectColor);
153 | } else {
154 | mPaint.setColor(getCurrentColor(fraction, defaultSelectColor, currentSelectColor));
155 | fraction += 1.0f / ((stepSize - 2) == 1 ? 5 : stepSize - 2);
156 | }
157 | if (i == 1) {
158 | mPaint.setColor(defaultSelectColor);
159 | Path path = new Path();
160 | path.moveTo(0, 0);
161 | path.lineTo(mStepWidth, 0);
162 | path.lineTo(mStepWidth + mTriangleWidth, mStepHeight / 2);
163 | path.lineTo(mStepWidth, mStepHeight);
164 |
165 | path.lineTo(0, mStepHeight);
166 | path.close();
167 | canvas.drawPath(path, mPaint);
168 | } else if (i > 1 && i < stepSize) {
169 | Path path = new Path();
170 | path.moveTo(mStepWidth * (i - 1), 0);
171 | path.moveTo(mStepWidth * i, 0);
172 | path.lineTo(mStepWidth * i + mTriangleWidth, mStepHeight / 2);
173 | path.lineTo(mStepWidth * i, mStepHeight);
174 | path.lineTo(mStepWidth * (i - 1), mStepHeight);
175 | path.lineTo(mStepWidth * (i - 1) + mTriangleWidth, mStepHeight / 2);
176 | path.lineTo(mStepWidth * (i - 1), 0);
177 | path.close();
178 | canvas.drawPath(path, mPaint);
179 | } else {
180 | Path path = new Path();
181 | path.moveTo(mStepWidth * (i - 1), 0);
182 | path.lineTo(mWidth, 0);
183 | path.lineTo(mWidth, mStepHeight);
184 | path.lineTo(mStepWidth * (i - 1), mStepHeight);
185 | path.lineTo(mStepWidth * (i - 1) + mTriangleWidth, mStepHeight / 2);
186 | path.lineTo(mStepWidth * (i - 1), 0);
187 | path.close();
188 | canvas.drawPath(path, mPaint);
189 | }
190 | }
191 | for (int i = 1; i <= stepSize; i++) {
192 | final String text = mSteps.get(i - 1);
193 | if (i <= mCurrentStep) {
194 | mPaint.setColor(Color.WHITE);
195 | } else {
196 | mPaint.setColor(mTextColor);
197 | }
198 | float v = mPaint.measureText(text);
199 |
200 | String number = String.valueOf(i);
201 | mPaint.setStyle(Paint.Style.STROKE);
202 | canvas.drawCircle(mStepWidth * i - mStepWidth / 2 - v / 2 - mTextMarginLeft, mStepHeight / 2, mCircleRadius, mPaint);
203 |
204 | mPaint.setStyle(Paint.Style.FILL);
205 | mPaint.setTextSize(mCircleTextSize);
206 | int baseLineY = getBaseLineY();
207 |
208 |
209 | canvas.drawText(number, mStepWidth * i - mStepWidth / 2 - v / 2 - mTextMarginLeft, baseLineY, mPaint);
210 | mPaint.setTextSize(mTextSize);
211 | baseLineY = getBaseLineY();
212 | canvas.drawText(text, mStepWidth * i - mStepWidth / 2, baseLineY, mPaint);
213 | }
214 | }
215 |
216 |
217 | /**
218 | * 获取基线y轴坐标
219 | * @return
220 | */
221 | public int getBaseLineY() {
222 | Paint.FontMetrics fontMetrics = mPaint.getFontMetrics();
223 | float textTop = fontMetrics.top;
224 | float textBottom = fontMetrics.bottom;
225 | float contentBottom = mStepHeight / 2;
226 | int baseLineY = (int) (contentBottom - textTop / 2 - textBottom / 2);
227 | return baseLineY;
228 | }
229 |
230 |
231 | /**
232 | * 设置步骤
233 | *
234 | * @param steps
235 | */
236 | public void setSteps(List steps) {
237 | if (steps != null) {
238 | mSteps.clear();
239 | if (steps.size() > MAX_STEP) {
240 | throw new RuntimeException("the step too many");
241 | }
242 | mSteps.addAll(steps);
243 | } else {
244 | throw new RuntimeException("the steps is null.");
245 | }
246 | selectedCurrentStep(mCurrentStep);
247 | }
248 |
249 | /**
250 | * 当前步骤
251 | *
252 | * @param step
253 | */
254 | public void selectedCurrentStep(int step) {
255 | final int selected = step < START_STEP ?
256 | START_STEP : (step > mSteps.size() ? mSteps.size() : step);
257 | mCurrentStep = selected;
258 | invalidate();
259 | }
260 |
261 | public int getCurrentStep() {
262 | return mCurrentStep;
263 | }
264 |
265 | public int getStepCount() {
266 | return mSteps.size();
267 | }
268 |
269 | /**
270 | * 根据fraction值来计算当前的颜色。 fraction值范围 0f-1f
271 | */
272 | private int getCurrentColor(float fraction, int startColor, int endColor) {
273 | int redCurrent;
274 | int blueCurrent;
275 | int greenCurrent;
276 | int alphaCurrent;
277 |
278 | int redStart = Color.red(startColor);
279 | int blueStart = Color.blue(startColor);
280 | int greenStart = Color.green(startColor);
281 | int alphaStart = Color.alpha(startColor);
282 |
283 | int redEnd = Color.red(endColor);
284 | int blueEnd = Color.blue(endColor);
285 | int greenEnd = Color.green(endColor);
286 | int alphaEnd = Color.alpha(endColor);
287 |
288 | int redDifference = redEnd - redStart;
289 | int blueDifference = blueEnd - blueStart;
290 | int greenDifference = greenEnd - greenStart;
291 | int alphaDifference = alphaEnd - alphaStart;
292 |
293 | redCurrent = (int) (redStart + fraction * redDifference);
294 | blueCurrent = (int) (blueStart + fraction * blueDifference);
295 | greenCurrent = (int) (greenStart + fraction * greenDifference);
296 | alphaCurrent = (int) (alphaStart + fraction * alphaDifference);
297 |
298 | return Color.argb(alphaCurrent, redCurrent, greenCurrent, blueCurrent);
299 | }
300 |
301 |
302 | }
303 |
--------------------------------------------------------------------------------