com.mikepenz.actionitembadge.library.utils.BadgeStyle Java Examples

The following examples show how to use com.mikepenz.actionitembadge.library.utils.BadgeStyle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From SkyTube with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Setup the video blocker notification icon which will be displayed in the tool bar.
	 */
void setupIconForToolBar(final Menu menu) {
	if (getTotalBlockedVideos() > 0) {
		// display a red bubble containing the number of blocked videos
		ActionItemBadge.update(activity,
				menu.findItem(R.id.menu_blocker),
				ContextCompat.getDrawable(activity, R.drawable.ic_video_blocker),
				ActionItemBadge.BadgeStyles.RED,
				getTotalBlockedVideos());
	} else {
		// Else, set the bubble to transparent.  This is required so that when the user
		// clicks on the icon, the app will be able to detect such click and displays the
		// BlockedVideosDialog (otherwise, the ActionItemBadge would just ignore such clicks.
		ActionItemBadge.update(activity,
				menu.findItem(R.id.menu_blocker),
				ContextCompat.getDrawable(activity, R.drawable.ic_video_blocker),
				new BadgeStyle(BadgeStyle.Style.DEFAULT, com.mikepenz.actionitembadge.library.R.layout.menu_action_item_badge, Color.TRANSPARENT, Color.TRANSPARENT, Color.WHITE),
				"");
	}
}
 
Example #2
Source File: ActivityMain.java    From fingen with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.menu_main, menu);
    MenuItem menuItemInbox = menu.findItem(R.id.action_incoming);
    Drawable icon = ContextCompat.getDrawable(this, R.drawable.ic_sms_white);
    int badgeColor = ContextCompat.getColor(this, R.color.negative_color);
    BadgeStyle badgeStyle = new BadgeStyle(BadgeStyle.Style.DEFAULT, com.mikepenz.actionitembadge.library.R.layout.menu_action_item_badge, badgeColor, badgeColor, -1);
    if (mUnreadSms > 0) {
        ActionItemBadge.update(this, menuItemInbox, icon, badgeStyle, NumberUtils.formatNumber(mUnreadSms));
    } else {
        ActionItemBadge.hide(menu.findItem(R.id.action_incoming));
    }
    return true;
}
 
Example #3
Source File: GiveawayListFragment.java    From SteamGifts with MIT License 5 votes vote down vote up
@Override
@SuppressWarnings("deprecation")
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    MenuItem filterMenu = menu.findItem(R.id.filter);
    filterMenu.setVisible(true);

    ActionItemBadge.update(getActivity(), filterMenu, getResources().getDrawable(R.drawable.ic_filter_variant), (BadgeStyle) null, FilterData.getCurrent(getContext()).isAnyActive() ? "\n\n{faw-check-circle}" : null);
}