Skip to content

Commit

Permalink
docs(api): add Ti.UI.Tab.badge and badgeColor for android
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga authored and sgtcoolguy committed Oct 8, 2020
1 parent a19c36e commit 6ca467a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ public void updateBadge(int index)
}

int menuItemId = this.mBottomNavigationView.getMenu().getItem(index).getItemId();
BadgeDrawable badgeDrawable = this.mBottomNavigationView.getOrCreateBadge(menuItemId);
if (tabProxy.getProperty(TiC.PROPERTY_BADGE) != null) {
BadgeDrawable badgeDrawable = this.mBottomNavigationView.getOrCreateBadge(menuItemId);
badgeDrawable.setVisible(true);
badgeDrawable.setNumber(TiConvert.toInt(tabProxy.getProperty(TiC.PROPERTY_BADGE), 0));
} else {
this.mBottomNavigationView.removeBadge(menuItemId);
badgeDrawable.setVisible(false);
}
}

Expand All @@ -315,7 +315,6 @@ public void updateBadgeColor(int index)
}

int menuItemId = this.mBottomNavigationView.getMenu().getItem(index).getItemId();
Log.i("COL", "" + tabProxy.getProperty(TiC.PROPERTY_BADGE_COLOR));
if (tabProxy.getProperty(TiC.PROPERTY_BADGE_COLOR) != null) {
BadgeDrawable badgeDrawable = this.mBottomNavigationView.getOrCreateBadge(menuItemId);
badgeDrawable.setBackgroundColor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public void updateBadge(int index)
badgeDrawable.setVisible(true);
badgeDrawable.setNumber(TiConvert.toInt(tabProxy.getProperty(TiC.PROPERTY_BADGE), 0));
} else {
this.mTabLayout.getTabAt(index).removeBadge();
badgeDrawable.setVisible(false);
}
}

Expand Down
14 changes: 10 additions & 4 deletions apidoc/Titanium/UI/Tab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,18 @@ properties:
For information about color values, see the "Colors" section of <Titanium.UI>.
platforms: [android]
since: {android: 3.0.0}
since: {android: "3.0.0"}

- name: badge
summary: Badge value for this tab. `null` indicates no badge.
description: |
On the Android platform you will need to use a Theme with `parent="Theme.MaterialComponents.*"`
in order to use a badge. You have to pass a number as a string. Non-numberic characters will not be displayed.
On iOS, a badge will only be shown if the tab has been assigned an icon. Text only tabs do not support badges.
type: String
platforms: [iphone,ipad, macos]
platforms: [android, iphone, ipad, macos]
since: {android: "9.3.0"}

- name: badgeColor
summary: |
Expand All @@ -194,9 +200,9 @@ properties:
description: |
For information about color values, see the "Colors" section of <Titanium.UI>.
type: [String, Titanium.UI.Color]
since: 6.1.0
osver: {ios: {min: "10.0"}}
platforms: [iphone, ipad, macos]
platforms: [android, iphone, ipad, macos]
since: {android: "9.3.0", iphone: "6.1.0", ipad: "6.1.0", macos: "9.2.0"}

- name: icon
summary: Icon URL for this tab.
Expand Down

0 comments on commit 6ca467a

Please sign in to comment.