コード例 #1
0
  public void load() {

    final Search search = new Search();
    search.searchId = teamId;

    backGroundRest(
        "team/detail",
        "POST",
        search,
        Team.class,
        new CallBack<Team>() {
          @Override
          public void success(Team team) {
            setPicture(team.picture, picture);
            name.setText(team.name);
            text.setText(team.text);

            members.setText(team.memberCount + "ыкЕ");
            leaders.setText(team.leader);

            getSupportActionBar().setTitle(team.name);

            if (!"J".equals(team.joined) && "N".equals(team.scope)) {
              text.setVisibility(View.VISIBLE);

              TeamDetailActivity.this.search.setVisibility(View.GONE);
              container.setVisibility(View.GONE);
            } else {
              text.setVisibility(View.GONE);

              TeamDetailActivity.this.search.setVisibility(View.VISIBLE);
              container.setVisibility(View.VISIBLE);
            }

            if (team.joined == null) {
              join.setVisibility(View.VISIBLE);
            } else {
              join.setVisibility(View.GONE);
            }

            if ("R".equals(team.joined)) {
              wait.setVisibility(View.VISIBLE);
            } else {
              wait.setVisibility(View.GONE);
            }

            Type listType = new TypeToken<ArrayList<Prayer>>() {}.getType();

            List<Prayer> prayerList = Util.rest("team/prayer", "POST", search, listType);

            setPrayerView(R.id.prayer_list, prayerList, false);
          }
        });
  }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_team_detail);

    Intent intent = getIntent();
    teamId = intent.getIntExtra("teamId", -1);

    Search search = new Search();
    search.searchId = teamId;

    backGroundRest(
        "team/detail",
        "POST",
        search,
        Team.class,
        new CallBack<Team>() {
          @Override
          public void success(Team team) {

            TeamDetailActivity.this.team = team;

            if (team == null) return;

            if (team.init == 0) {
              team.init = 1;

              rest("team", "PUT", team);
              Intent inviteIntent =
                  new Intent(TeamDetailActivity.this, ChooseContactsActivity.class);
              //                           intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
              // Intent.FLAG_ACTIVITY_NEW_TASK);
              inviteIntent.putExtra("type", "team");
              inviteIntent.putExtra("team", team);

              startActivityForResult(inviteIntent, 0);

              if (menu != null) {
                MenuItem write = menu.findItem(R.id.action_write);
                if ("J".equals(team.joined)) {
                  write.setVisible(true);
                } else {
                  write.setVisible(false);
                }
              }
            }
          }
        });
  }