Пример #1
0
  /** {@inheritDoc} */
  @Override
  public void updateStory(
      String message,
      String name,
      String caption,
      String description,
      String link,
      String picture,
      final SocialCallbacks.SocialActionListener socialActionListener) {
    if (!isInitialized) {
      return;
    }

    SoomlaUtils.LogDebug(TAG, "updateStory");

    RefProvider = getProvider();
    RefSocialActionListener = socialActionListener;

    preformingAction = ACTION_PUBLISH_STORY;

    try {
      twitter.updateStatus(message + " " + link);
    } catch (Exception e) {
      failListener(ACTION_PUBLISH_STORY, e.getMessage());
    }
  }
Пример #2
0
 public void onDisable() {
   try {
     if (connection != null && !connection.isClosed()) {
       connection.close();
     }
   } catch (Exception e) {
     // e.printStackTrace();
     this.getLogger().warning("Couldn't close MySQL Connection: " + e.getMessage() + "\n");
   }
 }
Пример #3
0
  /** {@inheritDoc} */
  @Override
  public void getUserProfile(final AuthCallbacks.UserProfileListener userProfileListener) {
    if (!isInitialized) {
      return;
    }

    SoomlaUtils.LogDebug(TAG, "getUserProfile");

    RefProvider = getProvider();
    RefUserProfileListener = userProfileListener;

    preformingAction = ACTION_GET_USER_PROFILE;

    try {
      twitter.showUser(twitterScreenName);
    } catch (Exception e) {
      failListener(ACTION_GET_USER_PROFILE, e.getMessage());
    }
  }
Пример #4
0
  /** {@inheritDoc} */
  @Override
  public void updateStatus(
      String status, final SocialCallbacks.SocialActionListener socialActionListener) {
    if (!isInitialized) {
      return;
    }

    SoomlaUtils.LogDebug(TAG, "updateStatus");

    RefProvider = getProvider();
    RefSocialActionListener = socialActionListener;

    preformingAction = ACTION_PUBLISH_STATUS;

    try {
      twitter.updateStatus(status);
    } catch (Exception e) {
      failListener(ACTION_PUBLISH_STATUS, e.getMessage());
    }
  }
Пример #5
0
  /** {@inheritDoc} */
  @Override
  public void getContacts(
      boolean fromStart, final SocialCallbacks.ContactsListener contactsListener) {
    if (!isInitialized) {
      return;
    }

    SoomlaUtils.LogDebug(TAG, "getContacts");

    RefProvider = getProvider();
    RefContactsListener = contactsListener;

    preformingAction = ACTION_GET_USER_PROFILE;

    try {
      twitter.getFriendsList(twitterScreenName, fromStart ? -1 : this.lastContactCursor);
      this.lastContactCursor = -1;
    } catch (Exception e) {
      failListener(ACTION_GET_USER_PROFILE, e.getMessage());
    }
  }
Пример #6
0
  /** {@inheritDoc} */
  @Override
  public void uploadImage(
      String message,
      String filePath,
      final SocialCallbacks.SocialActionListener socialActionListener) {
    if (!isInitialized) {
      return;
    }

    SoomlaUtils.LogDebug(TAG, "uploadImage");

    RefProvider = getProvider();
    RefSocialActionListener = socialActionListener;

    preformingAction = ACTION_UPLOAD_IMAGE;

    try {
      StatusUpdate updateImage = new StatusUpdate(message);
      updateImage.media(new File(filePath));
      twitter.updateStatus(updateImage);
    } catch (Exception e) {
      failListener(ACTION_UPLOAD_IMAGE, e.getMessage());
    }
  }
Пример #7
0
  /** {@inheritDoc} */
  @Override
  public void getFeed(Boolean fromStart, final SocialCallbacks.FeedListener feedListener) {
    if (!isInitialized) {
      return;
    }

    SoomlaUtils.LogDebug(TAG, "getFeed");

    RefProvider = getProvider();
    RefFeedListener = feedListener;

    preformingAction = ACTION_GET_FEED;

    try {
      if (fromStart) {
        this.lastFeedCursor = 1;
      }

      Paging paging = new Paging(this.lastFeedCursor, PAGE_SIZE);
      twitter.getUserTimeline(paging);
    } catch (Exception e) {
      failListener(ACTION_GET_FEED, e.getMessage());
    }
  }