diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-09-04 18:13:46 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-09-04 18:13:46 +0900 |
commit | d28ef87ab7ba5aa2dff191120c6fce9ecbfbd2c3 (patch) | |
tree | 0f1ef148c5f55ea58010130ab77849b1a8917816 /app | |
parent | 63602b9b89b8ae4f8b48e5fa1ed5fa03a963e699 (diff) | |
download | SmileEssence-d28ef87ab7ba5aa2dff191120c6fce9ecbfbd2c3.tar.gz |
fix tests
Diffstat (limited to 'app')
7 files changed, 48 insertions, 26 deletions
diff --git a/app/app.iml b/app/app.iml index 6171d07a..6f911693 100644 --- a/app/app.iml +++ b/app/app.iml @@ -27,18 +27,20 @@ <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" /> <output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" /> <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/build/data-binding-info/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" /> - <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/build/data-binding-info/androidTest/debug" isTestSource="true" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" /> - <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/debug" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" /> @@ -84,17 +86,33 @@ </content> <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" exported="" name="twitter4j-stream-4.0.4" level="project" /> - <orderEntry type="library" exported="" name="twitter-text-1.13.0" level="project" /> + <orderEntry type="library" exported="" name="kotlin-runtime-0.12.613" level="project" /> + <orderEntry type="library" exported="" name="commons-io-2.4" level="project" /> <orderEntry type="library" exported="" name="library-1.0.18" level="project" /> <orderEntry type="library" exported="" name="guava-19.0-rc1" level="project" /> + <orderEntry type="library" exported="" name="library-3.3.0-SNAPSHOT" level="project" /> + <orderEntry type="library" exported="" name="antlr4-4.5" level="project" /> + <orderEntry type="library" exported="" name="activeandroid-3.1.0-SNAPSHOT" level="project" /> + <orderEntry type="library" exported="" name="twitter4j-stream-4.0.4" level="project" /> + <orderEntry type="library" exported="" name="antlr4-runtime-4.5" level="project" /> + <orderEntry type="library" exported="" name="antlr4-annotations-4.5" level="project" /> + <orderEntry type="library" exported="" name="antlr-runtime-3.5.2" level="project" /> + <orderEntry type="library" exported="" name="library-1.0-rc1" level="project" /> + <orderEntry type="library" exported="" name="org.abego.treelayout.core-1.0.1" level="project" /> + <orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" /> + <orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" /> + <orderEntry type="library" exported="" name="adapters-1.0-rc1" level="project" /> + <orderEntry type="library" exported="" name="compilerCommon-1.0-rc1" level="project" /> + <orderEntry type="library" exported="" name="compiler-1.0-rc1" level="project" /> + <orderEntry type="library" exported="" name="baseLibrary-1.0-rc1" level="project" /> + <orderEntry type="library" exported="" name="twitter-text-1.13.0" level="project" /> + <orderEntry type="library" exported="" name="ST4-4.0.8" level="project" /> <orderEntry type="library" exported="" name="support-v13-23.0.0" level="project" /> <orderEntry type="library" exported="" name="crouton-1.8.5" level="project" /> + <orderEntry type="library" exported="" name="commons-codec-1.10" level="project" /> <orderEntry type="library" exported="" name="twitter4j-media-support-4.0.4" level="project" /> - <orderEntry type="library" exported="" name="library-3.3.0-SNAPSHOT" level="project" /> - <orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" /> - <orderEntry type="library" exported="" name="activeandroid-3.1.0-SNAPSHOT" level="project" /> + <orderEntry type="library" exported="" name="commons-lang3-3.3.2" level="project" /> + <orderEntry type="library" exported="" name="kotlin-stdlib-0.12.613" level="project" /> <orderEntry type="library" exported="" name="twitter4j-core-4.0.4" level="project" /> - <orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" /> </component> </module>
\ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 7c23bbe1..b1645c5a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.android.application' +apply plugin: 'com.android.databinding' android { compileSdkVersion 21 diff --git a/app/src/androidTest/java/net/lacolaco/smileessence/twitter/UserStreamListenerTest.java b/app/src/androidTest/java/net/lacolaco/smileessence/twitter/UserStreamListenerTest.java index fcda127a..3c9f05ba 100644 --- a/app/src/androidTest/java/net/lacolaco/smileessence/twitter/UserStreamListenerTest.java +++ b/app/src/androidTest/java/net/lacolaco/smileessence/twitter/UserStreamListenerTest.java @@ -68,7 +68,7 @@ public class UserStreamListenerTest extends ActivityInstrumentationTestCase2<Mai public void testOnStatus() throws Exception { final Status status = mock.getStatusMock(); - CustomListAdapter<?> home = getActivity().getListAdapter(MainActivity.ADAPTER_HOME); + CustomListAdapter<?> home = getActivity().getListAdapter(MainActivity.AdapterID.Home); listener.onStatus(status); home.updateForce(); Thread.sleep(500); @@ -96,7 +96,7 @@ public class UserStreamListenerTest extends ActivityInstrumentationTestCase2<Mai public void testOnMention() throws Exception { final Status status = mock.getReplyMock(); - CustomListAdapter<?> mentions = getActivity().getListAdapter(MainActivity.ADAPTER_MENTIONS); + CustomListAdapter<?> mentions = getActivity().getListAdapter(MainActivity.AdapterID.Mentions); listener.onStatus(status); mentions.updateForce(); Thread.sleep(500); @@ -106,7 +106,7 @@ public class UserStreamListenerTest extends ActivityInstrumentationTestCase2<Mai public void testOnRetweeted() throws Exception { final Status status = mock.getRetweetMock(); listener.onStatus(status); - CustomListAdapter<?> home = getActivity().getListAdapter(MainActivity.ADAPTER_HOME); + CustomListAdapter<?> home = getActivity().getListAdapter(MainActivity.AdapterID.Home); home.updateForce(); Thread.sleep(500); assertEquals(1, home.getCount()); @@ -115,7 +115,7 @@ public class UserStreamListenerTest extends ActivityInstrumentationTestCase2<Mai public void testOnFavorited() throws Exception { final Status status = mock.getReplyMock(); final User source = status.getUser(); - CustomListAdapter<?> history = getActivity().getListAdapter(MainActivity.ADAPTER_HISTORY); + CustomListAdapter<?> history = getActivity().getListAdapter(MainActivity.AdapterID.History); listener.onFavorite(source, user, status); history.updateForce(); Thread.sleep(500); @@ -128,7 +128,7 @@ public class UserStreamListenerTest extends ActivityInstrumentationTestCase2<Mai public void testOnFollow() throws Exception { final User source = mock.getUserMock(); - CustomListAdapter<?> history = getActivity().getListAdapter(MainActivity.ADAPTER_HISTORY); + CustomListAdapter<?> history = getActivity().getListAdapter(MainActivity.AdapterID.History); listener.onFollow(source, user); history.updateForce(); Thread.sleep(500); @@ -137,7 +137,7 @@ public class UserStreamListenerTest extends ActivityInstrumentationTestCase2<Mai public void testOnBlock() throws Exception { final User source = mock.getUserMock(); - CustomListAdapter<?> history = getActivity().getListAdapter(MainActivity.ADAPTER_HISTORY); + CustomListAdapter<?> history = getActivity().getListAdapter(MainActivity.AdapterID.History); listener.onBlock(source, user); listener.onUnblock(source, user); history.updateForce(); @@ -147,7 +147,7 @@ public class UserStreamListenerTest extends ActivityInstrumentationTestCase2<Mai public void testOnDirectMessage() throws Exception { final DirectMessage message = mock.getDirectMessageMock(); - CustomListAdapter<?> messages = getActivity().getListAdapter(MainActivity.ADAPTER_MESSAGES); + CustomListAdapter<?> messages = getActivity().getListAdapter(MainActivity.AdapterID.Messages); listener.onDirectMessage(message); messages.updateForce(); Thread.sleep(500); diff --git a/app/src/androidTest/java/net/lacolaco/smileessence/view/adapter/CustomListAdapterTest.java b/app/src/androidTest/java/net/lacolaco/smileessence/view/adapter/CustomListAdapterTest.java index 7722f1a6..fa176a88 100644 --- a/app/src/androidTest/java/net/lacolaco/smileessence/view/adapter/CustomListAdapterTest.java +++ b/app/src/androidTest/java/net/lacolaco/smileessence/view/adapter/CustomListAdapterTest.java @@ -44,7 +44,7 @@ public class CustomListAdapterTest extends ActivityInstrumentationTestCase2<Main @Override public void setUp() throws Exception { mock = new TwitterMock(getInstrumentation().getContext()); - adapter = new CustomListAdapter<>(getActivity(), StatusViewModel.class); + adapter = new CustomListAdapter<>(getActivity()); account = mock.getAccount(); } 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 29ef9e82..3e65742f 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java @@ -38,7 +38,6 @@ import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.WindowManager; -import android.widget.Adapter; import android.widget.ImageView; import net.lacolaco.smileessence.Application; @@ -100,7 +99,7 @@ public class MainActivity extends Activity { private int pageIndexHistory; private int pageIndexMessages; private int pageIndexSearch; - private int pageIndexUserlist; + private int pageIndexUserList; private ViewPager viewPager; private PageListAdapter pagerAdapter; private Account currentAccount; @@ -164,6 +163,10 @@ public class MainActivity extends Activity { return pageIndexHome; } + public int getPageIndexMentions() { + return pageIndexMentions; + } + public int getPageIndexHistory() { return pageIndexHistory; } @@ -176,8 +179,8 @@ public class MainActivity extends Activity { return pageIndexSearch; } - public int getPageIndexUserlist() { - return pageIndexUserlist; + public int getPageIndexUserList() { + return pageIndexUserList; } public PageListAdapter getPagerAdapter() { @@ -536,7 +539,7 @@ public class MainActivity extends Activity { boolean visible = getUserPreferenceHelper().getValue(R.string.key_page_list_visibility, true); getUserPreferenceHelper().putValue(R.string.key_page_list_visibility, visible); UserListListAdapter userListAdapter = new UserListListAdapter(this); - pageIndexUserlist = addListPage(getString(R.string.page_name_list), UserListFragment.class, userListAdapter, AdapterID.UserList, visible); + pageIndexUserList = addListPage(getString(R.string.page_name_list), UserListFragment.class, userListAdapter, AdapterID.UserList, visible); } private void getImageUri(int requestCode, int resultCode, Intent data) { @@ -640,7 +643,7 @@ public class MainActivity extends Activity { } private void initUserList(Twitter twitter) { - if (pageIndexUserlist == PAGE_INDEX_GONE) { + if (pageIndexUserList == PAGE_INDEX_GONE) { return; } String lastUserList = getLastUserList(); @@ -679,7 +682,7 @@ public class MainActivity extends Activity { } private void openUserListPage() { - setSelectedPageIndex(pageIndexUserlist); + setSelectedPageIndex(pageIndexUserList); } private void receiveOAuth(int requestCode, int resultCode, Intent data) { diff --git a/app/src/main/java/net/lacolaco/smileessence/view/adapter/CustomListAdapter.java b/app/src/main/java/net/lacolaco/smileessence/view/adapter/CustomListAdapter.java index 8b7b47a2..84585ebf 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/adapter/CustomListAdapter.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/adapter/CustomListAdapter.java @@ -152,7 +152,7 @@ public class CustomListAdapter<T extends IViewModel> extends BaseAdapter { } } - public void sort() { + protected void sort() { } public void update() { diff --git a/app/src/main/java/net/lacolaco/smileessence/view/adapter/StatusListAdapter.java b/app/src/main/java/net/lacolaco/smileessence/view/adapter/StatusListAdapter.java index f2b4854d..ece2eea8 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/adapter/StatusListAdapter.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/adapter/StatusListAdapter.java @@ -74,10 +74,10 @@ public class StatusListAdapter extends CustomListAdapter<StatusViewModel> { } /** - * Sort list by Status#createdAt + * Sort list by Status ID */ @Override - public void sort() { + protected void sort() { synchronized (LOCK) { Collections.sort(list, new Comparator<StatusViewModel>() { @Override |