コード例 #1
0
  private Invite makeInvite() {
    Invite invite = new Invite();

    for (String contact : contactSelectionMap.keySet()) {
      Friend friend = new Friend();
      friend.phone = contact;
      invite.phone.add(friend);
    }
    return invite;
  }
コード例 #2
0
  private void block() {
    Friend friend = new Friend();
    friend.id = blockId;
    friend.state = "B";
    Util.backGroundRest(
        "friend",
        "PUT",
        friend,
        Response.class,
        new CallBack<Response>() {
          @Override
          public void success(Response result) {
            load();
          }
        });
    //       Util.rest("friend", "PUT", friend, Response.class);

  }
コード例 #3
0
  @Override
  protected void confirm() {
    if ("info".equals(type)) {
      backGroundRest(
          "friend",
          "POST",
          makeInvite(),
          Invite.class,
          new CallBack<Invite>() {
            @Override
            public void success(Invite result) {}
          });
    } else if ("team".equals(type)) {

      Invite invite = makeInvite();
      invite.team = team.id;
      invite.phone.addAll(selectionMap.values());

      backGroundRest(
          "team/invite",
          "POST",
          invite,
          Invite.class,
          new CallBack<Invite>() {
            @Override
            public void success(Invite result) {
              Intent intent = new Intent(ChooseContactsActivity.this, TeamDetailActivity.class);
              intent.putExtra("teamId", team.id);
              startActivity(intent);
            }
          });

    } else if ("invite".equals(type)) {

      Invite invite = makeInvite();
      invite.team = team.id;
      invite.friends = new ArrayList<Integer>();
      for (Friend friend : selectionMap.values()) {
        invite.friends.add(friend.friend);
      }
      //            invite.phone.addAll(selectionMap.values());

      backGroundRest(
          "team/invite",
          "POST",
          invite,
          Invite.class,
          new CallBack<Invite>() {
            @Override
            public void success(Invite result) {
              succeed();
            }
          });

    } else {

      prayer.friends = new ArrayList<Friend>();
      for (Integer id : selectionMap.keySet()) {
        Friend friend = new Friend();
        friend.friend = id;
        prayer.friends.add(friend);
      }

      prayer.phone = new ArrayList<String>();
      prayer.phone.addAll(contactSelectionMap.keySet());

      if (selectionMap.size() + contactSelectionMap.size() > Global.FREE_FRIENDS_COUNT) {

        int total = selectionMap.size() + contactSelectionMap.size();
        final int ex = total - Global.FREE_FRIENDS_COUNT;

        showDialog(EX_DIALOG);

      } else {
        RestService.makePrayer(
            prayer,
            new CallBack<Response>() {
              @Override
              public void success(Response result) {
                succeed();
              }
            });
      }
    }

    if (contactSelectionMap.size() > 0) {
      Toast toast = Toast.makeText(getApplicationContext(), "초대하였습니다.", Toast.LENGTH_LONG);
      //            toast.setGravity(Gravity.CENTER, 0, 0);
      toast.show();
    }
  }