blob: f201492eacd794a8b83d090208c7edd908de655f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
package net.lacolaco.smileessence.twitter.task;
import net.lacolaco.smileessence.data.Account;
import net.lacolaco.smileessence.entity.Tweet;
import net.lacolaco.smileessence.util.BackgroundTask;
import twitter4j.TwitterException;
public class TweetReactions {
public static class RetweetTask extends BackgroundTask<Tweet, Void> {
// ------------------------------ FIELDS ------------------------------
private final Account account;
private final long statusID;
// --------------------------- CONSTRUCTORS ---------------------------
public RetweetTask(Account account, long statusID) {
this.account = account;
this.statusID = statusID;
}
// ------------------------ OVERRIDE METHODS ------------------------
@Override
protected Tweet doInBackground() throws TwitterException {
return Tweet.fromTwitter(account.getTwitter().tweets().retweetStatus(statusID), account.getUserId());
}
}
public static class FavoriteTask extends BackgroundTask<Tweet, Void> {
// ------------------------------ FIELDS ------------------------------
private final Account account;
private final long statusID;
// --------------------------- CONSTRUCTORS ---------------------------
public FavoriteTask(Account account, long statusID) {
this.account = account;
this.statusID = statusID;
}
// ------------------------ OVERRIDE METHODS ------------------------
@Override
protected Tweet doInBackground() throws TwitterException {
return Tweet.fromTwitter(account.getTwitter().favorites().createFavorite(statusID), account.getUserId());
}
}
public static class UnfavoriteTask extends BackgroundTask<Tweet, Void> {
// ------------------------------ FIELDS ------------------------------
private final Account account;
private final long statusID;
// --------------------------- CONSTRUCTORS ---------------------------
public UnfavoriteTask(Account account, long statusID) {
this.account = account;
this.statusID = statusID;
}
// ------------------------ OVERRIDE METHODS ------------------------
@Override
protected Tweet doInBackground() throws TwitterException {
return Tweet.fromTwitter(account.getTwitter().favorites().destroyFavorite(statusID), account.getUserId());
}
}
}
|