Added Clickable hashtags & usernames
This commit is contained in:
NudeDude 2018-03-19 22:49:58 +01:00
parent f9ac7f6d7c
commit 1f7e72bf4d

View File

@ -36,7 +36,7 @@ import twitter4j.conf.ConfigurationBuilder;
public class TwitterEngine { public class TwitterEngine {
private final String TWITTER_CONSUMER_KEY = "1JwXJbVrvGWrc9SSKPnnEWslJ"; private final String TWITTER_CONSUMER_KEY = "1JwXJbVrvGWrc9SSKPnnEWslJ";
private final String TWITTER_CONSUMER_SECRET = "INSERT SECRET"; // TODO private final String TWITTER_CONSUMER_SECRET = "INSERT SECRET"; //TODO
private static TwitterEngine mTwitter; private static TwitterEngine mTwitter;
private static long twitterID; private static long twitterID;
@ -462,9 +462,14 @@ public class TwitterEngine {
*/ */
private List<TwitterUser> convertUserList(List<User> users) { private List<TwitterUser> convertUserList(List<User> users) {
List <TwitterUser> result = new ArrayList<>(); List <TwitterUser> result = new ArrayList<>();
for(User user : users) { try {
TwitterUser item = getUser(user); for(User user : users) {
result.add(item); TwitterUser item = getUser(user);
result.add(item);
}
} catch (Exception err) {
// Bug in Twitter4J caused by 'wihheld accounts'
// because of empty profile image URL
} }
return result; return result;
} }
@ -477,16 +482,21 @@ public class TwitterEngine {
*/ */
private List<Tweet> convertStatusList(List<Status> statuses) { private List<Tweet> convertStatusList(List<Status> statuses) {
List<Tweet> result = new ArrayList<>(); List<Tweet> result = new ArrayList<>();
for(Status status : statuses) { try {
Status embedded = status.getRetweetedStatus(); for(Status status : statuses) {
if(embedded != null) { Status embedded = status.getRetweetedStatus();
Tweet retweet = getTweet(embedded, null); if(embedded != null) {
Tweet tweet = getTweet(status, retweet); Tweet retweet = getTweet(embedded, null);
result.add(tweet); Tweet tweet = getTweet(status, retweet);
} else { result.add(tweet);
Tweet tweet = getTweet(status, null); } else {
result.add(tweet); Tweet tweet = getTweet(status, null);
result.add(tweet);
}
} }
} catch (Exception err) {
// Bug in Twitter4J caused by 'wihheld accounts'
// because of empty profile image URL
} }
return result; return result;
} }