Skip to content

Commit 8c395ba

Browse files
author
Arjun
committed
readme update
1 parent 52aa1b4 commit 8c395ba

File tree

9 files changed

+112
-3
lines changed

9 files changed

+112
-3
lines changed

.idea/encodings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,98 @@
1-
# android-passcodeview
1+
# Android Passcode Keypad View
2+
3+
A custom view with keyboard and character display to be used for authentication.
4+
5+
The view has a bunch customisation options to make to look and work the way whichever needed.
6+
7+
## Demo
8+
<img src="https://arjun-sna.github.io/raw/passcodeview_1.gif" width="250" />
9+
<img src="https://arjun-sna.github.io/raw/passcodeview_2.gif" width="250" />
10+
11+
## Installation
12+
--to be updated
13+
14+
## Usage
15+
Add the view in the layout file
16+
17+
```xml
18+
<in.arjsna.lib.PassCodeView
19+
android:id="@+id/pass_code_view"
20+
android:layout_width="match_parent"
21+
android:layout_height="wrap_content"
22+
app:digits="4"
23+
app:digit_size="30.0dp"
24+
app:key_text_size="30.0sp"
25+
android:padding="25.0dp"
26+
app:empty_drawable="@drawable/empty_dot"
27+
app:filled_drawable="@drawable/filled_dot"/>
28+
29+
```
30+
31+
View attributes that can be included in xml are
32+
33+
34+
`digits` - number of digits in passcode
35+
36+
`filled_drawable` - drawable to be show for filled digits
37+
38+
`empty_drawable` - drawable to be show for empty digits
39+
40+
`key_text_size` - size of text in keyboard's key
41+
42+
`digit_spacing` - horizontal space between each digit
43+
44+
`digit_vertical_padding` - vertical padding of digits
45+
46+
`divider_visible` - boolean to show or hide divider between digits and keyboard
47+
48+
49+
Other customisations options available are
50+
51+
```java
52+
PassCodeView passCodeView = (PassCodeView) findViewById(R.id.pass_code_view);
53+
Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/Font-Bold.ttf");
54+
55+
/**
56+
*Set TypeFace for the font in keys of keypad
57+
*/
58+
passCodeView.setTypeFace(typeFace);
59+
60+
/**
61+
* Set color for the keypad text
62+
* @param color - Resource id of the color to be set
63+
*/
64+
passCodeView.setKeyTextColor(getResources.getColor(R.color.black));
65+
66+
/**
67+
* Set size of keypad text
68+
* @param size - Text size value to be set
69+
*/
70+
passCodeView.setKeyTextSize(30);
71+
72+
/**
73+
* Reset the code to empty
74+
*/
75+
passCodeView.reset();
76+
77+
/**
78+
* Attach {@code TextChangeListener} to get notified on text changes
79+
* @param listener - {@Code TextChangeListener} object to be attached and notified
80+
*/
81+
passCodeView.setOnTextChangeListener(new PassCodeView.TextChangeListener() {
82+
@Override
83+
public void onTextChanged(String text) {
84+
Log.i("Passcode", "text");
85+
}
86+
});
87+
```
88+
89+
License
90+
=======
91+
92+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License.
93+
You may obtain a copy of the License in the LICENSE file, or at:
94+
95+
http://www.apache.org/licenses/LICENSE-2.0
96+
97+
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.
98+
3.35 KB
Loading
2.09 KB
Loading
5.04 KB
Loading
8.6 KB
Loading
14.5 KB
Loading

app/src/main/res/layout/activity_main.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
android:orientation="vertical"
1010
android:gravity="center"
1111
tools:context="in.arjsna.passcodeviewsample.MainActivity">
12-
12+
<ImageView
13+
android:layout_width="50.0dp"
14+
android:layout_height="50.0dp"
15+
android:src="@drawable/lock"/>
1316
<TextView
1417
android:id="@+id/promptview"
1518
android:layout_width="match_parent"

0 commit comments

Comments
 (0)