Search in sources :

Example 1 with ConnectRequestInboxManagerFragment

use of com.waz.zclient.pages.main.connect.ConnectRequestInboxManagerFragment in project wire-android by wireapp.

the class SecondPageFragment method openPage.

private void openPage(Page page, Bundle arguments, ConversationChangeRequester conversationChangerSender) {
    if (getContainer() == null || !isResumed()) {
        return;
    }
    Fragment fragment = getChildFragmentManager().findFragmentById(R.id.fl__second_page_container);
    if (currentPage != null && currentPage.equals(page)) {
        // Scroll to a certain connect request in inbox
        if (fragment instanceof ConnectRequestInboxManagerFragment) {
            ((ConnectRequestInboxManagerFragment) fragment).setVisibleConnectRequest(arguments);
        }
        if (page != Page.CONNECT_REQUEST_PENDING) {
            return;
        }
    }
    currentPage = page;
    FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
    switch(getControllerFactory().getNavigationController().getCurrentPage()) {
        case CONVERSATION_LIST:
            transaction.setCustomAnimations(R.anim.message_fade_in, R.anim.message_fade_out, R.anim.message_fade_in, R.anim.message_fade_out);
            break;
        case CONNECT_REQUEST_INBOX:
        case CONNECT_REQUEST_PENDING:
            transaction.setCustomAnimations(R.anim.fragment_animation_second_page_slide_in_from_right, R.anim.fragment_animation_second_page_slide_out_to_left);
            break;
    }
    Fragment pageFragment;
    String tag;
    switch(page) {
        case CONNECT_REQUEST_PENDING:
            getControllerFactory().getNavigationController().setRightPage(Page.PENDING_CONNECT_REQUEST_AS_CONVERSATION, TAG);
            pageFragment = PendingConnectRequestManagerFragment.newInstance(null, arguments.getString(ARGUMENT_CONVERSATION_ID), ConnectRequestLoadMode.LOAD_BY_CONVERSATION_ID, IConnectStore.UserRequester.CONVERSATION);
            tag = PendingConnectRequestManagerFragment.TAG;
            break;
        case CONNECT_REQUEST_INBOX:
            getControllerFactory().getNavigationController().setRightPage(Page.CONNECT_REQUEST_INBOX, TAG);
            pageFragment = ConnectRequestInboxManagerFragment.newInstance(arguments.getString(ARGUMENT_CONVERSATION_ID));
            tag = ConnectRequestInboxManagerFragment.TAG;
            break;
        case MESSAGE_STREAM:
            getControllerFactory().getNavigationController().setRightPage(Page.MESSAGE_STREAM, TAG);
            pageFragment = ConversationManagerFragment.newInstance();
            tag = ConversationManagerFragment.TAG;
            break;
        case NONE:
        default:
            return;
    }
    transaction.replace(R.id.fl__second_page_container, pageFragment, tag).commit();
}
Also used : ConnectRequestInboxManagerFragment(com.waz.zclient.pages.main.connect.ConnectRequestInboxManagerFragment) FragmentTransaction(android.support.v4.app.FragmentTransaction) PendingConnectRequestManagerFragment(com.waz.zclient.pages.main.connect.PendingConnectRequestManagerFragment) Fragment(android.support.v4.app.Fragment) ConversationManagerFragment(com.waz.zclient.pages.main.conversation.ConversationManagerFragment) ConnectRequestInboxManagerFragment(com.waz.zclient.pages.main.connect.ConnectRequestInboxManagerFragment) BaseFragment(com.waz.zclient.pages.BaseFragment)

Aggregations

Fragment (android.support.v4.app.Fragment)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 BaseFragment (com.waz.zclient.pages.BaseFragment)1 ConnectRequestInboxManagerFragment (com.waz.zclient.pages.main.connect.ConnectRequestInboxManagerFragment)1 PendingConnectRequestManagerFragment (com.waz.zclient.pages.main.connect.PendingConnectRequestManagerFragment)1 ConversationManagerFragment (com.waz.zclient.pages.main.conversation.ConversationManagerFragment)1