GithubHelp home page GithubHelp logo

exinput's Introduction

ExInput

Better inputs for Android

Input types:

  1. Text
  2. Text-email
  3. Text-password
  4. Text-phone
  5. Text-search
  6. Number-int
  7. Number-double
  8. Date
  9. Time
  10. DateTime
  11. Icons
  12. Styling

Text input

Free text input.

Attributes

required: boolean

maxLength: integer

minLength: integer

Example xml

<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>

Text email input

Email text input. valid() method also checks if input text is vaild email format.

Attributes

required: boolean

maxLength: integer

minLength: integer

Example xml

<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>

Text password input

Password text input. Packs a button to show/hide password, which be disabled if needed through attributes.

Attributes

required: boolean

maxLength: integer

minLength: integer

showHideButton: boolean

Example xml

<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>

Text phone input

Phone text input. valid() method also checks if input text is vaild phone format.

Attributes

required: boolean

maxLength: integer

minLength: integer

Example xml

<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>

Text search input

Search text input. Packs usual search and clear icons.

Attributes

required: boolean

maxLength: integer

minLength: integer

Example xml

<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>

Number int input

Non floating number input.

Attributes

maxDigits: integer

markThousands: boolean

thousandSeparator: string

required: boolean

Example xml

<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>

Number double input

Floating number input.

Attributes

maxDigits: integer

maxIntegers: integer

maxDecimals: integer

markThousands: boolean

thousandSeparator: string

decimalSeparator: string

required: boolean

Example xml

<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

Date input.

Attributes

required: boolean

Example xml

<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

Time input.

Attributes

required: boolean

Example xml

<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>

DateTime input

Date time input.

Attributes

required: boolean

Example xml

<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>

Icons

Add them as usual.

Listener

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*/ }
	}
}

Example xml

android:drawableStart="@android:drawable/ic_delete"
android:drawableLeft="@android:drawable/ic_delete"

Styling

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: #000

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 -->

exinput's People

Contributors

inigolacoume avatar inlacou avatar

Watchers

 avatar

exinput's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.