MCPcopy Index your code
hub / github.com/AlburIvan/SlickForm

github.com/AlburIvan/SlickForm @v1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2 ↗ · + Follow
144 symbols 267 edges 10 files 60 documented · 42%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

SlickForm

CircleCI Twitter Codacy Badge Jitpack Badge

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 '....'
}

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 finished 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) // can be ommitted, read below...
            .withCustomValidation(new IOnCustomValidation() {

                // add your own custom validation if neccesarry. WARNING: it will override the FieldType to CUSTOM
                @Override
                public boolean withCustomValidation(FormField field) {

                    String password      = field.getInputField().getText().toString();

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

                    boolean isAtLeast8   =  password.length() >= 8;
                    boolean hasSpecial   = !password.matches("[A-Za-z0-9 ]*");

                    if( (!hasUppercase && !hasLowercase) || !isAtLeast8 || !hasSpecial )
                        return false;

                    return true;
                }
            })
            .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 finished 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();

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
withCustomValidation Assign this FormField an unique validation IOnCustomValidation

Credits

Thanks to Josh Cummings for the UI inspiration
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.

Extension points exported contracts — how you extend this code

IOnCustomValidation (Interface)
Created by Ivan on 5/30/2016. [1 implementers]
slicksignform/src/main/java/com/alburivan/slickform/interfaces/IOnCustomValidation.java
IOnProcessChange (Interface)
Created by Ivan on 5/19/2016
slicksignform/src/main/java/com/alburivan/slickform/interfaces/IOnProcessChange.java
OnDismissListener (Interface)
(no doc) [1 implementers]
slicksignform/src/main/java/com/alburivan/slickform/tooltip/SimpleTooltip.java
OnShowListener (Interface)
(no doc)
slicksignform/src/main/java/com/alburivan/slickform/tooltip/SimpleTooltip.java

Core symbols most depended-on inside this repo

findViewById
called by 10
slicksignform/src/main/java/com/alburivan/slickform/tooltip/SimpleTooltip.java
getInputField
called by 6
slicksignform/src/main/java/com/alburivan/slickform/FormField.java
startAnimation
called by 5
slicksignform/src/main/java/com/alburivan/slickform/tooltip/SimpleTooltip.java
initAttrs
called by 4
slicksignform/src/main/java/com/alburivan/slickform/FormField.java
getStepLabel
called by 4
slicksignform/src/main/java/com/alburivan/slickform/FormField.java
removeOnGlobalLayoutListener
called by 4
slicksignform/src/main/java/com/alburivan/slickform/tooltip/SimpleTooltipUtils.java
withType
called by 3
slicksignform/src/main/java/com/alburivan/slickform/FormField.java
withHint
called by 3
slicksignform/src/main/java/com/alburivan/slickform/FormField.java

Shape

Method 130
Class 9
Interface 4
Enum 1

Languages

Java100%

Modules by API surface

slicksignform/src/main/java/com/alburivan/slickform/tooltip/SimpleTooltip.java49 symbols
slicksignform/src/main/java/com/alburivan/slickform/SlickForm.java36 symbols
slicksignform/src/main/java/com/alburivan/slickform/FormField.java19 symbols
slicksignform/src/main/java/com/alburivan/slickform/tooltip/SimpleTooltipUtils.java14 symbols
slicksignform/src/main/java/com/alburivan/slickform/tooltip/ArrowDrawable.java9 symbols
slicksignform/src/main/java/com/alburivan/slickform/tooltip/OverlayView.java8 symbols
slicksignform/src/main/java/com/alburivan/slickform/interfaces/IOnProcessChange.java3 symbols
slicksignform/src/main/java/com/alburivan/slickform/animators/ProgressBarAnimation.java3 symbols
slicksignform/src/main/java/com/alburivan/slickform/interfaces/IOnCustomValidation.java2 symbols
slicksignform/src/main/java/com/alburivan/slickform/FieldsType.java1 symbols

For agents

$ claude mcp add SlickForm \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact