SlickForm


Source link: https://github.com/AlburIvan/SlickForm

SlickForm

Based on This awesome design from Josh Cummings. SlickForm is an Android library where you define a custom array of EditTexts with the purpose of handling a form in a cool animated way.

Table of Contents

Demo

Integration

To try this library into your build:

Step 1. Add the JitPack repository to your project build.gradle:

 allprojects {

repositories {

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

}
  
}

Step 2. Add the dependency

 dependencies {

compile 'com.github.AlburIvan:SlickForm:v1.2'  
}

Usage

In XML:

<com.alburivan.slicksignform.SlickSignForm

android:id="@+id/slick_form"

android:layout_width="match_parent"

android:layout_height="wrap_content"

app:slick_tooltipEnabled="true" />

Extra attributes available:

 <declare-styleable name="SlickSignForm">

<attr name="slick_buttonBgColor" format="color" />

<attr name="slick_buttonFgColor" format="color" />

<attr name="slick_tooltipEnabled" format="boolean" />

<attr name="slick_tooltipColor" format="color" /> </declare-styleable>

Default behavior (3 fields: email, user, & password):

 SlickForm slickForm =

  (SlickForm) findViewById(R.id.slick_form);

 slickForm.withDefaultFields()

 .setOnProcessChangeListener(new IOnProcessChange() {

  @Override

  public boolean workInBackground(List<FormField> param) {

 final String message = String.format(Locale.ENGLISH,

  "This form is doing work in background and the values are: first field: %s - second field: %s  - third field: %s",

  param.get(0).getInputFieldText(), param.get(1).getInputFieldText(), param.get(2).getInputFieldText()

);

 Log.d("TAG", message);

 // if all goes good, return true, if it failed return false

return true;

  
}

@Override

  public void workFinished() {

Log.d("TAG", "Done");

  
}

 
}
)

 .ready();

Thats it?

Yeah basically...

Only those fields?? Is it for signing in only??

Not really... You can extend it to your needs

  1. Create FormFields Objects
 FormField userField = new FormField(getApplicationContext())

 .withType(FieldsType.TEXT)

 .withHint("Username")

 .withLabel("Hit me");
 // optional - default: Next

FormField emailField = new FormField(getApplicationContext())

 .withType(FieldsType.EMAIL)

 .withHint("Email");

FormField passField = new FormField(getApplicationContext())

 .withType(FieldsType.PASSWORD)

 .withCustomValidation(new IOnCustomValidation() {

 // Add your own custom validation if neccesarry.

@Override

public boolean withCustomValidation(FormField field) {

  String password

= field.getInputFieldText();

  boolean hasUppercase = !password.equals(password.toLowerCase());

 boolean hasLowercase = !password.equals(password.toUpperCase());

  boolean isAtLeast8
=  password.length() >= 8;

  // return true if validation is successful, otherwise false

 return (hasUppercase && hasLowercase) && isAtLeast8;

}

  
}
)

 .withHint("Password");
  1. Add them your SlickForm Object
  SlickForm slickForm =

(SlickForm) findViewById(R.id.slick_form);

 slickForm

 .withField(userField)

 .withField(emailField)

 .withField(passField) // chain any number of fields in the order of appearance

 .setOnProcessChangeListener(new IOnProcessChange() {

@Override

public boolean workInBackground(List<FormField> param) {

  final String message = String.format(Locale.ENGLISH,

"This form is doing work in background and the values are: first field: %s - second field: %s  - third field: %s",

param.get(0).getInputFieldText(), param.get(1).getInputFieldText(), param.get(2).getInputFieldText()

 );

  Log.d("TAG", message);

  // if all goes good, return true, if it failed return false

 return true;

}

 @Override

public void workFinished() {

 Log.d("TAG", "Done");

}

  
}
)

 .withProcessingLabel("Sending")

  .ready();

Extras

FormField available methods

Method Description Usage
withType Add this form field's type so it can get validated correctly FieldType
withHint Add this form field's hint to let the user know what needs to be filled in. String
withIcon Add this form field's icon for avisual cue of what needs to be filled in. Drawable/SVG
withLabel Customize this form field's button label. Current default is "Next" String
withProcessingLabel Changes the form's is label when its doing background work String
withCustomValidation Assign this FormField an unique validation IOnCustomValidation

Credits

Thanks to Josh Cummings for the UI design
Thanks to Douglas Nassif Roma Junior for the awesome Tooltip Effect library Thanks to Georgi Eftimov for the SVG path view library Thanks to Perxis for the SVG line icons

License

Copyright 2016 AlburIvan  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

A simple yet-customizable Android drop-down menu. It supports Text with/without Icons, Separators, and even fully customized views.

Clean contacts is a sample repository to illustrate Clean architecture in Android. It has also many other details that hopefully will be useful too.

MarkdownView is an Android webview with the capability of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

Tool to output method counts in Android APK grouped by package.

An android password view, that looks like the pay password view in wechat or alipay.

A library that implements the persistent search bar seen on apps such as Google Now, Google Maps and Google Play.

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