コード例 #1
0
  @Override
  public void showOptionsMenu(final User user) {
    @IConversationScreenController.ConversationMenuRequester
    int menuRequester =
        (userRequester == IConnectStore.UserRequester.SEARCH)
            ? IConversationScreenController.USER_PROFILE_SEARCH
            : IConversationScreenController.CONVERSATION_DETAILS;

    optionsMenuControl.setTitle(user.getDisplayName());
    optionsMenuControl.createMenu(
        user.getConversation(),
        menuRequester,
        getControllerFactory().getThemeController().getThemeDependentOptionsTheme());
    optionsMenuControl.open();
  }
コード例 #2
0
  @Override
  public void onOptionsItemClicked(IConversation conversation, User user, OptionsMenuItem item) {
    switch (item) {
      case BLOCK:
        showBlockUserConfirmation(user);
        break;
      case UNBLOCK:
        user.unblock();
        break;
      case ARCHIVE:
        getStoreFactory().getConversationStore().archive(conversation, true);
        getControllerFactory()
            .getTrackingController()
            .tagEvent(new ArchivedConversationEvent(conversation.getType().toString()));
        break;
      case UNARCHIVE:
        getStoreFactory().getConversationStore().archive(conversation, false);
        getControllerFactory()
            .getTrackingController()
            .tagEvent(new UnarchivedConversationEvent(conversation.getType().toString()));
        break;
      case SILENCE:
        conversation.setMuted(true);
        break;
      case UNSILENCE:
        conversation.setMuted(false);
        break;
    }

    optionsMenuControl.close();
  }
コード例 #3
0
  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;
            }
            getControllerFactory()
                .getTrackingController()
                .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(IConfirmationController.BLOCK_PENDING)
            .withHeader(header)
            .withMessage(text)
            .withPositiveButton(confirm)
            .withNegativeButton(cancel)
            .withConfirmationCallback(callback)
            .withWireTheme(
                getControllerFactory().getThemeController().getThemeDependentOptionsTheme())
            .build();

    getControllerFactory()
        .getConfirmationController()
        .requestConfirmation(request, IConfirmationController.USER_PROFILE);

    getStoreFactory().getMediaStore().playSound(R.raw.alert);
    getControllerFactory().getVibratorController().vibrate(R.array.alert);
  }