Better inputs for Android
- Text
- Text-email
- Text-password
- Text-phone
- Text-search
- Number-int
- Number-double
- Date
- Time
- DateTime
- Icons
- Styling
Free text input.
required: boolean
maxLength: integer
minLength: integer
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="text"
android:theme="@style/exinput_textInputLayout"
style="@style/exinput_textInputLayout">
<com.inlacou.exinput.free.text.TextInput
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/exinput_input"
style="@style/exinput_input"
app:required="true"/>
</com.google.android.material.textfield.TextInputLayout>
Email text input. valid() method also checks if input text is vaild email format.
required: boolean
maxLength: integer
minLength: integer
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="text"
android:theme="@style/exinput_textInputLayout"
style="@style/exinput_textInputLayout">
<com.inlacou.exinput.free.text.email.EmailInput
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/exinput_input"
android:hint="email"/>
</com.google.android.material.textfield.TextInputLayout>
Password text input. Packs a button to show/hide password, which be disabled if needed through attributes.
required: boolean
maxLength: integer
minLength: integer
showHideButton: boolean
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="text"
android:theme="@style/exinput_textInputLayout"
style="@style/exinput_textInputLayout">
<com.inlacou.exinput.free.text.password.PasswordInput
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/exinput_input"
android:hint="password"/>
</com.google.android.material.textfield.TextInputLayout>
Phone text input. valid() method also checks if input text is vaild phone format.
required: boolean
maxLength: integer
minLength: integer
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="text"
android:theme="@style/exinput_textInputLayout"
style="@style/exinput_textInputLayout">
<com.inlacou.exinput.free.text.phone.PhoneInput
android:id="@+id/phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/exinput_input"
android:hint="phone"/>
</com.google.android.material.textfield.TextInputLayout>
Search text input. Packs usual search and clear icons.
required: boolean
maxLength: integer
minLength: integer
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="text"
android:theme="@style/exinput_textInputLayout"
style="@style/exinput_textInputLayout">
<com.inlacou.exinput.free.text.search.SearchInput
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/exinput_input"
android:drawablePadding="@dimen/general_all"
android:padding="@dimen/general_all"
android:hint="search"/>
</com.google.android.material.textfield.TextInputLayout>
Non floating number input.
maxDigits: integer
markThousands: boolean
thousandSeparator: string
required: boolean
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="text"
android:theme="@style/exinput_textInputLayout"
style="@style/exinput_textInputLayout">
<com.inlacou.exinput.free.numeric.vint.IntInput
android:id="@+id/int_i"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/exinput_input"
app:maxDigits="5"
android:hint="int"/>
</com.google.android.material.textfield.TextInputLayout>
Floating number input.
maxDigits: integer
maxIntegers: integer
maxDecimals: integer
markThousands: boolean
thousandSeparator: string
decimalSeparator: string
required: boolean
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="text"
android:theme="@style/exinput_textInputLayout"
style="@style/exinput_textInputLayout">
<com.inlacou.exinput.free.numeric.vdouble.DoubleInput
android:id="@+id/double_i"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/exinput_input"
app:maxIntegers="3"
app:maxDecimals="2"
app:decimalSeparator=","
app:markThousands="true"
app:thousandSeparator="."
android:hint="double"/>
</com.google.android.material.textfield.TextInputLayout>
Date input.
required: boolean
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="text"
android:theme="@style/exinput_textInputLayout"
style="@style/exinput_textInputLayout">
<com.inlacou.exinput.free.datetime.DateInput
android:id="@+id/date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/exinput_input"
android:hint="date"/>
</com.google.android.material.textfield.TextInputLayout>
Time input.
required: boolean
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="text"
android:theme="@style/exinput_textInputLayout"
style="@style/exinput_textInputLayout">
<com.inlacou.exinput.free.datetime.TimeInput
android:id="@+id/time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/exinput_input"
app:mode24h="false"
android:hint="time"/>
</com.google.android.material.textfield.TextInputLayout>
Date time input.
required: boolean
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="text"
android:theme="@style/exinput_textInputLayout"
style="@style/exinput_textInputLayout">
<com.inlacou.exinput.free.datetime.DateTimeInput
android:id="@+id/time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/exinput_input"
app:mode24h="true"
android:hint="time"/>
</com.google.android.material.textfield.TextInputLayout>
Add them as usual.
Basic way:
yourTextInput?.setOnTouchListener(object : OnTextViewDrawableTouchListener(interceptAllClick = true){
override fun onDrawableClick(touchTarget: TouchTarget) {
when(it) {
RIGHT -> { /*Clicked on right/end drawable*/ }
LEFT -> { /*Clicked on left/start drawable*/ }
}
}
}
Rx way:
yourTextInput.drawableClicks()?.filterRapidClicks()?.observeOn(AndroidSchedulers.mainThread())?.subscribe {
when(it) {
RIGHT -> { /*Clicked on right/end drawable*/ }
LEFT -> { /*Clicked on left/start drawable*/ }
}
}
android:drawableStart="@android:drawable/ic_delete"
android:drawableLeft="@android:drawable/ic_delete"
Easiest way is to just override this colors:
<color name="exinput_focused_general">@color/colorAccent</color>
<color name="exinput_unfocused_general">@color/colorPrimary</color>
Or you can override this ones:
<color name="exinput_text_color">@color/exinput_basic_black</color>
<color name="exinput_focused_hint">@color/exinput_focused_general</color>
<color name="exinput_unfocused_hint">@color/exinput_unfocused_general</color>
<color name="exinput_focused_outline">@color/exinput_focused_general</color>
<color name="exinput_unfocused_outline">@color/exinput_unfocused_general</color>
<color name="exinput_focused_bottom_bar">@color/exinput_focused_general</color>
<color name="exinput_unfocused_bottom_bar">@color/exinput_unfocused_general</color>
Current colors are: exinput_basic_black:
exinput_focused_general: your colorAccent
exinput_unfocused_general: your colorPrimary
Or you can extend this styles:
I you want full control you can make your own styles and ignore mine!
<style name="exinput_input"/> <!-- for text inputs -->
<style name="exinput_textInputLayout"/> <!-- For old layout -->
<style name="exinput_outlined_textInputLayout"/> <!-- For box layout -->