TextBase.prototype._onTextPropertyChanged = function (data) { var newValue = types.toUIString(data.newValue); this.ios.text = newValue; this.style._updateTextDecoration(); this.style._updateTextTransform(); this._requestLayoutOnTextChanged(); };
FormattedString.prototype.createFormattedStringCore = function () { var mas = NSMutableAttributedString.alloc().init(); var i; var spanStart = 0; var spanLength = 0; var spanText = ""; for (i = 0; i < this.spans.length; i++) { var span = this.spans.getItem(i); spanText = types.toUIString(span.text); spanLength = spanText.length; span.updateSpanModifiers(this); var attrDict = NSMutableDictionary.alloc().init(); var p; for (p = 0; p < span.spanModifiers.length; p++) { attrDict.setObjectForKey(span.spanModifiers[p].value, span.spanModifiers[p].key); } var nsAttributedString = NSMutableAttributedString.alloc().initWithStringAttributes(String(spanText), attrDict); mas.insertAttributedStringAtIndex(nsAttributedString, spanStart); spanStart += spanLength; } this._formattedText = mas; };
FormattedString.prototype.createFormattedStringCore = function () { 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 = this.spans.getItem(i); spanText = types.toUIString(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; };
EditableTextBase.prototype._onTextPropertyChanged = function (data) { if (this._android) { var newValue = types.toUIString(data.newValue); this.android.setText(newValue, android.widget.TextView.BufferType.EDITABLE); } };