Example usage for twitter4j Status getUser

List of usage examples for twitter4j Status getUser

Introduction

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

Prototype

User getUser();

Source Link

Document

Return the user associated with the status.
This can be null if the instance is from User.getStatus().

Usage

From source file:com.ikungolf.java.javatwitter.twitterCmd.java

public static void main(String[] args) throws InterruptedException {
    //        System.out.println("Hello, welcome to my first java application.");
    //        System.out.println("");
    //        String s = new String();
    //        while (!"exit".equals(s)) {
    //            try {
    //                BufferedReader bufferReader = new BufferedReader(new InputStreamReader(System.in));
    //                s = bufferReader.readLine();
    //                System.out.println(": " + s);
    //                twitterCmd cmd = new twitterCmd();
    //                String ip = cmd.getRemoteIpAddress();
    //                System.out.println("IP Address: " + ip);
    //            } catch (IOException e) {
    //                e.printStackTrace();
    //            }
    //        }//from www. j a  v  a 2  s.co  m
    twitterCmd getDM = new twitterCmd();
    if (args == null) {
        System.out.println(" ========== Start application. ");
        System.out.println("Showing @isongsee11's mentions.");

        if (!getDM.isOldMessageId()) {
            System.out.println("#################### Not Old Message. ");
            String command = new String();
            while (!"exit".equals(command)) {
                Thread.sleep(15000);
                Status s = new twitterCmd().getLastestMessage();
                command = s.getText();
                command = command.replace("@isongsee11", "");
                command = command.replaceAll("\\s+", "");
                System.out.println(" ##### command[" + command + "]");
                if ("ipaddress".equals(command)) {
                    String ipAdd = getDM.getRemoteIpAddress();
                    System.out.println("IP Address: " + ipAdd);
                    String replied = "@isongsee11 >> my ipaddress " + ipAdd;
                    getDM.updateStatus(replied);
                }

                if ("hello".equals(command)) {
                    String msg = "Hi, how are you ?";
                    String replied = "@" + s.getUser().getScreenName() + " - " + msg;
                    System.out.println(">" + replied);
                    getDM.updateStatus(replied);
                }
            }
        }
        System.out.println("  ========== End application. ");
    } else {
        if (args[0] == "cron") {
            System.out.println("Command crom:");
            Date date = new Date();
            String dateStr = String.format(" Date/Time : %tc", date);
            String ipAdd = getDM.getRemoteIpAddress();
            System.out.println("IP Address: " + ipAdd);
            String replied = "@isongsee11 >> my ipaddress " + ipAdd + " at " + dateStr;
            System.out.println("msg: " + replied);
            getDM.updateStatus(replied);
            System.out.println("Done.");
        }
    }
}

From source file:com.infine.android.devoxx.service.TwitterService.java

License:Apache License

private ContentProviderOperation buildCPOperation(Status tweet) {

    final ContentProviderOperation.Builder builder = ContentProviderOperation
            .newInsert(ScheduleContract.Tweets.CONTENT_URI);

    // affecte les valeurs des colonnes
    builder.withValue(ScheduleContract.Tweets.TWEET_ID, tweet.getId());
    builder.withValue(ScheduleContract.Tweets.CREATION_DATE, tweet.getCreatedAt().getTime());
    builder.withValue(ScheduleContract.Tweets.IMAGE_URL, tweet.getUser().getProfileImageURL());
    builder.withValue(ScheduleContract.Tweets.TEXT, tweet.getText());
    builder.withValue(ScheduleContract.Tweets.USER, tweet.getUser().getName());
    builder.withValue(ScheduleContract.Tweets.USER_NAME, tweet.getUser().getScreenName());

    return builder.build();
}

From source file:com.isdp.twitterposter.TwitterManager.java

License:Open Source License

