Search in sources :

Example 1 with FooterMenuCallback

use of com.waz.zclient.views.menus.FooterMenuCallback in project wire-android by wireapp.

the class SingleParticipantFragment method onUserUpdated.

//////////////////////////////////////////////////////////////////////////////////////////
//
//  SingleParticipantStoreObserver
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
public void onUserUpdated(final User user) {
    if (user == null) {
        return;
    }
    imageAssetImageViewProfile.connectImageAsset(user.getPicture());
    header.setText(user.getDisplayName());
    userDetailsView.setUser(user);
    shieldView.setVisibility(user.getVerified() == Verification.VERIFIED ? View.VISIBLE : View.GONE);
    // Show footer if profile is not for self user
    if (!user.isMe()) {
        if (!otherUserProfileScreenWasTracked) {
            otherUserProfileScreenWasTracked = true;
        }
        final boolean showingCommonUser = getArguments().getBoolean(ARGUMENT_SHOWING_COMMON_USER);
        final boolean ignoreRightClick = getArguments().getSerializable(ARGUMENT_USER_REQUESTER) == IConnectStore.UserRequester.CALL;
        if (ignoreRightClick) {
            footerMenu.setRightActionText("");
        } else if (showingCommonUser) {
            footerMenu.setRightActionText(getResources().getString(R.string.glyph__block));
        }
        footerMenu.setCallback(new FooterMenuCallback() {

            @Override
            public void onLeftActionClicked() {
                getControllerFactory().getConversationScreenController().hideParticipants(true, false);
                // Go to conversation with this user
                goToConversationWithUser = true;
                getContainer().dismissUserProfile();
                getStoreFactory().getConversationStore().setCurrentConversation(user.getConversation(), ConversationChangeRequester.START_CONVERSATION);
            }

            @Override
            public void onRightActionClicked() {
                if (ignoreRightClick) {
                    return;
                }
                if (showingCommonUser) {
                    showBlockConfirmation(user);
                } else {
                    getStoreFactory().getNetworkStore().doIfHasInternetOrNotifyUser(new NetworkAction() {

                        @Override
                        public void execute(NetworkMode networkMode) {
                            getContainer().showRemoveConfirmation(user);
                        }

                        @Override
                        public void onNoNetwork() {
                            ViewUtils.showAlertDialog(getActivity(), R.string.alert_dialog__no_network__header, R.string.remove_from_conversation__no_network__message, R.string.alert_dialog__confirmation, null, true);
                        }
                    });
                }
            }
        });
        if (getArguments().getSerializable(ARGUMENT_USER_REQUESTER) != IConnectStore.UserRequester.PARTICIPANTS) {
            footerMenu.setVisibility(View.VISIBLE);
        }
    }
}
Also used : FooterMenuCallback(com.waz.zclient.views.menus.FooterMenuCallback) NetworkMode(com.waz.api.NetworkMode) NetworkAction(com.waz.zclient.core.stores.network.NetworkAction)

Example 2 with FooterMenuCallback

use of com.waz.zclient.views.menus.FooterMenuCallback in project wire-android by wireapp.

the class BlockedUserProfileFragment method setGroupConversationFooterMenu.

private void setGroupConversationFooterMenu(final User user) {
    unblockButton.setVisibility(View.GONE);
    toggleUnblockAndFooterMenu(isShowingFooterMenu);
    // Hook up callbacks
    footerMenu.setLeftActionLabelText(getString(R.string.connect_request__footer__blocked_label));
    footerMenu.setRightActionText(getString(R.string.glyph__minus));
    footerMenu.setCallback(new FooterMenuCallback() {

        @Override
        public void onLeftActionClicked() {
            toggleUnblockAndFooterMenu(false);
        }

        @Override
        public void onRightActionClicked() {
            getContainer().showRemoveConfirmation(user);
        }
    });
    // Split unblock / cancel buttons
    cancelButton.setEnabled(true);
    cancelButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            toggleUnblockAndFooterMenu(true);
        }
    });
    smallUnblockButton.setEnabled(true);
    smallUnblockButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            unblockUser(user);
        }
    });
}
Also used : FooterMenuCallback(com.waz.zclient.views.menus.FooterMenuCallback) ImageAssetImageView(com.waz.zclient.views.images.ImageAssetImageView) View(android.view.View) UserDetailsView(com.waz.zclient.ui.views.UserDetailsView) TextView(android.widget.TextView)

