Search in sources :

Example 1 with ConfirmationRequest

use of com.waz.zclient.controllers.confirmation.ConfirmationRequest in project wire-android by wireapp.

the class ConversationListManagerFragment method showBlockConfirmation.

private void showBlockConfirmation(final User user) {
    ConfirmationCallback callback = new TwoButtonConfirmationCallback() {

        @Override
        public void positiveButtonClicked(boolean checkboxIsSelected) {
            if (getStoreFactory() == null || getControllerFactory() == null || getStoreFactory().isTornDown() || getControllerFactory().isTornDown()) {
                return;
            }
            boolean blockingCurrentConversation = user.getConversation().getId().equals(getStoreFactory().getConversationStore().getCurrentConversation().getId());
            getStoreFactory().getConnectStore().blockUser(user);
            if (blockingCurrentConversation) {
                getStoreFactory().getConversationStore().setCurrentConversationToNext(ConversationChangeRequester.BLOCK_USER);
            }
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new BlockingEvent(BlockingEvent.ConformationResponse.BLOCK));
        }

        @Override
        public void negativeButtonClicked() {
            if (getControllerFactory() == null || getControllerFactory().isTornDown()) {
                return;
            }
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new BlockingEvent(BlockingEvent.ConformationResponse.CANCEL));
        }

        @Override
        public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
        }
    };
    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().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) BlockingEvent(com.waz.zclient.controllers.tracking.events.connect.BlockingEvent) TwoButtonConfirmationCallback(com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback) ConfirmationRequest(com.waz.zclient.controllers.confirmation.ConfirmationRequest)

Example 2 with ConfirmationRequest

use of com.waz.zclient.controllers.confirmation.ConfirmationRequest in project wire-android by wireapp.

the class ParticipantFragment method showRemoveConfirmation.

//////////////////////////////////////////////////////////////////////////////////////////
//
//  UserProfileContainer
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
public void showRemoveConfirmation(final User user) {
    // Show confirmation dialog before removing user
    ConfirmationCallback callback = new TwoButtonConfirmationCallback() {

        @Override
        public void positiveButtonClicked(boolean checkboxIsSelected) {
            dismissUserProfile();
            new Handler().post(new Runnable() {

                @Override
                public void run() {
                    getStoreFactory().getConversationStore().getCurrentConversation().removeMember(user);
                    ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new RemoveContactEvent(true, getParticipantsCount()));
                }
            });
        }

        @Override
        public void negativeButtonClicked() {
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new RemoveContactEvent(false, getParticipantsCount()));
        }

        @Override
        public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
        }
    };
    String header = getString(R.string.confirmation_menu__header);
    String text = getString(R.string.confirmation_menu_text_with_name, user.getDisplayName());
    String confirm = getString(R.string.confirmation_menu__confirm_remove);
    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) BaseScalaActivity(com.waz.zclient.BaseScalaActivity) GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) TwoButtonConfirmationCallback(com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback) Handler(android.os.Handler) RemoveContactEvent(com.waz.zclient.controllers.tracking.events.group.RemoveContactEvent) ConfirmationRequest(com.waz.zclient.controllers.confirmation.ConfirmationRequest)

Example 3 with ConfirmationRequest

use of com.waz.zclient.controllers.confirmation.ConfirmationRequest in project wire-android by wireapp.

the class SingleParticipantFragment method showBlockConfirmation.

