Skip to content

Commit 636b81e

Browse files
cb1kenobigithub-actions[bot]
authored andcommitted
Apply automatic changes
1 parent 427e34d commit 636b81e

File tree

2 files changed

+133
-1
lines changed

2 files changed

+133
-1
lines changed

docs/api/api.json

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113799,6 +113799,10 @@
113799113799
{
113800113800
"description": "Adds attributes, one by one.",
113801113801
"code": "``` js\nvar win = Titanium.UI.createWindow({\n backgroundColor: '#ddd',\n});\n\nwin.open();\n\nvar text = 'Bacon ipsum dolor Titanium SDK rocks! sit amet fatback leberkas salami sausage tongue strip steak.';\n\nvar attr = Titanium.UI.createAttributedString({\n text: text\n});\n\n// Underlines text\nattr.addAttribute({\n type: Titanium.UI.ATTRIBUTE_UNDERLINES_STYLE,\n range: [0, text.length]\n});\n\nvar label = Titanium.UI.createLabel({\n left: 20,\n right: 20,\n height: Titanium.UI.SIZE,\n attributedString: attr\n});\n\nwin.add(label);\n```\n"
113802+
},
113803+
{
113804+
"description": "Links with underline color.",
113805+
"code": "``` js\nconst win = Ti.UI.createWindow({\n\tbackgroundColor: 'gray',\n\tlayout: 'vertical'\n});\nconst lbl_a = createLink();\nconst lbl_b = createLink();\n\ncolorLink(lbl_b);\n\nwin.add([lbl_a, lbl_b]);\nwin.open();\n\nfunction createLink() {\n\tconst label = Ti.UI.createLabel({\n\t\ttop: 20,\n\t\tattributedString: Ti.UI.createAttributedString({\n\t\t\ttext: 'Check out Titanium SDK',\n\t\t\tattributes: [{\n\t\t\t\ttype: Ti.UI.ATTRIBUTE_LINK,\n\t\t\t\tvalue: 'https://titaniumsdk.com',\n\t\t\t\trange: [10, 12]\n\t\t\t}]\n\t\t})\n\t});\n\n\tlabel.addEventListener('link', e => {\n\t\tTi.Platform.openURL(e.url);\n\t});\n\n\treturn label;\n}\n\nfunction colorLink(lbl) {\n\tconst attributedString = lbl.attributedString;\n\tconst textColor = 'purple';\n\tconst underlineColor = 'yellow';\n\n\tfor (const attribute of attributedString.attributes) {\n\t\tif (attribute.type === Ti.UI.ATTRIBUTE_LINK) {\n\n\t\t\t// Set new link color.\n\t\t\tattributedString.addAttribute({\n\t\t\t\ttype: Ti.UI.ATTRIBUTE_FOREGROUND_COLOR,\n\t\t\t\tvalue: textColor,\n\t\t\t\trange: attribute.range\n\t\t\t});\n\n\t\t\t// Set new underline color.\n\t\t\tattributedString.addAttribute({\n\t\t\t\ttype: Ti.UI.ATTRIBUTE_UNDERLINE_COLOR,\n\t\t\t\tvalue: underlineColor,\n\t\t\t\trange: attribute.range\n\t\t\t});\n\t\t}\n\t}\n}\n```\n"
113802113806
}
113803113807
],
113804113808
"methods": [
@@ -191854,6 +191858,21 @@
191854191858
],
191855191859
"availability": "creation"
191856191860
},
191861+
{
191862+
"name": "selectedBackgroundColor",
191863+
"summary": "Background color of the selected tab indicator.",
191864+
"platforms": [
191865+
{
191866+
"since": "8.0.0",
191867+
"name": "android"
191868+
}
191869+
],
191870+
"type": [
191871+
"String",
191872+
"Titanium.UI.Color"
191873+
],
191874+
"availability": "creation"
191875+
},
191857191876
{
191858191877
"name": "selectedTextColor",
191859191878
"summary": "Color of the selected text",
@@ -191884,7 +191903,7 @@
191884191903
{
191885191904
"name": "style",
191886191905
"summary": "Style of the tabbed bar.",
191887-
"description": "Specify one of the constants:\nFor iOS:\n[Titanium.UI.iOS.SystemButtonStyle](Titanium.UI.iOS.SystemButtonStyle),\neither `PLAIN`, `BORDERED`, or `BAR`.\n\nThe `BAR` style specifies a more compact style and allows the bar's background\ncolor or gradient to show through.\nFor Android:\n[Titanium.UI.TABS_STYLE_*]\nIn Android [style](Titanium.UI.TabbedBar.style) is only supported in the creation dictionary\nof the proxy.\n",
191906+
"description": "Specify one of the constants:\nFor iOS:\n[Titanium.UI.iOS.SystemButtonStyle](Titanium.UI.iOS.SystemButtonStyle),\neither `PLAIN`, `BORDERED`, or `BAR`.\n\nThe `BAR` style specifies a more compact style and allows the bar's background\ncolor or gradient to show through.\n\nFor Android use [Titanium.UI.TABS_STYLE_DEFAULT](Titanium.UI.TABS_STYLE_DEFAULT) or\n[Titanium.UI.TABS_STYLE_BOTTOM_NAVIGATION](Titanium.UI.TABS_STYLE_BOTTOM_NAVIGATION) and\nit is only supported in the creation dictionary of the proxy.\n",
191888191907
"platforms": [
191889191908
{
191890191909
"since": "8.0.0",
@@ -215883,6 +215902,10 @@
215883215902
"summary": "Use with <Attribute.type> to change the color of the horizontal line.\n",
215884215903
"description": "Use a color name or hex value for <Attribute.value>.\n\nSee <Attribute> for more information.\n",
215885215904
"platforms": [
215905+
{
215906+
"since": "10.0.0",
215907+
"name": "android"
215908+
},
215886215909
{
215887215910
"since": "3.6.0",
215888215911
"name": "iphone"
@@ -220322,6 +220345,54 @@
220322220345
"type": "Number",
220323220346
"permission": "read-only"
220324220347
},
220348+
{
220349+
"name": "TABS_STYLE_DEFAULT",
220350+
"summary": "Default tab style.",
220351+
"platforms": [
220352+
{
220353+
"since": "8.0.0",
220354+
"name": "android"
220355+
},
220356+
{
220357+
"since": "8.0.0",
220358+
"name": "iphone"
220359+
},
220360+
{
220361+
"since": "8.0.0",
220362+
"name": "ipad"
220363+
},
220364+
{
220365+
"since": "9.2.0",
220366+
"name": "macos"
220367+
}
220368+
],
220369+
"type": "Number",
220370+
"permission": "read-only"
220371+
},
220372+
{
220373+
"name": "TABS_STYLE_BOTTOM_NAVIGATION",
220374+
"summary": "Bottom navigation style.",
220375+
"platforms": [
220376+
{
220377+
"since": "8.0.0",
220378+
"name": "android"
220379+
},
220380+
{
220381+
"since": "8.0.0",
220382+
"name": "iphone"
220383+
},
220384+
{
220385+
"since": "8.0.0",
220386+
"name": "ipad"
220387+
},
220388+
{
220389+
"since": "9.2.0",
220390+
"name": "macos"
220391+
}
220392+
],
220393+
"type": "Number",
220394+
"permission": "read-only"
220395+
},
220325220396
{
220326220397
"name": "TABLE_VIEW_SEPARATOR_STYLE_NONE",
220327220398
"summary": "The row divider is hidden.",

docs/api/titanium/ui/attributedstring.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,65 @@ var label = Titanium.UI.createLabel({
111111
win.add(label);
112112
```
113113

114+
### Links with underline color.
115+
116+
``` js
117+
const win = Ti.UI.createWindow({
118+
backgroundColor: 'gray',
119+
layout: 'vertical'
120+
});
121+
const lbl_a = createLink();
122+
const lbl_b = createLink();
123+
124+
colorLink(lbl_b);
125+
126+
win.add([lbl_a, lbl_b]);
127+
win.open();
128+
129+
function createLink() {
130+
const label = Ti.UI.createLabel({
131+
top: 20,
132+
attributedString: Ti.UI.createAttributedString({
133+
text: 'Check out Titanium SDK',
134+
attributes: [{
135+
type: Ti.UI.ATTRIBUTE_LINK,
136+
value: 'https://titaniumsdk.com',
137+
range: [10, 12]
138+
}]
139+
})
140+
});
141+
142+
label.addEventListener('link', e => {
143+
Ti.Platform.openURL(e.url);
144+
});
145+
146+
return label;
147+
}
148+
149+
function colorLink(lbl) {
150+
const attributedString = lbl.attributedString;
151+
const textColor = 'purple';
152+
const underlineColor = 'yellow';
153+
154+
for (const attribute of attributedString.attributes) {
155+
if (attribute.type === Ti.UI.ATTRIBUTE_LINK) {
156+
157+
// Set new link color.
158+
attributedString.addAttribute({
159+
type: Ti.UI.ATTRIBUTE_FOREGROUND_COLOR,
160+
value: textColor,
161+
range: attribute.range
162+
});
163+
164+
// Set new underline color.
165+
attributedString.addAttribute({
166+
type: Ti.UI.ATTRIBUTE_UNDERLINE_COLOR,
167+
value: underlineColor,
168+
range: attribute.range
169+
});
170+
}
171+
}
172+
}
173+
```
174+
114175
<ApiDocs/>

0 commit comments

Comments
 (0)