@Override
  public void viewDidLoad() {
    super.viewDidLoad();

    getTableView().setSeparatorStyle(UITableViewCellSeparatorStyle.None);
    getTableView().setBackgroundColor(UIColor.black());

    getNavigationItem().setTitleView(new UIImageView(UIImage.getImage("TitleFindFriends")));

    if (getNavigationController().getViewControllers().first() == this) {
      UIBarButtonItem dismissLeftBarButtonItem =
          new UIBarButtonItem(
              "Back",
              UIBarButtonItemStyle.Plain,
              new UIBarButtonItem.OnClickListener() {
                @Override
                public void onClick(UIBarButtonItem barButtonItem) {
                  getNavigationController().dismissViewController(true, null);
                }
              });
      getNavigationItem().setLeftBarButtonItem(dismissLeftBarButtonItem);
    } else {
      getNavigationItem().setLeftBarButtonItem(null);
    }

    if (MFMailComposeViewController.canSendMail() || MFMessageComposeViewController.canSendText()) {
      headerView = new UIView(new CGRect(0, 0, 320, 67));
      headerView.setBackgroundColor(UIColor.black());
      UIButton clearButton = new UIButton(UIButtonType.Custom);
      clearButton.setBackgroundColor(UIColor.clear());
      clearButton.addOnTouchUpInsideListener(inviteFriendsButtonAction);
      clearButton.setFrame(headerView.getFrame());
      headerView.addSubview(clearButton);
      String inviteString = "Invite friends";
      CGRect boundingRect =
          NSString.getBoundingRect(
              inviteString,
              new CGSize(310, Float.MAX_VALUE),
              NSStringDrawingOptions.with(
                  NSStringDrawingOptions.TruncatesLastVisibleLine,
                  NSStringDrawingOptions.UsesLineFragmentOrigin),
              new NSAttributedStringAttributes().setFont(UIFont.getBoldSystemFont(18)),
              null);
      CGSize inviteStringSize = boundingRect.getSize();

      UILabel inviteLabel =
          new UILabel(
              new CGRect(
                  10,
                  (headerView.getFrame().getSize().getHeight() - inviteStringSize.getHeight()) / 2,
                  inviteStringSize.getWidth(),
                  inviteStringSize.getHeight()));
      inviteLabel.setText(inviteString);
      inviteLabel.setFont(UIFont.getBoldSystemFont(18));
      inviteLabel.setTextColor(UIColor.white());
      inviteLabel.setBackgroundColor(UIColor.clear());
      headerView.addSubview(inviteLabel);
      getTableView().setTableHeaderView(headerView);
    }
  }
  @Override
  public void didLoadObjects(NSError error) {
    super.didLoadObjects(error);

    PFQuery<PAPActivity> isFollowingQuery = PFQuery.getQuery(PAPActivity.class);
    isFollowingQuery.whereEqualTo(PAPActivity.FROM_USER_KEY, PAPUser.getCurrentUser());
    isFollowingQuery.whereEqualTo(PAPActivity.TYPE_KEY, PAPActivityType.FOLLOW.getKey());
    isFollowingQuery.whereContainedIn(PAPActivity.TO_USER_KEY, getObjects());
    isFollowingQuery.whereContainedIn(PAPActivity.TO_USER_KEY, getObjects());
    isFollowingQuery.setCachePolicy(PFCachePolicy.NetworkOnly);

    isFollowingQuery.countInBackground(
        new PFCountCallback() {
          @Override
          public void done(int count, NSError error) {
            NSArray<PAPUser> objects = getObjects();
            if (error == null) {
              if (count == objects.size()) {
                followStatus = PAPFindFriendsFollowStatus.ALL;
                configureUnfollowAllButton();
                for (PAPUser user : objects) {
                  PAPCache.getSharedCache().setUserFollowStatus(user, true);
                }
              } else if (count == 0) {
                followStatus = PAPFindFriendsFollowStatus.NONE;
                configureFollowAllButton();
                for (PAPUser user : objects) {
                  PAPCache.getSharedCache().setUserFollowStatus(user, false);
                }
              } else {
                followStatus = PAPFindFriendsFollowStatus.SOME;
                configureFollowAllButton();
              }
            }

            if (objects.size() == 0) {
              getNavigationItem().setRightBarButtonItem(null);
            }
          }
        });

    if (getObjects().size() == 0) {
      getNavigationItem().setRightBarButtonItem(null);
    }
  }
 @Override
 public void viewWillAppear(boolean animated) {
   super.viewWillAppear(animated);
   getTableView().setSeparatorColor(UIColor.fromRGBA(30f / 255f, 30f / 255f, 30f / 255f, 1));
 }