public void startTwitterStream() {
    TwitterStream twitterStream = new TwitterStreamFactory(configuration).getInstance();

    StatusListener listener = new StatusListener() {
        @Override/*w w w .j  a  v  a2s . c om*/
        public void onStatus(Status status) {
            try {
                System.out.println("Text recieved: @" + status.getUser().getScreenName() + " - "
                        + status.getText() + "\n");

                StringTokenizer st = new StringTokenizer(status.getText(), " ");

                //first token indicates search engine
                String searchEngine = st.nextToken();

                //burn the next random token
                String randToken = st.nextToken();

                //next token indicates max number of results to return
                int maxResults = Integer.parseInt(st.nextToken());

                String searchString = "";
                while (st.hasMoreTokens()) {
                    searchString += st.nextToken() + " ";
                }

                if (searchEngine.equals(GoogleManager.TAG_YELP)) {
                    String[] results = GoogleManager.getInstance().trySearch(searchString,
                            GoogleManager.SEARCH_YELP);

                    if (results != null) {
                        for (int i = 0; i < results.length && i < maxResults; ++i) {
                            String tweetMsg = Util.truncateString(results[i], TWITTER_CHARACTER_LIMIT);

                            System.out.println("Tweeting" + tweetMsg);

                            tweet(tweetMsg);
                        }
                    } else if (results == null || results.length == 0) {
                        tweet(Util.generateRandomString(7) + "\n" + "No results found!");
                    }
                } else if (searchEngine.equals(GoogleManager.TAG_WIKI)) {
                    String[] results = GoogleManager.getInstance().trySearch(searchString,
                            GoogleManager.SEARCH_WIKI);

                    if (results != null) {
                        for (int i = 0; i < results.length && i < maxResults; ++i) {
                            String tweetMsg = Util.generateRandomString(3) + "\n"
                                    + Util.shortenText(results[i]);
                            tweetMsg = Util.truncateString(tweetMsg, TWITTER_CHARACTER_LIMIT);

                            System.out.println("Tweeting " + tweetMsg);

                            tweet(tweetMsg);
                        }
                    } else if (results == null || results.length == 0) {
                        tweet(Util.generateRandomString(7) + "\n" + "No results found!");
                    }
                }
            } catch (Exception e) {
            }
        }

        @Override
        public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
            System.out.println(
                    "onDeletionNotice: Got a status deletion notice id:" + statusDeletionNotice.getStatusId());
        }

        @Override
        public void onTrackLimitationNotice(int numberOfLimitedStatuses) {
            System.out
                    .println("onTrackLimitationNotice: Got track limitation notice:" + numberOfLimitedStatuses);
        }

        @Override
        public void onScrubGeo(long userId, long upToStatusId) {
            System.out.println(
                    "onScrubGeo: Got scrub_geo event userId:" + userId + " upToStatusId:" + upToStatusId);
        }

        @Override
        public void onStallWarning(StallWarning warning) {
            System.out.println("onStallWarning: Got stall warning:" + warning);
        }

        @Override
        public void onException(Exception ex) {
            System.out.println("onException" + ex.toString());
        }
    };

    twitterStream.addListener(listener);

    FilterQuery tweetFilterQuery = new FilterQuery();

    tweetFilterQuery.follow(new long[] { FOLLOW_ID });

    twitterStream.filter(tweetFilterQuery);
}

From source file:com.isdp.twitterposterandroid.TwitterManager.java

License:Open Source License

