FormView

Additional

Language
Kotlin
Version
1.0.3 (Aug 14, 2019)
Created
Jun 18, 2019
Updated
Apr 14, 2020
Owner
Ali Modares (alimodares2003)
Contributor
Ali Modares (alimodares2003)
1
Activity
Badge
Generate
Download
Source code
APK file

Blurb

FormView

for check required text in EditText

Updates

version 1.0.3

1.set reset form to optional

2.for reset form fv.resetForm()

Installation

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

//add this to your dependencies
implementation 'com.github.alimodares2003:FormView:1.0.3'

How to use

1.add FromView to root layout. also you can add anywhere.

<?xml version="1.0" encoding="utf-8"?>
<ir.adp.library.FormView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    
    <!--you can write Edittext and button and other view-->

</ir.adp.library.FormView>
  1. for button click hundle:
fv.setOnSubmitClickListener {
  val et = et.getText()
  val et1 = et1.getText()
  val et2 = et2.getText()
  val et3 = et3.getText()
  Toast.makeText(this, "$et $et1 $et2 $et3", Toast.LENGTH_LONG).show()
  //your code
}

3.for add submit to toolbar item :

override fun onCreateOptionsMenu(menu: Menu): Boolean {
     menuInflater.inflate(R.menu.item_menu, menu)
     fv.onNavigationItemSelected(menu){
        Toast.makeText(this, "clicked", Toast.LENGTH_LONG).show()
     }
     return true
}

4.for change error text:

fv.errorText = "is required"
  1. for optional you can add this android:tag="optional" to TextInputLayout

Important explanations

1.your button id must be "submit"

2.your toolbar item id must be "submit"

3.EditText must be in TextInputLayout

License

Copyright 2018 Ali Modares

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.