Skip to content

Commit

Permalink
Fix the bug that accent texts display with hint text color.
Browse files Browse the repository at this point in the history
They should display transparent base color.
  • Loading branch information
rengwuxian committed Mar 29, 2015
1 parent 7357718 commit 714eaf1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1288,15 +1288,15 @@ protected void onDraw(@NonNull Canvas canvas) {

// draw the characters counter
if ((hasFocus() && hasCharatersCounter()) || !isCharactersCountValid()) {
textPaint.setColor(isCharactersCountValid() ? getCurrentHintTextColor() : errorColor);
textPaint.setColor(isCharactersCountValid() ? (baseColor & 0x00ffffff | 0x44000000) : errorColor);
String charactersCounterText = getCharactersCounterText();
canvas.drawText(charactersCounterText, isRTL() ? startX : endX - textPaint.measureText(charactersCounterText), lineStartY + bottomSpacing + relativeHeight, textPaint);
}

// draw the bottom text
if (textLayout != null) {
if (tempErrorText != null || ((helperTextAlwaysShown || hasFocus()) && !TextUtils.isEmpty(helperText))) { // error text or helper text
textPaint.setColor(tempErrorText != null ? errorColor : helperTextColor != -1 ? helperTextColor : getCurrentHintTextColor());
textPaint.setColor(tempErrorText != null ? errorColor : helperTextColor != -1 ? helperTextColor : (baseColor & 0x00ffffff | 0x44000000));
canvas.save();
canvas.translate(startX + getBottomTextLeftOffset(), lineStartY + bottomSpacing - bottomTextPadding);
textLayout.draw(canvas);
Expand All @@ -1308,7 +1308,7 @@ protected void onDraw(@NonNull Canvas canvas) {
if (floatingLabelEnabled && !TextUtils.isEmpty(floatingLabelText)) {
textPaint.setTextSize(floatingLabelTextSize);
// calculate the text color
textPaint.setColor((Integer) focusEvaluator.evaluate(focusFraction, floatingLabelTextColor != -1 ? floatingLabelTextColor : getCurrentHintTextColor(), primaryColor));
textPaint.setColor((Integer) focusEvaluator.evaluate(focusFraction, floatingLabelTextColor != -1 ? floatingLabelTextColor : (baseColor & 0x00ffffff | 0x44000000), primaryColor));

// calculate the horizontal position
float floatingLabelWidth = textPaint.measureText(floatingLabelText.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1288,15 +1288,15 @@ protected void onDraw(@NonNull Canvas canvas) {

// draw the characters counter
if ((hasFocus() && hasCharatersCounter()) || !isCharactersCountValid()) {
textPaint.setColor(isCharactersCountValid() ? getCurrentHintTextColor() : errorColor);
textPaint.setColor(isCharactersCountValid() ? (baseColor & 0x00ffffff | 0x44000000) : errorColor);
String charactersCounterText = getCharactersCounterText();
canvas.drawText(charactersCounterText, isRTL() ? startX : endX - textPaint.measureText(charactersCounterText), lineStartY + bottomSpacing + relativeHeight, textPaint);
}

// draw the bottom text
if (textLayout != null) {
if (tempErrorText != null || ((helperTextAlwaysShown || hasFocus()) && !TextUtils.isEmpty(helperText))) { // error text or helper text
textPaint.setColor(tempErrorText != null ? errorColor : helperTextColor != -1 ? helperTextColor : getCurrentHintTextColor());
textPaint.setColor(tempErrorText != null ? errorColor : helperTextColor != -1 ? helperTextColor : (baseColor & 0x00ffffff | 0x44000000));
canvas.save();
canvas.translate(startX + getBottomTextLeftOffset(), lineStartY + bottomSpacing - bottomTextPadding);
textLayout.draw(canvas);
Expand All @@ -1308,7 +1308,7 @@ protected void onDraw(@NonNull Canvas canvas) {
if (floatingLabelEnabled && !TextUtils.isEmpty(floatingLabelText)) {
textPaint.setTextSize(floatingLabelTextSize);
// calculate the text color
textPaint.setColor((Integer) focusEvaluator.evaluate(focusFraction, floatingLabelTextColor != -1 ? floatingLabelTextColor : getCurrentHintTextColor(), primaryColor));
textPaint.setColor((Integer) focusEvaluator.evaluate(focusFraction, floatingLabelTextColor != -1 ? floatingLabelTextColor : (baseColor & 0x00ffffff | 0x44000000), primaryColor));

// calculate the horizontal position
float floatingLabelWidth = textPaint.measureText(floatingLabelText.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1285,15 +1285,15 @@ protected void onDraw(@NonNull Canvas canvas) {

// draw the characters counter
if ((hasFocus() && hasCharatersCounter()) || !isCharactersCountValid()) {
textPaint.setColor(isCharactersCountValid() ? getCurrentHintTextColor() : errorColor);
textPaint.setColor(isCharactersCountValid() ? (baseColor & 0x00ffffff | 0x44000000) : errorColor);
String charactersCounterText = getCharactersCounterText();
canvas.drawText(charactersCounterText, isRTL() ? startX : endX - textPaint.measureText(charactersCounterText), lineStartY + bottomSpacing + relativeHeight, textPaint);
}

// draw the bottom text
if (textLayout != null) {
if (tempErrorText != null || ((helperTextAlwaysShown || hasFocus()) && !TextUtils.isEmpty(helperText))) { // error text or helper text
textPaint.setColor(tempErrorText != null ? errorColor : helperTextColor != -1 ? helperTextColor : getCurrentHintTextColor());
textPaint.setColor(tempErrorText != null ? errorColor : helperTextColor != -1 ? helperTextColor : (baseColor & 0x00ffffff | 0x44000000));
canvas.save();
canvas.translate(startX + getBottomTextLeftOffset(), lineStartY + bottomSpacing - bottomTextPadding);
textLayout.draw(canvas);
Expand All @@ -1305,7 +1305,7 @@ protected void onDraw(@NonNull Canvas canvas) {
if (floatingLabelEnabled && !TextUtils.isEmpty(floatingLabelText)) {
textPaint.setTextSize(floatingLabelTextSize);
// calculate the text color
textPaint.setColor((Integer) focusEvaluator.evaluate(focusFraction, floatingLabelTextColor != -1 ? floatingLabelTextColor : getCurrentHintTextColor(), primaryColor));
textPaint.setColor((Integer) focusEvaluator.evaluate(focusFraction, floatingLabelTextColor != -1 ? floatingLabelTextColor : (baseColor & 0x00ffffff | 0x44000000), primaryColor));

// calculate the horizontal position
float floatingLabelWidth = textPaint.measureText(floatingLabelText.toString());
Expand Down

0 comments on commit 714eaf1

Please sign in to comment.