Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ public EditText getEditText() {
@Override
public int getBaseline() {
if (editText != null) {
return editText.getPaddingTop() + editText.getBaseline();
return editText.getBaseline() + getPaddingTop() + calculateLabelMarginTop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, but boxBottomOffsetPx still needs to be accounted for. It should be added to the calculation only if boxBackgroundMode != BOX_BACKGROUND_NONE. You may want to split that logic out into a separate method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that's right. Here's a screenshot without the extra padding:

screenshot_20180904-153231

And here is with the extra padding:

screenshot_20180904-153407

BTW, here's my code:

int padding = getPaddingTop();
if (boxBackgroundMode != BOX_BACKGROUND_NONE) {
  padding += boxCollapsedPaddingTopPx;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra offset to account for is boxBottomOffsetPx, not boxCollapsedPaddingTopPx.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, that will move the legacy widget down. The first screenshot was fine... what is there to fix?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't move the legacy widget down if the offset is only being added when boxBackgroundMode != BOX_BACKGROUND_NONE.

From what I can see in the first screenshot, the legacy text field is a little off. Can you add a screenshot that includes a TextView, EditText, and the TextInputLayout legacy and updated styles side by side?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, this looks great. I'll merge the change.

Thanks for contributing!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the baseline does still appear to still be a little off:

image

Could you look around in TextInputLayout and see what could be causing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aw, dang! Can you share the XML you used so I can repro?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh never mind, that screenshot was using an earlier version of the code. I've verified that it works and I'll merge the changes.

Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phew! 😌 Can't wait to see this finally go through!!! 😁👏🎉

} else {
return super.getBaseline();
}
Expand Down