List of usage examples for twitter4j User getName
String getName();
From source file:com.daiv.android.twitter.adapters.FollowersArrayAdapter.java
License:Apache License
@Override public void setFollowingStatus(ViewHolder holder, User u) { if (holder.following != null) { Log.v("Test_followers", "checking follow status for: " + u.getName()); Long l = u.getId();//from www. j a va 2 s . com if (followingIds.contains(l)) { holder.following.setVisibility(View.VISIBLE); Log.v("Test_followers", "i am following this person"); } else { holder.following.setVisibility(View.GONE); Log.v("Test_followers", "i am not following this person"); } } }
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;//www . j a v a 2 s .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); } 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;//from w w w . j a va2 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"); } }); }
From source file:com.daiv.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); }/* ww w. j ava 2 s.c o m*/ 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]; final boolean inAConversation = thisStatus.getInReplyToStatusId() != -1; holder.gifUrl = TweetLinkUtils.getGIFUrl(status, otherUrl); if (holder.isAConversation != null) { if (inAConversation) { if (holder.isAConversation.getVisibility() != View.VISIBLE) { holder.isAConversation.setVisibility(View.VISIBLE); } } else { if (holder.isAConversation.getVisibility() != View.GONE) { holder.isAConversation.setVisibility(View.GONE); } } } if (!settings.reverseClickActions) { final String fRetweeter = retweeter; holder.background.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { String link; boolean hasGif = holder.gifUrl != null && !holder.gifUrl.isEmpty(); boolean displayPic = !holder.picUrl.equals("") && !holder.picUrl.contains("youtube") && !(hasGif); if (displayPic) { link = holder.picUrl; } else { link = otherUrl.split(" ")[0]; } Log.v("tweet_page", "clicked"); 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 hasGif = holder.gifUrl != null && !holder.gifUrl.isEmpty(); boolean displayPic = !holder.picUrl.equals("") && !holder.picUrl.contains("youtube") && !(hasGif); if (displayPic) { link = holder.picUrl; } else { link = otherUrl.split(" ")[0]; } Log.v("tweet_page", "clicked"); } }); 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)) { } 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 (TestLayout == 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") || (holder.gifUrl != null && !android.text.TextUtils.isEmpty(holder.gifUrl))) { 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 hasGif = holder.gifUrl != null && !holder.gifUrl.isEmpty(); boolean displayPic = !holder.picUrl.equals("") && !holder.picUrl.contains("youtube") && !(hasGif); if (displayPic) { link = holder.picUrl; } else { link = otherUrl.split(" ")[0]; } } }); holder.image.setImageDrawable(transparent); picture = true; } else { holder.image.setImageDrawable(transparent); picture = true; if (holder.playButton.getVisibility() == View.VISIBLE) { holder.playButton.setVisibility(View.GONE); } } 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) { // 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(); } }
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 w w w. ja v a2 s . c o m 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.daiv.android.twitter.data.sq_lite.FavoriteUsersDataSource.java
License:Apache License
public synchronized void createUser(User user, int account) { ContentValues values = new ContentValues(); long id = user.getId(); String screenName = user.getScreenName(); String name = user.getName(); String proPicUrl = user.getOriginalProfileImageURL(); values.put(FavoriteUsersSQLiteHelper.COLUMN_ACCOUNT, account); values.put(FavoriteUsersSQLiteHelper.COLUMN_ID, id); values.put(FavoriteUsersSQLiteHelper.COLUMN_NAME, name); values.put(FavoriteUsersSQLiteHelper.COLUMN_PRO_PIC, proPicUrl); values.put(FavoriteUsersSQLiteHelper.COLUMN_SCREEN_NAME, screenName); try {//from w w w. j av a2 s. c o m database.insert(FavoriteUsersSQLiteHelper.TABLE_HOME, null, values); } catch (Exception e) { open(); database.insert(FavoriteUsersSQLiteHelper.TABLE_HOME, null, values); } }
From source file:com.daiv.android.twitter.data.sq_lite.FollowersDataSource.java
License:Apache License
public synchronized void createUser(User user, int account) { ContentValues values = new ContentValues(); long id = user.getId(); String screenName = user.getScreenName(); String name = user.getName(); String proPicUrl = user.getOriginalProfileImageURL(); values.put(FollowersSQLiteHelper.COLUMN_ACCOUNT, account); values.put(FollowersSQLiteHelper.COLUMN_ID, id); values.put(FollowersSQLiteHelper.COLUMN_NAME, name); values.put(FollowersSQLiteHelper.COLUMN_PRO_PIC, proPicUrl); values.put(FollowersSQLiteHelper.COLUMN_SCREEN_NAME, screenName); if (database == null || !database.isOpen()) { open();//from www .j ava2s . c om } try { database.insert(FollowersSQLiteHelper.TABLE_HOME, null, values); } catch (Exception e) { // already exist. primary key must be unique } }
From source file:com.daiv.android.twitter.utils.NotificationUtils.java
License:Apache License
public static void newInteractions(User interactor, Context context, SharedPreferences sharedPrefs, String type) {//from w w w . j a v a 2 s .c o m String title = ""; String text = ""; String smallText = ""; Bitmap icon = null; AppSettings settings = AppSettings.getInstance(context); int newFollowers = sharedPrefs.getInt("new_followers", 0); int newRetweets = sharedPrefs.getInt("new_retweets", 0); int newFavorites = sharedPrefs.getInt("new_favorites", 0); int newQuotes = sharedPrefs.getInt("new_quotes", 0); // set title if (newFavorites + newRetweets + newFollowers > 1) { title = context.getResources().getString(R.string.new_interactions); } else { title = context.getResources().getString(R.string.new_interaction_upper); } // set text String currText = sharedPrefs.getString("old_interaction_text", ""); if (!currText.equals("")) { currText += "<br>"; } if (settings.displayScreenName) { text = currText + "<b>" + interactor.getScreenName() + "</b> " + type; } else { text = currText + "<b>" + interactor.getName() + "</b> " + type; } sharedPrefs.edit().putString("old_interaction_text", text).commit(); // set icon int types = 0; if (newFavorites > 0) { types++; } if (newFollowers > 0) { types++; } if (newRetweets > 0) { types++; } if (newQuotes > 0) { types++; } if (types > 1) { icon = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_stat_icon); } else { if (newFavorites > 0) { icon = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_action_important_dark); } else if (newRetweets > 0) { icon = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_action_repeat_dark); } else { icon = BitmapFactory.decodeResource(context.getResources(), R.drawable.drawer_user_dark); } } // set shorter text int total = newFavorites + newFollowers + newRetweets + newQuotes; if (total > 1) { smallText = total + " " + context.getResources().getString(R.string.new_interactions_lower); } else { smallText = text; } Intent markRead = new Intent(context, ReadInteractionsService.class); PendingIntent readPending = PendingIntent.getService(context, 0, markRead, 0); Intent deleteIntent = new Intent(context, NotificationDeleteReceiverOne.class); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context).setContentTitle(title) .setContentText(Html.fromHtml( settings.addonTheme ? smallText.replaceAll("FF8800", settings.accentColor) : smallText)) .setSmallIcon(R.drawable.ic_stat_icon).setLargeIcon(icon).setTicker(title) .setDeleteIntent(PendingIntent.getBroadcast(context, 0, deleteIntent, 0)) .setPriority(NotificationCompat.PRIORITY_HIGH).setAutoCancel(true); if (context.getResources().getBoolean(R.bool.expNotifications)) { mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText( Html.fromHtml(settings.addonTheme ? text.replaceAll("FF8800", settings.accentColor) : text))); } if (settings.vibrate) { mBuilder.setDefaults(Notification.DEFAULT_VIBRATE); } if (settings.sound) { try { mBuilder.setSound(Uri.parse(settings.ringtone)); } catch (Exception e) { mBuilder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)); } } if (settings.led) mBuilder.setLights(0xFFFFFF, 1000, 1000); if (settings.notifications) { NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); notificationManager.notify(4, mBuilder.build()); // if we want to wake the screen on a new message if (settings.wakeScreen) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); final PowerManager.WakeLock wakeLock = pm.newWakeLock((PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP), "TAG"); wakeLock.acquire(5000); } // Pebble notification if (sharedPrefs.getBoolean("pebble_notification", false)) { sendAlertToPebble(context, title, text); } // Light Flow notification sendToLightFlow(context, title, text); } }
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;//ww w. j a v a2s . co 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.fragment.UserProfileFragment.java
License:Open Source License
public void changeUser(final long account_id, final User user) { mFriendship = null;//from ww w . ja va 2 s .com mUserId = -1; mAccountId = -1; if (user == null || user.getId() <= 0 || getActivity() == null || !isMyActivatedAccount(getActivity(), account_id)) return; if (mUserInfoTask != null && mUserInfoTask.getStatus() == AsyncTask.Status.RUNNING) { mUserInfoTask.cancel(true); } final boolean is_my_activated_account = isMyActivatedAccount(getActivity(), user.getId()); mUserInfoTask = null; mErrorRetryContainer.setVisibility(View.GONE); mAccountId = account_id; mUserId = user.getId(); mScreenName = user.getScreenName(); updateUserColor(); 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(); } } mNameView.setText(user.getName()); mScreenNameView.setText("@" + user.getScreenName()); mScreenNameView.setCompoundDrawablesWithIntrinsicBounds( getUserTypeIconRes(user.isVerified(), user.isProtected()), 0, 0, 0); final String description = user.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 location = user.getLocation(); mLocationContainer .setVisibility(is_my_activated_account || !isNullOrEmpty(location) ? View.VISIBLE : View.GONE); mLocationContainer.setOnLongClickListener(this); mLocationView.setText(location); final String url = user.getURL() != null ? user.getURL().toString() : null; mURLContainer.setVisibility(is_my_activated_account || !isNullOrEmpty(url) ? View.VISIBLE : View.GONE); mURLContainer.setOnLongClickListener(this); mURLView.setText(url); mCreatedAtView.setText(formatToLongTimeString(getActivity(), getTimestampFromDate(user.getCreatedAt()))); mTweetCount.setText(String.valueOf(user.getStatusesCount())); mFollowersCount.setText(String.valueOf(user.getFollowersCount())); mFriendsCount.setText(String.valueOf(user.getFriendsCount())); // final boolean display_profile_image = // mPreferences.getBoolean(PREFERENCE_KEY_DISPLAY_PROFILE_IMAGE, true); // mProfileImageView.setVisibility(display_profile_image ? View.VISIBLE // : View.GONE); // if (display_profile_image) { final String profile_image_url_string = parseString(user.getProfileImageURL()); final boolean hires_profile_image = getResources().getBoolean(R.bool.hires_profile_image); mLazyImageLoader.displayProfileImage(mProfileImageView, hires_profile_image ? getBiggerTwitterProfileImage(profile_image_url_string) : profile_image_url_string); // } String profile_banner_url_string = parseString(user.getProfileBannerImageUrl()); if (profile_banner_url_string != null) { final int def_width = getResources().getDisplayMetrics().widthPixels; profile_banner_url_string = profile_banner_url_string + "/" + getBestBannerType(def_width); } final String banner_url = profile_banner_url_string; if (mProfileBackgroundView != null) { mProfileBackgroundView.setScaleType(ImageView.ScaleType.CENTER_CROP); if (banner_url != null) { mLazyImageLoader.displayPreviewImage(mProfileBackgroundView, banner_url); } else { final Drawable d = getResources().getDrawable(R.drawable.linen); mProfileBackgroundView.setImageDrawable(d); } } mUser = user; if (isMyAccount(getActivity(), user.getId())) { final ContentResolver resolver = getContentResolver(); final ContentValues values = new ContentValues(); final URL profile_image_url = user.getProfileImageURL(); if (profile_image_url != null) { values.put(Accounts.PROFILE_IMAGE_URL, profile_image_url.toString()); } values.put(Accounts.USERNAME, user.getScreenName()); final String where = Accounts.USER_ID + " = " + user.getId() + " AND 1 = 1"; resolver.update(Accounts.CONTENT_URI, values, where, null); } mAdapter.add(new UserRecentPhotosAction()); mAdapter.add(new FavoritesAction()); mAdapter.add(new UserMentionsAction()); mAdapter.add(new UserListTypesAction()); if (user.getId() == mAccountId) { mAdapter.add(new MyTweetsRetweetedAction()); mAdapter.add(new SavedSearchesAction()); boolean nativeMapSupported = true; try { Class.forName("com.google.android.maps.MapActivity"); Class.forName("com.google.android.maps.MapView"); } catch (final ClassNotFoundException e) { nativeMapSupported = false; } if (nativeMapSupported) { mAdapter.add(new UserNearbyAction()); } if (user.isProtected()) { mAdapter.add(new IncomingFriendshipsAction()); } mAdapter.add(new UserBlocksAction()); } mAdapter.notifyDataSetChanged(); if (mRecentPhotosGallery != null) { mRecentPhotosGallery.setVisibility(View.GONE); mRecentPhotosGallery.setAdapter(new ImageAdapter(this.getActivity())); mRecentPhotosGallery.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { ParcelableStatus pStatus = mMediaStatuses.get(position); final ImageSpec spec = getAllAvailableImage(pStatus.image_orig_url_string); if (spec != null) { openImage(UserProfileFragment.this.getActivity(), Uri.parse(spec.full_image_link), pStatus.is_possibly_sensitive); } } }); mMediaTimelineTask = new MediaTimelineTask(this.getActivity(), mAccountId, mUser.getScreenName()); if (mMediaTimelineTask != null) { mMediaTimelineTask.execute(); } } getFriendship(); checkPushTracked(); }