Skip to content

Commit 097c0e9

Browse files
author
Arjun
authored
Merge pull request #1 from Arjun-sna/dev
base_release
2 parents 27f85f0 + 8c395ba commit 097c0e9

File tree

28 files changed

+789
-71
lines changed

28 files changed

+789
-71
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/gradle.xml

Lines changed: 7 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: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 1 addition & 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+

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<category android:name="android.intent.category.LAUNCHER"/>
1818
</intent-filter>
1919
</activity>
20+
<activity android:name=".LoggedInActivity"
21+
android:label="LoggedInActivity"/>
2022
</application>
2123

2224
</manifest>
92.7 KB
Binary file not shown.
91.2 KB
Binary file not shown.
92.6 KB
Binary file not shown.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package in.arjsna.passcodeviewsample;
2+
3+
import android.os.Bundle;
4+
import android.support.v7.app.AppCompatActivity;
5+
6+
/**
7+
* Created by arjun on 8/4/16.
8+
*/
9+
public class LoggedInActivity extends AppCompatActivity{
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
overridePendingTransition(R.anim.fade_in, R.anim.slide_out_down);
13+
super.onCreate(savedInstanceState);
14+
setContentView(R.layout.logged_in_activity);
15+
}
16+
17+
@Override
18+
protected void onResume() {
19+
super.onResume();
20+
}
21+
22+
@Override
23+
public void onBackPressed() {
24+
super.onBackPressed();
25+
overridePendingTransition(R.anim.fade_in, R.anim.slide_out_down);
26+
}
27+
}

0 commit comments

Comments
 (0)