public void startTwitterStream() {
    TwitterStream twitterStream = new TwitterStreamFactory(configuration).getInstance();

    StatusListener listener = new StatusListener() {
        @Override/*  w w  w  . j  av  a  2  s.c o  m*/
        public void onStatus(Status status) {
            try {
                Log.d("Text recieved",
                        "@" + status.getUser().getScreenName() + " - " + status.getText() + "\n");

                StringTokenizer st = new StringTokenizer(status.getText(), " ");

                //first token indicates search engine
                String searchEngine = st.nextToken();

                //burn the next random token
                String randToken = st.nextToken();

                //next token indicates max number of results to return
                int maxResults = Integer.parseInt(st.nextToken());

                String searchString = "";
                while (st.hasMoreTokens()) {
                    searchString += st.nextToken() + " ";
                }

                if (searchEngine.equals(GoogleManager.TAG_YELP)) {
                    String[] results = GoogleManager.getInstance().trySearch(searchString,
                            GoogleManager.SEARCH_YELP);

                    if (results != null) {
                        for (int i = 0; i < results.length && i < maxResults; ++i) {
                            String tweetMsg = Util.truncateString(results[i], TWITTER_CHARACTER_LIMIT);

                            Log.d("Tweeting", tweetMsg);

                            tweet(tweetMsg);
                        }
                    } else if (results == null || results.length == 0) {
                        tweet(Util.generateRandomString(7) + "\n" + "No results found!");
                    }
                } else if (searchEngine.equals(GoogleManager.TAG_WIKI)) {
                    String[] results = GoogleManager.getInstance().trySearch(searchString,
                            GoogleManager.SEARCH_WIKI);

                    if (results != null) {
                        for (int i = 0; i < results.length && i < maxResults; ++i) {
                            String tweetMsg = Util.generateRandomString(3) + "\n"
                                    + Util.shortenText(results[i]);
                            tweetMsg = Util.truncateString(tweetMsg, TWITTER_CHARACTER_LIMIT);

                            Log.d("Tweeting", tweetMsg);

                            tweet(tweetMsg);
                        }
                    } else if (results == null || results.length == 0) {
                        tweet(Util.generateRandomString(7) + "\n" + "No results found!");
                    }
                }
            } catch (Exception e) {
            }
        }

        @Override
        public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
            Log.d("onDeletionNotice", "Got a status deletion notice id:" + statusDeletionNotice.getStatusId());
        }

        @Override
        public void onTrackLimitationNotice(int numberOfLimitedStatuses) {
            Log.d("onTrackLimitationNotice", "Got track limitation notice:" + numberOfLimitedStatuses);
        }

        @Override
        public void onScrubGeo(long userId, long upToStatusId) {
            Log.d("onScrubGeo", "Got scrub_geo event userId:" + userId + " upToStatusId:" + upToStatusId);
        }

        @Override
        public void onStallWarning(StallWarning warning) {
            Log.d("onStallWarning", "Got stall warning:" + warning);
        }

        @Override
        public void onException(Exception ex) {
            Log.d("onException", ex.toString());
        }
    };

    twitterStream.addListener(listener);

    FilterQuery tweetFilterQuery = new FilterQuery();

    tweetFilterQuery.follow(new long[] { FOLLOW_ID });

    twitterStream.filter(tweetFilterQuery);
}

From source file:com.javielinux.infos.InfoTweet.java

License:Apache License

public InfoTweet(Status status) {
    urls = new ArrayList<URLContent>();
    mTypeFrom = FROM_STATUS;//from w  w w . j  a  va  2 s.  c  o  m
    id = status.getId();
    urlAvatar = status.getUser().getProfileImageURL().toString();
    userId = status.getUser().getId();
    text = status.getText();
    username = status.getUser().getScreenName();
    fullname = status.getUser().getName();
    source = status.getSource();
    toUsername = status.getInReplyToScreenName();
    toUserId = status.getInReplyToUserId();
    createAt = status.getCreatedAt();
    toReplyId = status.getInReplyToStatusId();
    favorited = status.isFavorited();
    if (status.getGeoLocation() != null) {
        latitude = status.getGeoLocation().getLatitude();
        longitude = status.getGeoLocation().getLongitude();
    }
    if (status.getRetweetedStatus() != null) {
        retweet = true;
        urlAvatarRetweet = status.getRetweetedStatus().getUser().getProfileImageURL().toString();
        textRetweet = status.getRetweetedStatus().getText();
        usernameRetweet = status.getRetweetedStatus().getUser().getScreenName();
        fullnameRetweet = status.getRetweetedStatus().getUser().getName();
        sourceRetweet = status.getRetweetedStatus().getSource();
    }

    urlTweet = "http://twitter.com/#!/" + username.toLowerCase() + PREFIX_URL_TWITTER + id;

    calculateLinks();
}

From source file:com.joanzapata.android.twitter.TwitterFragment.java

License:Apache License

