Search in sources :

Example 1 with CameraFragment

use of com.waz.zclient.pages.main.profile.camera.CameraFragment in project wire-android by wireapp.

the class RootFragment method onBackPressed.

@Override
public boolean onBackPressed() {
    Fragment fragment = getChildFragmentManager().findFragmentByTag(ParticipantsDialogFragment.TAG);
    if (fragment instanceof OnBackPressedListener && ((OnBackPressedListener) fragment).onBackPressed()) {
        return true;
    }
    fragment = getChildFragmentManager().findFragmentById(R.id.fl__root__right_view);
    if (fragment instanceof OnBackPressedListener && ((OnBackPressedListener) fragment).onBackPressed()) {
        return true;
    }
    fragment = getChildFragmentManager().findFragmentById(R.id.fl__root__camera);
    if (fragment instanceof CameraFragment) {
        //TODO: https://wearezeta.atlassian.net/browse/AN-2311 Refactor camera into one view
        getControllerFactory().getCameraController().closeCamera(((CameraFragment) fragment).getCameraContext());
        return true;
    } else if (fragment instanceof OnBackPressedListener) {
        ((OnBackPressedListener) fragment).onBackPressed();
        return true;
    }
    fragment = getChildFragmentManager().findFragmentById(R.id.fl__root__giphy);
    if (fragment instanceof GiphySharingPreviewFragment) {
        if (!((GiphySharingPreviewFragment) fragment).onBackPressed()) {
            getControllerFactory().getGiphyController().cancel();
        }
        return true;
    }
    fragment = getChildFragmentManager().findFragmentById(R.id.fl__root__sketch);
    if (fragment instanceof OnBackPressedListener) {
        ((OnBackPressedListener) fragment).onBackPressed();
        return true;
    }
    if (getControllerFactory().getPickUserController().isShowingPickUser(IPickUserController.Destination.CONVERSATION_LIST)) {
        getControllerFactory().getPickUserController().hidePickUser(IPickUserController.Destination.CONVERSATION_LIST, true);
        return true;
    }
    if (slidingPaneLayout != null && !slidingPaneLayout.isOpen()) {
        slidingPaneLayout.openPane();
        return true;
    }
    return false;
}
Also used : OnBackPressedListener(com.waz.zclient.OnBackPressedListener) CameraFragment(com.waz.zclient.pages.main.profile.camera.CameraFragment) DrawingFragment(com.waz.zclient.pages.main.drawing.DrawingFragment) LocationFragment(com.waz.zclient.pages.main.conversation.LocationFragment) CollectionFragment(com.waz.zclient.conversation.CollectionFragment) Fragment(android.support.v4.app.Fragment) GiphySharingPreviewFragment(com.waz.zclient.pages.main.giphy.GiphySharingPreviewFragment) ConversationFragment(com.waz.zclient.pages.main.conversation.ConversationFragment) ParticipantsDialogFragment(com.waz.zclient.pages.main.participants.dialog.ParticipantsDialogFragment) PendingConnectRequestManagerFragment(com.waz.zclient.pages.main.connect.PendingConnectRequestManagerFragment) CameraFragment(com.waz.zclient.pages.main.profile.camera.CameraFragment) ConversationListManagerFragment(com.waz.zclient.pages.main.conversationlist.ConversationListManagerFragment) TabbedParticipantBodyFragment(com.waz.zclient.pages.main.participants.TabbedParticipantBodyFragment) ConnectRequestInboxManagerFragment(com.waz.zclient.pages.main.connect.ConnectRequestInboxManagerFragment) BaseFragment(com.waz.zclient.pages.BaseFragment) GiphySharingPreviewFragment(com.waz.zclient.pages.main.giphy.GiphySharingPreviewFragment)

Aggregations

Fragment (android.support.v4.app.Fragment)1 OnBackPressedListener (com.waz.zclient.OnBackPressedListener)1 CollectionFragment (com.waz.zclient.conversation.CollectionFragment)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 ConversationFragment (com.waz.zclient.pages.main.conversation.ConversationFragment)1 LocationFragment (com.waz.zclient.pages.main.conversation.LocationFragment)1 ConversationListManagerFragment (com.waz.zclient.pages.main.conversationlist.ConversationListManagerFragment)1 DrawingFragment (com.waz.zclient.pages.main.drawing.DrawingFragment)1 GiphySharingPreviewFragment (com.waz.zclient.pages.main.giphy.GiphySharingPreviewFragment)1 TabbedParticipantBodyFragment (com.waz.zclient.pages.main.participants.TabbedParticipantBodyFragment)1 ParticipantsDialogFragment (com.waz.zclient.pages.main.participants.dialog.ParticipantsDialogFragment)1 CameraFragment (com.waz.zclient.pages.main.profile.camera.CameraFragment)1