List of usage examples for twitter4j Status isRetweet
boolean isRetweet();
From source file:com.joanzapata.android.twitter.TwitterFragment.java
License:Apache License
@AfterViews void afterViews() { setRetainInstance(true);//from ww w. ja v a 2 s . c om 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.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 ww. java2 s . 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"); 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); }//from w w w . j a v a 2s. 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]; 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(); } }
From source file:com.klinker.android.twitter.data.sq_lite.HomeDataSource.java
License:Apache License
public synchronized void createTweet(Status status, int account) { ContentValues values = new ContentValues(); String originalName = ""; long time = status.getCreatedAt().getTime(); long id = status.getId(); if (status.isRetweet()) { originalName = status.getUser().getScreenName(); status = status.getRetweetedStatus(); }//from w w w. ja v a 2 s .c o m String[] html = TweetLinkUtils.getLinksInStatus(status); String text = html[0]; String media = html[1]; String url = html[2]; String hashtags = html[3]; String users = html[4]; String source; if (status.isRetweet()) { source = android.text.Html.fromHtml(status.getRetweetedStatus().getSource()).toString(); } else { source = android.text.Html.fromHtml(status.getSource()).toString(); } values.put(HomeSQLiteHelper.COLUMN_ACCOUNT, account); values.put(HomeSQLiteHelper.COLUMN_TEXT, text); values.put(HomeSQLiteHelper.COLUMN_TWEET_ID, id); values.put(HomeSQLiteHelper.COLUMN_NAME, status.getUser().getName()); values.put(HomeSQLiteHelper.COLUMN_PRO_PIC, status.getUser().getOriginalProfileImageURL()); values.put(HomeSQLiteHelper.COLUMN_SCREEN_NAME, status.getUser().getScreenName()); values.put(HomeSQLiteHelper.COLUMN_TIME, time); values.put(HomeSQLiteHelper.COLUMN_RETWEETER, originalName); values.put(HomeSQLiteHelper.COLUMN_UNREAD, 1); values.put(HomeSQLiteHelper.COLUMN_PIC_URL, media); values.put(HomeSQLiteHelper.COLUMN_URL, url); values.put(HomeSQLiteHelper.COLUMN_USERS, users); values.put(HomeSQLiteHelper.COLUMN_HASHTAGS, hashtags); values.put(HomeSQLiteHelper.COLUMN_CLIENT_SOURCE, source); try { database.insert(HomeSQLiteHelper.TABLE_HOME, null, values); } catch (Exception e) { open(); database.insert(HomeSQLiteHelper.TABLE_HOME, null, values); } }
From source file:com.klinker.android.twitter.data.sq_lite.HomeDataSource.java
License:Apache License
public synchronized void createTweet(Status status, int account, boolean initial) { ContentValues values = new ContentValues(); String originalName = ""; long time = status.getCreatedAt().getTime(); long id = status.getId(); if (status.isRetweet()) { originalName = status.getUser().getScreenName(); status = status.getRetweetedStatus(); }/*from w w w . java 2s. c om*/ String[] html = TweetLinkUtils.getLinksInStatus(status); String text = html[0]; String media = html[1]; String url = html[2]; String hashtags = html[3]; String users = html[4]; String source; if (status.isRetweet()) { source = android.text.Html.fromHtml(status.getRetweetedStatus().getSource()).toString(); } else { source = android.text.Html.fromHtml(status.getSource()).toString(); } values.put(HomeSQLiteHelper.COLUMN_ACCOUNT, account); values.put(HomeSQLiteHelper.COLUMN_TEXT, text); values.put(HomeSQLiteHelper.COLUMN_TWEET_ID, id); values.put(HomeSQLiteHelper.COLUMN_NAME, status.getUser().getName()); values.put(HomeSQLiteHelper.COLUMN_PRO_PIC, status.getUser().getOriginalProfileImageURL()); values.put(HomeSQLiteHelper.COLUMN_SCREEN_NAME, status.getUser().getScreenName()); values.put(HomeSQLiteHelper.COLUMN_TIME, time); values.put(HomeSQLiteHelper.COLUMN_RETWEETER, originalName); values.put(HomeSQLiteHelper.COLUMN_UNREAD, 0); values.put(HomeSQLiteHelper.COLUMN_PIC_URL, media); values.put(HomeSQLiteHelper.COLUMN_URL, url); values.put(HomeSQLiteHelper.COLUMN_USERS, users); values.put(HomeSQLiteHelper.COLUMN_HASHTAGS, hashtags); values.put(HomeSQLiteHelper.COLUMN_CLIENT_SOURCE, source); try { database.insert(HomeSQLiteHelper.TABLE_HOME, null, values); } catch (Exception e) { open(); database.insert(HomeSQLiteHelper.TABLE_HOME, null, values); } }
From source file:com.klinker.android.twitter.data.sq_lite.HomeDataSource.java
License:Apache License
public synchronized int insertTweets(List<Status> statuses, int currentAccount, long[] lastIds) { ContentValues[] valueses = new ContentValues[statuses.size()]; for (int i = 0; i < statuses.size(); i++) { Status status = statuses.get(i); Long id = status.getId(); ContentValues values = new ContentValues(); if (id > lastIds[0]) { String originalName = ""; long mId = status.getId(); long time = status.getCreatedAt().getTime(); if (status.isRetweet()) { originalName = status.getUser().getScreenName(); status = status.getRetweetedStatus(); }/*from w w w . j a v a2 s . c o m*/ String[] html = TweetLinkUtils.getLinksInStatus(status); String text = html[0]; String media = html[1]; String url = html[2]; String hashtags = html[3]; String users = html[4]; String source; if (status.isRetweet()) { source = android.text.Html.fromHtml(status.getRetweetedStatus().getSource()).toString(); } else { source = android.text.Html.fromHtml(status.getSource()).toString(); } values.put(HomeSQLiteHelper.COLUMN_ACCOUNT, currentAccount); values.put(HomeSQLiteHelper.COLUMN_TEXT, text); values.put(HomeSQLiteHelper.COLUMN_TWEET_ID, mId); values.put(HomeSQLiteHelper.COLUMN_NAME, status.getUser().getName()); values.put(HomeSQLiteHelper.COLUMN_PRO_PIC, status.getUser().getOriginalProfileImageURL()); values.put(HomeSQLiteHelper.COLUMN_SCREEN_NAME, status.getUser().getScreenName()); values.put(HomeSQLiteHelper.COLUMN_TIME, time); values.put(HomeSQLiteHelper.COLUMN_RETWEETER, originalName); values.put(HomeSQLiteHelper.COLUMN_UNREAD, 1); values.put(HomeSQLiteHelper.COLUMN_PIC_URL, media); values.put(HomeSQLiteHelper.COLUMN_URL, url); values.put(HomeSQLiteHelper.COLUMN_USERS, users); values.put(HomeSQLiteHelper.COLUMN_HASHTAGS, hashtags); values.put(HomeSQLiteHelper.COLUMN_CLIENT_SOURCE, source); } else { values = null; } valueses[i] = values; } ArrayList<ContentValues> vals = new ArrayList<ContentValues>(); for (ContentValues v : valueses) { if (v != null) { vals.add(v); } } insertMultiple(valueses); return vals.size(); }
From source file:com.klinker.android.twitter.data.sq_lite.ListDataSource.java
License:Apache License
public synchronized void createTweet(Status status, long listId) { ContentValues values = new ContentValues(); String originalName = ""; long time = status.getCreatedAt().getTime(); long id = status.getId(); if (status.isRetweet()) { originalName = status.getUser().getScreenName(); status = status.getRetweetedStatus(); }/*ww w .j a va2 s .co m*/ String[] html = TweetLinkUtils.getLinksInStatus(status); String text = html[0]; String media = html[1]; String url = html[2]; String hashtags = html[3]; String users = html[4]; values.put(ListSQLiteHelper.COLUMN_TEXT, text); values.put(ListSQLiteHelper.COLUMN_TWEET_ID, id); values.put(ListSQLiteHelper.COLUMN_NAME, status.getUser().getName()); values.put(ListSQLiteHelper.COLUMN_PRO_PIC, status.getUser().getOriginalProfileImageURL()); values.put(ListSQLiteHelper.COLUMN_SCREEN_NAME, status.getUser().getScreenName()); values.put(ListSQLiteHelper.COLUMN_TIME, time); values.put(ListSQLiteHelper.COLUMN_RETWEETER, originalName); values.put(ListSQLiteHelper.COLUMN_PIC_URL, media); values.put(ListSQLiteHelper.COLUMN_URL, url); values.put(ListSQLiteHelper.COLUMN_USERS, users); values.put(ListSQLiteHelper.COLUMN_HASHTAGS, hashtags); values.put(ListSQLiteHelper.COLUMN_LIST_ID, listId); try { database.insert(ListSQLiteHelper.TABLE_HOME, null, values); } catch (Exception e) { open(); database.insert(ListSQLiteHelper.TABLE_HOME, null, values); } }
From source file:com.klinker.android.twitter.data.sq_lite.ListDataSource.java
License:Apache License
public int insertTweets(List<Status> statuses, long listId) { ContentValues[] valueses = new ContentValues[statuses.size()]; for (int i = 0; i < statuses.size(); i++) { Status status = statuses.get(i); ContentValues values = new ContentValues(); String originalName = ""; long time = status.getCreatedAt().getTime(); long id = status.getId(); if (status.isRetweet()) { originalName = status.getUser().getScreenName(); status = status.getRetweetedStatus(); }//w ww .j a va 2 s . co m String[] html = TweetLinkUtils.getLinksInStatus(status); String text = html[0]; String media = html[1]; String url = html[2]; String hashtags = html[3]; String users = html[4]; values.put(ListSQLiteHelper.COLUMN_TEXT, text); values.put(ListSQLiteHelper.COLUMN_TWEET_ID, id); values.put(ListSQLiteHelper.COLUMN_NAME, status.getUser().getName()); values.put(ListSQLiteHelper.COLUMN_PRO_PIC, status.getUser().getOriginalProfileImageURL()); values.put(ListSQLiteHelper.COLUMN_SCREEN_NAME, status.getUser().getScreenName()); values.put(ListSQLiteHelper.COLUMN_TIME, time); values.put(ListSQLiteHelper.COLUMN_RETWEETER, originalName); values.put(ListSQLiteHelper.COLUMN_PIC_URL, media); values.put(ListSQLiteHelper.COLUMN_URL, url); values.put(ListSQLiteHelper.COLUMN_USERS, users); values.put(ListSQLiteHelper.COLUMN_HASHTAGS, hashtags); values.put(ListSQLiteHelper.COLUMN_LIST_ID, listId); valueses[i] = values; } return insertMultiple(valueses); }
From source file:com.klinker.android.twitter.ui.tweet_viewer.fragments.TweetFragment.java
License:Apache License
public void getFavoriteCount(final TextView favs, final View favButton, final long tweetId) { new Thread(new Runnable() { @Override/*from www. j ava 2 s. c om*/ public void run() { try { Twitter twitter = Utils.getTwitter(context, settings); twitter4j.Status status = twitter.showStatus(tweetId); if (status.isRetweet()) { twitter4j.Status retweeted = status.getRetweetedStatus(); status = retweeted; } final twitter4j.Status fStatus = status; ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { favs.setText(" " + fStatus.getFavoriteCount()); if (fStatus.isFavorited()) { TypedArray a = context.getTheme() .obtainStyledAttributes(new int[] { R.attr.favoritedButton }); int resource = a.getResourceId(0, 0); a.recycle(); if (favButton instanceof ImageButton) { if (!settings.addonTheme) { ((ImageButton) favButton) .setColorFilter(context.getResources().getColor(R.color.app_color)); } else { ((ImageButton) favButton).setColorFilter(settings.accentInt); } ((ImageButton) favButton) .setImageDrawable(context.getResources().getDrawable(resource)); } else if (favButton instanceof LinearLayout) { if (!settings.addonTheme) { favButton.setBackgroundColor( context.getResources().getColor(R.color.app_color)); } else { favButton.setBackgroundColor(settings.accentInt); } } isFavorited = true; } else { TypedArray a = context.getTheme() .obtainStyledAttributes(new int[] { R.attr.notFavoritedButton }); int resource = a.getResourceId(0, 0); a.recycle(); if (favButton instanceof ImageButton) { ((ImageButton) favButton) .setImageDrawable(context.getResources().getDrawable(resource)); isFavorited = false; ((ImageButton) favButton).clearColorFilter(); } else { favButton.setBackgroundColor( getResources().getColor(android.R.color.transparent)); } } } }); } catch (Exception e) { } } }).start(); }
From source file:com.klinker.android.twitter.ui.tweet_viewer.ViewRetweeters.java
License:Apache License
public void onRefreshStarted() { new Thread(new Runnable() { @Override//ww w .jav a 2s .com public void run() { try { Twitter twitter = Utils.getTwitter(context, settings); Status stat = twitter.showStatus(tweetId); if (stat.isRetweet()) { tweetId = stat.getRetweetedStatus().getId(); } // can get 100 retweeters is all ResponseList<twitter4j.Status> lists = twitter.getRetweets(tweetId); users.clear(); for (Status status : lists) { users.add(status.getUser()); } ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { adapter = new PeopleArrayAdapter(context, users); listView.setAdapter(adapter); listView.setVisibility(View.VISIBLE); spinner.setVisibility(View.GONE); if (users.size() == 0) { noContent.setVisibility(View.VISIBLE); } mPullToRefreshLayout.setRefreshing(false); } }); } catch (Exception e) { e.printStackTrace(); } catch (OutOfMemoryError e) { e.printStackTrace(); } } }).start(); }