Search in sources :

Example 1 with RemoveContactEvent

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

Aggregations

Handler (android.os.Handler)1 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)1 ConfirmationCallback (com.waz.zclient.controllers.confirmation.ConfirmationCallback)1 ConfirmationRequest (com.waz.zclient.controllers.confirmation.ConfirmationRequest)1 TwoButtonConfirmationCallback (com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback)1 RemoveContactEvent (com.waz.zclient.controllers.tracking.events.group.RemoveContactEvent)1 SoundController (com.waz.zclient.media.SoundController)1 GlobalTrackingController (com.waz.zclient.tracking.GlobalTrackingController)1