From f68545dc13f1b781d36266925c8703d7d028f06d Mon Sep 17 00:00:00 2001 From: Swapnil Tiwari Date: Sat, 30 Nov 2019 18:45:28 +0530 Subject: [PATCH] Fixing bug for oev_text_color --- .idea/codeStyles/Project.xml | 116 ++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 1 + app/src/main/res/values/integer.xml | 6 + .../broooapps/otpedittext2/OtpEditText.java | 7 +- otpedittext2/src/main/res/values/attrs.xml | 13 +- 5 files changed, 136 insertions(+), 7 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 app/src/main/res/values/integer.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index c99fe0c..ccfddbb 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -24,6 +24,7 @@ android:digits="0123456789" android:maxLength="6" android:padding="32dp" + app:oev_text_color="#dd1212" android:textSize="30sp" app:layout_constraintTop_toTopOf="parent" app:oev_mask_character="ø¥" diff --git a/app/src/main/res/values/integer.xml b/app/src/main/res/values/integer.xml new file mode 100644 index 0000000..75812bc --- /dev/null +++ b/app/src/main/res/values/integer.xml @@ -0,0 +1,6 @@ + + + + 5 + + \ No newline at end of file diff --git a/otpedittext2/src/main/java/com/broooapps/otpedittext2/OtpEditText.java b/otpedittext2/src/main/java/com/broooapps/otpedittext2/OtpEditText.java index 84eb820..5450091 100644 --- a/otpedittext2/src/main/java/com/broooapps/otpedittext2/OtpEditText.java +++ b/otpedittext2/src/main/java/com/broooapps/otpedittext2/OtpEditText.java @@ -15,6 +15,7 @@ import android.text.TextWatcher; import android.util.AttributeSet; import android.view.ActionMode; +import android.view.ContextThemeWrapper; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -27,6 +28,7 @@ public class OtpEditText extends AppCompatEditText implements TextWatcher { private Paint mLinesPaint; private Paint mStrokePaint; + private Paint mTextPaint; private boolean mMaskInput; @@ -72,6 +74,9 @@ private void init(Context context, AttributeSet attrs) { getAttrsFromTypedArray(attrs); + mTextPaint = getPaint(); + mTextPaint.setColor(mTextColor); + // Set the TextWatcher this.addTextChangedListener(this); @@ -119,7 +124,7 @@ public void onClick(View v) { private void getAttrsFromTypedArray(AttributeSet attributeSet) { final TypedArray a = getContext().obtainStyledAttributes(attributeSet, R.styleable.OtpEditText, defStyleAttr, 0); - mMaxLength = attributeSet.getAttributeIntValue(XML_NAMESPACE_ANDROID, "maxLength", 4); + mMaxLength = attributeSet.getAttributeIntValue(XML_NAMESPACE_ANDROID, "maxLength", 6); mPrimaryColor = a.getColor(R.styleable.OtpEditText_oev_primary_color, getResources().getColor(android.R.color.holo_red_dark)); mSecondaryColor = a.getColor(R.styleable.OtpEditText_oev_secondary_color, getResources().getColor(R.color.light_gray)); mTextColor = a.getColor(R.styleable.OtpEditText_oev_text_color, getResources().getColor(android.R.color.black)); diff --git a/otpedittext2/src/main/res/values/attrs.xml b/otpedittext2/src/main/res/values/attrs.xml index 865e470..9d9b003 100644 --- a/otpedittext2/src/main/res/values/attrs.xml +++ b/otpedittext2/src/main/res/values/attrs.xml @@ -1,14 +1,15 @@ - - - - - + + + + + + - +