| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3afa2fc commit 121edfc
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -201,23 +201,23 @@ private void setupItem(LinearLayout ll, TextView textView,ImageView imgView, Tab | |||
| 201 | 201 | if (tabItem.title != null && !tabItem.title.isEmpty()) { | |
| 202 | 202 | textView.setText(tabItem.title); | |
| 203 | 203 | textView.setVisibility(VISIBLE); | |
| 204 | + | ||
| 205 | + if (tabItem.typeFace != null) { | ||
| 206 | + textView.setTypeface(tabItem.typeFace); | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + if (tabItem.fontSize != 0) { | ||
| 210 | + textView.setTextSize(tabItem.fontSize); | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + if (tabItem.color != 0) { | ||
| 214 | + textView.setTextColor(tabItem.color); | ||
| 215 | + mTabStrip.setShouldUpdateTabsTextColor(false); | ||
| 216 | + } | ||
| 204 | 217 | } else { | |
| 205 | 218 | textView.setVisibility(GONE); | |
| 206 | 219 | } | |
| 207 | 220 | ||
| 208 | - if (tabItem.typeFace != null) { | ||
| 209 | - textView.setTypeface(tabItem.typeFace); | ||
| 210 | - } | ||
| 211 | - | ||
| 212 | - if (tabItem.fontSize != 0) { | ||
| 213 | - textView.setTextSize(tabItem.fontSize); | ||
| 214 | - } | ||
| 215 | - | ||
| 216 | - if (tabItem.color != 0) { | ||
| 217 | - textView.setTextColor(tabItem.color); | ||
| 218 | - mTabStrip.setShouldUpdateTabsTextColor(false); | ||
| 219 | - } | ||
| 220 | - | ||
| 221 | 221 | if (tabItem.backgroundColor != 0) { | |
| 222 | 222 | ll.setBackgroundColor(tabItem.backgroundColor); | |
| 223 | 223 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -279,6 +279,19 @@ private void setupItem(LinearLayout ll, TextView textView,ImageView imgView, Tab | |||
| 279 | 279 | if (tabItem.title != null && !tabItem.title.isEmpty()) { | |
| 280 | 280 | textView.setText(tabItem.title); | |
| 281 | 281 | textView.setVisibility(VISIBLE); | |
| 282 | + | ||
| 283 | + if (tabItem.typeFace != null) { | ||
| 284 | + textView.setTypeface(tabItem.typeFace); | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + if (tabItem.fontSize != 0) { | ||
| 288 | + textView.setTextSize(tabItem.fontSize); | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + if (tabItem.color != 0) { | ||
| 292 | + textView.setTextColor(tabItem.color); | ||
| 293 | + mTabStrip.setShouldUpdateTabsTextColor(false); | ||
| 294 | + } | ||
| 282 | 295 | } else { | |
| 283 | 296 | textView.setVisibility(GONE); | |
| 284 | 297 | } | |
@@ -287,19 +300,6 @@ private void setupItem(LinearLayout ll, TextView textView,ImageView imgView, Tab | |||
| 287 | 300 | ll.setBackgroundColor(tabItem.backgroundColor); | |
| 288 | 301 | } | |
| 289 | 302 | ||
| 290 | - if (tabItem.typeFace != null) { | ||
| 291 | - textView.setTypeface(tabItem.typeFace); | ||
| 292 | - } | ||
| 293 | - | ||
| 294 | - if (tabItem.fontSize != 0) { | ||
| 295 | - textView.setTextSize(tabItem.fontSize); | ||
| 296 | - } | ||
| 297 | - | ||
| 298 | - if (tabItem.color != 0) { | ||
| 299 | - textView.setTextColor(tabItem.color); | ||
| 300 | - mTabStrip.setShouldUpdateTabsTextColor(false); | ||
| 301 | - } | ||
| 302 | - | ||
| 303 | 303 | if (imgView.getVisibility() == VISIBLE && textView.getVisibility() == VISIBLE) { | |
| 304 | 304 | ll.setMinimumHeight((int) (LARGE_MIN_HEIGHT * density)); | |
| 305 | 305 | } else { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -170,11 +170,11 @@ function createTabItemSpec(tabStripItem: TabStripItem): org.nativescript.widgets | |||
| 170 | 170 | const tabItemSpec = new org.nativescript.widgets.TabItemSpec(); | |
| 171 | 171 | ||
| 172 | 172 | if (tabStripItem.isLoaded) { | |
| 173 | - const nestedLabel = tabStripItem.label; | ||
| 174 | - let title = nestedLabel.text; | ||
| 173 | + const titleLabel = tabStripItem.label; | ||
| 174 | + let title = titleLabel.text; | ||
| 175 | 175 | ||
| 176 | 176 | // TEXT-TRANSFORM | |
| 177 | - const textTransform = nestedLabel.style.textTransform; | ||
| 177 | + const textTransform = titleLabel.style.textTransform; | ||
| 178 | 178 | if (textTransform) { | |
| 179 | 179 | title = getTransformedText(title, textTransform); | |
| 180 | 180 | } | |
@@ -187,13 +187,13 @@ function createTabItemSpec(tabStripItem: TabStripItem): org.nativescript.widgets | |||
| 187 | 187 | } | |
| 188 | 188 | ||
| 189 | 189 | // COLOR | |
| 190 | - const color = nestedLabel.style.color; | ||
| 190 | + const color = titleLabel.style.color; | ||
| 191 | 191 | if (color) { | |
| 192 | 192 | tabItemSpec.color = color.android; | |
| 193 | 193 | } | |
| 194 | 194 | ||
| 195 | 195 | // FONT | |
| 196 | - const fontInternal = nestedLabel.style.fontInternal; | ||
| 196 | + const fontInternal = titleLabel.style.fontInternal; | ||
| 197 | 197 | if (fontInternal) { | |
| 198 | 198 | tabItemSpec.fontSize = fontInternal.fontSize; | |
| 199 | 199 | tabItemSpec.typeFace = fontInternal.getAndroidTypeface(); | |
@@ -229,7 +229,7 @@ function createTabItemSpec(tabStripItem: TabStripItem): org.nativescript.widgets | |||
| 229 | 229 | function _getIcon(tabStripItem: TabStripItem): android.graphics.drawable.BitmapDrawable { | |
| 230 | 230 | const iconSource = tabStripItem.image && tabStripItem.image.src; | |
| 231 | 231 | ||
| 232 | - let is = new ImageSource(); | ||
| 232 | + let is: ImageSource; | ||
| 233 | 233 | if (isFontIconURI(iconSource)) { | |
| 234 | 234 | const fontIconCode = iconSource.split("//")[1]; | |
| 235 | 235 | const target = tabStripItem.image ? tabStripItem.image : tabStripItem; | |
@@ -633,8 +633,8 @@ export class BottomNavigation extends TabNavigationBase { | |||
| 633 | 633 | } | |
| 634 | 634 | ||
| 635 | 635 | public setTabBarItemTextTransform(tabStripItem: TabStripItem, value: TextTransform): void { | |
| 636 | - const nestedLabel = tabStripItem.label; | ||
| 637 | - const title = getTransformedText(nestedLabel.text, value); | ||
| 636 | + const titleLabel = tabStripItem.label; | ||
| 637 | + const title = getTransformedText(titleLabel.text, value); | ||
| 638 | 638 | tabStripItem.nativeViewProtected.setText(title); | |
| 639 | 639 | } | |
| 640 | 640 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,10 +10,8 @@ import { AddChildFromBuilder } from "../../core/view"; | |||
| 10 | 10 | ||
| 11 | 11 | // Requires | |
| 12 | 12 | import { | |
| 13 | - View, ViewBase, CSSType, backgroundColorProperty, backgroundInternalProperty, colorProperty, | ||
| 14 | - fontSizeProperty, fontInternalProperty, PseudoClassHandler | ||
| 13 | + View, ViewBase, CSSType, backgroundColorProperty, backgroundInternalProperty, PseudoClassHandler | ||
| 15 | 14 | } from "../../core/view"; | |
| 16 | - import { textTransformProperty, TextTransform } from "../../text-base"; | ||
| 17 | 15 | ||
| 18 | 16 | export * from "../../core/view"; | |
| 19 | 17 | export const traceCategory = "TabView"; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,6 +51,18 @@ export class TabStrip extends View implements TabStripDefinition, AddChildFromBu | |||
| 51 | 51 | } | |
| 52 | 52 | } | |
| 53 | 53 | ||
| 54 | + public onItemsChanged(oldItems: TabStripItem[], newItems: TabStripItem[]): void { | ||
| 55 | + if (oldItems) { | ||
| 56 | + oldItems.forEach(item => this._removeView(item)); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + if (newItems) { | ||
| 60 | + newItems.forEach(item => { | ||
| 61 | + this._addView(item); | ||
| 62 | + }); | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + | ||
| 54 | 66 | [backgroundColorProperty.getDefault](): Color { | |
| 55 | 67 | const parent = <TabNavigationBase>this.parent; | |
| 56 | 68 | ||
@@ -112,7 +124,14 @@ export class TabStrip extends View implements TabStripDefinition, AddChildFromBu | |||
| 112 | 124 | ||
| 113 | 125 | return parent && parent.setTabBarHighlightColor(value); | |
| 114 | 126 | } | |
| 115 | - } | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + export const itemsProperty = new Property<TabStrip, TabStripItem[]>({ | ||
| 130 | + name: "items", valueChanged: (target, oldValue, newValue) => { | ||
| 131 | + target.onItemsChanged(oldValue, newValue); | ||
| 132 | + } | ||
| 133 | + }); | ||
| 134 | + itemsProperty.register(TabStrip); | ||
| 116 | 135 | ||
| 117 | 136 | export const iosIconRenderingModeProperty = new Property<TabStrip, "automatic" | "alwaysOriginal" | "alwaysTemplate">({ name: "iosIconRenderingMode", defaultValue: "automatic" }); | |
| 118 | 137 | iosIconRenderingModeProperty.register(TabStrip); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments