├── .gitignore ├── .readme └── vertical.gif ├── LICENSE ├── README-CN.md ├── README.md ├── build.gradle ├── demo-kotlin ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── moe │ │ └── feng │ │ └── common │ │ └── stepperview │ │ └── demo │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── kotlin │ │ └── moe │ │ │ └── feng │ │ │ └── common │ │ │ └── stepperview │ │ │ └── demo │ │ │ ├── MainActivity.kt │ │ │ └── fragment │ │ │ ├── VerticalStepperAdapterDemoFragment.kt │ │ │ └── VerticalStepperDemoFragment.kt │ └── res │ │ ├── drawable │ │ ├── ic_format_list_bulleted_black_24dp.xml │ │ ├── ic_menu_white_24dp.xml │ │ ├── ic_open_in_new_black_24dp.xml │ │ ├── ic_save_white_16dp.xml │ │ └── ic_thumb_up_black_24dp.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── fragment_vertical_stepper.xml │ │ ├── fragment_vertical_stepper_adapter.xml │ │ └── vertical_stepper_sample_item.xml │ │ ├── menu │ │ └── navigation_main.xml │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── moe │ └── feng │ └── common │ └── stepperview │ └── demo │ └── ExampleUnitTest.java ├── demo ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── moe │ │ └── feng │ │ └── common │ │ └── stepperview │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── moe │ │ │ └── feng │ │ │ └── common │ │ │ └── stepperview │ │ │ └── demo │ │ │ ├── MainActivity.java │ │ │ └── fragment │ │ │ ├── VerticalStepperAdapterDemoFragment.java │ │ │ └── VerticalStepperDemoFragment.java │ └── res │ │ ├── drawable │ │ ├── ic_format_list_bulleted_black_24dp.xml │ │ ├── ic_menu_white_24dp.xml │ │ ├── ic_open_in_new_black_24dp.xml │ │ ├── ic_save_white_16dp.xml │ │ └── ic_thumb_up_black_24dp.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── fragment_vertical_stepper.xml │ │ ├── fragment_vertical_stepper_adapter.xml │ │ └── vertical_stepper_sample_item.xml │ │ ├── menu │ │ └── navigation_main.xml │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── moe │ └── feng │ └── common │ └── stepperview │ └── ExampleUnitTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── moe │ │ └── feng │ │ └── common │ │ └── stepperview │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── moe │ │ │ └── feng │ │ │ └── common │ │ │ └── stepperview │ │ │ ├── IStepperAdapter.java │ │ │ ├── IStepperView.java │ │ │ ├── VerticalStepperItemView.java │ │ │ ├── VerticalStepperView.java │ │ │ ├── ViewBasedStepperAdapter.java │ │ │ ├── ViewUtils.java │ │ │ └── internal │ │ │ ├── ClipOvalFrameLayout.java │ │ │ └── VerticalSpaceItemDecoration.java │ └── res │ │ ├── drawable │ │ ├── ic_done_white_16dp.xml │ │ ├── ic_warning_black_24dp.xml │ │ └── stepper_point_background.xml │ │ ├── layout │ │ └── vertical_stepper_item_view_layout.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ └── styles.xml │ └── test │ └── java │ └── moe │ └── feng │ └── common │ └── stepperview │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | -------------------------------------------------------------------------------- /.readme/vertical.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStepperView/43cc491ad1d7dcd4b608f48691f9128c8d8d6009/.readme/vertical.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Fung Go (fython) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README-CN.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStepperView/43cc491ad1d7dcd4b608f48691f9128c8d8d6009/README-CN.md -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MaterialStepperView 2 | 3 | [![](https://jitpack.io/v/moe.feng/MaterialStepperView.svg)](https://jitpack.io/#moe.feng/MaterialStepperView) 4 | 5 | [Material Design Stepper](https://material.io/guidelines/components/steppers.html) Widgets on Android (SDK 17+) 6 | 7 | [Repo Wiki](https://github.com/fython/MaterialStepperView/wiki) [简体中文说明](./README-CN.md) 8 | 9 | ## Import (Gradle) 10 | 11 | First, add it in your root build.gradle at the end of repositories: 12 | 13 | ```gradle 14 | allprojects { 15 | repositories { 16 | ... 17 | maven { url 'https://jitpack.io' } 18 | } 19 | } 20 | ``` 21 | 22 | Add the dependency to your app modules: 23 | 24 | ```gradle 25 | dependencies { 26 | compile 'moe.feng:MaterialStepperView:latest-version' 27 | } 28 | ``` 29 | 30 | ## Styles 31 | 32 | Currently, we have only made Vertical style stepper view. 33 | 34 | There will be more styles in the future. 35 | 36 | You can customize normal/activated point color, done icon, animation duration and animation enabled also. [How to?](https://github.com/fython/MaterialStepperView/wiki/Set-item-values-and-styles) 37 | 38 | ### Vertical Stepper View 39 | 40 | [![Vertical Stepper View Demo](.readme/vertical.gif)](https://www.youtube.com/watch?v=y9gSwHKwxVM) 41 | 42 | [Read Wiki](https://github.com/fython/MaterialStepperView/wiki/Vertical-Style) and learn how to use 43 | 44 | ## Support me 45 | 46 | If you like this library project and you are willing to support me, you can donate me via Alipay or PayPal. 47 | 48 | Alipay: fythonx@gmail.com 49 | 50 | PayPal: [https://www.paypal.me/fython](https://www.paypal.me/fython) 51 | 52 | ## License 53 | 54 | ``` 55 | MIT License 56 | 57 | Copyright (c) 2017-2020 Siubeng Fung (fython) 58 | 59 | Permission is hereby granted, free of charge, to any person obtaining a copy 60 | of this software and associated documentation files (the "Software"), to deal 61 | in the Software without restriction, including without limitation the rights 62 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 63 | copies of the Software, and to permit persons to whom the Software is 64 | furnished to do so, subject to the following conditions: 65 | 66 | The above copyright notice and this permission notice shall be included in all 67 | copies or substantial portions of the Software. 68 | 69 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 70 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 71 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 72 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 73 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 74 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 75 | SOFTWARE. 76 | ``` 77 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.61' 3 | repositories { 4 | jcenter() 5 | google() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:4.0.0-alpha09' 9 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | jcenter() 16 | google() 17 | maven { url "https://jitpack.io" } 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | 25 | ext { 26 | minSdkVersion = 17 27 | targetSdkVersion = 29 28 | versionCode = 7 29 | versionName = '0.2.5' 30 | } 31 | -------------------------------------------------------------------------------- /demo-kotlin/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /demo-kotlin/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion rootProject.ext.targetSdkVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.minSdkVersion 9 | targetSdkVersion rootProject.ext.targetSdkVersion 10 | versionCode rootProject.ext.versionCode 11 | versionName rootProject.ext.versionName 12 | applicationId "moe.feng.common.stepperview.demo" 13 | 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | sourceSets { 23 | main { 24 | java.srcDirs += 'src/main/kotlin' 25 | } 26 | } 27 | } 28 | 29 | dependencies { 30 | implementation fileTree(dir: 'libs', include: ['*.jar']) 31 | androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { 32 | exclude group: 'com.android.support', module: 'support-annotations' 33 | }) 34 | testImplementation 'junit:junit:4.12' 35 | 36 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 37 | implementation 'androidx.appcompat:appcompat:1.1.0' 38 | implementation 'com.google.android.material:material:1.2.0-alpha04' 39 | implementation 'moe.feng:AlipayZeroSdk:1.1' 40 | implementation project(':library') 41 | } 42 | -------------------------------------------------------------------------------- /demo-kotlin/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 | -------------------------------------------------------------------------------- /demo-kotlin/src/androidTest/java/moe/feng/common/stepperview/demo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package moe.feng.common.stepperview.demo; 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("moe.feng.common.stepperview.demo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /demo-kotlin/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /demo-kotlin/src/main/kotlin/moe/feng/common/stepperview/demo/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package moe.feng.common.stepperview.demo 2 | 3 | import android.app.AlertDialog 4 | import android.content.Intent 5 | import android.net.Uri 6 | import android.os.Bundle 7 | import android.view.MenuItem 8 | import androidx.appcompat.app.AppCompatActivity 9 | import androidx.drawerlayout.widget.DrawerLayout 10 | import androidx.fragment.app.Fragment 11 | import com.google.android.material.navigation.NavigationView 12 | import moe.feng.alipay.zerosdk.AlipayZeroSdk 13 | import moe.feng.common.stepperview.demo.fragment.VerticalStepperAdapterDemoFragment 14 | import moe.feng.common.stepperview.demo.fragment.VerticalStepperDemoFragment 15 | 16 | class MainActivity : AppCompatActivity() { 17 | 18 | private lateinit var mDrawerLayout: DrawerLayout 19 | private lateinit var mNavigationView: NavigationView 20 | 21 | private val mVerticalStepperDemoFragment = VerticalStepperDemoFragment() 22 | private val mVerticalStepperAdapterDemoFragment = VerticalStepperAdapterDemoFragment() 23 | 24 | override fun onCreate(savedInstanceState: Bundle?) { 25 | super.onCreate(savedInstanceState) 26 | setContentView(R.layout.activity_main) 27 | 28 | setSupportActionBar(findViewById(R.id.toolbar)) 29 | supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp) 30 | supportActionBar?.setDisplayHomeAsUpEnabled(true) 31 | 32 | mDrawerLayout = findViewById(R.id.drawer_layout) 33 | 34 | mNavigationView = findViewById(R.id.navigation_view) 35 | mNavigationView.setNavigationItemSelectedListener(this::onNavigationItemSelected) 36 | 37 | if (savedInstanceState == null) { 38 | replaceFragment(mVerticalStepperDemoFragment) 39 | } 40 | } 41 | 42 | override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) { 43 | android.R.id.home -> { 44 | if (mDrawerLayout.isDrawerOpen(mNavigationView)) { 45 | mDrawerLayout.closeDrawer(mNavigationView) 46 | } else { 47 | mDrawerLayout.openDrawer(mNavigationView) 48 | } 49 | true 50 | } 51 | else -> false 52 | } 53 | 54 | private fun onNavigationItemSelected(item: MenuItem): Boolean { 55 | mDrawerLayout.closeDrawer(mNavigationView) 56 | when (item.itemId) { 57 | R.id.item_vertical_stepper -> { 58 | replaceFragment(mVerticalStepperDemoFragment) 59 | return true 60 | } 61 | R.id.item_vertical_stepper_adapter -> { 62 | replaceFragment(mVerticalStepperAdapterDemoFragment) 63 | return true 64 | } 65 | R.id.action_alipay_donate -> { 66 | if (AlipayZeroSdk.hasInstalledAlipayClient(this)) { 67 | AlipayZeroSdk.startAlipayClient(this, "aehvyvf4taua18zo6e") 68 | } else { 69 | AlertDialog.Builder(this) 70 | .setTitle(R.string.donate_dialog_title) 71 | .setMessage(R.string.donate_dialog_message) 72 | .setPositiveButton(android.R.string.ok, null) 73 | .setNeutralButton(R.string.doante_dialog_paypal_button) { _, _ -> 74 | openWebsite("https://paypal.me/fython") 75 | } 76 | .show() 77 | } 78 | return true 79 | } 80 | R.id.action_fork_on_github -> { 81 | openWebsite("https://github.com/fython/MaterialStepperView") 82 | return true 83 | } 84 | else -> return false 85 | } 86 | } 87 | 88 | private fun replaceFragment(fragment: Fragment) { 89 | supportFragmentManager.beginTransaction().replace(R.id.container, fragment).commit() 90 | } 91 | 92 | private fun openWebsite(url: String) { 93 | val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) 94 | try { 95 | startActivity(intent) 96 | } catch (e: Exception) { 97 | e.printStackTrace() 98 | } 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /demo-kotlin/src/main/kotlin/moe/feng/common/stepperview/demo/fragment/VerticalStepperAdapterDemoFragment.kt: -------------------------------------------------------------------------------- 1 | package moe.feng.common.stepperview.demo.fragment 2 | 3 | import android.content.Context 4 | import android.os.Bundle 5 | import android.text.Html 6 | import android.view.LayoutInflater 7 | import android.view.View 8 | import android.view.ViewGroup 9 | import android.widget.Button 10 | import android.widget.TextView 11 | import androidx.fragment.app.Fragment 12 | import com.google.android.material.snackbar.Snackbar 13 | 14 | import moe.feng.common.stepperview.IStepperAdapter 15 | import moe.feng.common.stepperview.VerticalStepperItemView 16 | import moe.feng.common.stepperview.VerticalStepperView 17 | import moe.feng.common.stepperview.demo.R 18 | 19 | class VerticalStepperAdapterDemoFragment : Fragment(), IStepperAdapter { 20 | 21 | private lateinit var mVerticalStepperView: VerticalStepperView 22 | 23 | override fun onCreateView(inflater: LayoutInflater, parent: ViewGroup?, savedInstanceState: Bundle?): View? { 24 | return inflater.inflate(R.layout.fragment_vertical_stepper_adapter, parent, false) 25 | } 26 | 27 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 28 | mVerticalStepperView = view.findViewById(R.id.vertical_stepper_view) 29 | mVerticalStepperView.stepperAdapter = this 30 | } 31 | 32 | override fun getTitle(index: Int) = "Step $index" 33 | 34 | override fun getSummary(index: Int): CharSequence? = when (index) { 35 | 0 -> Html.fromHtml("Summarized if needed" + if (mVerticalStepperView.currentStep > index) "; isDone!" else "") 36 | 2 -> Html.fromHtml("Last step" + if (mVerticalStepperView.currentStep > index) "; isDone!" else "") 37 | else -> null 38 | } 39 | 40 | override fun size() = 3 41 | 42 | override fun onCreateCustomView(index: Int, context: Context, parent: VerticalStepperItemView): View { 43 | val inflateView = LayoutInflater.from(context).inflate(R.layout.vertical_stepper_sample_item, parent, false) 44 | val contentView = inflateView.findViewById(R.id.item_content) 45 | contentView.setText( 46 | when (index) { 47 | 0 -> R.string.content_step_0 48 | 1 -> R.string.content_step_1 49 | else -> R.string.content_step_2 50 | } 51 | ) 52 | val nextButton = inflateView.findViewById