Search in sources :

Example 1 with LeaveGroupConversationEvent

use of com.waz.zclient.controllers.tracking.events.group.LeaveGroupConversationEvent in project wire-android by wireapp.

the class ParticipantFragment method showLeaveConfirmation.

//////////////////////////////////////////////////////////////////////////////////////////
//
//  Confirmation overlays
//
//////////////////////////////////////////////////////////////////////////////////////////
private void showLeaveConfirmation(final IConversation conversation) {
    ConfirmationCallback callback = new TwoButtonConfirmationCallback() {

        @Override
        public void positiveButtonClicked(boolean checkboxIsSelected) {
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new LeaveGroupConversationEvent(true, getStoreFactory().getConversationStore().getCurrentConversation().getUsers().size()));
            getStoreFactory().getConversationStore().leave(conversation);
            getStoreFactory().getConversationStore().setCurrentConversationToNext(ConversationChangeRequester.LEAVE_CONVERSATION);
            if (LayoutSpec.isTablet(getActivity())) {
                getControllerFactory().getConversationScreenController().hideParticipants(false, true);
            }
        }

        @Override
        public void negativeButtonClicked() {
            ((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().getThemeDependentOptionsTheme()).build();
    getControllerFactory().getConfirmationController().requestConfirmation(request, IConfirmationController.PARTICIPANTS);
    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 2 with LeaveGroupConversationEvent

use of com.waz.zclient.controllers.tracking.events.group.LeaveGroupConversationEvent in project wire-android by wireapp.

the class ParticipantBodyFragment method showLeaveConfirmation.

private void showLeaveConfirmation(final IConversation conversation) {
    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);
            if (LayoutSpec.isTablet(getActivity())) {
                getControllerFactory().getConversationScreenController().hideParticipants(false, true);
            }
        }

        @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);
    String 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().getThemeDependentOptionsTheme()).withCheckboxSelectedByDefault().build();
    getControllerFactory().getConfirmationController().requestConfirmation(request, IConfirmationController.PARTICIPANTS);
    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 3 with LeaveGroupConversationEvent

use of com.waz.zclient.controllers.tracking.events.group.LeaveGroupConversationEvent 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)

Aggregations

ConfirmationCallback (com.waz.zclient.controllers.confirmation.ConfirmationCallback)3 ConfirmationRequest (com.waz.zclient.controllers.confirmation.ConfirmationRequest)3 TwoButtonConfirmationCallback (com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback)3 LeaveGroupConversationEvent (com.waz.zclient.controllers.tracking.events.group.LeaveGroupConversationEvent)3 SoundController (com.waz.zclient.media.SoundController)3 GlobalTrackingController (com.waz.zclient.tracking.GlobalTrackingController)3