Search in sources :

Example 11 with SoundController

use of com.waz.zclient.media.SoundController in project wire-android by wireapp.

the class PendingConnectRequestManagerFragment method showBlockUserConfirmation.

private void showBlockUserConfirmation(final User user) {
    getControllerFactory().getNavigationController().setRightPage(Page.CONFIRMATION_DIALOG, TAG);
    ConfirmationCallback callback = new TwoButtonConfirmationCallback() {

        @Override
        public void positiveButtonClicked(boolean checkboxIsSelected) {
            getStoreFactory().getConnectStore().blockUser(user);
            final IConnectStore.UserRequester userRequester = IConnectStore.UserRequester.valueOf(getArguments().getString(ARGUMENT_USER_REQUESTER));
            getStoreFactory().getConnectStore().blockUser(user);
            switch(userRequester) {
                case CONVERSATION:
                    getStoreFactory().getConversationStore().setCurrentConversationToNext(ConversationChangeRequester.BLOCK_USER);
                    break;
                case SEARCH:
                case POPOVER:
                    getControllerFactory().getPickUserController().hideUserProfile();
                    break;
            }
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new BlockingEvent(BlockingEvent.ConformationResponse.BLOCK));
        }

        @Override
        public void negativeButtonClicked() {
        }

        @Override
        public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
            restoreCurrentPageAfterClosingOverlay();
        }
    };
    String header = getString(R.string.confirmation_menu__block_header);
    String text = getString(R.string.confirmation_menu__block_text_with_name, user.getDisplayName());
    String confirm = getString(R.string.confirmation_menu__confirm_block);
    String cancel = getString(R.string.confirmation_menu__cancel);
    ConfirmationRequest request = new ConfirmationRequest.Builder().withHeader(header).withMessage(text).withPositiveButton(confirm).withNegativeButton(cancel).withConfirmationCallback(callback).withWireTheme(getControllerFactory().getThemeController().getThemeDependentOptionsTheme()).build();
    getControllerFactory().getConfirmationController().requestConfirmation(request, IConfirmationController.USER_PROFILE);
    SoundController ctrl = inject(SoundController.class);
    if (ctrl != null) {
        ctrl.playAlert();
    }
}
Also used : SoundController(com.waz.zclient.media.SoundController) ConfirmationCallback(com.waz.zclient.controllers.confirmation.ConfirmationCallback) TwoButtonConfirmationCallback(com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback) GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) IConnectStore(com.waz.zclient.core.stores.connect.IConnectStore) BlockingEvent(com.waz.zclient.controllers.tracking.events.connect.BlockingEvent) TwoButtonConfirmationCallback(com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback) ConfirmationRequest(com.waz.zclient.controllers.confirmation.ConfirmationRequest)

Example 12 with SoundController

use of com.waz.zclient.media.SoundController in project wire-android by wireapp.

the class ConversationListManagerFragment method leaveConversation.

//////////////////////////////////////////////////////////////////////////////////////////
//
//  ConversationListFragment.Container
//
//////////////////////////////////////////////////////////////////////////////////////////
public void leaveConversation(final IConversation conversation) {
    closeMenu();
    ConfirmationCallback callback = new TwoButtonConfirmationCallback() {

        @Override
        public void positiveButtonClicked(boolean checkboxIsSelected) {
            if (getStoreFactory() == null || getControllerFactory() == null || getStoreFactory().isTornDown() || getControllerFactory().isTornDown()) {
                return;
            }
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new LeaveGroupConversationEvent(true, getStoreFactory().getConversationStore().getCurrentConversation().getUsers().size()));
            getStoreFactory().getConversationStore().leave(conversation);
            getStoreFactory().getConversationStore().setCurrentConversationToNext(ConversationChangeRequester.LEAVE_CONVERSATION);
        }

        @Override
        public void negativeButtonClicked() {
            if (getControllerFactory() == null || getControllerFactory().isTornDown()) {
                return;
            }
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new LeaveGroupConversationEvent(false, getStoreFactory().getConversationStore().getCurrentConversation().getUsers().size()));
        }

        @Override
        public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
        }
    };
    String header = getString(R.string.confirmation_menu__meta_remove);
    String text = getString(R.string.confirmation_menu__meta_remove_text);
    String confirm = getString(R.string.confirmation_menu__confirm_leave);
    String cancel = getString(R.string.confirmation_menu__cancel);
    ConfirmationRequest request = new ConfirmationRequest.Builder().withHeader(header).withMessage(text).withPositiveButton(confirm).withNegativeButton(cancel).withConfirmationCallback(callback).withWireTheme(getControllerFactory().getThemeController().getOptionsDarkTheme()).build();
    getControllerFactory().getConfirmationController().requestConfirmation(request, IConfirmationController.CONVERSATION_LIST);
    SoundController ctrl = inject(SoundController.class);
    if (ctrl != null) {
        ctrl.playAlert();
    }
}
Also used : SoundController(com.waz.zclient.media.SoundController) ConfirmationCallback(com.waz.zclient.controllers.confirmation.ConfirmationCallback) TwoButtonConfirmationCallback(com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback) GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) TwoButtonConfirmationCallback(com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback) LeaveGroupConversationEvent(com.waz.zclient.controllers.tracking.events.group.LeaveGroupConversationEvent) ConfirmationRequest(com.waz.zclient.controllers.confirmation.ConfirmationRequest)

