Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Text Field] Add ability to provide helperText custom horizontal padding #3141

Open
wants to merge 6 commits into
base: release-1.6
Choose a base branch
from

Conversation

valeryvpetrov-dev
Copy link

@valeryvpetrov-dev valeryvpetrov-dev commented Dec 14, 2022

Thanks for starting a pull request on Material Components!

Don't forget:

  • Identify the component the PR relates to in brackets in the title.
    [Buttons] Updated documentation
  • Sign the CLA bot. You can do this once the pull request is opened.

Contributing
has more information and tips for a great pull request.

@google-cla
Copy link

google-cla bot commented Dec 14, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

boolean isFontScaleLarge, @DimenRes int largeFontPaddingRes, int defaultPadding) {
if (helperTextHorizontalPaddingPx != NO_HELPER_TEXT_HORIZONTAL_PADDING)
return helperTextHorizontalPaddingPx;
else
Copy link
Contributor

Choose a reason for hiding this comment

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

Please always use brackets.

Copy link
Author

@valeryvpetrov-dev valeryvpetrov-dev Apr 26, 2023

Choose a reason for hiding this comment

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

getIndicatorHorizontalPadding(
isFontScaleLarge,
R.dimen.material_helper_text_font_1_3_padding_horizontal,
ViewCompat.getPaddingStart(editText)),
getIndicatorPadding(
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel we probably need some refactoring here.

To make the code more clear, I think we should create separate methods getHelperTextVerticalPadding and getHelperTextHorizontalPadding, and call getIndicatorPadding from them.

Copy link
Author

@valeryvpetrov-dev valeryvpetrov-dev Apr 26, 2023

Choose a reason for hiding this comment

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

@drchen I didn't catch your idea. We have only horizontal padding option for now. What is the purpose of getHelperTextVerticalPadding then? getIndicatorHorizontalPadding encapsulates padding resolution logic. Can you reformulate your suggestion?

@@ -187,6 +187,8 @@
*/
public class TextInputLayout extends LinearLayout {

static final int NO_HELPER_TEXT_HORIZONTAL_PADDING = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

The constant name is not accurate. Maybe just USE_DEFAULT_PADDING?

Copy link
Author

@valeryvpetrov-dev valeryvpetrov-dev Apr 26, 2023

Choose a reason for hiding this comment

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

build.gradle Outdated
@@ -59,7 +59,7 @@ ext {
? project.property('mavenRepoUrl') : '/tmp/myRepo/')

// Current version of the library (could be in-development/unreleased).
mdcLibraryVersion = '1.6.1'
mdcLibraryVersion = '1.6.2'
Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert this change.

Copy link
Author

@valeryvpetrov-dev valeryvpetrov-dev Apr 26, 2023

Choose a reason for hiding this comment

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

@valeryvpetrov-dev
Copy link
Author

@drchen Hi! Any others questions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants