package kokeroulis.gr.sample;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

@@ -98,16 +98,313 @@
 .Bundle;
+%0Aimport android.widget.Toast;%0A%0Aimport kokeroulis.gr.uiforms.forms.DoubleForm;%0Aimport kokeroulis.gr.uiforms.forms.IntegerForm;%0Aimport kokeroulis.gr.uiforms.validators.DoubleValidator;%0Aimport kokeroulis.gr.uiforms.validators.IntegerValidator;%0Aimport kokeroulis.gr.uiforms.validators.NumberValidator;
 %0A%0Apublic
@@ -451,16 +451,43 @@
 ivity %7B%0A
+    private Toast mToast;%0A%0A
 %0A    @Ov
@@ -594,16 +594,16 @@
 State);%0A
-
         
@@ -641,16 +641,1164 @@
 y_main);
+%0A%0A        IntegerForm intForm = (IntegerForm) findViewById(R.id.int_form);%0A        DoubleForm doubleForm = (DoubleForm) findViewById(R.id.double_form);%0A%0A        intForm.generateValidator(new IntegerValidator(0, 50));%0A        doubleForm.generateValidator(new DoubleValidator(0.0, 50.0));%0A%0A        intForm.setInvalidInputListener(new NumberValidator.InvalidInputListener() %7B%0A            @Override%0A            public void onInvalidInput(String source, int reasonId) %7B%0A                showError(source, reasonId);%0A            %7D%0A        %7D);%0A%0A        doubleForm.setInvalidInputListener(new NumberValidator.InvalidInputListener() %7B%0A            @Override%0A            public void onInvalidInput(String source, int reasonId) %7B%0A                showError(source, reasonId);%0A            %7D%0A        %7D);%0A    %7D%0A%0A    private void showError(String msg, int reasonId) %7B%0A        stopToast();%0A        mToast = Toast.makeText(this, %22Invalid input: %22 + msg + %22 Reason: %22 + reasonId, Toast.LENGTH_SHORT);%0A        mToast.show();%0A    %7D%0A%0A    private void stopToast() %7B%0A        if (mToast == null) %7B%0A            return;%0A        %7D%0A        mToast.cancel();%0A        mToast = null;
 %0A    %7D%0A%7D

Add validator