-
Notifications
You must be signed in to change notification settings - Fork 3k
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
base: release-1.6
Are you sure you want to change the base?
Conversation
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please always use brackets.
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drchen Hi! Any others questions? |
Thanks for starting a pull request on Material Components!
Don't forget:
[Buttons] Updated documentation
Contributing
has more information and tips for a great pull request.