use of android.text.style.RelativeSizeSpan in project MPAndroidChart by PhilJay.
the class PieChartActivity method generateCenterSpannableText.
private SpannableString generateCenterSpannableText() {
SpannableString s = new SpannableString("MPAndroidChart\ndeveloped by Philipp Jahoda");
s.setSpan(new RelativeSizeSpan(1.7f), 0, 14, 0);
s.setSpan(new StyleSpan(Typeface.NORMAL), 14, s.length() - 15, 0);
s.setSpan(new ForegroundColorSpan(Color.GRAY), 14, s.length() - 15, 0);
s.setSpan(new RelativeSizeSpan(.8f), 14, s.length() - 15, 0);
s.setSpan(new StyleSpan(Typeface.ITALIC), s.length() - 14, s.length(), 0);
s.setSpan(new ForegroundColorSpan(ColorTemplate.getHoloBlue()), s.length() - 14, s.length(), 0);
return s;
}
use of android.text.style.RelativeSizeSpan in project MPAndroidChart by PhilJay.
the class PieChartFrag method generateCenterText.
private SpannableString generateCenterText() {
SpannableString s = new SpannableString("Revenues\nQuarters 2015");
s.setSpan(new RelativeSizeSpan(2f), 0, 8, 0);
s.setSpan(new ForegroundColorSpan(Color.GRAY), 8, s.length(), 0);
return s;
}
use of android.text.style.RelativeSizeSpan in project CoCoin by Nightonke.
the class CoCoinUtil method init.
public static void init(Context context) {
typefaceLatoRegular = Typeface.createFromAsset(context.getAssets(), "fonts/Lato-Regular.ttf");
typefaceLatoHairline = Typeface.createFromAsset(context.getAssets(), "fonts/Lato-Hairline.ttf");
typefaceLatoLight = Typeface.createFromAsset(context.getAssets(), "fonts/LatoLatin-Light.ttf");
relativeSizeSpan = new RelativeSizeSpan(2f);
redForegroundSpan = new ForegroundColorSpan(Color.parseColor("#ff5252"));
greenForegroundSpan = new ForegroundColorSpan(Color.parseColor("#4ca550"));
whiteForegroundSpan = new ForegroundColorSpan(Color.parseColor("#ffffff"));
lastColor0 = "";
lastColor1 = "";
lastColor2 = "";
random = new Random();
MY_BLUE = ContextCompat.getColor(CoCoinApplication.getAppContext(), R.color.my_blue);
}
use of android.text.style.RelativeSizeSpan in project platform_frameworks_base by android.
the class Notification method removeTextSizeSpans.
private static CharSequence removeTextSizeSpans(CharSequence charSequence) {
if (charSequence instanceof Spanned) {
Spanned ss = (Spanned) charSequence;
Object[] spans = ss.getSpans(0, ss.length(), Object.class);
SpannableStringBuilder builder = new SpannableStringBuilder(ss.toString());
for (Object span : spans) {
Object resultSpan = 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 (resultSpan instanceof RelativeSizeSpan || resultSpan instanceof AbsoluteSizeSpan) {
continue;
} else {
resultSpan = span;
}
builder.setSpan(resultSpan, ss.getSpanStart(span), ss.getSpanEnd(span), ss.getSpanFlags(span));
}
return builder;
}
return charSequence;
}
use of android.text.style.RelativeSizeSpan in project platform_frameworks_base by android.
the class HtmlToSpannedConverter method endHeading.
private static void endHeading(Editable text) {
// RelativeSizeSpan and StyleSpan are CharacterStyles
// Their ranges should not include the newlines at the end
Heading h = getLast(text, Heading.class);
if (h != null) {
setSpanFromMark(text, h, new RelativeSizeSpan(HEADING_SIZES[h.mLevel]), new StyleSpan(Typeface.BOLD));
}
endBlockElement(text);
}
Aggregations