/*
   * (non-Javadoc)
   * @see com.socialize.networks.AbstractSocialNetworkSharer#doShare(android.app.Activity, com.socialize.entity.Entity, com.socialize.entity.PropagationUrlSet, java.lang.String, com.socialize.networks.SocialNetworkListener, com.socialize.api.action.ActionType)
   */
  @Override
  protected void doShare(
      Activity context,
      Entity entity,
      PropagationInfo urlSet,
      String comment,
      SocialNetworkListener listener,
      ActionType type) {

    Tweet tweet = new Tweet();

    switch (type) {
      case SHARE:
        if (StringUtils.isEmpty(comment)) comment = "Shared " + entity.getDisplayName();
        break;
      case LIKE:
        comment = "\u2764 likes " + entity.getDisplayName();
        break;
      case VIEW:
        comment = "Viewed " + entity.getDisplayName();
        break;
    }

    StringBuilder status = new StringBuilder();

    if (StringUtils.isEmpty(comment)) {
      status.append(entity.getDisplayName());
    } else {
      status.append(comment);
    }

    status.append(", ");
    status.append(urlSet.getEntityUrl());

    tweet.setText(status.toString());

    UserSettings settings = UserUtils.getUserSettings(context);

    if (settings != null && settings.isLocationEnabled()) {
      tweet.setLocation(LocationUtils.getLastKnownLocation(context));
      tweet.setShareLocation(true);
    }

    TwitterUtils.tweet(context, tweet, listener);
  }