-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[TIMOB-16512] Android: added left and right padding to TextField #5492
Changes from 3 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 |
---|---|---|
|
@@ -75,7 +75,6 @@ public class TiUIText extends TiUIView | |
private int maxLength = -1; | ||
private boolean isTruncatingText = false; | ||
private boolean disableChangeEvent = false; | ||
|
||
protected TiEditText tv; | ||
|
||
public class TiEditText extends EditText | ||
|
@@ -201,8 +200,37 @@ public void processProperties(KrollDict d) | |
if (d.containsKey(TiC.PROPERTY_AUTO_LINK)) { | ||
TiUIHelper.linkifyIfEnabled(tv, d.get(TiC.PROPERTY_AUTO_LINK)); | ||
} | ||
|
||
setTextPadding(d); | ||
} | ||
|
||
private boolean setTextPadding(KrollDict d) | ||
{ | ||
boolean padding = false; | ||
int paddingLeft = 0; | ||
int paddingRight = 0; | ||
int paddingTop = 0; | ||
int paddingBottom = 0; | ||
if (d.containsKey(TiC.PROPERTY_PADDING_LEFT)) { | ||
paddingLeft = TiConvert.toInt(d, TiC.PROPERTY_PADDING_LEFT); | ||
padding = true; | ||
} else { | ||
paddingLeft = tv.getPaddingLeft(); | ||
} | ||
if (d.containsKey(TiC.PROPERTY_PADDING_RIGHT)) { | ||
paddingRight = TiConvert.toInt(d, TiC.PROPERTY_PADDING_RIGHT); | ||
padding = true; | ||
} else { | ||
paddingRight = tv.getPaddingRight(); | ||
} | ||
if(padding) | ||
{ | ||
paddingBottom = tv.getPaddingBottom(); | ||
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. Indentation |
||
paddingTop = tv.getPaddingTop(); | ||
tv.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); | ||
} | ||
return padding; | ||
} | ||
|
||
@Override | ||
public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) | ||
|
@@ -262,7 +290,7 @@ public void propertyChanged(String key, Object oldValue, Object newValue, KrollP | |
TiUIHelper.styleText(tv, (HashMap) newValue); | ||
} else if (key.equals(TiC.PROPERTY_AUTO_LINK)) { | ||
TiUIHelper.linkifyIfEnabled(tv, newValue); | ||
} else { | ||
} else if (!setTextPadding(proxy.getProperties())){ | ||
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. This implementation is inefficient. You don't need to call it every time a property is changed.. You only need to call it when paddingRight and Left is called. |
||
super.propertyChanged(key, oldValue, newValue, proxy); | ||
} | ||
} | ||
|
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.
if (padding) {