Example usage for twitter4j User getId

List of usage examples for twitter4j User getId

Introduction

In this page you can find the example usage for twitter4j User getId.

Prototype

long getId();

Source Link

Document

Returns the id of the user

Usage

From source file:com.freshdigitable.udonroad.module.realm.UserRealm.java

License:Apache License

UserRealm(final User user) {
    this.id = user.getId();
    this.profileImageURLHttps = user.getProfileImageURLHttps();
    this.miniProfileImageURLHttps = user.getMiniProfileImageURLHttps();
    this.name = user.getName();
    this.screenName = user.getScreenName();
    this.description = user.getDescription();
    this.profileBannerMobileURL = user.getProfileBannerMobileURL();
    this.statusesCount = user.getStatusesCount();
    this.followersCount = user.getFollowersCount();
    this.friendsCount = user.getFriendsCount();
    this.favoritesCount = user.getFavouritesCount();
    this.profileLinkColor = user.getProfileLinkColor();
    this.descriptionURLEntities = URLEntityRealm.createList(user.getDescriptionURLEntities());
    this.url = user.getURL();
    if (user.getURLEntity() != null) {
        this.urlEntity = new URLEntityRealm(user.getURLEntity());
    }//  ww w.  ja  v  a 2  s.  co m
    this.location = user.getLocation();
    this.verified = user.isVerified();
    this.isProtected = user.isProtected();
}

From source file:com.freshdigitable.udonroad.module.realm.UserSortedCacheRealm.java

License:Apache License

@Override
public void upsert(List<User> entities) {
    if (entities == null || entities.isEmpty()) {
        return;/*ww  w.j  ava 2 s.co m*/
    }
    userCache.upsert(entities);
    final List<ListedUserIDs> inserts = new ArrayList<>();
    for (User user : entities) {
        final ListedUserIDs userIds = realm.where(ListedUserIDs.class).equalTo("userId", user.getId())
                .findFirst();
        if (userIds == null) {
            inserts.add(new ListedUserIDs(user, order));
            order++;
        }
    }
    realm.beginTransaction();
    final List<ListedUserIDs> inserted = realm.copyToRealmOrUpdate(inserts);
    realm.commitTransaction();
    if (inserted.isEmpty() || !insertEvent.hasObservers()) {
        return;
    }
    updateCursorList(entities);
    ordered.addChangeListener(new RealmChangeListener<RealmResults<ListedUserIDs>>() {
        @Override
        public void onChange(RealmResults<ListedUserIDs> element) {
            for (ListedUserIDs ids : inserted) {
                insertEvent.onNext(ids.order);
            }
            element.removeChangeListener(this);
        }
    });
}

From source file:com.freshdigitable.udonroad.module.twitter.TwitterApi.java

License:Apache License

public Observable<List<Status>> getUserTimeline(final User user) {
    final long userId = user.getId();
    return getUserTimeline(userId);
}

From source file:com.freshdigitable.udonroad.StatusViewImageHelper.java

License:Apache License

public static void load(User user, FullStatusView itemView) {
    loadUserIcon(user, user.getId(), itemView);
}

From source file:com.freshdigitable.udonroad.TimelineInstTestBase.java

License:Apache License

protected void setupConfig(User loginUser) throws Exception {
    final TwitterAPIConfiguration twitterAPIConfigMock = TwitterResponseMock.createTwitterAPIConfigMock();
    when(twitter.getAPIConfiguration()).thenReturn(twitterAPIConfigMock);

    final long userId = loginUser.getId();
    when(twitter.getId()).thenReturn(userId);
    when(twitter.showUser(userId)).thenReturn(loginUser);
    when(twitter.verifyCredentials()).thenReturn(loginUser);

    final IDs ignoringUserIDsMock = mock(IDs.class);
    when(ignoringUserIDsMock.getIDs()).thenReturn(new long[0]);
    when(ignoringUserIDsMock.getNextCursor()).thenReturn(0L);
    when(ignoringUserIDsMock.getPreviousCursor()).thenReturn(0L);
    when(twitter.getBlocksIDs()).thenReturn(ignoringUserIDsMock);
    when(twitter.getBlocksIDs(anyLong())).thenReturn(ignoringUserIDsMock);
    when(twitter.getMutesIDs(anyLong())).thenReturn(ignoringUserIDsMock);
}

From source file:com.freshdigitable.udonroad.TimelineInstTestBase.java

License:Apache License

protected int setupDefaultUserInfoTimeline() throws TwitterException {
    final User loginUser = getLoginUser();
    final ResponseList<Status> responseList = createDefaultResponseList(loginUser);
    this.responseList = responseList;
    final ResponseList<Status> emptyStatusResponseList = createResponseList();

    final int size = responseList.size();
    when(loginUser.getStatusesCount()).thenReturn(size);
    when(twitter.getUserTimeline(loginUser.getId())).thenReturn(responseList);
    when(twitter.getUserTimeline(anyLong(), any(Paging.class))).thenReturn(emptyStatusResponseList);
    when(twitter.getFavorites(anyLong())).thenReturn(emptyStatusResponseList);
    final PagableResponseList<User> emptyUserPagableResponseList = mock(PagableResponseList.class);
    when(twitter.getFollowersList(anyLong(), anyLong())).thenReturn(emptyUserPagableResponseList);
    when(twitter.getFriendsList(anyLong(), anyLong())).thenReturn(emptyUserPagableResponseList);

    final Relationship relationship = mock(Relationship.class);
    when(relationship.isSourceFollowingTarget()).thenReturn(true);
    when(relationship.isSourceMutingTarget()).thenReturn(false);
    when(twitter.showFriendship(anyLong(), anyLong())).thenReturn(relationship);
    return responseList.size();
}

From source file:com.freshdigitable.udonroad.UserInfoActivity.java

License:Apache License

public static Intent createIntent(Context context, User user) {
    return createIntent(context, user.getId());
}

From source file:com.freshdigitable.udonroad.UserInfoActivity.java

License:Apache License

public static void start(Activity activity, User user, View userIcon) {
    final Intent intent = createIntent(activity.getApplicationContext(), user.getId());
    ViewCompat.setTransitionName(userIcon, "user_icon");
    ActivityCompat.startActivity(activity, intent,
            ActivityOptionsCompat.makeSceneTransitionAnimation(activity, userIcon, "user_icon").toBundle());
}

From source file:com.freshdigitable.udonroad.util.UserUtil.java

License:Apache License

public static User create() {
    final User mock = mock(User.class);
    when(mock.getScreenName()).thenReturn("akihito104");
    when(mock.getName()).thenReturn("Akihito Matsuda");
    when(mock.getId()).thenReturn(2000L);
    when(mock.getProfileBackgroundColor()).thenReturn("ffffff");
    when(mock.getDescription()).thenReturn("user description is here.");
    when(mock.getDescriptionURLEntities()).thenReturn(new URLEntity[0]);
    when(mock.getURL()).thenReturn(null);
    when(mock.getLocation()).thenReturn(null);
    return mock;// ww  w .  j  a v  a 2  s  .c o  m
}

From source file:com.github.gorbin.asne.twitter.TwitterSocialNetwork.java

License:Open Source License

private SocialPerson getSocialPerson(SocialPerson socialPerson, User user) {
    socialPerson.id = Long.toString(user.getId());
    socialPerson.name = user.getName();// w  ww . ja  v a2  s  .  c  om
    socialPerson.avatarURL = user.getBiggerProfileImageURL();
    socialPerson.profileURL = user.getURL();
    return socialPerson;
}