Merge "AutoSize TextView - fix measurements" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e812e7dc2e
@@ -8148,11 +8148,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
mTempTextPaint.set(getPaint());
|
mTempTextPaint.set(getPaint());
|
||||||
mTempTextPaint.setTextSize(suggestedSizeInPx);
|
mTempTextPaint.setTextSize(suggestedSizeInPx);
|
||||||
|
|
||||||
if ((mLayout instanceof BoringLayout) && BoringLayout.isBoring(
|
|
||||||
text, mTempTextPaint, getTextDirectionHeuristic(), mBoring) != null) {
|
|
||||||
return mTempTextPaint.getFontSpacing() <= availableSpace.bottom
|
|
||||||
&& mTempTextPaint.measureText(text, 0, text.length()) <= availableSpace.right;
|
|
||||||
} else {
|
|
||||||
final StaticLayout.Builder layoutBuilder = StaticLayout.Builder.obtain(
|
final StaticLayout.Builder layoutBuilder = StaticLayout.Builder.obtain(
|
||||||
text, 0, text.length(), mTempTextPaint,
|
text, 0, text.length(), mTempTextPaint,
|
||||||
getMeasuredWidth() - getTotalPaddingLeft() - getTotalPaddingRight());
|
getMeasuredWidth() - getTotalPaddingLeft() - getTotalPaddingRight());
|
||||||
@@ -8177,7 +8172,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
if (layout.getHeight() > availableSpace.bottom) {
|
if (layout.getHeight() > availableSpace.bottom) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user