Skip to content

Commit

Permalink
[TextField] Apply edit text's letter spacing to expanded hints
Browse files Browse the repository at this point in the history
Resolves #2202

PiperOrigin-RevId: 417863400
  • Loading branch information
drchen authored and leticiarossi committed Dec 23, 2021
1 parent a295de9 commit 88eb089
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Expand Up @@ -229,6 +229,13 @@ public void setExpandedTextColor(ColorStateList textColor) {
}
}

public void setExpandedLetterSpacing(float letterSpacing) {
if (expandedLetterSpacing != letterSpacing) {
expandedLetterSpacing = letterSpacing;
recalculate();
}
}

public void setExpandedBounds(int left, int top, int right, int bottom) {
if (!rectEquals(expandedBounds, left, top, right, bottom)) {
expandedBounds.set(left, top, right, bottom);
Expand Down
Expand Up @@ -1454,9 +1454,12 @@ private void setEditText(EditText editText) {
onApplyBoxBackgroundMode();
setTextInputAccessibilityDelegate(new AccessibilityDelegate(this));

// Use the EditText's typeface, and its text size for our expanded text.
// Use the EditText's typeface, text size, and letter spacing for our expanded text.
collapsingTextHelper.setTypefaces(this.editText.getTypeface());
collapsingTextHelper.setExpandedTextSize(this.editText.getTextSize());
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
collapsingTextHelper.setExpandedLetterSpacing(this.editText.getLetterSpacing());
}

final int editTextGravity = this.editText.getGravity();
collapsingTextHelper.setCollapsedTextGravity(
Expand Down

0 comments on commit 88eb089

Please sign in to comment.