Skip to content

Commit

Permalink
issue no #8
Browse files Browse the repository at this point in the history
  • Loading branch information
Arjun committed Jan 16, 2017
1 parent d2e0bd8 commit 5dbacb9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 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)
# 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)

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

Expand All @@ -15,7 +15,7 @@ repositories {
jcenter()
}
dependencies {
compile 'in.arjsna:passcodeviewlib:1.1.0'
compile 'in.arjsna:passcodeviewlib:1.2.1'
}
```
Expand Down Expand Up @@ -96,6 +96,16 @@ public void setPassCode("8854")
*/
passCodeView.reset();

/**
* Set drawable for empty digits programmatically
*/
passCodeView.setEmptyDrawable(R.drawable.empty);

/**
* Set drawable for filled digits programmatically
*/
passCodeView.setFilledDrawable(R.drawable.filled);

/**
* Attach {@code TextChangeListener} to get notified on text changes
* @param listener - {@Code TextChangeListener} object to be attached and notified
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
testCompile 'junit:junit:4.12'
// compile 'com.android.support:appcompat-v7:24.0.0'
// compile 'in.arjsna:passcodeviewlib:1.1.0'
compile 'in.arjsna:passcodeview:1.2.0'
compile 'in.arjsna:passcodeview:1.2.1'

// compile project(':passcodeview')
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class MainActivity extends AppCompatActivity {
Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/Font-Bold.ttf");
passCodeView.setTypeFace(typeFace);
passCodeView.setKeyTextColor(R.color.black_shade);
passCodeView.setEmptyDrawable(R.drawable.empty_dot);
passCodeView.setFilledDrawable(R.drawable.filled_dot);
promptView.setTypeface(typeFace);
bindEvents();
}
Expand Down
2 changes: 1 addition & 1 deletion passcodeview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ext {
siteUrl = 'https://github.com/Arjun-sna/android-passcodeview/'
gitUrl = 'https://github.com/Arjun-sna/android-passcodeview.git'

libraryVersion = '1.2.0'
libraryVersion = '1.2.1'

developerId = 'Arjun-Sna'
developerName = 'Arjun'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr, int def

drawableWidth = (int) digitSize; //DEFAULT_DRAWABLE_DIM;
drawableHeight = (int) digitSize; //DEFAULT_DRAWABLE_DIM;
filledDrawable =
getBitmap(values.getResourceId(R.styleable.PassCodeView_filled_drawable, -1));
emptyDrawable = getBitmap(values.getResourceId(R.styleable.PassCodeView_empty_drawable, -1));
setFilledDrawable(values.getResourceId(R.styleable.PassCodeView_filled_drawable, -1));
setEmptyDrawable(values.getResourceId(R.styleable.PassCodeView_empty_drawable, -1));
} catch (Exception e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -423,6 +422,15 @@ private void findKeyPressed(int downEventX, int downEventY, int upEventX, int up
}
}

public void setEmptyDrawable(int resId) {
emptyDrawable = getBitmap(resId);
}


public void setFilledDrawable(int resId) {
filledDrawable = getBitmap(resId);
}

/**
* Reset the code to empty and redraw the view
*/
Expand Down

0 comments on commit 5dbacb9

Please sign in to comment.