Example 3 with FooterMenuCallback

use of com.waz.zclient.views.menus.FooterMenuCallback in project wire-android by wireapp.

the class PendingConnectRequestFragment method setFooterForOutgoingConnectRequest.

//////////////////////////////////////////////////////////////////////////////////////////
//
//  UI
//
//////////////////////////////////////////////////////////////////////////////////////////
private void setFooterForOutgoingConnectRequest(final User user) {
    // Show footer
    footerMenu.setVisibility(View.VISIBLE);
    isShowingFooterMenu = true;
    footerMenu.setRightActionText("");
    footerMenu.setCallback(new FooterMenuCallback() {

        @Override
        public void onLeftActionClicked() {
            user.cancelConnection();
            getActivity().onBackPressed();
        }

        @Override
        public void onRightActionClicked() {
        }
    });
}
Also used : FooterMenuCallback(com.waz.zclient.views.menus.FooterMenuCallback)

Example 4 with FooterMenuCallback

use of com.waz.zclient.views.menus.FooterMenuCallback in project wire-android by wireapp.

the class PendingConnectRequestFragment method setFooterForIncomingConnectRequest.

private void setFooterForIncomingConnectRequest(final User user) {
    if (userRequester != IConnectStore.UserRequester.PARTICIPANTS) {
        return;
    }
    footerMenu.setVisibility(View.VISIBLE);
    footerMenu.setRightActionText(getString(R.string.glyph__minus));
    footerMenu.setCallback(new FooterMenuCallback() {

        @Override
        public void onLeftActionClicked() {
            IConversation conversation = user.acceptConnection();
            getContainer().onAcceptedConnectRequest(conversation);
        }

        @Override
        public void onRightActionClicked() {
            getContainer().showRemoveConfirmation(user);
        }
    });
    footerMenu.setLeftActionText(getString(R.string.glyph__plus));
    footerMenu.setLeftActionLabelText(getString(R.string.send_connect_request__connect_button__text));
}
Also used : FooterMenuCallback(com.waz.zclient.views.menus.FooterMenuCallback) IConversation(com.waz.api.IConversation)

Example 5 with FooterMenuCallback

use of com.waz.zclient.views.menus.FooterMenuCallback in project wire-android by wireapp.

the class PendingConnectRequestFragment method setFooterForIgnoredConnectRequest.

private void setFooterForIgnoredConnectRequest(final User user) {
    footerMenu.setVisibility(View.VISIBLE);
    footerMenu.setRightActionText("");
    footerMenu.setRightActionLabelText("");
    footerMenu.setCallback(new FooterMenuCallback() {

        @Override
        public void onLeftActionClicked() {
            IConversation conversation = user.acceptConnection();
            getContainer().onAcceptedConnectRequest(conversation);
        }

        @Override
        public void onRightActionClicked() {
        }
    });
    footerMenu.setLeftActionText(getString(R.string.glyph__plus));
    footerMenu.setLeftActionLabelText(getString(R.string.send_connect_request__connect_button__text));
}
Also used : FooterMenuCallback(com.waz.zclient.views.menus.FooterMenuCallback) IConversation(com.waz.api.IConversation)

Aggregations

FooterMenuCallback (com.waz.zclient.views.menus.FooterMenuCallback)8 IConversation (com.waz.api.IConversation)4 NetworkMode (com.waz.api.NetworkMode)3 NetworkAction (com.waz.zclient.core.stores.network.NetworkAction)3 View (android.view.View)2 TextView (android.widget.TextView)2 User (com.waz.api.User)2 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)2 OpenedGroupActionEvent (com.waz.zclient.controllers.tracking.events.group.OpenedGroupActionEvent)2 UserDetailsView (com.waz.zclient.ui.views.UserDetailsView)2 ImageAssetImageView (com.waz.zclient.views.images.ImageAssetImageView)2