blob: 633ff17e9c1d1576a35d4c151cf27ced2ac3a02a (
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
|
package net.miz_hi.smileessence.task.impl;
import net.miz_hi.smileessence.Client;
import net.miz_hi.smileessence.auth.Account;
import net.miz_hi.smileessence.notification.Notificator;
import net.miz_hi.smileessence.task.Task;
import net.miz_hi.smileessence.twitter.API;
import twitter4j.TwitterException;
public class RetweetTask extends Task<Boolean>
{
private Account account;
private long statusId;
public RetweetTask(long statusId)
{
this(Client.getMainAccount(), statusId);
}
public RetweetTask(Account account, long statusId)
{
this.account = account;
this.statusId = statusId;
}
@Override
public Boolean call()
{
try
{
API.retweet(account, statusId);
return true;
}
catch (TwitterException e)
{
e.printStackTrace();
return false;
}
}
@Override
public void onPreExecute()
{
}
@Override
public void onPostExecute(Boolean result)
{
if (result)
{
Notificator.info("リツイートしました");
}
else
{
Notificator.info("リツイートに失敗しました");
}
}
}
|