-
Notifications
You must be signed in to change notification settings - Fork 1k
Add convenient functions #225
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -331,6 +331,14 @@ public MaterialEditText(Context context, AttributeSet attrs, int style) { | |
| init(context, attrs); | ||
| } | ||
|
|
||
| public String getString() { | ||
| return getText().toString().trim(); | ||
| } | ||
|
|
||
| public boolean isEmpty() { | ||
| return TextUtils.isEmpty(getString()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. getString().isEmpty()
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you right! wow! I didnt know that! |
||
| } | ||
|
|
||
| private void init(Context context, AttributeSet attrs) { | ||
| iconSize = getPixel(32); | ||
| iconOuterWidth = getPixel(48); | ||
|
|
||
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.
you should not trim here. its not responsibility of the the met
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.
getTrimmedStringinstead?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 would not put it at all (my point of view). this is an edittext, it should not care about how you want to handle the string typed
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.
Yeah but when you deal with user profile forms, you need to trim the strings. Either by extending MET, or creating a static function.
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.
you are free to do that on your side. what about if I need to get space the user has typed?