Skip to content

Commit f68545d

Browse files
committed
Fixing bug for oev_text_color
1 parent 73dd564 commit f68545d

File tree

5 files changed

+136
-7
lines changed

5 files changed

+136
-7
lines changed

.idea/codeStyles/Project.xml

Lines changed: 116 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/res/layout/activity_main.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
android:digits="0123456789"
2525
android:maxLength="6"
2626
android:padding="32dp"
27+
app:oev_text_color="#dd1212"
2728
android:textSize="30sp"
2829
app:layout_constraintTop_toTopOf="parent"
2930
app:oev_mask_character="ø¥"

app/src/main/res/values/integer.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<item name="maxLength" type="integer">5</item>
5+
6+
</resources>

otpedittext2/src/main/java/com/broooapps/otpedittext2/OtpEditText.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import android.text.TextWatcher;
1616
import android.util.AttributeSet;
1717
import android.view.ActionMode;
18+
import android.view.ContextThemeWrapper;
1819
import android.view.Menu;
1920
import android.view.MenuItem;
2021
import android.view.View;
@@ -27,6 +28,7 @@ public class OtpEditText extends AppCompatEditText implements TextWatcher {
2728

2829
private Paint mLinesPaint;
2930
private Paint mStrokePaint;
31+
private Paint mTextPaint;
3032

3133
private boolean mMaskInput;
3234

@@ -72,6 +74,9 @@ private void init(Context context, AttributeSet attrs) {
7274

7375
getAttrsFromTypedArray(attrs);
7476

77+
mTextPaint = getPaint();
78+
mTextPaint.setColor(mTextColor);
79+
7580
// Set the TextWatcher
7681
this.addTextChangedListener(this);
7782

@@ -119,7 +124,7 @@ public void onClick(View v) {
119124
private void getAttrsFromTypedArray(AttributeSet attributeSet) {
120125
final TypedArray a = getContext().obtainStyledAttributes(attributeSet, R.styleable.OtpEditText, defStyleAttr, 0);
121126

122-
mMaxLength = attributeSet.getAttributeIntValue(XML_NAMESPACE_ANDROID, "maxLength", 4);
127+
mMaxLength = attributeSet.getAttributeIntValue(XML_NAMESPACE_ANDROID, "maxLength", 6);
123128
mPrimaryColor = a.getColor(R.styleable.OtpEditText_oev_primary_color, getResources().getColor(android.R.color.holo_red_dark));
124129
mSecondaryColor = a.getColor(R.styleable.OtpEditText_oev_secondary_color, getResources().getColor(R.color.light_gray));
125130
mTextColor = a.getColor(R.styleable.OtpEditText_oev_text_color, getResources().getColor(android.R.color.black));

otpedittext2/src/main/res/values/attrs.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<declare-styleable name="OtpEditText">
4-
<attr name="oev_length" format="integer"/>
5-
<attr name="oev_primary_color" format="color" />
6-
<attr name="oev_secondary_color" format="color" />
7-
<attr name="oev_text_color" format="color" />
8-
<attr name="oev_box_style" format="string" />
4+
<attr name="oev_length" format="integer|reference"/>
5+
<attr name="oev_primary_color" format="color|reference" />
6+
<attr name="oev_secondary_color" format="color|reference" />
7+
<attr name="oev_text_color" format="color|reference" />
8+
9+
<attr name="oev_box_style" format="string|reference" />
910

1011
<attr name="oev_mask_input" format="boolean" />
11-
<attr name="oev_mask_character" format="string" />
12+
<attr name="oev_mask_character" format="string|reference" />
1213

1314
</declare-styleable>
1415

0 commit comments

Comments
 (0)