Example usage for twitter4j UserList getName

List of usage examples for twitter4j UserList getName

Introduction

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

Prototype

String getName();

Source Link

Document

Returns the name of the list

Usage

From source file:com.daiv.android.twitter.adapters.ListsArrayAdapter.java

License:Apache License

public void bindView(final View view, Context mContext, final UserList list) {
    final ViewHolder holder = (ViewHolder) view.getTag();

    final String name = list.getName();
    final String id = list.getId() + "";

    holder.text.setText(name);//from w w  w .  j a  v  a2  s . c om

    holder.text.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {

            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.setItems(R.array.lists_options, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    final int DELETE_LIST = 0;
                    final int VIEW_USERS = 1;
                    switch (i) {
                    case DELETE_LIST:
                        new DeleteList().execute(id + "");
                        break;
                    }

                }
            });

            builder.create();
            builder.show();

            return false;
        }
    });

}

From source file:com.daiv.android.twitter.settings.configure_pages.ListChooserArrayAdapter.java

License:Apache License

@Override
public void bindView(final View view, Context mContext, final UserList list) {
    final ViewHolder holder = (ViewHolder) view.getTag();

    final String name = list.getName();
    final String id = list.getId() + "";

    holder.text.setText(name);//from  w  ww. j a v a 2s .  c o  m
}

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 ww  .ja v  a  2s.  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.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();/*from   w  ww. j a  va 2  s  .  c om*/
    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.dwdesign.tweetings.util.Utils.java

License:Open Source License

public static UserList findUserList(final Twitter twitter, final long user_id, final String list_name)
        throws TwitterException {
    if (twitter == null || user_id <= 0 || list_name == null)
        return null;
    final ResponseList<UserList> response = twitter.getUserLists(user_id, -1);
    for (final UserList list : response) {
        if (list_name.equals(list.getName()))
            return list;
    }/*from   ww  w .  ja  v a 2  s  . c  o  m*/
    return null;
}

From source file:com.dwdesign.tweetings.util.Utils.java

License:Open Source License

public static UserList findUserList(final Twitter twitter, final String screen_name, final String list_name)
        throws TwitterException {
    if (twitter == null || screen_name == null || list_name == null)
        return null;
    final ResponseList<UserList> response = twitter.getUserLists(screen_name, -1);
    for (final UserList list : response) {
        if (list_name.equals(list.getName()))
            return list;
    }//from w  w w .  ja  v  a2 s .c  o m
    return null;
}

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 .ja va  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  ww . j a  v  a  2s.c  o 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:com.javielinux.tweettopics2.UserListsActivity.java

License:Apache License

private void createUserListsColumn(UserList userList) {

    ArrayList<Entity> created_column_list = DataFramework.getInstance().getEntityList("columns",
            "userlist_id=" + userList.getId());
    int position = 0;

    if (created_column_list.size() == 0) {
        position = ColumnsUtils.nextPositionColumn();

        Entity type = new Entity("type_columns", (long) TweetTopicsUtils.COLUMN_LIST_USER);
        Entity user_list = new Entity("columns");
        user_list.setValue("description", userList.getName());
        user_list.setValue("type_id", type);
        user_list.setValue("user_id", user_id);
        user_list.setValue("position", position);
        user_list.setValue("userlist_id", userList.getId());
        user_list.save();// w w w .j a  v  a  2s.co  m
        Toast.makeText(this, getString(R.string.column_created, userList.getName()), Toast.LENGTH_LONG).show();
    } else {
        position = created_column_list.get(0).getInt("position");
    }

    Intent intent = getIntent();
    intent.putExtra("position", position);

    setResult(RESULT_OK, intent);
    finish();

    /*ArrayList<Entity> created_column_list = DataFramework.getInstance().getEntityList("columns", "userlist_id=" + userList.getId());
            
    int position = 0;
            
    if (created_column_list.size() == 0) {
    position = DBUtils.nextPositionColumn();
            
    Entity type = new Entity("type_columns", (long) TweetTopicsUtils.COLUMN_LIST_USER);
    Entity user_list = new Entity("columns");
    user_list.setValue("description", type.getString("description"));
    user_list.setValue("type_id", type);
    user_list.setValue("position", position);
    user_list.setValue("userlist_id", userList.getId());
    user_list.save();
    Toast.makeText(this, getString(R.string.column_created, userList.getString("name")), Toast.LENGTH_LONG).show();
    } else {
    position = created_column_list.get(0).getInt("position");
    }
            
    Intent intent = getIntent();
    intent.putExtra("position", position);
            
    setResult(RESULT_OK, intent);
    finish();*/
}

From source file:com.klinker.android.twitter.activities.drawer_activities.lists.ListsActivity.java

License:Apache License

public void getLists() {
    new Thread(new Runnable() {
        @Override//  w w w . ja  v  a2  s  .  c  o  m
        public void run() {
            try {
                Twitter twitter = Utils.getTwitter(context, settings);

                final ResponseList<UserList> lists;
                try {
                    lists = twitter.getUserLists(settings.myScreenName);
                } catch (OutOfMemoryError e) {
                    return;
                }

                Collections.sort(lists, new Comparator<UserList>() {
                    public int compare(UserList result1, UserList result2) {
                        return result1.getName().compareTo(result2.getName());
                    }
                });

                ((Activity) context).runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        if (lists.size() > 0) {
                            listView.setAdapter(new ListsArrayAdapter(context, lists));
                            listView.setVisibility(View.VISIBLE);
                        } else {
                            LinearLayout nothing = (LinearLayout) findViewById(R.id.no_content);
                            try {
                                nothing.setVisibility(View.VISIBLE);
                            } catch (Exception e) {

                            }
                            listView.setVisibility(View.GONE);
                        }

                        LinearLayout spinner = (LinearLayout) findViewById(R.id.list_progress);
                        spinner.setVisibility(View.GONE);
                    }
                });
            } catch (Exception e) {
                e.printStackTrace();
                ((Activity) context).runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        LinearLayout nothing = (LinearLayout) findViewById(R.id.no_content);
                        nothing.setVisibility(View.VISIBLE);
                        listView.setVisibility(View.GONE);

                        LinearLayout spinner = (LinearLayout) findViewById(R.id.list_progress);
                        spinner.setVisibility(View.GONE);
                    }
                });
            }
        }
    }).start();
}