├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── images ├── animation_all.gif ├── animation_circle.gif ├── animation_circles.gif ├── animation_line.gif ├── animation_none.gif └── no_text.png ├── publish-mavencentral.gradle ├── sample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── shuhart │ │ └── stepview │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── shuhart │ │ │ └── stepview │ │ │ └── sample │ │ │ ├── examples │ │ │ ├── customise │ │ │ │ └── CustomiseActivity.java │ │ │ ├── delayed │ │ │ │ └── DelayedInitActivity.java │ │ │ ├── recyclerview │ │ │ │ ├── CurrentStepListener.java │ │ │ │ ├── DummyAdapter.java │ │ │ │ └── RecyclerViewExampleActivity.java │ │ │ ├── rtl │ │ │ │ └── RTLActivity.java │ │ │ ├── scrollview │ │ │ │ └── ScrollViewExampleActivity.java │ │ │ └── simple │ │ │ │ └── SimpleActivity.java │ │ │ └── main │ │ │ ├── MainActivity.java │ │ │ └── MainAdapter.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── font │ │ ├── iran_sans_mobile.ttf │ │ ├── roboto_bold.ttf │ │ ├── roboto_italic.ttf │ │ └── roboto_regular.ttf │ │ ├── layout │ │ ├── activity_customise.xml │ │ ├── activity_delayed_init.xml │ │ ├── activity_main.xml │ │ ├── activity_recycler_view.xml │ │ ├── activity_rtl.xml │ │ ├── activity_scrollview.xml │ │ ├── activity_simple.xml │ │ ├── item_dummy.xml │ │ └── item_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── shuhart │ └── stepview │ └── ExampleUnitTest.java ├── settings.gradle └── stepview ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src └── main ├── AndroidManifest.xml ├── java └── com │ └── shuhart │ └── stepview │ ├── StepView.java │ └── animation │ └── AnimatorListener.java └── res └── values ├── attrs.xml ├── colors.xml ├── strings.xml └── styles.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | /build 15 | /android/build 16 | 17 | # Local configuration file (sdk path, etc) 18 | local.properties 19 | 20 | # Eclipse project files 21 | .classpath 22 | .project 23 | 24 | # Windows thumbnail db 25 | .DS_Store 26 | 27 | # IDEA/Android Studio project files, because 28 | # the project can be imported from settings.gradle 29 | .idea 30 | *.iml 31 | 32 | # Old-style IDEA project files 33 | *.ipr 34 | *.iws 35 | 36 | # Local IDEA workspace 37 | .idea/workspace.xml 38 | 39 | # Gradle cache 40 | .gradle 41 | 42 | # Sandbox stuff 43 | _sandbox 44 | 45 | release_notes.txt 46 | /android/release -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | StepView 2 | ====================== 3 | 4 | A simple animated step view for Android. Backward and forward animations is supported. 5 | 6 | Usage 7 | ----- 8 | 9 | 1. Add mavenCentral() to repositories block in your gradle file. 10 | 2. Add `implementation 'com.github.shuhart:stepview:1.5.1'` to your dependencies. 11 | 3. Add `StepView` into your layouts or view hierarchy. 12 | 13 | Supported animations: 14 | 15 | Name| Preview 16 | -------- | --- 17 | `ANIMATION_LINE`| ![animation_line](/images/animation_line.gif) 18 | `ANIMATION_CIRCLE`| ![animation_circle](/images/animation_circle.gif) 19 | `ANIMATION_ALL`| ![animation_all](/images/animation_all.gif) 20 | `ANIMATION_NONE`| ![animation_none](/images/animation_none.gif) 21 | `ANIMATION_ALL and all next circles enabled`| ![animation_circles](/images/animation_circles.gif) 22 | 23 | In ANIMATION_CIRCLE and ANIMATION_NONE examples the line color remains the same. You can achieve this by specifying: 24 | ``` app:doneStepLineColor="@color/stepview_line_next" ``` 25 | 26 | Usage: 27 | 28 | Specify steps with xml attribute: 29 | ```xml 30 | app:steps="@array/steps" 31 | ``` 32 | ```java 33 | stepView.setSteps(List steps); 34 | ``` 35 | 36 | Or Specify numbers of steps so that only circles with step number are shown: 37 | 38 | ```xml 39 | app:stepsNumber="4" 40 | ``` 41 | ```java 42 | stepView.setStepsNumber(4); 43 | ``` 44 | 45 | 46 | 47 | 48 | Styling: 49 | 50 | ```xml 51 | 72 | ``` 73 | 74 | or instantiate and setup it in runtime with handy state builder: 75 | 76 | ```java 77 | stepView.getState() 78 | .selectedTextColor(ContextCompat.getColor(this, R.color.colorAccent)) 79 | .animationType(StepView.ANIMATION_CIRCLE) 80 | .selectedCircleColor(ContextCompat.getColor(this, R.color.colorAccent)) 81 | .selectedCircleRadius(getResources().getDimensionPixelSize(R.dimen.dp14)) 82 | .selectedStepNumberColor(ContextCompat.getColor(this, R.color.colorPrimary)) 83 | // You should specify only stepsNumber or steps array of strings. 84 | // In case you specify both steps array is chosen. 85 | .steps(new ArrayList() {{ 86 | add("First step"); 87 | add("Second step"); 88 | add("Third step"); 89 | }}) 90 | // You should specify only steps number or steps array of strings. 91 | // In case you specify both steps array is chosen. 92 | .stepsNumber(4) 93 | .animationDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) 94 | .stepLineWidth(getResources().getDimensionPixelSize(R.dimen.dp1)) 95 | .textSize(getResources().getDimensionPixelSize(R.dimen.sp14)) 96 | .stepNumberTextSize(getResources().getDimensionPixelSize(R.dimen.sp16)) 97 | .typeface(ResourcesCompat.getFont(context, R.font.roboto_italic)) 98 | // other state methods are equal to the corresponding xml attributes 99 | .commit(); 100 | ``` 101 | 102 | Change a step: 103 | ```java 104 | // Passing 'true' triggers an animation if enabled. 105 | // Animation would run if a difference between current and next is 1. 106 | stepView.go(step, true); 107 | ``` 108 | 109 | If you want to mark last step with a done mark: 110 | ```java 111 | stepView.done(true); 112 | ``` 113 | If you want to allow going back after that, you should unmark the done state: 114 | ```java 115 | stepView.done(false) 116 | ``` 117 | 118 | You can set a step click listener: 119 | ```java 120 | stepView.setOnStepClickListener(new StepView.OnStepClickListener() { 121 | @Override 122 | public void onStepClick(int step) { 123 | // 0 is the first step 124 | } 125 | }); 126 | ``` 127 | 128 | See the sample for additional details. 129 | 130 | If you want a custom typeface you should add font files to the resource folder "font" and reference any in xml layout. 131 | Alternatively you can specify typeface using the state builder in your code. Look into the sample for additional details on that. 132 | 133 | You can enable view to draw remained step circles with a specified color. 134 | In xml: 135 | ```xml 136 | 143 | ``` 144 | 145 | In java: 146 | ```java 147 | stepView.getState() 148 | .nextStepCircleEnabled(isChecked) 149 | .nextStepCircleColor(Color.GRAY) 150 | .commit(); 151 | ``` 152 | 153 | License 154 | ======= 155 | 156 | Copyright 2017 Bogdan Kornev. 157 | 158 | Licensed under the Apache License, Version 2.0 (the "License"); 159 | you may not use this file except in compliance with the License. 160 | You may obtain a copy of the License at 161 | 162 | http://www.apache.org/licenses/LICENSE-2.0 163 | 164 | Unless required by applicable law or agreed to in writing, software 165 | distributed under the License is distributed on an "AS IS" BASIS, 166 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 167 | See the License for the specific language governing permissions and 168 | limitations under the License. 169 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | mavenCentral() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:7.2.1' 11 | classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0' 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | ext.supportVersion = "27.1.1" 20 | repositories { 21 | google() 22 | jcenter() 23 | mavenCentral() 24 | } 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | 31 | apply plugin: 'io.codearte.nexus-staging' 32 | -------------------------------------------------------------------------------- /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 | android.enableJetifier=true 13 | android.useAndroidX=true 14 | org.gradle.jvmargs=-Xmx1536m 15 | 16 | # When configured, Gradle will run in incubating parallel mode. 17 | # This option should only be used with decoupled projects. More details, visit 18 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 19 | # org.gradle.parallel=true 20 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuhart/StepView/4173c717463a35992a8b84075ee92f651030ef7d/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Feb 25 07:37:14 CET 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 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 Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /images/animation_all.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuhart/StepView/4173c717463a35992a8b84075ee92f651030ef7d/images/animation_all.gif -------------------------------------------------------------------------------- /images/animation_circle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuhart/StepView/4173c717463a35992a8b84075ee92f651030ef7d/images/animation_circle.gif -------------------------------------------------------------------------------- /images/animation_circles.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuhart/StepView/4173c717463a35992a8b84075ee92f651030ef7d/images/animation_circles.gif -------------------------------------------------------------------------------- /images/animation_line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuhart/StepView/4173c717463a35992a8b84075ee92f651030ef7d/images/animation_line.gif -------------------------------------------------------------------------------- /images/animation_none.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuhart/StepView/4173c717463a35992a8b84075ee92f651030ef7d/images/animation_none.gif -------------------------------------------------------------------------------- /images/no_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuhart/StepView/4173c717463a35992a8b84075ee92f651030ef7d/images/no_text.png -------------------------------------------------------------------------------- /publish-mavencentral.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven-publish' 2 | apply plugin: 'signing' 3 | 4 | task androidSourcesJar(type: Jar) { 5 | archiveClassifier.set('sources') 6 | if (project.plugins.findPlugin("com.android.library")) { 7 | // For Android libraries 8 | from android.sourceSets.main.java.srcDirs 9 | } else { 10 | // For pure Kotlin libraries, in case you have them 11 | from sourceSets.main.java.srcDirs 12 | } 13 | } 14 | 15 | artifacts { 16 | archives androidSourcesJar 17 | } 18 | 19 | group = PUBLISH_GROUP_ID 20 | version = PUBLISH_VERSION 21 | 22 | ext["signing.keyId"] = '' 23 | ext["signing.password"] = '' 24 | ext["signing.secretKeyRingFile"] = '' 25 | ext["ossrhUsername"] = '' 26 | ext["ossrhPassword"] = '' 27 | ext["sonatypeStagingProfileId"] = '' 28 | 29 | File secretPropsFile = project.rootProject.file('local.properties') 30 | if (secretPropsFile.exists()) { 31 | Properties p = new Properties() 32 | new FileInputStream(secretPropsFile).withCloseable { is -> 33 | p.load(is) 34 | } 35 | p.each { name, value -> 36 | ext[name] = value 37 | } 38 | } else { 39 | ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') 40 | ext["signing.password"] = System.getenv('SIGNING_PASSWORD') 41 | ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') 42 | ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') 43 | ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') 44 | ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') 45 | } 46 | 47 | publishing { 48 | publications { 49 | release(MavenPublication) { 50 | // The coordinates of the library, being set from variables that 51 | // we'll set up later 52 | groupId PUBLISH_GROUP_ID 53 | artifactId PUBLISH_ARTIFACT_ID 54 | version PUBLISH_VERSION 55 | 56 | // Two artifacts, the `aar` (or `jar`) and the sources 57 | if (project.plugins.findPlugin("com.android.library")) { 58 | artifact("$buildDir/outputs/aar/${project.getName()}-release.aar") 59 | } else { 60 | artifact("$buildDir/libs/${project.getName()}-${version}.jar") 61 | } 62 | artifact androidSourcesJar 63 | 64 | // Mostly self-explanatory metadata 65 | pom { 66 | name = PUBLISH_ARTIFACT_ID 67 | description = 'Step View' 68 | url = 'https://github.com/shuhart/stepview' 69 | licenses { 70 | license { 71 | name = 'License' 72 | url = 'https://github.com/shuhart/stepview/blob/master/LICENSE' 73 | } 74 | } 75 | developers { 76 | developer { 77 | id = 'schuhart' 78 | name = 'Bogdan Kornev' 79 | email = '5305278+shuhart@users.noreply.github.com' 80 | } 81 | // Add all other devs here... 82 | } 83 | // Version control info - if you're using GitHub, follow the format as seen here 84 | scm { 85 | connection = 'scm:git:github.com/shuhart/stepview.git' 86 | developerConnection = 'scm:git:ssh://github.com/shuhart/stepview.git' 87 | url = 'https://github.com/shuhart/stepview/tree/main' 88 | } 89 | // A slightly hacky fix so that your POM will include any transitive dependencies 90 | // that your library builds upon 91 | withXml { 92 | def dependenciesNode = asNode().appendNode('dependencies') 93 | 94 | project.configurations.implementation.allDependencies.each { 95 | def dependencyNode = dependenciesNode.appendNode('dependency') 96 | dependencyNode.appendNode('groupId', it.group) 97 | dependencyNode.appendNode('artifactId', it.name) 98 | dependencyNode.appendNode('version', it.version) 99 | } 100 | } 101 | } 102 | } 103 | } 104 | // The repository to publish to, Sonatype/MavenCentral 105 | repositories { 106 | maven { 107 | // This is an arbitrary name, you may also use "mavencentral" or 108 | // any other name that's descriptive for you 109 | name = "sonatype" 110 | url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" 111 | credentials { 112 | username ossrhUsername 113 | password ossrhPassword 114 | } 115 | } 116 | } 117 | } 118 | 119 | nexusStaging { 120 | packageGroup = PUBLISH_GROUP_ID 121 | stagingProfileId = sonatypeStagingProfileId 122 | username = ossrhUsername 123 | password = ossrhPassword 124 | } 125 | 126 | signing { 127 | sign publishing.publications 128 | } -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 32 5 | defaultConfig { 6 | applicationId "com.shuhart.stepview" 7 | minSdkVersion 15 8 | targetSdkVersion 30 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation 'androidx.appcompat:appcompat:1.1.0' 24 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 25 | implementation 'androidx.recyclerview:recyclerview:1.1.0' 26 | implementation "com.github.skydoves:colorpickerview:2.0.0" 27 | implementation project(':stepview') 28 | 29 | implementation 'junit:junit:4.13' 30 | testImplementation 'junit:junit:4.13' 31 | 32 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 33 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 34 | } 35 | -------------------------------------------------------------------------------- /sample/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 | -------------------------------------------------------------------------------- /sample/src/androidTest/java/com/shuhart/stepview/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.shuhart.stepview; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | import androidx.test.ext.junit.runners.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.shuhart.stepview", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /sample/src/main/java/com/shuhart/stepview/sample/examples/customise/CustomiseActivity.java: -------------------------------------------------------------------------------- 1 | package com.shuhart.stepview.sample.examples.customise; 2 | 3 | import android.app.AlertDialog; 4 | import android.content.DialogInterface; 5 | import android.graphics.Color; 6 | import android.graphics.drawable.ColorDrawable; 7 | import android.os.Bundle; 8 | import androidx.annotation.Nullable; 9 | import androidx.core.content.ContextCompat; 10 | import androidx.appcompat.app.AppCompatActivity; 11 | import android.text.Editable; 12 | import android.text.TextWatcher; 13 | import android.view.View; 14 | import android.widget.CompoundButton; 15 | import android.widget.EditText; 16 | import android.widget.ImageView; 17 | import android.widget.Switch; 18 | import android.widget.Toast; 19 | 20 | import com.shuhart.stepview.StepView; 21 | import com.shuhart.stepview.sample.R; 22 | import com.skydoves.colorpickerview.ColorEnvelope; 23 | import com.skydoves.colorpickerview.ColorPickerDialog; 24 | import com.skydoves.colorpickerview.listeners.ColorEnvelopeListener; 25 | 26 | import java.util.ArrayList; 27 | import java.util.List; 28 | 29 | public class CustomiseActivity extends AppCompatActivity { 30 | private int currentStep = 0; 31 | private StepView stepView; 32 | 33 | @Override 34 | protected void onCreate(@Nullable Bundle savedInstanceState) { 35 | super.onCreate(savedInstanceState); 36 | setContentView(R.layout.activity_customise); 37 | stepView = findViewById(R.id.step_view); 38 | setupStepView(); 39 | setupCustomisation(); 40 | } 41 | 42 | private void setupStepView() { 43 | stepView.setOnStepClickListener(new StepView.OnStepClickListener() { 44 | @Override 45 | public void onStepClick(int step) { 46 | Toast.makeText(CustomiseActivity.this, "Step " + step, Toast.LENGTH_SHORT).show(); 47 | } 48 | }); 49 | findViewById(R.id.next).setOnClickListener(new View.OnClickListener() { 50 | @Override 51 | public void onClick(View v) { 52 | if (currentStep < stepView.getStepCount() - 1) { 53 | currentStep++; 54 | stepView.go(currentStep, true); 55 | } else { 56 | stepView.done(true); 57 | } 58 | } 59 | }); 60 | findViewById(R.id.back).setOnClickListener(new View.OnClickListener() { 61 | @Override 62 | public void onClick(View v) { 63 | if (currentStep > 0) { 64 | currentStep--; 65 | } 66 | stepView.done(false); 67 | stepView.go(currentStep, true); 68 | } 69 | }); 70 | Switch sw = findViewById(R.id.next_circle_switch); 71 | sw.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 72 | @Override 73 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 74 | stepView.getState().nextStepCircleEnabled(isChecked).commit(); 75 | } 76 | }); 77 | List steps = new ArrayList<>(); 78 | for (int i = 0; i < 5; i++) { 79 | steps.add("Step " + (i + 1)); 80 | } 81 | stepView.setSteps(steps); 82 | } 83 | 84 | private void setupCustomisation() { 85 | setupSelectCircleColorCustomisation(); 86 | setupSelectTextColorCustomisation(); 87 | setupNextCircleColorCustomisation(); 88 | } 89 | 90 | private void setupSelectCircleColorCustomisation() { 91 | final EditText selectedCircleColorEditText = findViewById(R.id.selected_circle_color_hex); 92 | final ImageView selectedCircleColorSampleImageView = findViewById(R.id.selected_circle_color_sample); 93 | 94 | selectedCircleColorEditText.addTextChangedListener(new TextWatcher() { 95 | @Override 96 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { 97 | // empty 98 | } 99 | 100 | @Override 101 | public void onTextChanged(CharSequence s, int start, int before, int count) { 102 | // empty 103 | } 104 | 105 | @Override 106 | public void afterTextChanged(Editable s) { 107 | String candidateColorHex = s.toString(); 108 | if (!candidateColorHex.contains("#")) { 109 | candidateColorHex = "#" + candidateColorHex; 110 | } 111 | try { 112 | int color = Color.parseColor(candidateColorHex); 113 | selectedCircleColorSampleImageView.setImageDrawable(new ColorDrawable(color)); 114 | stepView.getState().selectedCircleColor(color).commit(); 115 | } catch (IllegalArgumentException ignore) { 116 | } 117 | } 118 | }); 119 | 120 | int color = ContextCompat.getColor(this, R.color.stepview_circle_selected); 121 | String hex = Integer.toHexString(color).toUpperCase().substring(2); 122 | selectedCircleColorEditText.setText(hex); 123 | 124 | selectedCircleColorSampleImageView.setOnClickListener(new View.OnClickListener() { 125 | @Override 126 | public void onClick(View v) { 127 | showColorPickerDialog(new ColorPickListener() { 128 | @Override 129 | public void onColorPicked(String hex) { 130 | selectedCircleColorEditText.setText(hex); 131 | } 132 | }); 133 | } 134 | }); 135 | } 136 | 137 | private void setupSelectTextColorCustomisation() { 138 | final EditText selectedTextColorEditText = findViewById(R.id.selected_text_color_hex); 139 | final ImageView selectedTextColorSampleImageView = findViewById(R.id.selected_text_color_sample); 140 | 141 | selectedTextColorEditText.addTextChangedListener(new TextWatcher() { 142 | @Override 143 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { 144 | // empty 145 | } 146 | 147 | @Override 148 | public void onTextChanged(CharSequence s, int start, int before, int count) { 149 | // empty 150 | } 151 | 152 | @Override 153 | public void afterTextChanged(Editable s) { 154 | String candidateColorHex = s.toString(); 155 | if (!candidateColorHex.contains("#")) { 156 | candidateColorHex = "#" + candidateColorHex; 157 | } 158 | try { 159 | int color = Color.parseColor(candidateColorHex); 160 | selectedTextColorSampleImageView.setImageDrawable(new ColorDrawable(color)); 161 | stepView.getState().selectedTextColor(color).commit(); 162 | } catch (IllegalArgumentException ignore) { 163 | } 164 | } 165 | }); 166 | 167 | int color = ContextCompat.getColor(this, R.color.stepview_circle_selected); 168 | String hex = Integer.toHexString(color).toUpperCase().substring(2); 169 | selectedTextColorEditText.setText(hex); 170 | 171 | selectedTextColorSampleImageView.setOnClickListener(new View.OnClickListener() { 172 | @Override 173 | public void onClick(View v) { 174 | showColorPickerDialog(new ColorPickListener() { 175 | @Override 176 | public void onColorPicked(String hex) { 177 | selectedTextColorEditText.setText(hex); 178 | } 179 | }); 180 | } 181 | }); 182 | } 183 | 184 | private void setupNextCircleColorCustomisation() { 185 | final EditText hext = findViewById(R.id.next_circle_color_hex); 186 | final ImageView sample = findViewById(R.id.next_circle_color_sample); 187 | 188 | hext.addTextChangedListener(new TextWatcher() { 189 | @Override 190 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { 191 | // empty 192 | } 193 | 194 | @Override 195 | public void onTextChanged(CharSequence s, int start, int before, int count) { 196 | // empty 197 | } 198 | 199 | @Override 200 | public void afterTextChanged(Editable s) { 201 | String candidateColorHex = s.toString(); 202 | if (!candidateColorHex.contains("#")) { 203 | candidateColorHex = "#" + candidateColorHex; 204 | } 205 | try { 206 | int color = Color.parseColor(candidateColorHex); 207 | sample.setImageDrawable(new ColorDrawable(color)); 208 | stepView.getState().nextStepCircleColor(color).commit(); 209 | } catch (IllegalArgumentException ignore) { 210 | } 211 | } 212 | }); 213 | 214 | int color = Color.GRAY; 215 | String hex = Integer.toHexString(color).toUpperCase().substring(2); 216 | hext.setText(hex); 217 | 218 | sample.setOnClickListener(new View.OnClickListener() { 219 | @Override 220 | public void onClick(View v) { 221 | showColorPickerDialog(new ColorPickListener() { 222 | @Override 223 | public void onColorPicked(String hex) { 224 | hext.setText(hex); 225 | } 226 | }); 227 | } 228 | }); 229 | } 230 | 231 | private void showColorPickerDialog(final ColorPickListener listener) { 232 | ColorPickerDialog.Builder builder = new ColorPickerDialog.Builder(CustomiseActivity.this, AlertDialog.THEME_DEVICE_DEFAULT_DARK); 233 | builder.setTitle("ColorPicker Dialog"); 234 | builder.setPositiveButton(getString(R.string.confirm), new ColorEnvelopeListener() { 235 | @Override 236 | public void onColorSelected(ColorEnvelope envelope, boolean fromUser) { 237 | listener.onColorPicked(envelope.getHexCode()); 238 | } 239 | }); 240 | builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { 241 | @Override 242 | public void onClick(DialogInterface dialogInterface, int i) { 243 | dialogInterface.dismiss(); 244 | } 245 | }); 246 | builder.show(); 247 | } 248 | 249 | interface ColorPickListener { 250 | void onColorPicked(String hex); 251 | } 252 | } 253 | -------------------------------------------------------------------------------- /sample/src/main/java/com/shuhart/stepview/sample/examples/delayed/DelayedInitActivity.java: -------------------------------------------------------------------------------- 1 | package com.shuhart.stepview.sample.examples.delayed; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import android.view.View; 7 | import android.widget.Toast; 8 | 9 | import com.shuhart.stepview.StepView; 10 | import com.shuhart.stepview.sample.R; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class DelayedInitActivity extends AppCompatActivity { 16 | private int currentStep = 0; 17 | 18 | @Override 19 | protected void onCreate(@Nullable Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_delayed_init); 22 | final StepView stepView = findViewById(R.id.step_view); 23 | stepView.setOnStepClickListener(new StepView.OnStepClickListener() { 24 | @Override 25 | public void onStepClick(int step) { 26 | Toast.makeText(DelayedInitActivity.this, "Step " + step, Toast.LENGTH_SHORT).show(); 27 | } 28 | }); 29 | findViewById(R.id.next).setOnClickListener(new View.OnClickListener() { 30 | @Override 31 | public void onClick(View v) { 32 | if (currentStep < stepView.getStepCount() - 1) { 33 | currentStep++; 34 | stepView.go(currentStep, true); 35 | } else { 36 | stepView.done(true); 37 | } 38 | } 39 | }); 40 | findViewById(R.id.back).setOnClickListener(new View.OnClickListener() { 41 | @Override 42 | public void onClick(View v) { 43 | if (currentStep > 0) { 44 | currentStep--; 45 | } 46 | stepView.done(false); 47 | stepView.go(currentStep, true); 48 | } 49 | }); 50 | findViewById(R.id.btn_init).setOnClickListener(new View.OnClickListener() { 51 | @Override 52 | public void onClick(View v) { 53 | List steps = new ArrayList<>(); 54 | for (int i = 0; i < 5; i++) { 55 | steps.add("Step " + (i + 1)); 56 | } 57 | stepView.setSteps(steps); 58 | } 59 | }); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /sample/src/main/java/com/shuhart/stepview/sample/examples/recyclerview/CurrentStepListener.java: -------------------------------------------------------------------------------- 1 | package com.shuhart.stepview.sample.examples.recyclerview; 2 | 3 | interface CurrentStepListener { 4 | void update(int adapterPosition, int step); 5 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/shuhart/stepview/sample/examples/recyclerview/DummyAdapter.java: -------------------------------------------------------------------------------- 1 | package com.shuhart.stepview.sample.examples.recyclerview; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.recyclerview.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.Toast; 9 | 10 | import com.shuhart.stepview.StepView; 11 | import com.shuhart.stepview.sample.R; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | public class DummyAdapter extends RecyclerView.Adapter implements CurrentStepListener { 17 | private List currentSteps = new ArrayList(){{ 18 | for (int i = 0; i < 20; i++){ 19 | add(0); 20 | } 21 | }}; 22 | 23 | @NonNull 24 | @Override 25 | public DummyAdapter.DummyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 26 | return new DummyHolder( 27 | LayoutInflater.from(parent.getContext()) 28 | .inflate(R.layout.item_dummy, parent, false) 29 | ); 30 | } 31 | 32 | @Override 33 | public void onBindViewHolder(@NonNull DummyAdapter.DummyHolder holder, int position) { 34 | if (position % 2 == 0) { 35 | List steps = new ArrayList<>(); 36 | for (int i = 0; i < 5; i++) { 37 | steps.add("Step " + (i + 1)); 38 | } 39 | holder.stepView.setSteps(steps); 40 | } else { 41 | holder.stepView.setStepsNumber(5); 42 | } 43 | holder.stepView.go(currentSteps.get(position), false); 44 | } 45 | 46 | @Override 47 | public void onViewAttachedToWindow(@NonNull DummyHolder holder) { 48 | super.onViewAttachedToWindow(holder); 49 | holder.listener = this; 50 | } 51 | 52 | @Override 53 | public void onViewDetachedFromWindow(@NonNull DummyHolder holder) { 54 | super.onViewDetachedFromWindow(holder); 55 | holder.listener = null; 56 | } 57 | 58 | @Override 59 | public int getItemCount() { 60 | return currentSteps.size(); 61 | } 62 | 63 | @Override 64 | public void update(int adapterPosition, int step) { 65 | currentSteps.set(adapterPosition, step); 66 | } 67 | 68 | static class DummyHolder extends RecyclerView.ViewHolder { 69 | StepView stepView; 70 | CurrentStepListener listener; 71 | 72 | private int currentStep = 0; 73 | 74 | DummyHolder(final View itemView) { 75 | super(itemView); 76 | stepView = itemView.findViewById(R.id.step_view); 77 | stepView.setOnStepClickListener(new StepView.OnStepClickListener() { 78 | @Override 79 | public void onStepClick(int step) { 80 | Toast.makeText(itemView.getContext(), "Step " + step, Toast.LENGTH_SHORT).show(); 81 | } 82 | }); 83 | itemView.findViewById(R.id.next).setOnClickListener(new View.OnClickListener() { 84 | @Override 85 | public void onClick(View v) { 86 | if (currentStep < stepView.getStepCount() - 1) { 87 | currentStep++; 88 | stepView.go(currentStep, true); 89 | listener.update(getAdapterPosition(), currentStep); 90 | } else { 91 | stepView.done(true); 92 | } 93 | } 94 | }); 95 | itemView.findViewById(R.id.back).setOnClickListener(new View.OnClickListener() { 96 | @Override 97 | public void onClick(View v) { 98 | if (currentStep > 0) { 99 | currentStep--; 100 | listener.update(getAdapterPosition(), currentStep); 101 | } 102 | stepView.done(false); 103 | stepView.go(currentStep, true); 104 | } 105 | }); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /sample/src/main/java/com/shuhart/stepview/sample/examples/recyclerview/RecyclerViewExampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.shuhart.stepview.sample.examples.recyclerview; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import androidx.recyclerview.widget.LinearLayoutManager; 7 | import androidx.recyclerview.widget.RecyclerView; 8 | 9 | import com.shuhart.stepview.sample.R; 10 | 11 | public class RecyclerViewExampleActivity extends AppCompatActivity { 12 | @Override 13 | protected void onCreate(@Nullable Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_recycler_view); 16 | RecyclerView recyclerView = findViewById(R.id.recycler_view); 17 | DummyAdapter adapter = new DummyAdapter(); 18 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 19 | recyclerView.setAdapter(adapter); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /sample/src/main/java/com/shuhart/stepview/sample/examples/rtl/RTLActivity.java: -------------------------------------------------------------------------------- 1 | package com.shuhart.stepview.sample.examples.rtl; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import android.view.View; 7 | import android.widget.Toast; 8 | 9 | import com.shuhart.stepview.StepView; 10 | import com.shuhart.stepview.sample.R; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class RTLActivity extends AppCompatActivity { 16 | private int currentStep = 0; 17 | 18 | @Override 19 | protected void onCreate(@Nullable Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.item_dummy); 22 | final StepView stepView = findViewById(R.id.step_view); 23 | stepView.setOnStepClickListener(new StepView.OnStepClickListener() { 24 | @Override 25 | public void onStepClick(int step) { 26 | Toast.makeText(RTLActivity.this, "Step " + step, Toast.LENGTH_SHORT).show(); 27 | } 28 | }); 29 | findViewById(R.id.next).setOnClickListener(new View.OnClickListener() { 30 | @Override 31 | public void onClick(View v) { 32 | if (currentStep < stepView.getStepCount() - 1) { 33 | currentStep++; 34 | stepView.go(currentStep, true); 35 | } else { 36 | stepView.done(true); 37 | } 38 | } 39 | }); 40 | findViewById(R.id.back).setOnClickListener(new View.OnClickListener() { 41 | @Override 42 | public void onClick(View v) { 43 | if (currentStep > 0) { 44 | currentStep--; 45 | } 46 | stepView.done(false); 47 | stepView.go(currentStep, true); 48 | } 49 | }); 50 | List steps = new ArrayList(){{ 51 | add("الأول"); 52 | add("الثاني ، نص طويل نوعا ما"); 53 | add("الثالث"); 54 | add("الرابع"); 55 | add("الخامس"); 56 | }}; 57 | stepView.setSteps(steps); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /sample/src/main/java/com/shuhart/stepview/sample/examples/scrollview/ScrollViewExampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.shuhart.stepview.sample.examples.scrollview; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import android.view.View; 7 | import android.widget.Toast; 8 | 9 | import com.shuhart.stepview.StepView; 10 | import com.shuhart.stepview.sample.R; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class ScrollViewExampleActivity extends AppCompatActivity { 16 | private int currentStep = 0; 17 | 18 | @Override 19 | protected void onCreate(@Nullable Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_scrollview); 22 | final StepView stepView = findViewById(R.id.step_view); 23 | stepView.setOnStepClickListener(new StepView.OnStepClickListener() { 24 | @Override 25 | public void onStepClick(int step) { 26 | Toast.makeText(ScrollViewExampleActivity.this, "Step " + step, Toast.LENGTH_SHORT).show(); 27 | } 28 | }); 29 | findViewById(R.id.next).setOnClickListener(new View.OnClickListener() { 30 | @Override 31 | public void onClick(View v) { 32 | if (currentStep < stepView.getStepCount() - 1) { 33 | currentStep++; 34 | stepView.go(currentStep, true); 35 | } else { 36 | stepView.done(true); 37 | } 38 | } 39 | }); 40 | findViewById(R.id.back).setOnClickListener(new View.OnClickListener() { 41 | @Override 42 | public void onClick(View v) { 43 | if (currentStep > 0) { 44 | currentStep--; 45 | } 46 | stepView.done(false); 47 | stepView.go(currentStep, true); 48 | } 49 | }); 50 | List steps = new ArrayList<>(); 51 | for (int i = 0; i < 5; i++) { 52 | steps.add("Step " + (i + 1)); 53 | } 54 | stepView.setSteps(steps); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /sample/src/main/java/com/shuhart/stepview/sample/examples/simple/SimpleActivity.java: -------------------------------------------------------------------------------- 1 | package com.shuhart.stepview.sample.examples.simple; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import android.view.View; 7 | import android.widget.Toast; 8 | 9 | import com.shuhart.stepview.StepView; 10 | import com.shuhart.stepview.sample.R; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class SimpleActivity extends AppCompatActivity { 16 | private int currentStep = 0; 17 | private int currentStep2 = 0; 18 | 19 | @Override 20 | protected void onCreate(@Nullable Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.activity_simple); 23 | final StepView stepView = findViewById(R.id.step_view); 24 | stepView.setOnStepClickListener(new StepView.OnStepClickListener() { 25 | @Override 26 | public void onStepClick(int step) { 27 | Toast.makeText(SimpleActivity.this, "Step " + step, Toast.LENGTH_SHORT).show(); 28 | } 29 | }); 30 | findViewById(R.id.next).setOnClickListener(new View.OnClickListener() { 31 | @Override 32 | public void onClick(View v) { 33 | if (currentStep < stepView.getStepCount() - 1) { 34 | currentStep++; 35 | stepView.go(currentStep, true); 36 | } else { 37 | stepView.done(true); 38 | } 39 | } 40 | }); 41 | findViewById(R.id.back).setOnClickListener(new View.OnClickListener() { 42 | @Override 43 | public void onClick(View v) { 44 | if (currentStep > 0) { 45 | currentStep--; 46 | } 47 | stepView.done(false); 48 | stepView.go(currentStep, true); 49 | } 50 | }); 51 | List steps = new ArrayList<>(); 52 | for (int i = 0; i < 5; i++) { 53 | steps.add("Step " + (i + 1)); 54 | } 55 | steps.set(steps.size() - 1, steps.get(steps.size() - 1) + " last one"); 56 | stepView.setSteps(steps); 57 | 58 | final StepView stepView2 = findViewById(R.id.step_view_2); 59 | stepView2.setOnStepClickListener(new StepView.OnStepClickListener() { 60 | @Override 61 | public void onStepClick(int step) { 62 | Toast.makeText(SimpleActivity.this, "Step " + step, Toast.LENGTH_SHORT).show(); 63 | } 64 | }); 65 | findViewById(R.id.next_2).setOnClickListener(new View.OnClickListener() { 66 | @Override 67 | public void onClick(View v) { 68 | if (currentStep2 < stepView2.getStepCount() - 1) { 69 | currentStep2++; 70 | stepView2.go(currentStep2, true); 71 | } else { 72 | stepView2.done(true); 73 | } 74 | } 75 | }); 76 | findViewById(R.id.back_2).setOnClickListener(new View.OnClickListener() { 77 | @Override 78 | public void onClick(View v) { 79 | if (currentStep2 > 0) { 80 | currentStep2--; 81 | } 82 | stepView2.done(false); 83 | stepView2.go(currentStep2, true); 84 | } 85 | }); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /sample/src/main/java/com/shuhart/stepview/sample/main/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.shuhart.stepview.sample.main; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import androidx.recyclerview.widget.LinearLayoutManager; 7 | import androidx.recyclerview.widget.RecyclerView; 8 | 9 | import com.shuhart.stepview.sample.R; 10 | import com.shuhart.stepview.sample.examples.customise.CustomiseActivity; 11 | import com.shuhart.stepview.sample.examples.delayed.DelayedInitActivity; 12 | import com.shuhart.stepview.sample.examples.recyclerview.RecyclerViewExampleActivity; 13 | import com.shuhart.stepview.sample.examples.rtl.RTLActivity; 14 | import com.shuhart.stepview.sample.examples.scrollview.ScrollViewExampleActivity; 15 | import com.shuhart.stepview.sample.examples.simple.SimpleActivity; 16 | 17 | import java.util.ArrayList; 18 | 19 | public class MainActivity extends AppCompatActivity { 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_main); 25 | MainAdapter adapter = new MainAdapter(); 26 | adapter.items = new ArrayList() {{ 27 | add(MainAdapter.Item.SIMPLE); 28 | add(MainAdapter.Item.RECYCLER_VIEW); 29 | add(MainAdapter.Item.SCROLL_VIEW); 30 | add(MainAdapter.Item.CUSTOMISE); 31 | add(MainAdapter.Item.RTL); 32 | add(MainAdapter.Item.DELAYED_INIT); 33 | }}; 34 | adapter.listener = new MainAdapter.ItemClickListener() { 35 | @Override 36 | public void onClick(MainAdapter.Item item) { 37 | switch (item) { 38 | case SIMPLE: 39 | startActivity(new Intent(MainActivity.this, SimpleActivity.class)); 40 | break; 41 | case RECYCLER_VIEW: 42 | startActivity(new Intent(MainActivity.this, RecyclerViewExampleActivity.class)); 43 | break; 44 | case SCROLL_VIEW: 45 | startActivity(new Intent(MainActivity.this, ScrollViewExampleActivity.class)); 46 | break; 47 | case CUSTOMISE: 48 | startActivity(new Intent(MainActivity.this, CustomiseActivity.class)); 49 | break; 50 | case RTL: 51 | startActivity(new Intent(MainActivity.this, RTLActivity.class)); 52 | break; 53 | case DELAYED_INIT: 54 | startActivity(new Intent(MainActivity.this, DelayedInitActivity.class)); 55 | break; 56 | } 57 | } 58 | }; 59 | RecyclerView recyclerView = findViewById(R.id.recycler_view); 60 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 61 | recyclerView.setAdapter(adapter); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /sample/src/main/java/com/shuhart/stepview/sample/main/MainAdapter.java: -------------------------------------------------------------------------------- 1 | package com.shuhart.stepview.sample.main; 2 | 3 | import android.view.LayoutInflater; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.widget.TextView; 7 | 8 | import androidx.annotation.NonNull; 9 | import androidx.recyclerview.widget.RecyclerView; 10 | 11 | import com.shuhart.stepview.sample.R; 12 | 13 | import org.junit.Assert; 14 | 15 | import java.util.List; 16 | 17 | public class MainAdapter extends RecyclerView.Adapter { 18 | 19 | List items; 20 | ItemClickListener listener; 21 | 22 | @NonNull 23 | @Override 24 | public MainAdapter.MainViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 25 | return new MainViewHolder( 26 | LayoutInflater.from(parent.getContext()) 27 | .inflate(R.layout.item_main, parent, false) 28 | ); 29 | } 30 | 31 | @Override 32 | public void onBindViewHolder(@NonNull MainAdapter.MainViewHolder holder, int position) { 33 | holder.bind(items.get(position)); 34 | } 35 | 36 | @Override 37 | public void onViewDetachedFromWindow(@NonNull MainViewHolder holder) { 38 | super.onViewDetachedFromWindow(holder); 39 | holder.listener = null; 40 | } 41 | 42 | @Override 43 | public void onViewAttachedToWindow(@NonNull MainViewHolder holder) { 44 | super.onViewAttachedToWindow(holder); 45 | holder.listener = listener; 46 | } 47 | 48 | @Override 49 | public int getItemCount() { 50 | return items == null ? 0 : items.size(); 51 | } 52 | 53 | static class MainViewHolder extends RecyclerView.ViewHolder { 54 | 55 | ItemClickListener listener; 56 | Item item; 57 | 58 | private TextView titleTextView; 59 | private TextView subtitleTextView; 60 | 61 | MainViewHolder(View itemView) { 62 | super(itemView); 63 | titleTextView = itemView.findViewById(R.id.title); 64 | subtitleTextView = itemView.findViewById(R.id.subtitle); 65 | } 66 | 67 | void bind(final Item item) { 68 | this.item = item; 69 | String title = null; 70 | String subtitle = null; 71 | switch (item) { 72 | case SIMPLE: { 73 | title = titleTextView.getContext().getString(R.string.main_list_item_simple_title); 74 | subtitle = subtitleTextView.getContext().getString(R.string.main_list_item_simple_subtitle); 75 | break; 76 | } 77 | case RECYCLER_VIEW: { 78 | title = titleTextView.getContext().getString(R.string.main_list_item_recyclerview_title); 79 | subtitle = subtitleTextView.getContext().getString(R.string.main_list_item_recyclerview_subtitle); 80 | break; 81 | } 82 | case SCROLL_VIEW: { 83 | title = titleTextView.getContext().getString(R.string.main_list_item_scrollview_title); 84 | subtitle = subtitleTextView.getContext().getString(R.string.main_list_item_scrollview_subtitle); 85 | break; 86 | } 87 | case CUSTOMISE: 88 | title = titleTextView.getContext().getString(R.string.main_list_item_customise_title); 89 | subtitle = subtitleTextView.getContext().getString(R.string.main_list_item_customise_subtitle); 90 | break; 91 | case RTL: 92 | title = titleTextView.getContext().getString(R.string.main_list_item_rtl_title); 93 | subtitle = subtitleTextView.getContext().getString(R.string.main_list_item_rtl_subtitle); 94 | break; 95 | case DELAYED_INIT: 96 | title = titleTextView.getContext().getString(R.string.main_list_item_delayed_init_title); 97 | subtitle = subtitleTextView.getContext().getString(R.string.main_list_item_delayed_init_subtitle); 98 | break; 99 | } 100 | Assert.assertNotNull(title); 101 | Assert.assertNotNull(subtitle); 102 | titleTextView.setText(title); 103 | subtitleTextView.setText(subtitle); 104 | itemView.setOnClickListener(new View.OnClickListener() { 105 | @Override 106 | public void onClick(View v) { 107 | if (listener != null) { 108 | listener.onClick(item); 109 | } 110 | } 111 | }); 112 | } 113 | } 114 | 115 | public interface ItemClickListener { 116 | void onClick(Item item); 117 | } 118 | 119 | public enum Item { 120 | SIMPLE, 121 | RECYCLER_VIEW, 122 | SCROLL_VIEW, 123 | CUSTOMISE, 124 | RTL, 125 | DELAYED_INIT 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /sample/src/main/res/font/iran_sans_mobile.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuhart/StepView/4173c717463a35992a8b84075ee92f651030ef7d/sample/src/main/res/font/iran_sans_mobile.ttf -------------------------------------------------------------------------------- /sample/src/main/res/font/roboto_bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuhart/StepView/4173c717463a35992a8b84075ee92f651030ef7d/sample/src/main/res/font/roboto_bold.ttf -------------------------------------------------------------------------------- /sample/src/main/res/font/roboto_italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuhart/StepView/4173c717463a35992a8b84075ee92f651030ef7d/sample/src/main/res/font/roboto_italic.ttf -------------------------------------------------------------------------------- /sample/src/main/res/font/roboto_regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuhart/StepView/4173c717463a35992a8b84075ee92f651030ef7d/sample/src/main/res/font/roboto_regular.ttf -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_customise.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 27 | 28 |