(item: TabViewItem)
| 289 | } |
| 290 | |
| 291 | function createTabItemSpec(item: TabViewItem): org.nativescript.widgets.TabItemSpec { |
| 292 | const result = new org.nativescript.widgets.TabItemSpec(); |
| 293 | result.title = item.title; |
| 294 | |
| 295 | if (item.iconSource) { |
| 296 | const addDrawable = (is: ImageSource) => { |
| 297 | if (is) { |
| 298 | // TODO: Make this native call that accepts string so that we don't load Bitmap in JS. |
| 299 | result.iconDrawable = new android.graphics.drawable.BitmapDrawable(appResources, is.android); |
| 300 | } else { |
| 301 | traceMissingIcon(item.iconSource); |
| 302 | } |
| 303 | }; |
| 304 | if (item.iconSource.indexOf(RESOURCE_PREFIX) === 0) { |
| 305 | result.iconId = androidUtils.resources.getDrawableId(item.iconSource.slice(RESOURCE_PREFIX.length)); |
| 306 | if (result.iconId === 0) { |
| 307 | traceMissingIcon(item.iconSource); |
| 308 | } |
| 309 | } else if (isFontIconURI(item.iconSource)) { |
| 310 | // Allow specifying a separate font family for the icon via style.iconFontFamily. |
| 311 | let iconFont: any = item.style.fontInternal; |
| 312 | const iconFontFamily = item.iconFontFamily || item.style.iconFontFamily; |
| 313 | if (iconFontFamily) { |
| 314 | const baseFont = item.style.fontInternal || Font.default; |
| 315 | iconFont = baseFont.withFontFamily(iconFontFamily); |
| 316 | } |
| 317 | const is = ImageSource.fromFontIconCodeSync(item.iconSource.slice(FONT_PREFIX.length), iconFont, item.style.color); |
| 318 | addDrawable(is); |
| 319 | } else { |
| 320 | addDrawable(ImageSource.fromFileOrResourceSync(item.iconSource)); |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | return result; |
| 325 | } |
| 326 | |
| 327 | let defaultAccentColor: number = undefined; |
| 328 | function getDefaultAccentColor(context: android.content.Context): number { |
no test coverage detected