Example usage for twitter4j User getDescriptionURLEntities

List of usage examples for twitter4j User getDescriptionURLEntities

Introduction

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

Prototype

URLEntity[] getDescriptionURLEntities();

Source Link

Document

Returns URL entities for user description.

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());
    }//from   w  w  w. j a  v  a 2 s. c o  m
    this.location = user.getLocation();
    this.verified = user.isVerified();
    this.isProtected = user.isProtected();
}

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

License:Apache License

void merge(@NonNull User u, @NonNull Realm realm) {
    if (u.getDescription() != null) { // description is nullable
        this.description = u.getDescription();
        final URLEntity[] descriptionURLEntities = u.getDescriptionURLEntities();
        if (descriptionURLEntities != null && descriptionURLEntities.length > 0) {
            this.descriptionURLEntities.clear();
            for (URLEntity url : descriptionURLEntities) {
                this.descriptionURLEntities.add(URLEntityRealm.findOrCreateFromRealm(url, realm));
            }/*from   w  ww  . j a v a 2s.co  m*/
        }
    }
    this.favoritesCount = u.getFavouritesCount();
    this.followersCount = u.getFollowersCount();
    this.friendsCount = u.getFriendsCount();
    this.miniProfileImageURLHttps = u.getMiniProfileImageURLHttps();
    this.name = u.getName();
    this.profileBannerMobileURL = u.getProfileBannerMobileURL();
    this.profileImageURLHttps = u.getProfileImageURLHttps();
    this.profileLinkColor = u.getProfileLinkColor();
    this.screenName = u.getScreenName();
    this.statusesCount = u.getStatusesCount();
    this.url = u.getURL();
    final URLEntity urlEntity = u.getURLEntity();
    if (urlEntity != null && isNewUrlEntity(urlEntity)) {
        this.urlEntity = URLEntityRealm.findOrCreateFromRealm(urlEntity, realm);
    }
    this.location = u.getLocation();
    this.verified = u.isVerified();
    this.isProtected = u.isProtected();
}

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

License:Apache License

public void bindData(User user) {
    name.setText(user.getName());/*from  w  w w .j a  v a 2s.com*/
    if (user.isVerified()) {
        verifiedIcon.setVisibility(VISIBLE);
    }
    if (user.isProtected()) {
        protectedIcon.setVisibility(VISIBLE);
    }
    UserInfoActivity.bindUserScreenName(screenName, user);
    final CharSequence desc = SpannableStringUtil.create(user.getDescription(),
            user.getDescriptionURLEntities());
    description.setText(desc);

    final String profileLinkColor = user.getProfileLinkColor();
    if (isColorParsable(profileLinkColor)) {
        final int color = parseColor(profileLinkColor);
        banner.setBackgroundColor(color);
    }

    bindURL(user);

    if (TextUtils.isEmpty(user.getLocation())) {
        locationIcon.setVisibility(GONE);
        location.setVisibility(GONE);
    } else {
        locationIcon.setVisibility(VISIBLE);
        location.setVisibility(VISIBLE);
        location.setText(user.getLocation());
    }
}

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;/*  w  w  w  . ja  v  a  2s  . co m*/
}

From source file:org.tweetalib.android.model.TwitterUser.java

License:Apache License

public TwitterUser(User user) {
    mId = user.getId();/*from  ww w .  j  av  a  2s .  c  o  m*/
    mScreenName = user.getScreenName();
    mName = user.getName();
    mDescription = user.getDescription();
    ArrayList<URLEntity> urlEntityArrayList = new ArrayList<URLEntity>();
    if (user.getDescriptionURLEntities() != null) {
        urlEntityArrayList = new ArrayList<URLEntity>(Arrays.asList(user.getDescriptionURLEntities()));
    }

    if (user.getURL() != null) {
        mUrl = user.getURL();
        urlEntityArrayList.add(user.getURLEntity());
    }

    mUrlEntities = urlEntityArrayList.toArray(new URLEntity[urlEntityArrayList.size()]);

    if (user.getLocation() != null && !user.getLocation().equals("")) {
        mLocation = user.getLocation();
    }

    if (user.getOriginalProfileImageURLHttps() != null) {
        mProfileImageUrlOriginal = user.getOriginalProfileImageURLHttps();
    }

    if (user.getBiggerProfileImageURLHttps() != null) {
        mProfileImageUrlBigger = user.getBiggerProfileImageURLHttps();
    }

    if (user.getProfileImageURLHttps() != null) {
        mProfileImageUrlNormal = user.getProfileImageURLHttps();
    }

    if (user.getMiniProfileImageURLHttps() != null) {
        mProfileImageUrlMini = user.getMiniProfileImageURLHttps();
    }

    mStatusesCount = user.getStatusesCount();
    mFriendsCount = user.getFriendsCount();
    mFollowersCount = user.getFollowersCount();
    mFavoritesCount = user.getFavouritesCount();
    mListedCount = user.getListedCount();
    mVerified = user.isVerified();
    mProtected = user.isProtected();
    mSocialNetType = SocialNetConstant.Type.Twitter;
}