Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Commit e2f7504

Browse files
committed
update readme
1 parent 8b19dd1 commit e2f7504

3 files changed

Lines changed: 112 additions & 1 deletion

File tree

README.md

Lines changed: 112 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,113 @@
11
# VerifyCodeEditText
2-
Verify Code Edit Text
2+
3+
***
4+
[![Release](https://img.shields.io/github/release/jakode2020/VerifyCodeEditText.svg?style=flat)](https://jitpack.io/#jakode2020/VerifyCodeEditText)
5+
[![Kotlin Version](https://img.shields.io/badge/kotlin-1.4.30-ff8a0d.svg)](https://kotlinlang.org)
6+
[![API](https://img.shields.io/badge/API-17%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=17)
7+
[![Telegram Chanel](https://img.shields.io/badge/Telegram-@jakode2020-0373fc.svg?style=flat)](http://t.me/jakode2020)
8+
[![Instagram](https://img.shields.io/badge/Instagram-@jakode2020-ff12d7.svg?style=flat)](http://www.instagram.com/jakode2020?r=nametag)
9+
10+
The use of verify code edit text is to get a one-time code from the user,
11+
There is no default edit text in Android to get a one-time use code.<br>
12+
That's why I decided to build a library so that both xml and kotlin could create such input :)
13+
14+
[1]
15+
16+
### Gradle Setup
17+
***
18+
```gradle
19+
repositories {
20+
maven { url 'https://jitpack.io' }
21+
}
22+
23+
dependencies {
24+
implementation 'com.github.jakode2020:VerifyCodeEditText:1.1'
25+
}
26+
```
27+
28+
## Usage
29+
***
30+
### XML
31+
32+
```
33+
<com.jakode.verifycodeedittext.VerifyCodeEditText
34+
android:layout_width="wrap_content"
35+
android:layout_height="wrap_content"
36+
android:layoutDirection="ltr" (RTL language need this fiels)
37+
android:paddingBottom="12dp"
38+
app:BottomErrorIcon="@drawable/bottom_error_icon"
39+
app:BottomIconHeight="2dp"
40+
app:BottomIconWidth="40dp"
41+
app:BottomSelectedIcon="@drawable/bottom_selected_icon"
42+
app:BottomUnSelectedIcon="@drawable/bottom_unselected_icon"
43+
app:ItemSpaceSize="28dp"
44+
app:TextColor="@color/black"
45+
app:TextFont="@font/baloo"
46+
app:TextSize="16sp"
47+
app:ViewCount="Four"/>
48+
```
49+
complete listener
50+
```
51+
verifyCodeEditText.setCompleteListener { complete ->
52+
// some code
53+
}
54+
```
55+
change bottom drawable state
56+
```
57+
// all bottom drawble show erro state
58+
verifyCodeEditText.setCodeItemErrorLineDrawable()
59+
60+
// reset drawble to normal state
61+
verifyCodeEditText.resetCodeItemLineDrawable()
62+
```
63+
64+
[2]
65+
66+
set / get text
67+
```
68+
verifyCodeEditText.text = "99999" // set
69+
println(verifyCodeEditText.text) // get
70+
```
71+
72+
### Kotlin Builder
73+
```
74+
val verifyCodeEditText = VerifyCodeEditText.Builder {
75+
text {
76+
size = 20F
77+
color = Color.parseColor("#000000")
78+
}
79+
bottomIcon {
80+
iconHeight = 5
81+
iconWidth = 60
82+
selectedIcon = ContextCompat.getDrawable(this@MainActivity, R.drawable.bottom_selected_icon)
83+
unSelectedIcon = ContextCompat.getDrawable(this@MainActivity, R.drawable.bottom_unselected_icon)
84+
errorIcon = ContextCompat.getDrawable(this@MainActivity, R.drawable.bottom_error_icon)
85+
}
86+
verifyCell {
87+
count = VerifyCodeEditText.Builder.ViewCount.Five
88+
spaceSize = 48
89+
}
90+
}.build(context = this)
91+
findViewById<ConstraintLayout>(R.id.layout).addView(verifyCodeEditText)
92+
```
93+
94+
### License
95+
***
96+
```
97+
Copyright Jakode2020
98+
99+
Licensed under the Apache License, Version 2.0 (the "License");
100+
you may not use this file except in compliance with the License.
101+
You may obtain a copy of the License at
102+
103+
http://www.apache.org/licenses/LICENSE-2.0
104+
105+
Unless required by applicable law or agreed to in writing, software
106+
distributed under the License is distributed on an "AS IS" BASIS,
107+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
108+
See the License for the specific language governing permissions and
109+
limitations under the License.
110+
```
111+
112+
[1]: ./art/Screenshot.png
113+
[2]: ./art/ScreenshotError.png

art/Screenshot.png

8.1 KB
Loading

art/ScreenshotError.png

9.02 KB
Loading

0 commit comments

Comments
 (0)