private void showBlockConfirmation(final User user) {
    ConfirmationCallback callback = new TwoButtonConfirmationCallback() {

        @Override
        public void positiveButtonClicked(boolean checkboxIsSelected) {
            getStoreFactory().getConnectStore().blockUser(user);
            // Dismiss common user profile
            getContainer().dismissUserProfile();
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new BlockingEvent(BlockingEvent.ConformationResponse.BLOCK));
        }

        @Override
        public void negativeButtonClicked() {
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new BlockingEvent(BlockingEvent.ConformationResponse.CANCEL));
        }

        @Override
        public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
        }
    };
    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);
    OptionsTheme optionsTheme = getControllerFactory().getThemeController().getThemeDependentOptionsTheme();
    ConfirmationRequest request = new ConfirmationRequest.Builder().withHeader(header).withMessage(text).withPositiveButton(confirm).withNegativeButton(cancel).withConfirmationCallback(callback).withWireTheme(optionsTheme).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) BlockingEvent(com.waz.zclient.controllers.tracking.events.connect.BlockingEvent) TwoButtonConfirmationCallback(com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback) OptionsTheme(com.waz.zclient.ui.theme.OptionsTheme) ConfirmationRequest(com.waz.zclient.controllers.confirmation.ConfirmationRequest)

Example 4 with ConfirmationRequest

use of com.waz.zclient.controllers.confirmation.ConfirmationRequest in project wire-android by wireapp.

the class ParticipantFragment method showBlockUserConfirmation.

private void showBlockUserConfirmation(final User user) {
    ConfirmationCallback callback = new TwoButtonConfirmationCallback() {

        @Override
        public void positiveButtonClicked(boolean checkboxIsSelected) {
            getStoreFactory().getConversationStore().setCurrentConversationToNext(ConversationChangeRequester.BLOCK_USER);
            getStoreFactory().getConnectStore().blockUser(user);
            getControllerFactory().getConversationScreenController().hideUser();
            if (LayoutSpec.isTablet(getActivity())) {
                getControllerFactory().getConversationScreenController().hideParticipants(false, true);
            }
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new BlockingEvent(BlockingEvent.ConformationResponse.BLOCK));
        }

        @Override
        public void negativeButtonClicked() {
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new BlockingEvent(BlockingEvent.ConformationResponse.CANCEL));
        }

        @Override
        public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
        }
    };
    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);
    OptionsTheme optionsTheme = getControllerFactory().getThemeController().getThemeDependentOptionsTheme();
    ConfirmationRequest request = new ConfirmationRequest.Builder().withHeader(header).withMessage(text).withPositiveButton(confirm).withNegativeButton(cancel).withConfirmationCallback(callback).withWireTheme(optionsTheme).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) BlockingEvent(com.waz.zclient.controllers.tracking.events.connect.BlockingEvent) TwoButtonConfirmationCallback(com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback) OptionsTheme(com.waz.zclient.ui.theme.OptionsTheme) ConfirmationRequest(com.waz.zclient.controllers.confirmation.ConfirmationRequest)

Example 5 with ConfirmationRequest

use of com.waz.zclient.controllers.confirmation.ConfirmationRequest 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)

Aggregations

ConfirmationCallback (com.waz.zclient.controllers.confirmation.ConfirmationCallback)10 ConfirmationRequest (com.waz.zclient.controllers.confirmation.ConfirmationRequest)10 TwoButtonConfirmationCallback (com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback)9 SoundController (com.waz.zclient.media.SoundController)9 GlobalTrackingController (com.waz.zclient.tracking.GlobalTrackingController)9 BlockingEvent (com.waz.zclient.controllers.tracking.events.connect.BlockingEvent)4 LeaveGroupConversationEvent (com.waz.zclient.controllers.tracking.events.group.LeaveGroupConversationEvent)3 OptionsTheme (com.waz.zclient.ui.theme.OptionsTheme)2 SuppressLint (android.annotation.SuppressLint)1 Handler (android.os.Handler)1 ActionMenuView (android.support.v7.widget.ActionMenuView)1 View (android.view.View)1 AbsListView (android.widget.AbsListView)1 TextView (android.widget.TextView)1 IConversation (com.waz.api.IConversation)1 Message (com.waz.api.Message)1 OtrClient (com.waz.api.OtrClient)1 User (com.waz.api.User)1 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)1 DeleteConversationEvent (com.waz.zclient.controllers.tracking.events.conversation.DeleteConversationEvent)1