Example usage for twitter4j UserList getUser

List of usage examples for twitter4j UserList getUser

Introduction

In this page you can find the example usage for twitter4j UserList getUser.

Prototype

User getUser();

Source Link

Document

Returns the user of the list

Usage

From source file:com.dwdesign.tweetings.fragment.UserListDetailsFragment.java

License:Open Source License

public void changeUserList(final long account_id, final UserList user_list) {
    if (user_list == null || getActivity() == null || !isMyActivatedAccount(getActivity(), account_id))
        return;//  w  w  w.  j  av a2  s . c  o m
    getLoaderManager().destroyLoader(0);
    final User user = user_list.getUser();
    if (user == null)
        return;
    final boolean is_my_activated_account = isMyActivatedAccount(getActivity(), user_list.getId());
    mErrorRetryContainer.setVisibility(View.GONE);
    mAccountId = account_id;
    mUserListId = user_list.getId();
    mUserName = user.getName();
    mUserId = user.getId();
    mUserScreenName = user.getScreenName();
    mListName = user_list.getName();
    mListSlug = user_list.getSlug();

    final boolean is_multiple_account_enabled = getActivatedAccountIds(getActivity()).length > 1;

    mListView.setBackgroundResource(is_multiple_account_enabled ? R.drawable.ic_label_account_nopadding : 0);
    if (is_multiple_account_enabled) {
        final Drawable d = mListView.getBackground();
        if (d != null) {
            d.mutate().setColorFilter(getAccountColor(getActivity(), account_id), PorterDuff.Mode.MULTIPLY);
            mListView.invalidate();
        }
    }

    mListNameView.setText(mListName);
    mUserNameView.setText(mDisplayName ? mUserName : mUserScreenName);
    final String description = user_list.getDescription();
    mDescriptionContainer
            .setVisibility(is_my_activated_account || !isNullOrEmpty(description) ? View.VISIBLE : View.GONE);
    mDescriptionContainer.setOnLongClickListener(this);
    mDescriptionView.setText(description);
    final TwidereLinkify linkify = new TwidereLinkify(mDescriptionView);
    linkify.setOnLinkClickListener(this);
    linkify.addAllLinks();
    mDescriptionView.setMovementMethod(LinkMovementMethod.getInstance());
    final String profile_image_url_string = parseString(user.getProfileImageURL());
    final boolean hires_profile_image = getResources().getBoolean(R.bool.hires_profile_image);
    mProfileImageLoader.displayProfileImage(mProfileImageView,
            hires_profile_image ? getBiggerTwitterProfileImage(profile_image_url_string)
                    : profile_image_url_string);
    mUserList = user_list;
    //if (mUserId == mAccountId) {
    mFollowMoreButton.setText(R.string.more);
    mFollowMoreButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.expander_open_holo, 0);
    //} else {
    //   mFollowMoreButton.setText(user_list.isFollowing() ? R.string.unfollow : R.string.follow);
    //   mFollowMoreButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
    //}
    mAdapter.notifyDataSetChanged();
}

From source file:com.dwdesign.tweetings.loader.UserListMembersLoader.java

License:Open Source License

@Override
public List<ParcelableUser> getUsers() throws TwitterException {
    final Twitter twitter = getTwitter();
    if (twitter == null)
        return null;
    final PagableResponseList<User> users;
    if (mListId > 0) {
        if (mUserListId <= 0) {
            mUserListId = mListId;//from w w  w .  j a v  a 2 s .co m
        }
        if (mOwnerId <= 0) {
            final UserList list = twitter.showUserList(mListId);
            final User owner = list != null ? list.getUser() : null;
            mOwnerId = owner != null ? owner.getId() : -1;
        }
        users = twitter.getUserListMembers(mListId, mCursor);
    } else {
        final UserList list = findUserList(twitter, mUserId, mScreenName, mListName);
        if (list == null)
            return null;
        if (mOwnerId <= 0) {
            final User owner = list.getUser();
            mOwnerId = owner != null ? owner.getId() : -1;
        }
        if (list != null && list.getId() > 0) {
            if (mUserListId <= 0) {
                mUserListId = list.getId();
            }
            users = twitter.getUserListMembers(list.getId(), mCursor);
        } else
            return null;
    }
    mNextCursor = users.getNextCursor();
    mPrevCursor = users.getPreviousCursor();
    final List<ParcelableUser> result = new ArrayList<ParcelableUser>();
    final int size = users.size();
    for (int i = 0; i < size; i++) {
        result.add(new ParcelableUser(users.get(i), mAccountId, (mCursor + 1) * 20 + i));
    }
    return result;
}

