Automated g4 rollback of changelist 165622891.

*** Reason for rollback ***

Breaks GMM

*** Original change description ***

Reposition label to adapt to box surroundings.

Move the collapsed and expanded bounds of the floating label towards where each belongs. This commit is the first stage in setting the floating label's bounds, so it avoids calculating the exact dimensions based on internal dimensions. The label positioning work is being broken up into stages since the internal dimensions of the text field will likely change either in an upcoming design rethink and while adding the dimension parameters. The final d...

***

PiperOrigin-RevId: 165664978
This commit is contained in:
Material Design Team 2017-08-17 23:41:17 -04:00 committed by Miguel Yanez Barreto
parent 84d3d9ef92
commit feee8126e6

View File

@ -1328,26 +1328,27 @@ public class TextInputLayout extends LinearLayout {
if (mTextInputBoxBackground != null) {
updateTextInputBoxBounds();
}
if (!mHintEnabled || mEditText == null) {
return;
if (mHintEnabled && mEditText != null) {
final Rect rect = mTmpRect;
ViewGroupUtils.getDescendantRect(this, mEditText, rect);
final int l = rect.left + mEditText.getCompoundPaddingLeft();
final int r = rect.right - mEditText.getCompoundPaddingRight();
mCollapsingTextHelper.setExpandedBounds(
l,
rect.top + mEditText.getCompoundPaddingTop(),
r,
rect.bottom - mEditText.getCompoundPaddingBottom());
// Set the collapsed bounds to be the full height (minus padding) to match the
// EditText's editable area
mCollapsingTextHelper.setCollapsedBounds(
l, getPaddingTop(), r, bottom - top - getPaddingBottom());
mCollapsingTextHelper.recalculate();
}
final Rect rect = mTmpRect;
ViewGroupUtils.getDescendantRect(this, mEditText, rect);
final int l = rect.left + mEditText.getCompoundPaddingLeft();
final int r = rect.right - mEditText.getCompoundPaddingRight();
final int collapsedTop = mEditText.getPaddingTop() / 2;
final int collapsedBottom = bottom - top - getPaddingBottom();
final int expandedTop = rect.top;
final int expandedBottom = rect.bottom - mEditText.getCompoundPaddingBottom();
mCollapsingTextHelper.setExpandedBounds(l, expandedTop, r, expandedBottom);
mCollapsingTextHelper.setCollapsedBounds(l, collapsedTop, r, collapsedBottom);
mCollapsingTextHelper.recalculate();
}
private void collapseHint(boolean animate) {