diff --git a/codeinputlib/src/main/java/com/github/glomadrian/codeinputlib/CodeInput.java b/codeinputlib/src/main/java/com/github/glomadrian/codeinputlib/CodeInput.java index 783c3b4..1166ee0 100644 --- a/codeinputlib/src/main/java/com/github/glomadrian/codeinputlib/CodeInput.java +++ b/codeinputlib/src/main/java/com/github/glomadrian/codeinputlib/CodeInput.java @@ -137,7 +137,7 @@ private void initCustomAttributes(AttributeSet attributeset) { hintText = attributes.getString(R.styleable.core_area_hint_text); underlineAmount = attributes.getInt(R.styleable.core_area_codes, underlineAmount); textColor = attributes.getInt(R.styleable.core_area_text_color, textColor); - + attributes.recycle(); } @@ -227,7 +227,7 @@ private void showKeyboard() { inputmethodmanager.viewClicked(this); } - private void hideKeyBoard(){ + private void hideKeyBoard() { InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Activity.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN); } @@ -235,6 +235,7 @@ private void hideKeyBoard(){ /** * Set Input type like InputType.TYPE_CLASS_PHONE, InputType.TYPE_CLASS_NUMBER * Doesn't work for password + * * @param inputType */ public void setInputType(int inputType) { @@ -319,6 +320,16 @@ public void run() { }, animationDuration); } + /** + * Set code length + * + * @param codeLength number of underlines + */ + public void setCodeLength(int codeLength) { + this.underlineAmount = codeLength; + initDataStructures(); + } + /** * String text * Pass empty string to remove text