use of com.xabber.android.data.extension.muc.RoomState in project xabber-android by redsolution.
the class ChatViewerFragment method setUpOptionsMenu.
private void setUpOptionsMenu(Menu menu) {
AbstractChat abstractChat = MessageManager.getInstance().getChat(account, user);
if (abstractChat instanceof RoomChat) {
RoomState chatState = ((RoomChat) abstractChat).getState();
if (chatState == RoomState.available) {
menu.findItem(R.id.action_list_of_occupants).setVisible(true);
}
if (chatState == RoomState.unavailable) {
menu.findItem(R.id.action_join_conference).setVisible(true);
} else {
menu.findItem(R.id.action_invite_to_chat).setVisible(true);
if (chatState == RoomState.error) {
menu.findItem(R.id.action_authorization_settings).setVisible(true);
} else {
menu.findItem(R.id.action_leave_conference).setVisible(true);
}
}
}
if (abstractChat instanceof RegularChat) {
menu.findItem(R.id.action_view_contact).setVisible(true);
menu.findItem(R.id.action_close_chat).setVisible(true);
menu.findItem(R.id.action_block_contact).setVisible(true);
}
}
Aggregations