Skip to content

Commit

Permalink
resetCode method cjh
Browse files Browse the repository at this point in the history
  • Loading branch information
aha_android committed Nov 21, 2016
1 parent 7b8bbcd commit 5ae289c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/src/main/java/cjh/authnumberview/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,14 @@ public void changeLineWidth(View view) {
auth2.setLineWidth(12);
}


/**
* clear and reset codeView
*
* @param view
*/
public void resetCode(View view) {
auth2.resetCode();
}

}
7 changes: 7 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@
android:text="changeLineWidth"
android:textAllCaps="false" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="resetCode"
android:text="resetCode"
android:textAllCaps="false" />

</GridLayout>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,4 +515,13 @@ public void setLineWidth(int lineWidth) {
}
}

public void resetCode() {
if (list.size() > 0) {
for (EditText editText : list) {
editText.setText("");
}
setSelectView(list.get(0));
}
}

}

0 comments on commit 5ae289c

Please sign in to comment.