Skip to content
Open
Changes from all commits
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 @@ -331,6 +331,14 @@ public MaterialEditText(Context context, AttributeSet attrs, int style) {
init(context, attrs);
}

public String getString() {
return getText().toString().trim();
Copy link

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

Copy link
Author

Choose a reason for hiding this comment

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

getTrimmedString instead?

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

Copy link
Author

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.

Copy link

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?

}

public boolean isEmpty() {
return TextUtils.isEmpty(getString());
Copy link

Choose a reason for hiding this comment

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

getString().isEmpty()

Copy link
Author

Choose a reason for hiding this comment

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

isEmpty only available API 9+

Choose a reason for hiding this comment

The 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);
Expand Down