Example 13 with SoundController

use of com.waz.zclient.media.SoundController in project wire-android by wireapp.

the class ConversationListManagerFragment method deleteConversation.

public void deleteConversation(final IConversation conversation) {
    closeMenu();
    ConfirmationCallback callback = new TwoButtonConfirmationCallback() {

        @Override
        public void positiveButtonClicked(boolean checkboxIsSelected) {
        }

        @Override
        public void negativeButtonClicked() {
        }

        @Override
        public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
            if (getStoreFactory() == null || getStoreFactory().isTornDown() || getControllerFactory() == null || getControllerFactory().isTornDown()) {
                return;
            }
            if (!confirmed) {
                ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new DeleteConversationEvent(ConversationType.getValue(conversation), DeleteConversationEvent.Context.LIST, DeleteConversationEvent.Response.CANCEL));
                return;
            }
            boolean deleteCurrentConversation = conversation.getId().equals(getStoreFactory().getConversationStore().getCurrentConversation().getId());
            getStoreFactory().getConversationStore().deleteConversation(conversation, checkboxIsSelected);
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new DeleteConversationEvent(ConversationType.getValue(conversation), DeleteConversationEvent.Context.LIST, DeleteConversationEvent.Response.DELETE));
            if (deleteCurrentConversation) {
                getStoreFactory().getConversationStore().setCurrentConversationToNext(ConversationChangeRequester.DELETE_CONVERSATION);
            }
        }
    };
    String header = getString(R.string.confirmation_menu__meta_delete);
    String text = getString(R.string.confirmation_menu__meta_delete_text);
    String confirm = getString(R.string.confirmation_menu__confirm_delete);
    String cancel = getString(R.string.confirmation_menu__cancel);
    String checkboxLabel = "";
    if (conversation.getType() == IConversation.Type.GROUP) {
        checkboxLabel = getString(R.string.confirmation_menu__delete_conversation__checkbox__label);
    }
    ConfirmationRequest request = new ConfirmationRequest.Builder().withHeader(header).withMessage(text).withPositiveButton(confirm).withNegativeButton(cancel).withConfirmationCallback(callback).withCheckboxLabel(checkboxLabel).withWireTheme(getControllerFactory().getThemeController().getOptionsDarkTheme()).build();
    getControllerFactory().getConfirmationController().requestConfirmation(request, IConfirmationController.CONVERSATION_LIST);
    SoundController ctrl = inject(SoundController.class);
    if (ctrl != null) {
        ctrl.playAlert();
    }
}
Also used : SoundController(com.waz.zclient.media.SoundController) ConfirmationCallback(com.waz.zclient.controllers.confirmation.ConfirmationCallback) TwoButtonConfirmationCallback(com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback) GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) TwoButtonConfirmationCallback(com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback) DeleteConversationEvent(com.waz.zclient.controllers.tracking.events.conversation.DeleteConversationEvent) ConfirmationRequest(com.waz.zclient.controllers.confirmation.ConfirmationRequest)

Aggregations

SoundController (com.waz.zclient.media.SoundController)13 GlobalTrackingController (com.waz.zclient.tracking.GlobalTrackingController)13 ConfirmationCallback (com.waz.zclient.controllers.confirmation.ConfirmationCallback)10 ConfirmationRequest (com.waz.zclient.controllers.confirmation.ConfirmationRequest)10 TwoButtonConfirmationCallback (com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback)10 BlockingEvent (com.waz.zclient.controllers.tracking.events.connect.BlockingEvent)4 IConversation (com.waz.api.IConversation)3 LeaveGroupConversationEvent (com.waz.zclient.controllers.tracking.events.group.LeaveGroupConversationEvent)3 DeleteConversationEvent (com.waz.zclient.controllers.tracking.events.conversation.DeleteConversationEvent)2 OptionsTheme (com.waz.zclient.ui.theme.OptionsTheme)2 SuppressLint (android.annotation.SuppressLint)1 Handler (android.os.Handler)1 NetworkMode (com.waz.api.NetworkMode)1 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)1 RemoveContactEvent (com.waz.zclient.controllers.tracking.events.group.RemoveContactEvent)1 OpenedMoreActionsEvent (com.waz.zclient.controllers.tracking.events.navigation.OpenedMoreActionsEvent)1 Event (com.waz.zclient.core.controllers.tracking.events.Event)1 StartedRecordingAudioMessageEvent (com.waz.zclient.core.controllers.tracking.events.media.StartedRecordingAudioMessageEvent)1 ChangedContactsPermissionEvent (com.waz.zclient.core.controllers.tracking.events.settings.ChangedContactsPermissionEvent)1 ChangedImageDownloadPreferenceEvent (com.waz.zclient.core.controllers.tracking.events.settings.ChangedImageDownloadPreferenceEvent)1