@AfterViews
void afterViews() {
    setRetainInstance(true);/*  w w  w  . j  a  v a2s  . co m*/
    getSherlockActivity().setTitle("@" + followingAccount);
    listView.setOnEndOfListListener(this);
    if (adapter == null)
        adapter = new QuickAdapter<Status>(getSherlockActivity(), R.layout.tweet) {
            @Override
            protected void convert(BaseAdapterHelper helper, Status status) {
                boolean isRetweet = status.isRetweet();
                if (isRetweet)
                    status = status.getRetweetedStatus();
                helper.setText(tweetText, status.getText()).setVisible(tweetRT, isRetweet)
                        .setText(tweetName, status.getUser().getName())
                        .setText(tweetDate, dateFormat.format(status.getCreatedAt()))
                        .setImageUrl(tweetAvatar, status.getUser().getProfileImageURL()).linkify(tweetText);
            }
        };
    listView.setAdapter(adapter);
}

From source file:com.joshlong.esb.springintegration.modules.social.twitter.TwitterMessageSource.java

License:Apache License

private Tweet buildTweetFromStatus(Status firstPost) {
    Tweet tweet = new Tweet(firstPost.getId(), firstPost.getUser().getName(), firstPost.getCreatedAt(),
            firstPost.getText());/* w ww  . j  a v  a2s.  c  o m*/

    return tweet;
}

From source file:com.klinker.android.twitter.activities.tweet_viewer.fragments.ConversationFragment.java

License:Apache License

public void getDiscussion(final ListView listView, final long tweetId, final LinearLayout progressBar,
        final HoloTextView none, final Status status) {

    Log.v("talon_replies", "getting discussion");

    if (replies.size() == 0) {
        replies.add(status);/*from   w  ww . j  a  v  a  2s.c om*/
    }

    Thread getReplies = new Thread(new Runnable() {
        @Override
        public void run() {

            if (!isRunning) {
                return;
            }

            ArrayList<twitter4j.Status> all = null;
            Twitter twitter = Utils.getTwitter(context, settings);
            try {
                Log.v("talon_replies", "looking for discussion");

                long id = status.getId();
                String screenname = status.getUser().getScreenName();

                query = new Query("@" + screenname + " since_id:" + id);

                Log.v("talon_replies", "query string: " + query.getQuery());

                try {
                    query.setCount(100);
                } catch (Throwable e) {
                    // enlarge buffer error?
                    query.setCount(30);
                }

                QueryResult result = twitter.search(query);
                Log.v("talon_replies", "result: " + result.getTweets().size());

                all = new ArrayList<twitter4j.Status>();

                do {
                    Log.v("talon_replies", "do loop repetition");
                    if (!isRunning) {
                        return;
                    }
                    List<Status> tweets = result.getTweets();

                    for (twitter4j.Status tweet : tweets) {
                        if (tweet.getInReplyToStatusId() == id) {
                            all.add(tweet);
                            Log.v("talon_replies", tweet.getText());
                        }
                    }

                    if (all.size() > 0) {
                        for (int i = all.size() - 1; i >= 0; i--) {
                            Log.v("talon_replies", "inserting into arraylist:" + all.get(i).getText());
                            replies.add(all.get(i));
                        }

                        all.clear();

                        ((Activity) context).runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                progressBar.setVisibility(View.GONE);
                                try {
                                    if (replies.size() > 0) {
                                        if (adapter == null || adapter.getCount() == 0) {
                                            adapter = new TimelineArrayAdapter(context, replies);
                                            listView.setAdapter(adapter);
                                            listView.setVisibility(View.VISIBLE);
                                        } else {
                                            Log.v("talon_replies", "notifying adapter change");
                                            adapter.notifyDataSetChanged();
                                        }
                                    } else {
                                        none.setVisibility(View.VISIBLE);
                                    }
                                } catch (Exception e) {
                                    // none and it got the null object
                                    e.printStackTrace();
                                    listView.setVisibility(View.GONE);
                                    none.setVisibility(View.VISIBLE);
                                }
                            }
                        });
                    }

                    try {
                        Thread.sleep(250);
                    } catch (Exception e) {
                        // since we are changing the arraylist for the adapter in the background, we need to make sure it
                        // gets updated before continuing
                    }

                    query = result.nextQuery();

                    if (query != null)
                        result = twitter.search(query);

                } while (query != null);

            } catch (Exception e) {
                e.printStackTrace();
            } catch (OutOfMemoryError e) {
                e.printStackTrace();
            }

            if (replies.size() < 2) {
                // nothing to show, so tell them that
                ((Activity) context).runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        progressBar.setVisibility(View.GONE);
                        listView.setVisibility(View.GONE);
                        none.setVisibility(View.VISIBLE);
                    }
                });
            }
        }
    });

    getReplies.setPriority(8);
    getReplies.start();

}

