public ContentValues prepareChannelUserMapperValues(ChannelUserMapper channelUserMapper) { ContentValues contentValues = new ContentValues(); if (channelUserMapper != null) { if (channelUserMapper.getKey() != null) { contentValues.put(MobiComDatabaseHelper.CHANNEL_KEY, channelUserMapper.getKey()); } if (channelUserMapper.getUserKey() != null) { contentValues.put(MobiComDatabaseHelper.USERID, channelUserMapper.getUserKey()); } if (channelUserMapper.getUserKey() != null) { contentValues.put(MobiComDatabaseHelper.UNREAD_COUNT, channelUserMapper.getUnreadCount()); } if (channelUserMapper.getStatus() != 0) { contentValues.put(MobiComDatabaseHelper.STATUS, channelUserMapper.getStatus()); } contentValues.put(MobiComDatabaseHelper.ROLE, channelUserMapper.getRole()); if (channelUserMapper.getParentKey() != null) { contentValues.put(MobiComDatabaseHelper.PARENT_GROUP_KEY, channelUserMapper.getParentKey()); } } return contentValues; }
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.channel_menu_option, menu); if (channel == null) { return true; } ChannelUserMapper loggedInUserMapper = ChannelService.getInstance(this).getChannelUserMapperByUserId(channel.getKey(), MobiComUserPreference.getInstance(ChannelInfoActivity.this).getUserId()); if (alCustomizationSettings.isHideGroupAddMembersButton() || loggedInUserMapper != null && ChannelUserMapper.UserRole.MEMBER.getValue().equals(loggedInUserMapper.getRole()) || (!ChannelUtils.isAdminUserId(userPreference.getUserId(), channel) && loggedInUserMapper != null && Integer.valueOf(0).equals(loggedInUserMapper.getRole()))) { menu.removeItem(R.id.add_member_to_channel); } if (alCustomizationSettings.isHideGroupNameUpdateButton() || channel.isBroadcastMessage()) { menu.removeItem(R.id.edit_channel_name); } return true; }
holder.displayName.setText(contact.getDisplayName()); if (ChannelUtils.isAdminUserId(channelUserMapper.getUserKey(), channel) && Integer.valueOf(0).equals(channelUserMapper.getRole()) || ChannelUserMapper.UserRole.ADMIN.getValue().equals(channelUserMapper.getRole())) { holder.adminTextView.setVisibility(View.VISIBLE); } else {
Contact contact = baseContactService.getContactById(channelUserMapper.getUserKey()); for (int i = 0; i < menuItems.length; i++) { if (menuItems[i].equals(getString(R.string.make_admin_text_info)) && loggedInUserMapper != null && ChannelUserMapper.UserRole.MEMBER.getValue().equals(loggedInUserMapper.getRole())) { continue; if (menuItems[i].equals(getString(R.string.remove_member)) && (isHideRemove || !isUserPresent || !ChannelUtils.isAdminUserId(userPreference.getUserId(), channel) && loggedInUserMapper != null && Integer.valueOf(0).equals(loggedInUserMapper.getRole()) || loggedInUserMapper != null && ChannelUserMapper.UserRole.MEMBER.getValue().equals(loggedInUserMapper.getRole()))) { continue; if (menuItems[i].equals(getString(R.string.make_admin_text_info)) && (!isUserPresent || ChannelUserMapper.UserRole.ADMIN.getValue().equals(channelUserMapper.getRole()) || (channel != null && Channel.GroupType.BROADCAST.getValue().equals(channel.getType())))) { continue;