Merge "Fixed a bug where the font sizes where not enforced correctly" into nyc-dev

am: c5ce69f555

* commit 'c5ce69f555ce703a0bd1d7438e1b87ee9854eae8':
  Fixed a bug where the font sizes where not enforced correctly
This commit is contained in:
Selim Cinek
2016-03-08 22:27:42 +00:00
committed by android-build-merger

View File

@@ -47,6 +47,7 @@ import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.CharacterStyle;
import android.text.style.RelativeSizeSpan;
import android.text.style.TextAppearanceSpan;
import android.util.Log;
@@ -1664,17 +1665,22 @@ public class Notification implements Parcelable
SpannableStringBuilder builder = new SpannableStringBuilder(ss.toString());
for (Object span : spans) {
Object resultSpan = span;
if (span instanceof TextAppearanceSpan) {
TextAppearanceSpan originalSpan = (TextAppearanceSpan) span;
if (resultSpan instanceof CharacterStyle) {
resultSpan = ((CharacterStyle) span).getUnderlying();
}
if (resultSpan instanceof TextAppearanceSpan) {
TextAppearanceSpan originalSpan = (TextAppearanceSpan) resultSpan;
resultSpan = new TextAppearanceSpan(
originalSpan.getFamily(),
originalSpan.getTextStyle(),
-1,
originalSpan.getTextColor(),
originalSpan.getLinkTextColor());
} else if (span instanceof RelativeSizeSpan
|| span instanceof AbsoluteSizeSpan) {
} else if (resultSpan instanceof RelativeSizeSpan
|| resultSpan instanceof AbsoluteSizeSpan) {
continue;
} else {
resultSpan = span;
}
builder.setSpan(resultSpan, ss.getSpanStart(span), ss.getSpanEnd(span),
ss.getSpanFlags(span));