Example usage for twitter4j User getBiggerProfileImageURL

List of usage examples for twitter4j User getBiggerProfileImageURL

Introduction

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

Prototype

String getBiggerProfileImageURL();

Source Link

Usage

From source file:MainActivity.java

public void setTwitter(Twitter t) throws TwitterException, MalformedURLException, IOException {

    twitter = t;/*from w  w w  . j a va  2s  .  c o m*/
    screenName = twitter.getScreenName();
    name.setText(twitter.getScreenName());

    twitter4j.User user = twitter.showUser(twitter.getId());
    URL url = new URL(user.getBiggerProfileImageURL());
    //URL url = new URL(fullUrlPath);
    BufferedImage img = ImageIO.read(url);
    ImageIcon icon = new ImageIcon(img);
    imgIcon.setIcon(icon);
    //JOptionPane.showMessageDialog(null, icon);
    Afollowing.setText(user.getFriendsCount() + "");
    Afollowers.setText(user.getFollowersCount() + "");
    createdAt.setText(user.getCreatedAt() + "");
    lists.setText(user.getListedCount() + "");
    favourites.setText(user.getFavouritesCount() + "");
    tweets.setText(user.getStatusesCount() + "");

}

From source file:com.anshul.HomeServlet.java

License:Open Source License

private void statusCheck(Twitter twitter, HttpServletRequest req, HttpServletResponse resp)
        throws IOException, TwitterException {
    User user = twitter.verifyCredentials();

    String username = user.getName();
    String latestTweet = user.getStatus().getText();
    TweetWrapper tweetWrapper = TweetWrapper.feel(latestTweet);
    String emotion = tweetWrapper.getStrongestEmotion();

    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
    Query query = new Query("Station");
    query.setFilter(FilterOperator.EQUAL.of("mood", emotion));
    List<Entity> stations = datastore.prepare(query).asList(FetchOptions.Builder.withLimit(1));
    Entity station = stations.get(0);

    req.getSession().setAttribute("user", username);
    req.getSession().setAttribute("userId", user.getId());
    req.getSession().setAttribute("latestTweet", latestTweet);
    req.getSession().setAttribute("emotion", emotion);
    req.getSession().setAttribute("stationName", station.getProperty("name"));
    req.getSession().setAttribute("url", station.getProperty("url"));
    req.getSession().setAttribute("profileImage", user.getBiggerProfileImageURL());
    req.removeAttribute("oauth_token");
    req.removeAttribute("oauth_verifier");
    resp.sendRedirect("login.jsp");
}

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

License:Apache License

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

    final long id = user.getId();
    holder.userId = id;/*from   w  w w  . j a v a 2 s .c  om*/

    holder.name.setText(user.getName());
    holder.screenName.setText("@" + user.getScreenName());

    //holder.picture.loadImage(user.getBiggerProfileImageURL(), true, null, NetworkedCacheableImageView.CIRCLE);
    final String url = user.getBiggerProfileImageURL();
    if (settings.roundContactImages) {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (holder.userId == id) {
                    loadCircleImage(context, holder, url, mCache, id);
                }
            }
        }, 500);
    } else {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (holder.userId == id) {
                    loadImage(context, holder, url, mCache, id);
                }
            }
        }, 500);
    }

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

    setFollowingStatus(holder, user);
}

From source file:com.daiv.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("Test_picture", "text: " + status.getText());

    Status thisStatus;//  w w w  .  ja  v a2s.  co 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");
        }
    });

}

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

License:Apache License

@Override
public void bindView(final View view, int position, final User user) {
    final ViewHolder holder = (ViewHolder) view.getTag();

    final long id = user.getId();
    holder.userId = id;/*from  ww w.  j ava 2s.  com*/

    holder.name.setText(user.getName());
    holder.screenName.setText("@" + user.getScreenName());

    final String url = user.getBiggerProfileImageURL();
    if (settings.roundContactImages) {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (holder.userId == id) {
                    loadCircleImage(context, holder, url, mCache, id);
                }
            }
        }, 500);
    } else {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (holder.userId == id) {
                    loadImage(context, holder, url, mCache, id);
                }
            }
        }, 500);
    }

    holder.background.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            new AlertDialog.Builder(context).setTitle(context.getResources().getString(R.string.remove_user))
                    .setMessage(context.getResources().getString(R.string.remove) + " " + user.getName() + " "
                            + context.getResources().getString(R.string.from_list) + "?")
                    .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            try {
                                new RemoveUser().execute(user.getId() + "");
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {

                        }
                    }).create().show();
        }
    });
}

From source file:com.github.gorbin.asne.twitter.TwitterSocialNetwork.java

License:Open Source License

private SocialPerson getSocialPerson(SocialPerson socialPerson, User user) {
    socialPerson.id = Long.toString(user.getId());
    socialPerson.name = user.getName();/*from w w w . j a  v  a 2 s .com*/
    socialPerson.avatarURL = user.getBiggerProfileImageURL();
    socialPerson.profileURL = user.getURL();
    return socialPerson;
}

From source file:com.github.jcustenborder.kafka.connect.twitter.StatusConverter.java

License:Apache License

