The credit card entry form doesn't really fit in when it is placed in an application with a dark theme. The defaults for app:cursor_color
, app:text_color
, app:input_background
, etc. are dark colors and are not very visible on dark themes. It's possible to manually set these colors, but it would be nicer if the widget just used the default colors that are provided by the theme.
I tried going through and just removing the places where the underlying EditTexts have colors assigned, and it worked pretty well for me.
diff --git a/CreditCardEntry/src/com/devmarvel/creditcardentry/fields/CreditEntryFieldBase.java b/CreditCardEntry/src/com/devmarvel/creditcardentry/fields/CreditEntryFieldBase.java
index 064b1b9..de368a8 100644
--- a/CreditCardEntry/src/com/devmarvel/creditcardentry/fields/CreditEntryFieldBase.java
+++ b/CreditCardEntry/src/com/devmarvel/creditcardentry/fields/CreditEntryFieldBase.java
@@ -82,9 +82,9 @@ public abstract class CreditEntryFieldBase extends EditText implements
}
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CreditCardForm);
- setTextColor(typedArray.getColor(R.styleable.CreditCardForm_text_color, Color.BLACK));
- setHintTextColor(typedArray.getColor(R.styleable.CreditCardForm_hint_text_color, Color.LTGRAY));
- setCursorDrawableColor(typedArray.getColor(R.styleable.CreditCardForm_cursor_color, Color.BLACK));
+// setTextColor(typedArray.getColor(R.styleable.CreditCardForm_text_color, Color.BLACK));
+// setHintTextColor(typedArray.getColor(R.styleable.CreditCardForm_hint_text_color, Color.LTGRAY));
+// setCursorDrawableColor(typedArray.getColor(R.styleable.CreditCardForm_cursor_color, Color.BLACK));
typedArray.recycle();
}
diff --git a/CreditCardEntry/src/com/devmarvel/creditcardentry/internal/CreditCardEntry.java b/CreditCardEntry/src/com/devmarvel/creditcardentry/internal/CreditCardEntry.java
index 6987b28..e586971 100644
--- a/CreditCardEntry/src/com/devmarvel/creditcardentry/internal/CreditCardEntry.java
+++ b/CreditCardEntry/src/com/devmarvel/creditcardentry/internal/CreditCardEntry.java
@@ -86,7 +86,7 @@ public class CreditCardEntry extends HorizontalScrollView implements
this.context = context;
TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CreditCardForm, 0, 0);
- textColor = typedArray.getColor(R.styleable.CreditCardForm_text_color, Color.BLACK);
+// textColor = typedArray.getColor(R.styleable.CreditCardForm_text_color, Color.BLACK);
typedArray.recycle();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
@@ -123,7 +123,8 @@ public class CreditCardEntry extends HorizontalScrollView implements
textFourDigits = new TextView(context);
textFourDigits.setTextSize(20);
- textFourDigits.setTextColor(textColor);
+ textColor = textFourDigits.getCurrentTextColor();
+// textFourDigits.setTextColor(textColor);
container.addView(textFourDigits);
expDateText = new ExpDateText(context, attrs);