diff --git a/pinentry/src/main/java/me/philio/pinentry/PinEntryView.java b/pinentry/src/main/java/me/philio/pinentry/PinEntryView.java
index 786f8cf..d58d496 100644
--- a/pinentry/src/main/java/me/philio/pinentry/PinEntryView.java
+++ b/pinentry/src/main/java/me/philio/pinentry/PinEntryView.java
@@ -106,6 +106,11 @@ public class PinEntryView extends ViewGroup {
*/
private boolean accentRequiresFocus;
+ /**
+ * If no mask is set, all alphabet characters will be shown upercase
+ */
+ private boolean textUpperCase;
+
public PinEntryView(Context context) {
this(context, null);
}
@@ -171,6 +176,9 @@ public PinEntryView(Context context, AttributeSet attrs, int defStyle) {
// Accent shown, default to only when focused
accentRequiresFocus = array.getBoolean(R.styleable.PinEntryView_accentRequiresFocus, true);
+ // All caps default false
+ textUpperCase = array.getBoolean(R.styleable.PinEntryView_textUpperCase, false);
+
// Recycle the typed array
array.recycle();
@@ -383,7 +391,8 @@ public void afterTextChanged(Editable s) {
for (int i = 0; i < digits; i++) {
if (s.length() > i) {
String mask = PinEntryView.this.mask == null || PinEntryView.this.mask.length() == 0 ?
- String.valueOf(s.charAt(i)) : PinEntryView.this.mask;
+ (PinEntryView.this.textUpperCase ? String.valueOf(s.charAt(i)).toUpperCase() : String.valueOf(s.charAt(i)))
+ : PinEntryView.this.mask;
((TextView) getChildAt(i)).setText(mask);
} else {
((TextView) getChildAt(i)).setText("");
@@ -403,6 +412,10 @@ public void afterTextChanged(Editable s) {
addView(editText);
}
+ public interface OnPinEnteredListener {
+ void onPinEntered(String pin);
+ }
+
/**
* Save state of the view
*/
@@ -478,8 +491,4 @@ protected void onDraw(Canvas canvas) {
}
- public interface OnPinEnteredListener {
- void onPinEntered(String pin);
- }
-
}
diff --git a/pinentry/src/main/res/values/attrs.xml b/pinentry/src/main/res/values/attrs.xml
index 6d2f172..2af0c32 100644
--- a/pinentry/src/main/res/values/attrs.xml
+++ b/pinentry/src/main/res/values/attrs.xml
@@ -35,5 +35,7 @@
+
+
\ No newline at end of file