use of com.google.android.material.badge.BadgeDrawable in project GreenHouse by utsanjan.
the class BottomNavigationMenuView method getOrCreateBadge.
/* JADX INFO: Access modifiers changed from: package-private */
public BadgeDrawable getOrCreateBadge(int menuItemId) {
validateMenuItemId(menuItemId);
BadgeDrawable badgeDrawable = this.badgeDrawables.get(menuItemId);
if (badgeDrawable == null) {
badgeDrawable = BadgeDrawable.create(getContext());
this.badgeDrawables.put(menuItemId, badgeDrawable);
}
BottomNavigationItemView itemView = findItemView(menuItemId);
if (itemView != null) {
itemView.setBadge(badgeDrawable);
}
return badgeDrawable;
}
use of com.google.android.material.badge.BadgeDrawable in project sesl by OneUIProject.
the class NavigationBarMenuView method setBadgeIfNeeded.
private void setBadgeIfNeeded(@NonNull NavigationBarItemView child) {
int childId = child.getId();
if (!isValidId(childId)) {
// Child doesn't have a valid id, do not set any BadgeDrawable on the view.
return;
}
BadgeDrawable badgeDrawable = badgeDrawables.get(childId);
if (badgeDrawable != null) {
child.setBadge(badgeDrawable);
}
}
use of com.google.android.material.badge.BadgeDrawable in project AppManager by MuntashirAkon.
the class ReflowMenuView method removeBadge.
void removeBadge(int menuItemId) {
validateMenuItemId(menuItemId);
BadgeDrawable badgeDrawable = badgeDrawables.get(menuItemId);
ReflowMenuItemView itemView = findItemView(menuItemId);
if (itemView != null) {
itemView.removeBadge();
}
if (badgeDrawable != null) {
badgeDrawables.remove(menuItemId);
}
}
use of com.google.android.material.badge.BadgeDrawable in project ods-android by Orange-OpenSource.
the class TabsMainDemoFragment method setupBadging.
private void setupBadging() {
for (TabLayout tabLayout : tabLayouts) {
// An icon only badge will be displayed.
BadgeDrawable badgeDrawable = tabLayout.getTabAt(0).getOrCreateBadge();
badgeDrawable.setVisible(true);
// A badge with the text "99" will be displayed.
badgeDrawable = tabLayout.getTabAt(1).getOrCreateBadge();
badgeDrawable.setVisible(true);
badgeDrawable.setNumber(99);
// A badge with the text "999+" will be displayed.
badgeDrawable = tabLayout.getTabAt(2).getOrCreateBadge();
badgeDrawable.setVisible(true);
badgeDrawable.setNumber(9999);
tabLayout.addOnTabSelectedListener(new OnTabSelectedListener() {
@Override
public void onTabSelected(Tab tab) {
clearAndHideBadge(tab.getPosition());
}
@Override
public void onTabUnselected(Tab tab) {
}
@Override
public void onTabReselected(Tab tab) {
clearAndHideBadge(tab.getPosition());
}
});
}
}
use of com.google.android.material.badge.BadgeDrawable in project ods-android by Orange-OpenSource.
the class TabsMainDemoFragment method incrementBadgeNumber.
private void incrementBadgeNumber() {
for (TabLayout tabLayout : tabLayouts) {
// Increase the badge number on the first tab position.
// In case the first tab has been selected and the badge was hidden, call
// BadgeDrawable#setVisible() to ensure the badge is visible.
BadgeDrawable badgeDrawable = tabLayout.getTabAt(0).getOrCreateBadge();
badgeDrawable.setVisible(true);
badgeDrawable.setNumber(badgeDrawable.getNumber() + 1);
}
}
Aggregations