forked from NativeScript/NativeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformatted-string.android.ts
More file actions
30 lines (28 loc) · 1.14 KB
/
formatted-string.android.ts
File metadata and controls
30 lines (28 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import formattedStringCommon = require("text/formatted-string-common");
import spanModule = require("text/span");
declare var exports;
require("utils/module-merge").merge(formattedStringCommon, exports);
export class FormattedString extends formattedStringCommon.FormattedString {
public createFormattedStringCore() {
var ssb = new android.text.SpannableStringBuilder();
var i;
var spanStart = 0;
var spanLength = 0;
var spanText = "";
for (i = 0; i < this.spans.length; i++) {
var span = <spanModule.Span>this.spans.getItem(i);
spanText = span.text || "";
spanLength = spanText.length;
if (spanLength !== 0) {
ssb.insert(spanStart, spanText);
span.updateSpanModifiers(this);
var p;
for (p = 0; p < span.spanModifiers.length; p++) {
ssb.setSpan(span.spanModifiers[p], spanStart, spanStart + spanLength, android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
spanStart += spanLength;
}
}
this._formattedText = ssb;
}
}