Example usage for twitter4j UserList getId

List of usage examples for twitter4j UserList getId

Introduction

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

Prototype

long getId();

Source Link

Document

Returns the id of the list

Usage

From source file:com.klinker.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);// w ww .  j a va 2  s. c o  m

    holder.text.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent list = new Intent(context, ChoosenListActivity.class);
            list.putExtra("list_id", id);
            list.putExtra("list_name", name);
            list.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            context.startActivity(list);
        }
    });

    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;

                    case VIEW_USERS:
                        Intent viewUsers = new Intent(context, ViewUsers.class);
                        viewUsers.putExtra("list_id", Integer.parseInt(id));
                        viewUsers.putExtra("list_name", name);
                        context.startActivity(viewUsers);
                        break;
                    }

                }
            });

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

            return false;
        }
    });

}

From source file:com.klinker.android.twitter.settings.configure_pages.ListChooser.java

License:Apache License

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    context = this;
    sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences",
            Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE);
    settings = AppSettings.getInstance(this);

    Utils.setUpTheme(context, settings);
    setContentView(R.layout.list_chooser);

    actionBar = getActionBar();//w  w  w  .j a  v  a  2s. com
    actionBar.setTitle(getResources().getString(R.string.lists));

    if (!settings.isTwitterLoggedIn) {
        Intent login = new Intent(context, LoginActivity.class);
        startActivity(login);
        finish();
    }

    listView = (AsyncListView) findViewById(R.id.listView);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            UserList list = arrayAdapter.getItem(i);
            Intent returnIntent = new Intent();
            returnIntent.putExtra("listId", list.getId());
            returnIntent.putExtra("listName", list.getName());
            setResult(RESULT_OK, returnIntent);
            finish();
        }
    });

    new GetLists().execute();
}

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();
    is_public = list.isPublic();
    this.is_following = is_following;
    name = list.getName();/*from   w w  w.  ja  v  a  2  s. co  m*/
    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.examproject.tweet.service.SimpleTweetService.java

License:Apache License

private ResponseList<Status> getResponseList() {
    LOG.debug("called.");

    long cursol = -1;
    int listId = 0;
    int count = 50;
    int pageNumber = 1;

    Paging paging = new Paging(pageNumber, count);

    try {//www . j  a  va  2  s  .c om
        // TODO: polymorphism to here? -> plugin.

        // home
        if (paramValue.getResponseListMode().equals("home")) {
            Twitter twitter = getTwitter();
            return twitter.getHomeTimeline(paging);
        }

        // user
        if (paramValue.getResponseListMode().equals("user")) {
            Twitter twitter = getTwitter();
            return twitter.getUserTimeline(paging);
        }

        // list
        if (paramValue.getResponseListMode().equals("list")) {
            if (paramValue.getUserListName().length() != 0) {
                Twitter twitter = getTwitter();
                PagableResponseList<UserList> lists = twitter.getUserLists(twitter.getScreenName(), cursol);
                for (UserList list : lists) {
                    String listFullName = list.getFullName();
                    if (listFullName.equals(paramValue.getUserListName())) {
                        listId = list.getId();
                        return twitter.getUserListStatuses(listId, paging);
                    }
                }
            }
        }

        // default..
        Twitter twitter = getTwitter();
        return twitter.getHomeTimeline();

    } catch (TwitterException te) {
        // TODO: transition to an error page here?
        throw new RuntimeException(te);
    }
}

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();
    is_public = list.isPublic();
    this.is_following = is_following;
    name = list.getName();/*from w  w  w.  ja va  2 s.  c  om*/
    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();
}

From source file:org.mariotaku.twidere.loader.ListTimelineLoader.java

License:Open Source License

@Override
public ResponseList<Status> getStatuses(Paging paging) throws TwitterException {
    final Twitter twitter = getTwitter();
    if (twitter == null)
        return null;
    if (mListId > 0)
        return twitter.getUserListStatuses(mListId, paging);
    else {/*from   w w w. j  a  v  a2 s . co  m*/
        final UserList list = findUserList(twitter, mUserId, mScreenName, mListName);
        if (list != null && list.getId() > 0)
            return twitter.getUserListStatuses(list.getId(), paging);
    }
    return null;
}

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

License:Apache License

public TwitterList(UserList list) {
    mId = list.getId();
    mName = list.getName();/*from  w  ww  .j  a va 2s. c  o  m*/
    mFullName = list.getFullName();
    mDescription = list.getDescription();
    mIsPublic = list.isPublic();
    mIsFollowing = list.isFollowing();
    mMemberCount = list.getMemberCount();
    mSubscriberCount = list.getSubscriberCount();
}

From source file:twitter4j.examples.list.CreateUserList.java

License:Apache License

/**
 * Usage: java twitter4j.examples.list.CreateUserList [list name] [list description]
 *
 * @param args message/*from ww  w  .ja v a  2 s  . c o m*/
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.list.CreateUserList [list name] [list description]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        String description = null;
        if (args.length >= 2) {
            description = args[1];
        }
        UserList list = twitter.createUserList(args[0], true, description);
        System.out
                .println("Successfully created a list (id:" + list.getId() + ", slug:" + list.getSlug() + ").");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to create a list: " + te.getMessage());
        System.exit(-1);
    }
}

From source file:twitter4j.examples.list.DestroyUserList.java

License:Apache License

/**
 * Usage: java twitter4j.examples.list.DestroyUserList [list id]
 *
 * @param args message//from   w  w  w.  ja v a2s . co m
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.list.DestroyUserList [list id]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        UserList list = twitter.destroyUserList(Integer.parseInt(args[0]));
        System.out.println(
                "Successfully deleted the list (id:" + list.getId() + ", slug:" + list.getSlug() + ").");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to delete a list: " + te.getMessage());
        System.exit(-1);
    }
}

From source file:twitter4j.examples.list.GetUserListMemberships.java

License:Apache License

/**
 * Usage: java twitter4j.examples.list.GetUserListMemberships [list member screen name]
 *
 * @param args message/*  w  ww  .ja  v  a  2 s . c  om*/
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println(
                "Usage: java twitter4j.examples.list.GetUserListMemberships [list member screen name]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        long cursor = -1;
        PagableResponseList<UserList> lists;
        do {
            lists = twitter.getUserListMemberships(args[0], cursor);
            for (UserList list : lists) {
                System.out.println("id:" + list.getId() + ", name:" + list.getName() + ", description:"
                        + list.getDescription() + ", slug:" + list.getSlug() + "");
            }
        } while ((cursor = lists.getNextCursor()) != 0);
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to list the lists: " + te.getMessage());
        System.exit(-1);
    }
}