From source file:com.dwdesign.tweetings.model.ParcelableUserList.java

License:Open Source License

public ParcelableUserList(final UserList list, final long account_id, final long position) {
    final User user = list.getUser();
    this.position = position;
    this.account_id = account_id;
    list_id = list.getId();// www . ja  v a 2 s .  c  o m
    is_public = list.isPublic();
    is_following = list.isFollowing();
    name = list.getName();
    description = list.getDescription();
    user_id = user.getId();
    user_name = user.getName();
    user_screen_name = user.getScreenName();
    user_profile_image_url = user.getProfileImageURL();
    user_profile_image_url_string = parseString(user_profile_image_url);
}

From source file:com.javielinux.adapters.RowUserListsAdapter.java

License:Apache License

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    UserList item = getItem(position);

    View view;//w  w w  .  j  av a 2  s.  c o m

    if (convertView == null) {
        view = View.inflate(getContext(), R.layout.row_userlist, null);
    } else {
        view = convertView;
    }

    ViewHolder viewHolder = RowUserListsAdapter.generateViewHolder(view);

    AQuery aQuery = listAQuery.recycle(convertView);
    aQuery.id(viewHolder.avatarView).image(item.getUser().getProfileImageURL().toString(), true, true, 0,
            R.drawable.avatar, aQuery.getCachedImage(R.drawable.avatar), 0);

    viewHolder.title.setText(item.getName());

    return view;
}

From source file:com.javielinux.adapters.UserListsAdapter.java

License:Apache License

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    UserList item = getItem(position);

    View view;/*w w  w.j  av a  2  s. co m*/

    if (convertView == null) {
        view = View.inflate(getContext(), R.layout.row_user_list_fragment, null);
    } else {
        view = convertView;
    }

    ViewHolder viewHolder = UserListsAdapter.generateViewHolder(view);

    try {
        Bitmap bmp = null;
        String urlAvatar = item.getUser().getProfileImageURL().toString();

        File file = Utils.getFileForSaveURL(context, urlAvatar);

        if (!file.exists()) {
            bmp = ImageUtils.saveAvatar(urlAvatar, file);
        } else {
            bmp = BitmapFactory.decodeFile(file.getAbsolutePath());
        }

        viewHolder.avatarView.setImageBitmap(Bitmap.createScaledBitmap(bmp, 64, 64, true));
    } catch (Exception e) {
        e.printStackTrace();
        viewHolder.avatarView.setImageResource(R.drawable.avatar);
    }

    viewHolder.title.setText(item.getName());

    viewHolder.avatarView.setAlpha(255);
    viewHolder.title.onSetAlpha(255);

    return view;
}

From source file:de.vanita5.twittnuker.model.ParcelableUserList.java

License:Open Source License

public ParcelableUserList(final UserList list, final long account_id, final long position,
        final boolean is_following) {
    final User user = list.getUser();
    this.position = position;
    this.account_id = account_id;
    id = list.getId();//from w ww . j a v  a 2 s. co  m
    is_public = list.isPublic();
    this.is_following = is_following;
    name = list.getName();
    description = list.getDescription();
    user_id = user.getId();
    user_name = user.getName();
    user_screen_name = user.getScreenName();
    user_profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps());
    members_count = list.getMemberCount();
    subscribers_count = list.getSubscriberCount();
}

From source file:org.getlantern.firetweet.model.ParcelableUserList.java

License:Open Source License

public ParcelableUserList(final UserList list, final long account_id, final long position,
        final boolean is_following) {
    final User user = list.getUser();
    this.position = position;
    this.account_id = account_id;
    id = list.getId();//from   ww  w.j av  a2s .  co  m
    is_public = list.isPublic();
    this.is_following = is_following;
    name = list.getName();
    description = list.getDescription();
    user_id = user.getId();
    user_name = user.getName();
    user_screen_name = user.getScreenName();
    user_profile_image_url = user.getProfileImageUrlHttps();
    members_count = list.getMemberCount();
    subscribers_count = list.getSubscriberCount();
}