Java Code Examples for com.mikepenz.actionitembadge.library.ActionItemBadge#update()

The following examples show how to use com.mikepenz.actionitembadge.library.ActionItemBadge#update() . 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: IgnoreSetting.java    From MemoryCleaner with Apache License 2.0 6 votes vote down vote up
@Override public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_ignore_setting, menu);
    SubMenu subMenu = menu.addSubMenu(GROUP_ID, BASE_ID, 0, "排序");
    subMenu.setIcon(R.drawable.ic_sort_white_24dp);
    subMenu.add(GROUP_ID + 1, BASE_ID + 1, 0, "应用名");
    subMenu.add(GROUP_ID + 1, BASE_ID + 2, 1, "选中");
    subMenu.add(GROUP_ID + 2, BASE_ID + 3, 2, "降序")
           .setCheckable(true)
           .setChecked(true);
    subMenu.setGroupCheckable(GROUP_ID + 1, true, true);
    mMenuItem = menu.findItem(R.id.allcheck);
    ActionItemBadge.update(this, mMenuItem, FontAwesome.Icon.faw_check,
            ActionItemBadge.BadgeStyles.DARK_GREY, 0);
    return true;
}
 
Example 2
Source File: MemoryClean.java    From MemoryCleaner with Apache License 2.0 6 votes vote down vote up
@Override public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_memory_clean, menu);
    SubMenu subMenu = menu.addSubMenu(GROUP_ID, BASE_ID, 0, "排序");
    subMenu.setIcon(R.drawable.ic_sort_white_24dp);
    subMenu.add(GROUP_ID + 1, BASE_ID + 1, 0, "应用名");
    subMenu.add(GROUP_ID + 1, BASE_ID + 2, 1, "大小");
    subMenu.add(GROUP_ID + 1, BASE_ID + 3, 2, "选中");
    subMenu.add(GROUP_ID + 2, BASE_ID + 4, 3, "降序")
           .setCheckable(true)
           .setChecked(true);
    subMenu.setGroupCheckable(GROUP_ID + 1, true, true);
    mMenuItem = menu.findItem(R.id.allcheck);
    ActionItemBadge.update(this, mMenuItem, FontAwesome.Icon.faw_check,
            ActionItemBadge.BadgeStyles.DARK_GREY, 0);
    return true;
}
 
Example 3
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 4
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 5
Source File: AbstractMainActivity.java    From monolog-android with MIT License 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    //重载菜单图标
    ActionItemBadge.update(this, menu.findItem(R.id.action_publish), FontAwesome.Icon.faw_plus, Color.GRAY, ActionItemBadge.BadgeStyles.GREY, Integer.MIN_VALUE);
    ActionItemBadge.update(this, menu.findItem(R.id.action_chat), FontAwesome.Icon.faw_comment_o, Color.GRAY, ActionItemBadge.BadgeStyles.GREY, Integer.MIN_VALUE);
    return true;
}
 
Example 6
Source File: AbstractMainActivity.java    From monolog-android with MIT License 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
        case R.id.action_publish:
            startActivityForResult(PublishActivity.newIntent(), PublishActivity.REQUEST_PUBLISH);
            break;
        case R.id.action_chat:
            ActionItemBadge.update(this, item, FontAwesome.Icon.faw_comment_o,Color.GRAY, ActionItemBadge.BadgeStyles.GREY,  Integer.MIN_VALUE);
            PrefService.getInstance(getApplicationContext()).cleanUnread();
            startActivity(ChatListActivity.newIntent());
            break;
    }
    return true;
}
 
Example 7
Source File: AbstractMainActivity.java    From monolog-android with MIT License 5 votes vote down vote up
/**
 * 新消息提示
 */
@Override
public void onNewMsg() {
    int count=PrefService.getInstance(getApplicationContext()).getUnread();
    Log.d("MainActivity", "Recieve msg:" + count);
    ActionItemBadge.update(this, toolbar.getMenu().findItem(R.id.action_chat), FontAwesome.Icon.faw_comment_o,Color.GRAY, ActionItemBadge.BadgeStyles.RED, PrefService.getInstance(getApplicationContext()).getUnread());
}
 
Example 8
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);
}
 
Example 9
Source File: IgnoreSetting.java    From MemoryCleaner with Apache License 2.0 4 votes vote down vote up
@Override public void updateBadge(int count) {
    ActionItemBadge.update(mMenuItem, count);
}
 
Example 10
Source File: MemoryClean.java    From MemoryCleaner with Apache License 2.0 4 votes vote down vote up
@Override public void updateBadge(int count) {
    ActionItemBadge.update(mMenuItem, count);
}