Loading core/java/com/android/internal/widget/ImageFloatingTextView.java +5 −58 Original line number Diff line number Diff line Loading @@ -18,11 +18,9 @@ package com.android.internal.widget; import android.annotation.Nullable; import android.content.Context; import android.os.Build; import android.os.Trace; import android.text.BoringLayout; import android.text.Layout; import android.text.PrecomputedText; import android.text.StaticLayout; import android.text.TextUtils; import android.text.method.TransformationMethod; Loading Loading @@ -50,10 +48,6 @@ public class ImageFloatingTextView extends TextView { private int mLayoutMaxLines = -1; private int mImageEndMargin; private int mStaticLayoutCreationCountInOnMeasure = 0; private static final boolean TRACE_ONMEASURE = Build.isDebuggable(); public ImageFloatingTextView(Context context) { this(context, null); } Loading @@ -77,10 +71,7 @@ public class ImageFloatingTextView extends TextView { protected Layout makeSingleLayout(int wantWidth, BoringLayout.Metrics boring, int ellipsisWidth, Layout.Alignment alignment, boolean shouldEllipsize, TextUtils.TruncateAt effectiveEllipsize, boolean useSaved) { if (TRACE_ONMEASURE) { Trace.beginSection("ImageFloatingTextView#makeSingleLayout"); mStaticLayoutCreationCountInOnMeasure++; } TransformationMethod transformationMethod = getTransformationMethod(); CharSequence text = getText(); if (transformationMethod != null) { Loading Loading @@ -124,10 +115,7 @@ public class ImageFloatingTextView extends TextView { } final StaticLayout result = builder.build(); if (TRACE_ONMEASURE) { trackMaxLines(); Trace.endSection(); } return result; } Loading @@ -153,10 +141,7 @@ public class ImageFloatingTextView extends TextView { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (TRACE_ONMEASURE) { Trace.beginSection("ImageFloatingTextView#onMeasure"); } mStaticLayoutCreationCountInOnMeasure = 0; int availableHeight = MeasureSpec.getSize(heightMeasureSpec) - mPaddingTop - mPaddingBottom; if (getLayout() != null && getLayout().getHeight() != availableHeight) { // We've been measured before and the new size is different than before, lets make sure Loading @@ -183,13 +168,8 @@ public class ImageFloatingTextView extends TextView { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } if (TRACE_ONMEASURE) { trackParameters(); Trace.endSection(); } } @Override public void onRtlPropertiesChanged(int layoutDirection) { Loading Loading @@ -236,37 +216,4 @@ public class ImageFloatingTextView extends TextView { requestLayout(); } } private void trackParameters() { if (!TRACE_ONMEASURE) { return; } Trace.setCounter("ImageFloatingView#staticLayoutCreationCount", mStaticLayoutCreationCountInOnMeasure); Trace.setCounter("ImageFloatingView#isPrecomputedText", isTextAPrecomputedText()); } /** * @return 1 if {@link TextView#getText()} is PrecomputedText, else 0 */ private int isTextAPrecomputedText() { final CharSequence text = getText(); if (text == null || text.isEmpty()) { return 0; } if (text instanceof PrecomputedText) { return 1; } return 0; } private void trackMaxLines() { if (!TRACE_ONMEASURE) { return; } Trace.setCounter("ImageFloatingView#layoutMaxLines", mLayoutMaxLines); } } Loading
core/java/com/android/internal/widget/ImageFloatingTextView.java +5 −58 Original line number Diff line number Diff line Loading @@ -18,11 +18,9 @@ package com.android.internal.widget; import android.annotation.Nullable; import android.content.Context; import android.os.Build; import android.os.Trace; import android.text.BoringLayout; import android.text.Layout; import android.text.PrecomputedText; import android.text.StaticLayout; import android.text.TextUtils; import android.text.method.TransformationMethod; Loading Loading @@ -50,10 +48,6 @@ public class ImageFloatingTextView extends TextView { private int mLayoutMaxLines = -1; private int mImageEndMargin; private int mStaticLayoutCreationCountInOnMeasure = 0; private static final boolean TRACE_ONMEASURE = Build.isDebuggable(); public ImageFloatingTextView(Context context) { this(context, null); } Loading @@ -77,10 +71,7 @@ public class ImageFloatingTextView extends TextView { protected Layout makeSingleLayout(int wantWidth, BoringLayout.Metrics boring, int ellipsisWidth, Layout.Alignment alignment, boolean shouldEllipsize, TextUtils.TruncateAt effectiveEllipsize, boolean useSaved) { if (TRACE_ONMEASURE) { Trace.beginSection("ImageFloatingTextView#makeSingleLayout"); mStaticLayoutCreationCountInOnMeasure++; } TransformationMethod transformationMethod = getTransformationMethod(); CharSequence text = getText(); if (transformationMethod != null) { Loading Loading @@ -124,10 +115,7 @@ public class ImageFloatingTextView extends TextView { } final StaticLayout result = builder.build(); if (TRACE_ONMEASURE) { trackMaxLines(); Trace.endSection(); } return result; } Loading @@ -153,10 +141,7 @@ public class ImageFloatingTextView extends TextView { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (TRACE_ONMEASURE) { Trace.beginSection("ImageFloatingTextView#onMeasure"); } mStaticLayoutCreationCountInOnMeasure = 0; int availableHeight = MeasureSpec.getSize(heightMeasureSpec) - mPaddingTop - mPaddingBottom; if (getLayout() != null && getLayout().getHeight() != availableHeight) { // We've been measured before and the new size is different than before, lets make sure Loading @@ -183,13 +168,8 @@ public class ImageFloatingTextView extends TextView { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } if (TRACE_ONMEASURE) { trackParameters(); Trace.endSection(); } } @Override public void onRtlPropertiesChanged(int layoutDirection) { Loading Loading @@ -236,37 +216,4 @@ public class ImageFloatingTextView extends TextView { requestLayout(); } } private void trackParameters() { if (!TRACE_ONMEASURE) { return; } Trace.setCounter("ImageFloatingView#staticLayoutCreationCount", mStaticLayoutCreationCountInOnMeasure); Trace.setCounter("ImageFloatingView#isPrecomputedText", isTextAPrecomputedText()); } /** * @return 1 if {@link TextView#getText()} is PrecomputedText, else 0 */ private int isTextAPrecomputedText() { final CharSequence text = getText(); if (text == null || text.isEmpty()) { return 0; } if (text instanceof PrecomputedText) { return 1; } return 0; } private void trackMaxLines() { if (!TRACE_ONMEASURE) { return; } Trace.setCounter("ImageFloatingView#layoutMaxLines", mLayoutMaxLines); } }