public static void convert(User user, Struct struct) {
    struct.put("Id", user.getId()).put("Name", user.getName()).put("ScreenName", user.getScreenName())
            .put("Location", user.getLocation()).put("Description", user.getDescription())
            .put("ContributorsEnabled", user.isContributorsEnabled())
            .put("ProfileImageURL", user.getProfileImageURL())
            .put("BiggerProfileImageURL", user.getBiggerProfileImageURL())
            .put("MiniProfileImageURL", user.getMiniProfileImageURL())
            .put("OriginalProfileImageURL", user.getOriginalProfileImageURL())
            .put("ProfileImageURLHttps", user.getProfileImageURLHttps())
            .put("BiggerProfileImageURLHttps", user.getBiggerProfileImageURLHttps())
            .put("MiniProfileImageURLHttps", user.getMiniProfileImageURLHttps())
            .put("OriginalProfileImageURLHttps", user.getOriginalProfileImageURLHttps())
            .put("DefaultProfileImage", user.isDefaultProfileImage()).put("URL", user.getURL())
            .put("Protected", user.isProtected()).put("FollowersCount", user.getFollowersCount())
            .put("ProfileBackgroundColor", user.getProfileBackgroundColor())
            .put("ProfileTextColor", user.getProfileTextColor())
            .put("ProfileLinkColor", user.getProfileLinkColor())
            .put("ProfileSidebarFillColor", user.getProfileSidebarFillColor())
            .put("ProfileSidebarBorderColor", user.getProfileSidebarBorderColor())
            .put("ProfileUseBackgroundImage", user.isProfileUseBackgroundImage())
            .put("DefaultProfile", user.isDefaultProfile())
            .put("ShowAllInlineMedia", user.isShowAllInlineMedia()).put("FriendsCount", user.getFriendsCount())
            .put("CreatedAt", user.getCreatedAt()).put("FavouritesCount", user.getFavouritesCount())
            .put("UtcOffset", user.getUtcOffset()).put("TimeZone", user.getTimeZone())
            .put("ProfileBackgroundImageURL", user.getProfileBackgroundImageURL())
            .put("ProfileBackgroundImageUrlHttps", user.getProfileBackgroundImageUrlHttps())
            .put("ProfileBannerURL", user.getProfileBannerURL())
            .put("ProfileBannerRetinaURL", user.getProfileBannerRetinaURL())
            .put("ProfileBannerIPadURL", user.getProfileBannerIPadURL())
            .put("ProfileBannerIPadRetinaURL", user.getProfileBannerIPadRetinaURL())
            .put("ProfileBannerMobileURL", user.getProfileBannerMobileURL())
            .put("ProfileBannerMobileRetinaURL", user.getProfileBannerMobileRetinaURL())
            .put("ProfileBackgroundTiled", user.isProfileBackgroundTiled()).put("Lang", user.getLang())
            .put("StatusesCount", user.getStatusesCount()).put("GeoEnabled", user.isGeoEnabled())
            .put("Verified", user.isVerified()).put("Translator", user.isTranslator())
            .put("ListedCount", user.getListedCount()).put("FollowRequestSent", user.isFollowRequestSent());

    List<String> withheldInCountries = new ArrayList<>();
    if (null != user.getWithheldInCountries()) {
        for (String s : user.getWithheldInCountries()) {
            withheldInCountries.add(s);/*w  ww.jav a 2s  .co m*/
        }
    }
    struct.put("WithheldInCountries", withheldInCountries);

}

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

License:Apache License

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

    final long id = user.getId();
    holder.userId = id;/*from w ww . j  a  v a 2s. c  o  m*/

    holder.name.setText(user.getName());
    holder.screenName.setText("@" + user.getScreenName());

    //holder.picture.loadImage(user.getBiggerProfileImageURL(), true, null, NetworkedCacheableImageView.CIRCLE);
    final String url = user.getBiggerProfileImageURL();
    if (settings.roundContactImages) {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (holder.userId == id) {
                    loadCircleImage(context, holder, url, mCache, id);
                }
            }
        }, 500);
    } else {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (holder.userId == id) {
                    loadImage(context, holder, url, mCache, id);
                }
            }
        }, 500);
    }

    holder.background.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent viewProfile = new Intent(context, ProfilePager.class);
            viewProfile.putExtra("name", user.getName());
            viewProfile.putExtra("screenname", user.getScreenName());
            viewProfile.putExtra("proPic", user.getBiggerProfileImageURL());
            //viewProfile.putExtra("tweetid", holder.tweetId);
            viewProfile.putExtra("retweet", false);

            context.startActivity(viewProfile);
        }
    });

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

    setFollowingStatus(holder, user);
}

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;/*from  ww  w.  ja  v a 2  s .  com*/

    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.UserListMembersArrayAdapter.java

License:Apache License

@Override
public void bindView(final View view, int position, final User user) {
    final ViewHolder holder = (ViewHolder) view.getTag();

    final long id = user.getId();
    holder.userId = id;/*w w  w  .  ja v a2s . c  om*/

    holder.name.setText(user.getName());
    holder.screenName.setText("@" + user.getScreenName());

    final String url = user.getBiggerProfileImageURL();
    if (settings.roundContactImages) {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (holder.userId == id) {
                    loadCircleImage(context, holder, url, mCache, id);
                }
            }
        }, 500);
    } else {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (holder.userId == id) {
                    loadImage(context, holder, url, mCache, id);
                }
            }
        }, 500);
    }

    holder.picture.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent viewProfile = new Intent(context, ProfilePager.class);
            viewProfile.putExtra("name", user.getName());
            viewProfile.putExtra("screenname", user.getScreenName());
            viewProfile.putExtra("proPic", user.getBiggerProfileImageURL());
            //viewProfile.putExtra("tweetid", holder.tweetId);
            viewProfile.putExtra("retweet", false);

            context.startActivity(viewProfile);
        }
    });

    holder.background.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            new AlertDialog.Builder(context).setTitle(context.getResources().getString(R.string.remove_user))
                    .setMessage(context.getResources().getString(R.string.remove) + " " + user.getName() + " "
                            + context.getResources().getString(R.string.from_list) + "?")
                    .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            try {
                                new RemoveUser().execute(user.getId() + "");
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {

                        }
                    }).create().show();
        }
    });
}