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

[TIMOB-19235]: Fix layout for ellipsize. #7014

Merged
merged 1 commit into from
Aug 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public TiUILabel(final TiViewProxy proxy)
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
// Only allow label to exceed the size of parent when it's size behavior with both wordwrap and ellipsize disabled
if (!wordWrap && ellipsize != null && layoutParams.optionWidth == null && !layoutParams.autoFillsWidth) {
if (!wordWrap && ellipsize == null && layoutParams.optionWidth == null && !layoutParams.autoFillsWidth) {
widthMeasureSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec),
MeasureSpec.UNSPECIFIED);
heightMeasureSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(heightMeasureSpec),
Expand Down Expand Up @@ -206,14 +206,15 @@ public void processProperties(KrollDict d)
String verticalAlign = d.optString(TiC.PROPERTY_VERTICAL_ALIGN, "middle");
TiUIHelper.setAlignment(tv, textAlign, verticalAlign);
}

if (d.containsKey(TiC.PROPERTY_ELLIPSIZE)) {

Object value = d.get(TiC.PROPERTY_ELLIPSIZE);

if (value instanceof Boolean){
ellipsize = (Boolean) value ? TruncateAt.END : null;
}

if (value instanceof Integer){
switch((Integer)value){
case UIModule.TEXT_ELLIPSIZE_TRUNCATE_START:
Expand All @@ -231,13 +232,14 @@ public void processProperties(KrollDict d)
ellipsize = null;
}
}

tv.setEllipsize(ellipsize);
}

if (d.containsKey(TiC.PROPERTY_WORD_WRAP)) {
wordWrap = TiConvert.toBoolean(d, TiC.PROPERTY_WORD_WRAP, true);
tv.setSingleLine(!wordWrap);
}

if (d.containsKey(TiC.PROPERTY_SHADOW_OFFSET)) {
Object value = d.get(TiC.PROPERTY_SHADOW_OFFSET);
if (value instanceof HashMap) {
Expand Down