Material Stepper


Source link: https://github.com/fcannizzaro/material-stepper

DEPRECATED

See android-material-stepper

Material Stepper

Dependency

allprojects {

  repositories {

...

maven {
 url "https://jitpack.io" 
}

  
}

Add the dependency

dependencies {

 compile 'com.github.fcannizzaro:material-stepper:1.2.2' 
}

Preview

Stepper

Extend one of these classes TextStepper, ProgressStepper, DotStepper, TabStepper

Methods

setTitle(String)

set stepper title

addStep(String)

add a step

setPrimaryColor(int)

set primary color (Toolbar/ Progress & Dot & Tab Circle color )

setDarkPrimaryColor(int)

set status bar & text color

setErrorTimeout(int)

set timeout (milliseconds) of error message

setStateAdapter()

use FragmentStatePagerAdapter for ViewPager instead of FragmentPagerAdapter

setStartPreviousButton()

show initial "previous" button (first step)

Tab Stepper Methods

setLinear(boolean)

limit user path (user has to complete previous step before move to next)

setPreviousVisible()

show previous button on the left

setDisabledTouch()

disable user touch on tabs (prevent click)

setAlternativeTab(boolean)

use alternative tab style

  • classic

  • alternative

Toolbar getToolbar();

get stepper toolbar

Override Method

void onComplete()

void onComplete(Bundle data)

called when 'complete' button is pressed

public class Sample extends TabStepper {

@Override
  protected void onCreate(Bundle savedInstanceState) {

 /*   ...      methods      ...  */
 // call super at the end  super.onCreate(savedInstanceState);

  
}
 

Step

Extend AbstractStep

Override Methods

String name()

override step name

String error()

override error message (HTML supported)

boolean isOptional()

override if is optional [Default = false]

boolean nextIf()

override condition to move to next step [Default = true]

void onStepVisible()

called when a step is visible

void onNext()

called when next button is pressed

void onPrevious()

called when previous button is pressed

public class StepSample extends AbstractStep {

// step name
  @Override
  public String name() {

return "Step title";
  
}

// step optional title (default: "Optional")
  @Override
  public String optional() {

return "Optional subtitle";
  
}

 // set step optional or not (default: false)
  @Override
  public boolean isOptional() {

return true;
  
}

// override only if step is limited by condition
  @Override
  public boolean nextIf() {

return i > 5;
  
}

// error showed on change next step ( see nextIf )
  @Override
  public String error() {

return "<b>Condition</b>";
  
}

// do something when step is visible
  @Override
  public void onStepVisible() {

super.onStepVisible();

  
}
  
}

Share Data between steps

Bundle getStepData()

get available bundle for current step

Bundle getStepDataFor(int step)

get bundle for specific step and set your data

Bundle getLastStepData()

get bundle for last step

// get bundle for step 3 Bundle data = getStepDataFor(3);
 data.putInt("test",5);

Save Stepper Result

Save data returned in onActivityResult

Bundle data = mStepper.getExtras();

Strings

Overwrite these strings for support multilanguage / custom titles

<string name="ms_prev">PREV</string> <string name="ms_next">NEXT</string> <string name="ms_end">COMPLETE</string> <string name="ms_continue">CONTINUE</string> <string name="ms_optional">Optional</string> <string name="ms_text_step">Step $current of $total</string>

Resources

WhatsappFormatter repo helps to perform formatting just like whatsapp does it on its EditText and TextView.

An adapter library to prevent a lot of duplication code.

A CoordinatorLayout behavior which mimics the functionality of DrawerLayout.

This is a library to help creating expanding views with animation in Android.

A Gradle Plugin that notifies about ending of the build task.

Protobuf Plugin for Gradle.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes