本文整理了Java中com.mikepenz.materialdrawer.Drawer.updateBadge()
方法的一些代码示例,展示了Drawer.updateBadge()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawer.updateBadge()
方法的具体详情如下:
包路径:com.mikepenz.materialdrawer.Drawer
类名称:Drawer
方法名:updateBadge
[英]update the badge for a specific drawerItem identified by its id
[中]更新由其id标识的特定抽屉的徽章
代码示例来源:origin: mikepenz/Android-Iconics
private void search(String s) {
mCurrentSearch = s;
if (mDrawer != null) {
int count = 0;
for (ITypeface font : mFonts) {
int foundCount = 0;
if (font.getIcons() != null) {
for (String icon : font.getIcons()) {
if (icon.toLowerCase().contains(s.toLowerCase())) {
foundCount++;
}
}
}
mDrawer.updateBadge(count, new StringHolder(foundCount + ""));
count++;
}
}
//filter out the current fragment
if (mIconsFragment != null) mIconsFragment.onSearch(s);
}
});
代码示例来源:origin: mikepenz/MaterialDrawer
result.updateBadge(4, new StringHolder(10 + ""));
代码示例来源:origin: FreedomZZQ/YouJoin-Android
private void switchToMessage() {
getSupportFragmentManager().beginTransaction().replace(R.id.frame_content, new MessageFragment()).commit();
toolbar.setTitle(getString(R.string.title_message));
drawer.updateBadge(DRAWER_MSG, null);
}
代码示例来源:origin: FreedomZZQ/YouJoin-Android
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(ImTypeMessageEvent event){
drawer.updateBadge(DRAWER_MSG, new StringHolder(""));
//当收到了新的消息时,不需要重新获取所有的会话列表
//只需要将新收到的消息进行处理即可:
//1.增加该会话的未读消息数
addUnreadMsgCount(event.conversation);
//2.将新收到的消息本地存储(?)
//3.新收到的消息显示在会话列表
}
代码示例来源:origin: rsiebert/TVHClient
public void startObservingViewModels() {
ConnectionViewModel connectionViewModel = ViewModelProviders.of(activity).get(ConnectionViewModel.class);
connectionViewModel.getAllConnections().observe(activity, connections -> showConnectionsInDrawerHeader());
ChannelViewModel channelViewModel = ViewModelProviders.of(activity).get(ChannelViewModel.class);
channelViewModel.getNumberOfChannels().observe(activity, count -> result.updateBadge(MENU_CHANNELS, new StringHolder(count + "")));
SeriesRecordingViewModel seriesRecordingViewModel = ViewModelProviders.of(activity).get(SeriesRecordingViewModel.class);
seriesRecordingViewModel.getNumberOfRecordings().observe(activity, count -> result.updateBadge(MENU_SERIES_RECORDINGS, new StringHolder(count + "")));
TimerRecordingViewModel timerRecordingViewModel = ViewModelProviders.of(activity).get(TimerRecordingViewModel.class);
timerRecordingViewModel.getNumberOfRecordings().observe(activity, count -> result.updateBadge(MENU_TIMER_RECORDINGS, new StringHolder(count + "")));
RecordingViewModel recordingViewModel = ViewModelProviders.of(activity).get(RecordingViewModel.class);
recordingViewModel.getNumberOfCompletedRecordings().observe(activity, count -> result.updateBadge(MENU_COMPLETED_RECORDINGS, new StringHolder(count + "")));
recordingViewModel.getNumberOfScheduledRecordings().observe(activity, count -> result.updateBadge(MENU_SCHEDULED_RECORDINGS, new StringHolder(count + "")));
recordingViewModel.getNumberOfFailedRecordings().observe(activity, count -> result.updateBadge(MENU_FAILED_RECORDINGS, new StringHolder(count + "")));
recordingViewModel.getNumberOfRemovedRecordings().observe(activity, count -> result.updateBadge(MENU_REMOVED_RECORDINGS, new StringHolder(count + "")));
}
代码示例来源:origin: lincanbin/Android-Carbon-Forum
if(notificationsNumber>0){
mDrawer.updateBadge(4, new StringHolder(notificationsNumber + ""));
内容来源于网络,如有侵权,请联系作者删除!