List of usage examples for twitter4j User getProfileBannerURL
String getProfileBannerURL();
From source file:com.daiv.android.twitter.ui.profile_viewer.fragments.ProfileFragment.java
License:Apache License
public void getFollowers(final User user, final AsyncListView listView) { spinner.setVisibility(View.VISIBLE); canRefresh = false;/*from w w w . ja va2 s . c o m*/ new Thread(new Runnable() { @Override public void run() { try { Twitter twitter = Utils.getTwitter(context, settings); try { if (followingIds == null && user.getId() == settings.myId) { long currCursor = -1; IDs idObject; int rep = 0; do { // gets 5000 ids at a time idObject = twitter.getFriendsIDs(settings.myId, currCursor); long[] lIds = idObject.getIDs(); followingIds = new ArrayList<Long>(); for (int i = 0; i < lIds.length; i++) { followingIds.add(lIds[i]); } rep++; } while ((currCursor = idObject.getNextCursor()) != 0 && rep < 3); } } catch (Throwable t) { followingIds = null; } PagableResponseList<User> friendsPaging = twitter.getFollowersList(user.getId(), currentFollowers, 100); for (int i = 0; i < friendsPaging.size(); i++) { followers.add(friendsPaging.get(i)); } if (friendsPaging.size() > 17) { hasMore = true; } else { hasMore = false; } currentFollowers = friendsPaging.getNextCursor(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { if (followersAdapter == null) { if (followingIds == null) { // we will do a normal array adapter followersAdapter = new PeopleArrayAdapter(context, followers); } else { followersAdapter = new FollowersArrayAdapter(context, followers, followingIds); } listView.setAdapter(followersAdapter); } else { followersAdapter.notifyDataSetChanged(); } if (settings.roundContactImages) { ImageUtils.loadSizedCircleImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache, 96); } else { ImageUtils.loadImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache); } String url = user.getProfileBannerURL(); ImageUtils.loadImage(context, background, url, mCache); canRefresh = true; spinner.setVisibility(View.GONE); } }); } catch (Exception e) { e.printStackTrace(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { if (user != null && user.isProtected()) { Toast.makeText(context, getResources().getString(R.string.protected_account), Toast.LENGTH_SHORT).show(); if (settings.roundContactImages) { ImageUtils.loadSizedCircleImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache, 96); } else { ImageUtils.loadImage(context, profilePicture, user.getOriginalProfileImageURL(), mCache); } String url = user.getProfileBannerURL(); ImageUtils.loadImage(context, background, url, mCache); } else { Toast.makeText(context, getResources().getString(R.string.error_loading_timeline), Toast.LENGTH_SHORT).show(); } spinner.setVisibility(View.GONE); canRefresh = false; hasMore = false; } }); } } }).start(); }
From source file:com.daiv.android.twitter.ui.profile_viewer.fragments.ProfileFragment.java
License:Apache License
public void getFollowing(final User user, final AsyncListView listView) { spinner.setVisibility(View.VISIBLE); canRefresh = false;/* w w w .j a va2s . c o m*/ new Thread(new Runnable() { @Override public void run() { try { Twitter twitter = Utils.getTwitter(context, settings); PagableResponseList<User> friendsPaging; try { friendsPaging = twitter.getFriendsList(user.getId(), currentFollowing, 100); } catch (OutOfMemoryError e) { return; } for (int i = 0; i < friendsPaging.size(); i++) { following.add(friendsPaging.get(i)); Log.v("friends_list", friendsPaging.get(i).getName()); } if (friendsPaging.size() > 17) { hasMore = true; } else { hasMore = false; } currentFollowing = friendsPaging.getNextCursor(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { if (followingAdapter == null) { followingAdapter = new PeopleArrayAdapter(context, following); listView.setAdapter(followingAdapter); } else { followingAdapter.notifyDataSetChanged(); } if (settings.roundContactImages) { ImageUtils.loadSizedCircleImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache, 96); } else { ImageUtils.loadImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache); } String url = user.getProfileBannerURL(); ImageUtils.loadImage(context, background, url, mCache); canRefresh = true; spinner.setVisibility(View.GONE); } }); } catch (Exception e) { e.printStackTrace(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { try { if (user != null && user.isProtected()) { Toast.makeText(context, getResources().getString(R.string.protected_account), Toast.LENGTH_SHORT).show(); if (settings.roundContactImages) { ImageUtils.loadSizedCircleImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache, 96); } else { ImageUtils.loadImage(context, profilePicture, user.getOriginalProfileImageURL(), mCache); } String url = user.getProfileBannerURL(); ImageUtils.loadImage(context, background, url, mCache); } else { Toast.makeText(context, getResources().getString(R.string.error_loading_timeline), Toast.LENGTH_SHORT).show(); } spinner.setVisibility(View.GONE); } catch (Exception e) { // fragment not attached } canRefresh = false; hasMore = false; } }); } } }).start(); }
From source file:com.daiv.android.twitter.ui.profile_viewer.fragments.ProfileFragment.java
License:Apache License
public void getTimeline(final User user, final AsyncListView listView) { spinner.setVisibility(View.VISIBLE); canRefresh = false;//ww w . ja v a2s .co m new Thread(new Runnable() { @Override public void run() { try { Twitter twitter = Utils.getTwitter(context, settings); List<twitter4j.Status> statuses = twitter.getUserTimeline(user.getId(), timelinePaging); timelinePaging.setPage(timelinePaging.getPage() + 1); for (twitter4j.Status s : statuses) { timelineStatuses.add(s); } if (statuses.size() > 17) { hasMore = true; } else { hasMore = false; } ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { if (timelineAdapter != null) { timelineAdapter.notifyDataSetChanged(); } else { timelineAdapter = new TimelineArrayAdapter(context, timelineStatuses, screenName); listView.setItemManager(builder.build()); listView.setAdapter(timelineAdapter); } if (settings.roundContactImages) { ImageUtils.loadSizedCircleImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache, 96); } else { ImageUtils.loadImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache); } String url = user.getProfileBannerURL(); ImageUtils.loadImage(context, background, url, mCache); spinner.setVisibility(View.GONE); canRefresh = true; } }); } catch (Exception e) { e.printStackTrace(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { try { if (user != null && user.isProtected()) { Toast.makeText(context, getResources().getString(R.string.protected_account), Toast.LENGTH_SHORT).show(); if (settings.roundContactImages) { ImageUtils.loadSizedCircleImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache, 96); } else { ImageUtils.loadImage(context, profilePicture, user.getOriginalProfileImageURL(), mCache); } String url = user.getProfileBannerURL(); ImageUtils.loadImage(context, background, url, mCache); } else { Toast.makeText(context, getResources().getString(R.string.error_loading_timeline), Toast.LENGTH_SHORT).show(); } spinner.setVisibility(View.GONE); } catch (Exception e) { // not attached } canRefresh = false; hasMore = false; } }); } catch (OutOfMemoryError x) { x.printStackTrace(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { try { Toast.makeText(context, context.getResources().getString(R.string.error_loading_timeline), Toast.LENGTH_SHORT).show(); spinner.setVisibility(View.GONE); } catch (Exception e) { // not attached } canRefresh = false; hasMore = false; } }); } } }).start(); }
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);// ww w.j a v a 2 s . co m } } struct.put("WithheldInCountries", withheldInCountries); }
From source file:com.klinker.android.twitter.ui.profile_viewer.fragments.ProfileFragment.java
License:Apache License
public void getFollowers(final User user, final AsyncListView listView) { spinner.setVisibility(View.VISIBLE); canRefresh = false;/* w w w .j a v a 2s.c om*/ new Thread(new Runnable() { @Override public void run() { try { Twitter twitter = Utils.getTwitter(context, settings); try { if (followingIds == null && user.getId() == settings.myId) { long currCursor = -1; IDs idObject; int rep = 0; do { // gets 5000 ids at a time idObject = twitter.getFriendsIDs(settings.myId, currCursor); long[] lIds = idObject.getIDs(); followingIds = new ArrayList<Long>(); for (int i = 0; i < lIds.length; i++) { followingIds.add(lIds[i]); } rep++; } while ((currCursor = idObject.getNextCursor()) != 0 && rep < 3); } } catch (Throwable t) { followingIds = null; } PagableResponseList<User> friendsPaging = twitter.getFollowersList(user.getId(), currentFollowers); for (int i = 0; i < friendsPaging.size(); i++) { followers.add(friendsPaging.get(i)); } if (friendsPaging.size() > 17) { hasMore = true; } else { hasMore = false; } currentFollowers = friendsPaging.getNextCursor(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { if (followersAdapter == null) { if (followingIds == null) { // we will do a normal array adapter followersAdapter = new PeopleArrayAdapter(context, followers); } else { followersAdapter = new FollowersArrayAdapter(context, followers, followingIds); } listView.setAdapter(followersAdapter); } else { followersAdapter.notifyDataSetChanged(); } if (settings.roundContactImages) { ImageUtils.loadSizedCircleImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache, 96); } else { ImageUtils.loadImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache); } String url = user.getProfileBannerURL(); ImageUtils.loadImage(context, background, url, mCache); canRefresh = true; spinner.setVisibility(View.GONE); } }); } catch (Exception e) { e.printStackTrace(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { if (user != null && user.isProtected()) { Toast.makeText(context, getResources().getString(R.string.protected_account), Toast.LENGTH_SHORT).show(); if (settings.roundContactImages) { ImageUtils.loadSizedCircleImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache, 96); } else { ImageUtils.loadImage(context, profilePicture, user.getOriginalProfileImageURL(), mCache); } String url = user.getProfileBannerURL(); ImageUtils.loadImage(context, background, url, mCache); } else { Toast.makeText(context, getResources().getString(R.string.error_loading_timeline), Toast.LENGTH_SHORT).show(); } spinner.setVisibility(View.GONE); canRefresh = false; hasMore = false; } }); } } }).start(); }
From source file:com.klinker.android.twitter.ui.profile_viewer.fragments.ProfileFragment.java
License:Apache License
public void getFollowing(final User user, final AsyncListView listView) { spinner.setVisibility(View.VISIBLE); canRefresh = false;/*from www. java 2s . co m*/ new Thread(new Runnable() { @Override public void run() { try { Twitter twitter = Utils.getTwitter(context, settings); PagableResponseList<User> friendsPaging; try { friendsPaging = twitter.getFriendsList(user.getId(), currentFollowing); } catch (OutOfMemoryError e) { return; } for (int i = 0; i < friendsPaging.size(); i++) { following.add(friendsPaging.get(i)); Log.v("friends_list", friendsPaging.get(i).getName()); } if (friendsPaging.size() > 17) { hasMore = true; } else { hasMore = false; } currentFollowing = friendsPaging.getNextCursor(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { if (followingAdapter == null) { followingAdapter = new PeopleArrayAdapter(context, following); listView.setAdapter(followingAdapter); } else { followingAdapter.notifyDataSetChanged(); } if (settings.roundContactImages) { ImageUtils.loadSizedCircleImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache, 96); } else { ImageUtils.loadImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache); } String url = user.getProfileBannerURL(); ImageUtils.loadImage(context, background, url, mCache); canRefresh = true; spinner.setVisibility(View.GONE); } }); } catch (Exception e) { e.printStackTrace(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { try { if (user != null && user.isProtected()) { Toast.makeText(context, getResources().getString(R.string.protected_account), Toast.LENGTH_SHORT).show(); if (settings.roundContactImages) { ImageUtils.loadSizedCircleImage(context, profilePicture, thisUser.getOriginalProfileImageURL(), mCache, 96); } else { ImageUtils.loadImage(context, profilePicture, user.getOriginalProfileImageURL(), mCache); } String url = user.getProfileBannerURL(); ImageUtils.loadImage(context, background, url, mCache); } else { Toast.makeText(context, getResources().getString(R.string.error_loading_timeline), Toast.LENGTH_SHORT).show(); } spinner.setVisibility(View.GONE); } catch (Exception e) { // fragment not attached } canRefresh = false; hasMore = false; } }); } } }).start(); }
From source file:com.twitt4droid.data.dao.impl.sqlite.UserSQLiteDAO.java
License:Apache License
/** {@inheritDoc} */ @Override//from w w w . jav a 2 s.com public void save(User user) { getSQLiteTemplate().execute(getSqlString(R.string.twitt4droid_insert_user_sql), new String[] { Objects.toString(user.getId()), user.getName(), user.getScreenName(), user.getProfileImageURL(), user.getProfileBannerURL(), user.getURL(), user.getDescription(), user.getLocation() }); }
From source file:com.twitt4droid.fragment.UserTimelineFragment.java
License:Apache License
/** * Sets up the user GUI./*from w w w . ja v a2s. c o m*/ * * @param user the user. */ private void setUpUser(User user) { userScreenName.setText(user.getName()); if (!Strings.isNullOrBlank(user.getProfileBannerURL())) { new ImageLoader(getActivity()).setLoadingColorId(R.color.twitt4droid_no_image_background) .setImageView(userProfileBannerImage).execute(user.getProfileBannerURL()); } if (!Strings.isNullOrBlank(user.getProfileImageURL())) { new ImageLoader(getActivity()).setLoadingColorId(R.color.twitt4droid_no_image_background) .setImageView(userProfileImage).execute(user.getProfileImageURL()); } }
From source file:net.lacolaco.smileessence.view.dialog.UserDetailDialogFragment.java
License:Open Source License
private void initUserData(User user, final Account account) { textViewName.setText(user.getName()); textViewScreenName.setText(user.getScreenName()); if (TextUtils.isEmpty(user.getLocation())) { textViewLocate.setVisibility(View.GONE); } else {/*www. j a v a 2 s . com*/ textViewLocate.setText(user.getLocation()); } if (TextUtils.isEmpty(user.getURL())) { textViewURL.setVisibility(View.GONE); } else { textViewURL.setText(user.getURL()); } textViewTweetCount.setText(String.valueOf(user.getStatusesCount())); textViewFriendCount.setText(String.valueOf(user.getFriendsCount())); textViewFollowerCount.setText(String.valueOf(user.getFollowersCount())); textViewFavoriteCount.setText(String.valueOf(user.getFavouritesCount())); textViewProtected.setVisibility(user.isProtected() ? View.VISIBLE : View.GONE); String htmlDescription = getHtmlDescription(user.getDescription()); textViewDescription.setText(Html.fromHtml(htmlDescription)); textViewDescription.setMovementMethod(LinkMovementMethod.getInstance()); ImageCache.getInstance().setImageToView(user.getBiggerProfileImageURL(), imageViewIcon); ImageCache.getInstance().setImageToView(user.getProfileBannerURL(), imageViewHeader); MainActivity activity = (MainActivity) getActivity(); final StatusListAdapter adapter = new StatusListAdapter(activity); listViewTimeline.setAdapter(adapter); listViewTimeline.setOnRefreshListener(this); activity.setListAdapter(ADAPTER_INDEX, adapter); executeUserTimelineTask(user, account, adapter); updateRelationship(activity, user.getId()); }
From source file:net.lacolaco.smileessence.viewmodel.UserViewModel.java
License:Open Source License
public UserViewModel(User user) { id = user.getId();/* w ww. j av a2 s . c om*/ screenName = user.getScreenName(); name = user.getName(); description = user.getDescription(); location = user.getLocation(); url = user.getURL(); iconURL = user.getBiggerProfileImageURL(); bannerURL = user.getProfileBannerURL(); statusesCount = user.getStatusesCount(); friendsCount = user.getFriendsCount(); followersCount = user.getFollowersCount(); favoritesCount = user.getFavouritesCount(); isProtected = user.isProtected(); isVerified = user.isVerified(); }