From source file:com.klinker.android.twitter.adapters.PicturesArrayAdapter.java

License:Apache License

public void bindView(final View view, Context mContext, final String url, final Status status) {
    final ViewHolder holder = (ViewHolder) view.getTag();

    Log.v("talon_picture", "text: " + status.getText());

    Status thisStatus;// w w  w .  j a v  a  2  s  .c  o m

    String retweeter;
    final long time = status.getCreatedAt().getTime();
    long originalTime = 0;

    if (status.isRetweet()) {
        retweeter = status.getUser().getScreenName();

        thisStatus = status.getRetweetedStatus();
        originalTime = thisStatus.getCreatedAt().getTime();
    } else {
        retweeter = "";

        thisStatus = status;
    }
    final String fRetweeter = retweeter;

    final long fOriginalTime = originalTime;

    User user = thisStatus.getUser();

    final long id = thisStatus.getId();
    final String profilePic = user.getBiggerProfileImageURL();
    String tweetTexts = thisStatus.getText();
    final String name = user.getName();
    final String screenname = user.getScreenName();

    String[] html = TweetLinkUtils.getLinksInStatus(thisStatus);
    final String tweetText = html[0];
    final String picUrl = html[1];
    final String otherUrl = html[2];
    final String hashtags = html[3];
    final String users = html[4];

    holder.url = url;

    holder.iv.loadImage(url, false, new NetworkedCacheableImageView.OnImageLoadedListener() {
        @Override
        public void onImageLoaded(CacheableBitmapDrawable result) {
            holder.iv.setBackgroundDrawable(null);
        }
    });

    holder.iv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            String link;

            boolean displayPic = !picUrl.equals("");
            if (displayPic) {
                link = picUrl;
            } else {
                link = otherUrl.split("  ")[0];
            }

            Log.v("tweet_page", "clicked");
            Intent viewTweet = new Intent(context, TweetPager.class);
            viewTweet.putExtra("name", name);
            viewTweet.putExtra("screenname", screenname);
            viewTweet.putExtra("time", time);
            viewTweet.putExtra("tweet", tweetText);
            viewTweet.putExtra("retweeter", fRetweeter);
            viewTweet.putExtra("webpage", link);
            viewTweet.putExtra("other_links", otherUrl);
            viewTweet.putExtra("picture", displayPic);
            viewTweet.putExtra("tweetid", id);
            viewTweet.putExtra("proPic", profilePic);
            viewTweet.putExtra("users", users);
            viewTweet.putExtra("hashtags", hashtags);

            context.startActivity(viewTweet);
        }
    });

}

From source file:com.klinker.android.twitter.adapters.TimelineArrayAdapter.java

License:Apache License

