blob: 6893319c57f9a4ccb2cbbc762ecbf6f590738d66 (
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
|
package net.lacolaco.smileessence.twitter.task
import net.lacolaco.smileessence.data.Account
import net.lacolaco.smileessence.entity.Tweet
import twitter4j.TwitterException
class Timelines {
class HomeTimelineTask
// --------------------------- CONSTRUCTORS ---------------------------
(
// ------------------------------ FIELDS ------------------------------
private val account: Account) : TimelineTask<Tweet>() {
// ------------------------ OVERRIDE METHODS ------------------------
@Throws(TwitterException::class)
override fun doInBackground(): List<Tweet> {
return Tweet.fromTwitter(account.twitter.timelines().getHomeTimeline(paging), account.userId)
}
}
class MentionsTimelineTask
// --------------------------- CONSTRUCTORS ---------------------------
(
// ------------------------------ FIELDS ------------------------------
private val account: Account) : TimelineTask<Tweet>() {
// ------------------------ OVERRIDE METHODS ------------------------
@Throws(TwitterException::class)
override fun doInBackground(): List<Tweet> {
return Tweet.fromTwitter(account.twitter.timelines().getMentionsTimeline(paging), account.userId)
}
}
class UserTimelineTask
// --------------------------- CONSTRUCTORS ---------------------------
(private val account: Account,
// ------------------------------ FIELDS ------------------------------
private val userID: Long) : TimelineTask<Tweet>() {
// ------------------------ OVERRIDE METHODS ------------------------
@Throws(TwitterException::class)
override fun doInBackground(): List<Tweet> {
return Tweet.fromTwitter(account.twitter.timelines().getUserTimeline(userID, paging), account.userId)
}
}
class UserListStatusesTask
// --------------------------- CONSTRUCTORS ---------------------------
(
// ------------------------------ FIELDS ------------------------------
private val account: Account, private val listFullName: String) : TimelineTask<Tweet>() {
// ------------------------ OVERRIDE METHODS ------------------------
@Throws(TwitterException::class)
override fun doInBackground(): List<Tweet> {
val strings = listFullName.split("/".toRegex()).dropLastWhile({ it.isEmpty() }).toTypedArray()
return Tweet.fromTwitter(account.twitter.list().getUserListStatuses(strings[0], strings[1], paging), account.userId)
}
}
}
|