aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/net/lacolaco/smileessence/twitter/task/Users.java
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-10-05 15:58:59 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-10-05 15:58:59 +0900
commit9db537d339faa3ad44dfdcadb23f4c14bd8aceb4 (patch)
tree6b151cdfd0ca7dc44b9a189045b2b2cbc5aefc21 /app/src/main/java/net/lacolaco/smileessence/twitter/task/Users.java
parent52ad6edcb217762154a80990c34ca94772393848 (diff)
downloadSmileEssence-9db537d339faa3ad44dfdcadb23f4c14bd8aceb4.tar.gz
kotlin work part. 1
Diffstat (limited to 'app/src/main/java/net/lacolaco/smileessence/twitter/task/Users.java')
-rw-r--r--app/src/main/java/net/lacolaco/smileessence/twitter/task/Users.java143
1 files changed, 0 insertions, 143 deletions
diff --git a/app/src/main/java/net/lacolaco/smileessence/twitter/task/Users.java b/app/src/main/java/net/lacolaco/smileessence/twitter/task/Users.java
deleted file mode 100644
index 60b62841..00000000
--- a/app/src/main/java/net/lacolaco/smileessence/twitter/task/Users.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package net.lacolaco.smileessence.twitter.task;
-
-import net.lacolaco.smileessence.data.Account;
-import net.lacolaco.smileessence.entity.User;
-import net.lacolaco.smileessence.util.BackgroundTask;
-import net.lacolaco.smileessence.util.ListUtils;
-import twitter4j.Relationship;
-import twitter4j.TwitterException;
-import twitter4j.UserList;
-
-import java.util.List;
-
-public class Users {
- public static class GetTask extends BackgroundTask<User, Void> {
- private final Account account;
- private final long userID;
- private final String screenName;
-
- public GetTask(Account account, long userID) {
- this.account = account;
- this.userID = userID;
- this.screenName = null;
- }
-
- public GetTask(Account account, String screenName) {
- this.account = account;
- this.screenName = screenName;
- this.userID = -1;
- }
-
- @Override
- protected User doInBackground() throws TwitterException {
- if (screenName != null) {
- return User.fromTwitter(account.getTwitter().users().showUser(screenName));
- } else {
- return User.fromTwitter(account.getTwitter().users().showUser(userID));
- }
- }
- }
-
- public static class GetManyTask extends BackgroundTask<List<String>, Void> {
- private final Account account;
-
- public GetManyTask(Account account) {
- this.account = account;
- }
-
- @Override
- protected List<String> doInBackground() throws TwitterException {
- return ListUtils.map(account.getTwitter().list().getUserLists(account.getUserId()), UserList::getFullName);
- }
- }
-
- public static class FollowTask extends BackgroundTask<User, Void> {
- private final Account account;
- private final long userID;
-
- public FollowTask(Account account, long userID) {
- this.account = account;
- this.userID = userID;
- }
-
- @Override
- protected User doInBackground() throws TwitterException {
- return User.fromTwitter(account.getTwitter().friendsFollowers().createFriendship(userID));
- }
- }
-
- public static class UnfollowTask extends BackgroundTask<User, Void> {
- private final Account account;
- private final long userID;
-
- public UnfollowTask(Account account, long userID) {
- this.account = account;
- this.userID = userID;
- }
-
- @Override
- protected User doInBackground() throws TwitterException {
- return User.fromTwitter(account.getTwitter().friendsFollowers().destroyFriendship(userID));
- }
- }
-
- public static class BlockTask extends BackgroundTask<User, Void> {
- private final Account account;
- private final long userID;
-
- public BlockTask(Account account, long userID) {
- this.account = account;
- this.userID = userID;
- }
-
- @Override
- protected User doInBackground() throws TwitterException {
- return User.fromTwitter(account.getTwitter().users().createBlock(userID));
- }
- }
-
- public static class ReportForSpamTask extends BackgroundTask<User, Void> {
- private final Account account;
- private final long userID;
-
- public ReportForSpamTask(Account account, long userID) {
- this.account = account;
- this.userID = userID;
- }
-
- @Override
- protected User doInBackground() throws TwitterException {
- return User.fromTwitter(account.getTwitter().spamReporting().reportSpam(userID));
- }
- }
-
- public static class UnblockTask extends BackgroundTask<User, Void> {
- private final Account account;
- private final long userID;
-
- public UnblockTask(Account account, long userID) {
- this.account = account;
- this.userID = userID;
- }
-
- @Override
- protected User doInBackground() throws TwitterException {
- return User.fromTwitter(account.getTwitter().users().destroyBlock(userID));
- }
- }
-
- public static class ShowFriendshipTask extends BackgroundTask<Relationship, Void> {
- private final Account account;
- private final long userID;
-
- public ShowFriendshipTask(Account account, long userID) {
- this.account = account;
- this.userID = userID;
- }
-
- @Override
- protected Relationship doInBackground() throws TwitterException {
- return account.getTwitter().friendsFollowers().showFriendship(account.getTwitter().getId(), userID);
- }
- }
-}