diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-09-18 22:32:58 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-09-18 22:32:58 +0900 |
commit | e06ab7394233f320343aef55e689eb0437010c86 (patch) | |
tree | 7509fb12ec8a56b5b9cd1ae2aa3d2f27e36765af | |
parent | 0d2cf7dc057e21df9d6d680939df4f0b475862e9 (diff) | |
download | SmileEssence-e06ab7394233f320343aef55e689eb0437010c86.tar.gz |
TwitterUtils.getPagingCount を MainActivity に移動
9 files changed, 20 insertions, 22 deletions
diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java index 3fc33bc6..80299528 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java @@ -76,6 +76,9 @@ public class MainActivity extends Activity { private Uri cameraTempFilePath; // --------------------- GETTER / SETTER METHODS --------------------- + public int getRequestCountPerPage() { + return UserPreferenceHelper.getInstance().get(R.string.key_setting_timelines, 20); + } public Uri getCameraTempFilePath() { return cameraTempFilePath; diff --git a/app/src/main/java/net/lacolaco/smileessence/entity/EntitySupport.java b/app/src/main/java/net/lacolaco/smileessence/entity/EntitySupport.java index b82bb182..7d9f6360 100644 --- a/app/src/main/java/net/lacolaco/smileessence/entity/EntitySupport.java +++ b/app/src/main/java/net/lacolaco/smileessence/entity/EntitySupport.java @@ -1,6 +1,5 @@ package net.lacolaco.smileessence.entity; -import com.google.common.collect.Lists; import twitter4j.*; import java.util.*; diff --git a/app/src/main/java/net/lacolaco/smileessence/twitter/util/TwitterUtils.java b/app/src/main/java/net/lacolaco/smileessence/twitter/util/TwitterUtils.java index 7d1a0afc..284bb305 100644 --- a/app/src/main/java/net/lacolaco/smileessence/twitter/util/TwitterUtils.java +++ b/app/src/main/java/net/lacolaco/smileessence/twitter/util/TwitterUtils.java @@ -51,7 +51,4 @@ public class TwitterUtils { return new Paging(1).count(count); } - public static int getPagingCount(MainActivity activity) { - return UserPreferenceHelper.getInstance().get(R.string.key_setting_timelines, 20); - } } diff --git a/app/src/main/java/net/lacolaco/smileessence/view/HomeFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/HomeFragment.java index fbe0a998..45159f81 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/HomeFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/HomeFragment.java @@ -67,7 +67,7 @@ public class HomeFragment extends CustomListFragment<StatusListAdapter> { adapter.update(); }); final Twitter twitter = ((MainActivity) getActivity()).getCurrentAccount().getTwitter(); - final Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount((MainActivity) getActivity())); + final Paging paging = TwitterUtils.getPaging(((MainActivity) getActivity()).getRequestCountPerPage()); new HomeTimelineTask(twitter, paging) { @Override protected void onPostExecute(List<Tweet> tweets) { @@ -98,7 +98,7 @@ public class HomeFragment extends CustomListFragment<StatusListAdapter> { } final Account currentAccount = activity.getCurrentAccount(); Twitter twitter = currentAccount.getTwitter(); - Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); + Paging paging = TwitterUtils.getPaging(activity.getRequestCountPerPage()); if (adapter.getCount() > 0) { paging.setSinceId(adapter.getTopID()); } @@ -124,7 +124,7 @@ public class HomeFragment extends CustomListFragment<StatusListAdapter> { final StatusListAdapter adapter = getAdapter(); final Account currentAccount = activity.getCurrentAccount(); Twitter twitter = currentAccount.getTwitter(); - Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); + Paging paging = TwitterUtils.getPaging(activity.getRequestCountPerPage()); if (adapter.getCount() > 0) { paging.setMaxId(adapter.getLastID() - 1); } diff --git a/app/src/main/java/net/lacolaco/smileessence/view/MentionsFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/MentionsFragment.java index 3b1e8904..865322f0 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/MentionsFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/MentionsFragment.java @@ -72,7 +72,7 @@ public class MentionsFragment extends CustomListFragment<StatusListAdapter> { } }); final Twitter twitter = ((MainActivity) getActivity()).getCurrentAccount().getTwitter(); - final Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount((MainActivity) getActivity())); + final Paging paging = TwitterUtils.getPaging(((MainActivity) getActivity()).getRequestCountPerPage()); final StatusListAdapter adapter_ = adapter; new MentionsTimelineTask(twitter, paging) { @Override @@ -96,7 +96,7 @@ public class MentionsFragment extends CustomListFragment<StatusListAdapter> { final Account currentAccount = activity.getCurrentAccount(); final StatusListAdapter adapter = getAdapter(); Twitter twitter = currentAccount.getTwitter(); - Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); + Paging paging = TwitterUtils.getPaging(activity.getRequestCountPerPage()); if (adapter.getCount() > 0) { paging.setSinceId(adapter.getTopID()); } @@ -119,7 +119,7 @@ public class MentionsFragment extends CustomListFragment<StatusListAdapter> { final Account currentAccount = activity.getCurrentAccount(); final StatusListAdapter adapter = getAdapter(); Twitter twitter = currentAccount.getTwitter(); - Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); + Paging paging = TwitterUtils.getPaging(activity.getRequestCountPerPage()); if (adapter.getCount() > 0) { paging.setMaxId(adapter.getLastID() - 1); } diff --git a/app/src/main/java/net/lacolaco/smileessence/view/MessagesFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/MessagesFragment.java index 3ae2a958..31fdd7db 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/MessagesFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/MessagesFragment.java @@ -69,7 +69,7 @@ public class MessagesFragment extends CustomListFragment<MessageListAdapter> { adapter.update(); }); final Twitter twitter = ((MainActivity) getActivity()).getCurrentAccount().getTwitter(); - final Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount((MainActivity) getActivity())); + final Paging paging = TwitterUtils.getPaging(((MainActivity) getActivity()).getRequestCountPerPage()); new DirectMessagesTask(twitter, paging) { @Override protected void onPostExecute(List<DirectMessage> directMessages) { @@ -100,7 +100,7 @@ public class MessagesFragment extends CustomListFragment<MessageListAdapter> { final Account currentAccount = activity.getCurrentAccount(); Twitter twitter = currentAccount.getTwitter(); final MessageListAdapter adapter = getAdapter(); - Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); + Paging paging = TwitterUtils.getPaging(activity.getRequestCountPerPage()); if (adapter.getCount() > 0) { paging.setSinceId(adapter.getTopID()); } @@ -123,7 +123,7 @@ public class MessagesFragment extends CustomListFragment<MessageListAdapter> { final Account currentAccount = activity.getCurrentAccount(); Twitter twitter = currentAccount.getTwitter(); final MessageListAdapter adapter = getAdapter(); - Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); + Paging paging = TwitterUtils.getPaging(activity.getRequestCountPerPage()); if (adapter.getCount() > 0) { paging.setMaxId(adapter.getLastID() - 1); } diff --git a/app/src/main/java/net/lacolaco/smileessence/view/SearchFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/SearchFragment.java index 59ec0b8f..4af11217 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/SearchFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/SearchFragment.java @@ -51,7 +51,6 @@ import net.lacolaco.smileessence.notification.NotificationType; import net.lacolaco.smileessence.notification.Notificator; import net.lacolaco.smileessence.twitter.StatusFilter; import net.lacolaco.smileessence.twitter.task.SearchTask; -import net.lacolaco.smileessence.twitter.util.TwitterUtils; import net.lacolaco.smileessence.util.UIHandler; import net.lacolaco.smileessence.view.adapter.SearchListAdapter; import net.lacolaco.smileessence.view.dialog.SelectSearchQueryDialogFragment; @@ -149,7 +148,7 @@ public class SearchFragment extends CustomListFragment<SearchListAdapter> implem } final Query query = new Query(); query.setQuery(queryString); - query.setCount(TwitterUtils.getPagingCount(activity)); + query.setCount(activity.getRequestCountPerPage()); query.setResultType(Query.RECENT); if (adapter.getCount() > 0) { query.setSinceId(adapter.getTopID()); @@ -192,7 +191,7 @@ public class SearchFragment extends CustomListFragment<SearchListAdapter> implem } final Query query = new Query(); query.setQuery(queryString); - query.setCount(TwitterUtils.getPagingCount(activity)); + query.setCount(activity.getRequestCountPerPage()); query.setResultType(Query.RECENT); if (adapter.getCount() > 0) { query.setMaxId(adapter.getLastID() - 1); @@ -349,7 +348,7 @@ public class SearchFragment extends CustomListFragment<SearchListAdapter> implem adapter.updateForce(); final Query query = new Query(); query.setQuery(queryString); - query.setCount(TwitterUtils.getPagingCount((MainActivity) getActivity())); + query.setCount(((MainActivity) getActivity()).getRequestCountPerPage()); query.setResultType(Query.RECENT); new SearchTask(twitter, query) { @Override diff --git a/app/src/main/java/net/lacolaco/smileessence/view/UserListFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/UserListFragment.java index da1503f5..7cb7cd6e 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/UserListFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/UserListFragment.java @@ -115,7 +115,7 @@ public class UserListFragment extends CustomListFragment<UserListListAdapter> im }).post(); return; } - Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); + Paging paging = TwitterUtils.getPaging(activity.getRequestCountPerPage()); if (adapter.getCount() > 0) { paging.setSinceId(adapter.getTopID()); } @@ -148,7 +148,7 @@ public class UserListFragment extends CustomListFragment<UserListListAdapter> im }).post(); return; } - Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); + Paging paging = TwitterUtils.getPaging(activity.getRequestCountPerPage()); if (adapter.getCount() > 0) { paging.setMaxId(adapter.getLastID() - 1); } @@ -218,7 +218,7 @@ public class UserListFragment extends CustomListFragment<UserListListAdapter> im adapter.setListFullName(listFullName); adapter.clear(); adapter.updateForce(); - new UserListStatusesTask(twitter, listFullName, TwitterUtils.getPaging(TwitterUtils.getPagingCount(getMainActivity()))) { + new UserListStatusesTask(twitter, listFullName, TwitterUtils.getPaging(getMainActivity().getRequestCountPerPage())) { @Override protected void onPostExecute(List<Tweet> tweets) { super.onPostExecute(tweets); diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/UserDetailDialogFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/dialog/UserDetailDialogFragment.java index cd8c935e..9b344641 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/UserDetailDialogFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/UserDetailDialogFragment.java @@ -173,7 +173,7 @@ public class UserDetailDialogFragment extends StackableDialogFragment implements final MainActivity activity = (MainActivity) getActivity(); final Account currentAccount = activity.getCurrentAccount(); Twitter twitter = currentAccount.getTwitter(); - Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); + Paging paging = TwitterUtils.getPaging(activity.getRequestCountPerPage()); if (adapter.getCount() > 0) { paging.setSinceId(adapter.getTopID()); } @@ -195,7 +195,7 @@ public class UserDetailDialogFragment extends StackableDialogFragment implements final MainActivity activity = (MainActivity) getActivity(); final Account currentAccount = activity.getCurrentAccount(); Twitter twitter = currentAccount.getTwitter(); - Paging paging = TwitterUtils.getPaging(TwitterUtils.getPagingCount(activity)); + Paging paging = TwitterUtils.getPaging(activity.getRequestCountPerPage()); if (adapter.getCount() > 0) { paging.setMaxId(adapter.getLastID() - 1); } |