public void bindView(final View view, Status status, int position) {
    final ViewHolder holder = (ViewHolder) view.getTag();

    if (holder.expandArea.getVisibility() == View.VISIBLE) {
        removeExpansionNoAnimation(holder);
    }/*  w w w. j a v  a  2 s .  c  om*/

    Status thisStatus;

    String retweeter;
    final long time = status.getCreatedAt().getTime();
    long originalTime = 0;

    if (status.isRetweet()) {
        retweeter = status.getUser().getScreenName();

        thisStatus = status.getRetweetedStatus();
        originalTime = thisStatus.getCreatedAt().getTime();
    } else {
        retweeter = "";

        thisStatus = status;
    }

    final long fOriginalTime = originalTime;

    User user = thisStatus.getUser();

    holder.tweetId = thisStatus.getId();
    final long id = holder.tweetId;
    final String profilePic = user.getOriginalProfileImageURL();
    String tweetTexts = thisStatus.getText();
    final String name = user.getName();
    final String screenname = user.getScreenName();

    String[] html = TweetLinkUtils.getLinksInStatus(thisStatus);

    final String tweetText = html[0];
    final String picUrl = html[1];
    holder.picUrl = picUrl;
    final String otherUrl = html[2];
    final String hashtags = html[3];
    final String users = html[4];

    if (!settings.reverseClickActions) {
        final String fRetweeter = retweeter;
        holder.background.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {

                String link;

                boolean displayPic = !holder.picUrl.equals("") && !holder.picUrl.contains("youtube");
                if (displayPic) {
                    link = holder.picUrl;
                } else {
                    link = otherUrl.split("  ")[0];
                }

                Log.v("tweet_page", "clicked");
                Intent viewTweet = new Intent(context, TweetPager.class);
                viewTweet.putExtra("name", name);
                viewTweet.putExtra("screenname", screenname);
                viewTweet.putExtra("time", time);
                viewTweet.putExtra("tweet", tweetText);
                viewTweet.putExtra("retweeter", fRetweeter);
                viewTweet.putExtra("webpage", link);
                viewTweet.putExtra("other_links", otherUrl);
                viewTweet.putExtra("picture", displayPic);
                viewTweet.putExtra("tweetid", holder.tweetId);
                viewTweet.putExtra("proPic", profilePic);
                viewTweet.putExtra("users", users);
                viewTweet.putExtra("hashtags", hashtags);

                context.startActivity(viewTweet);

                return true;
            }
        });

        holder.background.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (holder.preventNextClick) {
                    holder.preventNextClick = false;
                    return;
                }
                if (holder.expandArea.getVisibility() == View.GONE) {
                    addExpansion(holder, screenname, users, otherUrl.split("  "), holder.picUrl, id);
                } else {
                    removeExpansionWithAnimation(holder);
                    removeKeyboard(holder);
                }
            }
        });

    } else {
        final String fRetweeter = retweeter;
        holder.background.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (holder.preventNextClick) {
                    holder.preventNextClick = false;
                    return;
                }

                String link;

                boolean displayPic = !holder.picUrl.equals("") && !holder.picUrl.contains("youtube");
                if (displayPic) {
                    link = holder.picUrl;
                } else {
                    link = otherUrl.split("  ")[0];
                }

                Log.v("tweet_page", "clicked");
                Intent viewTweet = new Intent(context, TweetPager.class);
                viewTweet.putExtra("name", name);
                viewTweet.putExtra("screenname", screenname);
                viewTweet.putExtra("time", time);
                viewTweet.putExtra("tweet", tweetText);
                viewTweet.putExtra("retweeter", fRetweeter);
                viewTweet.putExtra("webpage", link);
                viewTweet.putExtra("other_links", otherUrl);
                viewTweet.putExtra("picture", displayPic);
                viewTweet.putExtra("tweetid", holder.tweetId);
                viewTweet.putExtra("proPic", profilePic);
                viewTweet.putExtra("users", users);
                viewTweet.putExtra("hashtags", hashtags);

                context.startActivity(viewTweet);
            }
        });

        holder.background.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                if (holder.expandArea.getVisibility() == View.GONE) {
                    addExpansion(holder, screenname, users, otherUrl.split("  "), holder.picUrl, id);
                } else {
                    removeExpansionWithAnimation(holder);
                    removeKeyboard(holder);
                }

                return true;
            }
        });
    }

    if (!screenname.equals(username)) {
        holder.profilePic.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent viewProfile = new Intent(context, ProfilePager.class);
                viewProfile.putExtra("name", name);
                viewProfile.putExtra("screenname", screenname);
                viewProfile.putExtra("proPic", profilePic);
                viewProfile.putExtra("tweetid", holder.tweetId);
                viewProfile.putExtra("retweet", holder.retweeter.getVisibility() == View.VISIBLE);
                viewProfile.putExtra("long_click", false);

                context.startActivity(viewProfile);
            }
        });

        holder.profilePic.setOnLongClickListener(new View.OnLongClickListener() {

            @Override
            public boolean onLongClick(View view) {

                Intent viewProfile = new Intent(context, ProfilePager.class);
                viewProfile.putExtra("name", name);
                viewProfile.putExtra("screenname", screenname);
                viewProfile.putExtra("proPic", profilePic);
                viewProfile.putExtra("tweetid", holder.tweetId);
                viewProfile.putExtra("retweet", holder.retweeter.getVisibility() == View.VISIBLE);
                viewProfile.putExtra("long_click", true);

                context.startActivity(viewProfile);

                return false;
            }
        });
    } else {
        // need to clear the click listener so it isn't left over from another profile
        holder.profilePic.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });

        holder.profilePic.setOnLongClickListener(new View.OnLongClickListener() {

            @Override
            public boolean onLongClick(View view) {
                return true;
            }
        });
    }

    if (talonLayout == AppSettings.LAYOUT_FULL_SCREEN
            || (settings.nameAndHandleOnTweet && settings.addonTheme)) {
        if (holder.screenTV.getVisibility() == View.GONE) {
            holder.screenTV.setVisibility(View.VISIBLE);
        }
        holder.screenTV.setText("@" + screenname);
        holder.name.setText(name);
    } else {
        if (!settings.showBoth) {
            holder.name.setText(settings.displayScreenName ? "@" + screenname : name);
        } else {
            if (holder.screenTV.getVisibility() == View.GONE) {
                holder.screenTV.setVisibility(View.VISIBLE);
            }
            holder.name.setText(name);
            holder.screenTV.setText("@" + screenname);
        }
    }

    if (!settings.absoluteDate) {
        holder.time.setText(Utils.getTimeAgo(time, context));
    } else {
        Date date = new Date(time);
        holder.time
                .setText(timeFormatter.format(date).replace("24:", "00:") + ", " + dateFormatter.format(date));
    }

    holder.tweet.setText(tweetText);

    boolean picture = false;

    if (settings.inlinePics) {
        if (holder.picUrl.equals("")) {
            if (holder.image.getVisibility() != View.GONE) {
                holder.image.setVisibility(View.GONE);
            }

            if (holder.playButton.getVisibility() == View.VISIBLE) {
                holder.playButton.setVisibility(View.GONE);
            }
        } else {
            if (holder.picUrl.contains("youtube")) {

                if (holder.playButton.getVisibility() == View.GONE) {
                    holder.playButton.setVisibility(View.VISIBLE);
                }

                final String fRetweeter = retweeter;

                holder.image.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        String link;

                        boolean displayPic = !holder.picUrl.equals("") && !holder.picUrl.contains("youtube");
                        if (displayPic) {
                            link = holder.picUrl;
                        } else {
                            link = otherUrl.split("  ")[0];
                        }

                        Intent viewTweet = new Intent(context, TweetPager.class);
                        viewTweet.putExtra("name", name);
                        viewTweet.putExtra("screenname", screenname);
                        viewTweet.putExtra("time", time);
                        viewTweet.putExtra("tweet", tweetText);
                        viewTweet.putExtra("retweeter", fRetweeter);
                        viewTweet.putExtra("webpage", link);
                        viewTweet.putExtra("other_links", otherUrl);
                        viewTweet.putExtra("picture", displayPic);
                        viewTweet.putExtra("tweetid", holder.tweetId);
                        viewTweet.putExtra("proPic", profilePic);
                        viewTweet.putExtra("users", users);
                        viewTweet.putExtra("hashtags", hashtags);
                        viewTweet.putExtra("clicked_youtube", true);

                        context.startActivity(viewTweet);
                    }
                });

                holder.image.setImageDrawable(transparent);

                picture = true;

            } else {
                holder.image.setImageDrawable(transparent);

                picture = true;

                if (holder.playButton.getVisibility() == View.VISIBLE) {
                    holder.playButton.setVisibility(View.GONE);
                }

                holder.image.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        if (holder.picUrl.contains(" ")) {
                            context.startActivity(new Intent(context, ViewPictures.class).putExtra("pictures",
                                    holder.picUrl));
                        } else {
                            context.startActivity(new Intent(context, PhotoViewerDialog.class).putExtra("url",
                                    holder.picUrl));
                        }
                    }
                });
            }

            if (holder.image.getVisibility() == View.GONE) {
                holder.image.setVisibility(View.VISIBLE);
            }
        }
    }

    if (type == NORMAL) {
        if (retweeter.length() > 0) {
            holder.retweeter.setText(context.getResources().getString(R.string.retweeter) + retweeter);
            holder.retweeterName = retweeter;
            holder.retweeter.setVisibility(View.VISIBLE);
        } else if (holder.retweeter.getVisibility() == View.VISIBLE) {
            holder.retweeter.setVisibility(View.GONE);
        }
    } else if (type == RETWEET) {

        int count = status.getRetweetCount();

        if (count > 1) {
            holder.retweeter.setText(
                    status.getRetweetCount() + " " + context.getResources().getString(R.string.retweets_lower));
            holder.retweeter.setVisibility(View.VISIBLE);
        } else if (count == 1) {
            holder.retweeter.setText(
                    status.getRetweetCount() + " " + context.getResources().getString(R.string.retweet_lower));
            holder.retweeter.setVisibility(View.VISIBLE);
        }
    }

    if (picture) {
        CacheableBitmapDrawable wrapper = mCache.getFromMemoryCache(holder.picUrl);
        if (wrapper != null) {
            holder.image.setImageDrawable(wrapper);
            picture = false;
        }
    }

    final boolean hasPicture = picture;
    mHandler[currHandler].removeCallbacksAndMessages(null);
    mHandler[currHandler].postDelayed(new Runnable() {
        @Override
        public void run() {
            if (holder.tweetId == id) {
                if (hasPicture) {
                    loadImage(context, holder, holder.picUrl, mCache, id);
                }

                if (settings.useEmoji
                        && (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || EmojiUtils.ios)) {
                    String text = holder.tweet.getText().toString();
                    if (EmojiUtils.emojiPattern.matcher(text).find()) {
                        final Spannable span = EmojiUtils.getSmiledText(context, Html.fromHtml(tweetText));
                        holder.tweet.setText(span);
                    }
                }

                holder.tweet.setSoundEffectsEnabled(false);
                holder.tweet.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        if (!TouchableMovementMethod.touched) {
                            Log.v("talon_clickable", "clicked in the cursor adapter");
                            // we need to manually set the background for click feedback because the spannable
                            // absorbs the click on the background
                            if (!holder.preventNextClick) {
                                holder.background.getBackground()
                                        .setState(new int[] { android.R.attr.state_pressed });
                                new Handler().postDelayed(new Runnable() {
                                    @Override
                                    public void run() {
                                        holder.background.getBackground()
                                                .setState(new int[] { android.R.attr.state_empty });
                                    }
                                }, 25);
                            }

                            holder.background.performClick();
                        }
                    }
                });

                holder.tweet.setOnLongClickListener(new View.OnLongClickListener() {
                    @Override
                    public boolean onLongClick(View view) {
                        if (!TouchableMovementMethod.touched) {
                            holder.background.performLongClick();
                            holder.preventNextClick = true;
                        }
                        return false;
                    }
                });

                if (holder.retweeter.getVisibility() == View.VISIBLE) {
                    holder.retweeter.setSoundEffectsEnabled(false);
                    holder.retweeter.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (!TouchableMovementMethod.touched) {
                                if (!holder.preventNextClick) {
                                    holder.background.getBackground()
                                            .setState(new int[] { android.R.attr.state_pressed });
                                    new Handler().postDelayed(new Runnable() {
                                        @Override
                                        public void run() {
                                            holder.background.getBackground()
                                                    .setState(new int[] { android.R.attr.state_empty });
                                        }
                                    }, 25);
                                }

                                holder.background.performClick();
                            }
                        }
                    });

                    holder.retweeter.setOnLongClickListener(new View.OnLongClickListener() {
                        @Override
                        public boolean onLongClick(View view) {
                            if (!TouchableMovementMethod.touched) {
                                holder.background.performLongClick();
                                holder.preventNextClick = true;
                            }
                            return false;
                        }
                    });
                }

                TextUtils.linkifyText(context, holder.tweet, holder.background, true, otherUrl, false);
                TextUtils.linkifyText(context, holder.retweeter, holder.background, true, "", false);
            }
        }
    }, 400);
    currHandler++;

    if (currHandler == 10) {
        currHandler = 0;
    }

    if (openFirst && position == 0) {
        holder.background.performClick();
    }
}