Skip to content

Commit 5dbacb9

Browse files
author
Arjun
committed
issue no #8
1 parent d2e0bd8 commit 5dbacb9

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Android Passcode Keypad View [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-android--passcodeview-green.svg?style=true)](https://android-arsenal.com/details/1/4124) [ ![Download](https://api.bintray.com/packages/arjun-sna/maven/passcodeviewlib/images/download.svg) ](https://bintray.com/arjun-sna/maven/passcodeviewlib/_latestVersion)
1+
# Android Passcode Keypad View [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-android--passcodeview-green.svg?style=true)](https://android-arsenal.com/details/1/4124) [ ![Download](https://api.bintray.com/packages/arjun-sna/maven/passcodeview/images/download.svg) ](https://bintray.com/arjun-sna/maven/passcodeview/_latestVersion)
22

33
A custom view with keyboard and character display to be used for authentication.
44

@@ -15,7 +15,7 @@ repositories {
1515
jcenter()
1616
}
1717
dependencies {
18-
compile 'in.arjsna:passcodeviewlib:1.1.0'
18+
compile 'in.arjsna:passcodeviewlib:1.2.1'
1919
}
2020
2121
```
@@ -96,6 +96,16 @@ public void setPassCode("8854")
9696
*/
9797
passCodeView.reset();
9898

99+
/**
100+
* Set drawable for empty digits programmatically
101+
*/
102+
passCodeView.setEmptyDrawable(R.drawable.empty);
103+
104+
/**
105+
* Set drawable for filled digits programmatically
106+
*/
107+
passCodeView.setFilledDrawable(R.drawable.filled);
108+
99109
/**
100110
* Attach {@code TextChangeListener} to get notified on text changes
101111
* @param listener - {@Code TextChangeListener} object to be attached and notified

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies {
2424
testCompile 'junit:junit:4.12'
2525
// compile 'com.android.support:appcompat-v7:24.0.0'
2626
// compile 'in.arjsna:passcodeviewlib:1.1.0'
27-
compile 'in.arjsna:passcodeview:1.2.0'
27+
compile 'in.arjsna:passcodeview:1.2.1'
2828

2929
// compile project(':passcodeview')
3030
}

app/src/main/java/in/arjsna/passcodeviewsample/MainActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public class MainActivity extends AppCompatActivity {
2222
Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/Font-Bold.ttf");
2323
passCodeView.setTypeFace(typeFace);
2424
passCodeView.setKeyTextColor(R.color.black_shade);
25+
passCodeView.setEmptyDrawable(R.drawable.empty_dot);
26+
passCodeView.setFilledDrawable(R.drawable.filled_dot);
2527
promptView.setTypeface(typeFace);
2628
bindEvents();
2729
}

passcodeview/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ext {
1414
siteUrl = 'https://github.com/Arjun-sna/android-passcodeview/'
1515
gitUrl = 'https://github.com/Arjun-sna/android-passcodeview.git'
1616

17-
libraryVersion = '1.2.0'
17+
libraryVersion = '1.2.1'
1818

1919
developerId = 'Arjun-Sna'
2020
developerName = 'Arjun'

passcodeview/src/main/java/in/arjsna/passcodeview/PassCodeView.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,8 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr, int def
108108

109109
drawableWidth = (int) digitSize; //DEFAULT_DRAWABLE_DIM;
110110
drawableHeight = (int) digitSize; //DEFAULT_DRAWABLE_DIM;
111-
filledDrawable =
112-
getBitmap(values.getResourceId(R.styleable.PassCodeView_filled_drawable, -1));
113-
emptyDrawable = getBitmap(values.getResourceId(R.styleable.PassCodeView_empty_drawable, -1));
111+
setFilledDrawable(values.getResourceId(R.styleable.PassCodeView_filled_drawable, -1));
112+
setEmptyDrawable(values.getResourceId(R.styleable.PassCodeView_empty_drawable, -1));
114113
} catch (Exception e) {
115114
e.printStackTrace();
116115
}
@@ -423,6 +422,15 @@ private void findKeyPressed(int downEventX, int downEventY, int upEventX, int up
423422
}
424423
}
425424

425+
public void setEmptyDrawable(int resId) {
426+
emptyDrawable = getBitmap(resId);
427+
}
428+
429+
430+
public void setFilledDrawable(int resId) {
431+
filledDrawable = getBitmap(resId);
432+
}
433+
426434
/**
427435
* Reset the code to empty and redraw the view
428436
*/

0 commit comments

Comments
 (0)