Search in sources :

Example 1 with RoomState

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);
    }
}
Also used : AbstractChat(com.xabber.android.data.message.AbstractChat) RoomChat(com.xabber.android.data.extension.muc.RoomChat) RegularChat(com.xabber.android.data.message.RegularChat) RoomState(com.xabber.android.data.extension.muc.RoomState)

Aggregations

RoomChat (com.xabber.android.data.extension.muc.RoomChat)1 RoomState (com.xabber.android.data.extension.muc.RoomState)1 AbstractChat (com.xabber.android.data.message.AbstractChat)1 RegularChat (com.xabber.android.data.message.RegularChat)1