diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowListFragment.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowListFragment.java
new file mode 100644
index 0000000000..cb56769b54
--- /dev/null
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowListFragment.java
@@ -0,0 +1,31 @@
+package com.xtremelabs.robolectric.shadows;
+
+import android.os.Bundle;
+import android.support.v4.app.ListFragment;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ListView;
+
+import com.xtremelabs.robolectric.internal.Implementation;
+import com.xtremelabs.robolectric.internal.Implements;
+
+@Implements(ListFragment.class)
+public class ShadowListFragment extends ShadowFragment {
+
+ final private AdapterView.OnItemClickListener mOnClickListener = //
+ new AdapterView.OnItemClickListener() {
+ public void onItemClick(AdapterView> parent, View v, int position, long id) {
+ onListItemClick((ListView) parent, v, position, id);
+ }
+ };
+
+ @Implementation
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ ListView list = (ListView) view.findViewById(android.R.id.list);
+ list.setOnItemClickListener(mOnClickListener);
+ }
+
+ @Implementation
+ public void onListItemClick(ListView l, View v, int position, long id) {
+ }
+}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/efragment/MyFragmentActivityTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/efragment/MyFragmentActivityTest.java
index 19c935f6ae..278d72b8d8 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/efragment/MyFragmentActivityTest.java
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/efragment/MyFragmentActivityTest.java
@@ -17,12 +17,6 @@
import static org.fest.assertions.Assertions.assertThat;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import org.androidannotations.test15.AndroidAnnotationsTestRunner;
-
/**
* Those test are disabled for now, we need to update Robolectric version for
* fragment support, however we'll have to solve other issues to do so.
@@ -48,14 +42,4 @@ public void can_inject_native_fragment_with_id() {
assertThat(activity.myFragment2).isNotNull();
}
- // @Test
- public void can_inject_support_fragment_with_default_id() {
- assertThat(activity.mySupportFragment).isNotNull();
- }
-
- // @Test
- public void can_inject_support_fragment_with_id() {
- assertThat(activity.mySupportFragment2).isNotNull();
- }
-
}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/efragment/MyListFragmentTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/efragment/MyListFragmentTest.java
new file mode 100644
index 0000000000..d2180a64bb
--- /dev/null
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/efragment/MyListFragmentTest.java
@@ -0,0 +1,52 @@
+package org.androidannotations.test15.efragment;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+import org.androidannotations.test15.AndroidAnnotationsTestRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
+import android.view.View;
+import android.widget.ListView;
+
+import com.xtremelabs.robolectric.Robolectric;
+import com.xtremelabs.robolectric.shadows.ShadowListFragment;
+
+@RunWith(AndroidAnnotationsTestRunner.class)
+public class MyListFragmentTest {
+
+ private static final int TESTED_CLICKED_INDEX = 4;
+
+ MyListFragment_ myListFragment;
+
+ @Before
+ public void setup() {
+ Robolectric.bindShadowClass(ShadowListFragment.class);
+
+ myListFragment = new MyListFragment_();
+ startFragment(myListFragment);
+ }
+
+ @Test
+ public void is_item_click_available_from_list_fragment() {
+ ListView listView = (ListView) myListFragment.findViewById(android.R.id.list);
+ long itemId = listView.getAdapter().getItemId(TESTED_CLICKED_INDEX);
+ View view = listView.getChildAt(TESTED_CLICKED_INDEX);
+
+ assertThat(myListFragment.listItemClicked).isFalse();
+ listView.performItemClick(view, TESTED_CLICKED_INDEX, itemId);
+ assertThat(myListFragment.listItemClicked).isTrue();
+ }
+
+ public static void startFragment(Fragment fragment) {
+ FragmentManager fragmentManager = new FragmentActivity().getSupportFragmentManager();
+ FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
+ fragmentTransaction.add(fragment, null);
+ fragmentTransaction.commit();
+ }
+}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/efragment/MySupportFragmentActivityTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/efragment/MySupportFragmentActivityTest.java
new file mode 100644
index 0000000000..68dad8b878
--- /dev/null
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/efragment/MySupportFragmentActivityTest.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright (C) 2010-2012 eBusiness Information, Excilys Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed To in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.androidannotations.test15.efragment;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+import org.androidannotations.test15.AndroidAnnotationsTestRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidAnnotationsTestRunner.class)
+public class MySupportFragmentActivityTest {
+
+ private MySupportFragmentActivity_ activity;
+
+ @Before
+ public void setup() {
+ activity = new MySupportFragmentActivity_();
+ activity.onCreate(null);
+ }
+
+ @Test
+ public void can_inject_support_fragment_with_default_id() {
+ assertThat(activity.mySupportFragment).isNotNull();
+ }
+
+ @Test
+ public void can_inject_support_fragment_with_id() {
+ assertThat(activity.mySupportFragment2).isNotNull();
+ }
+
+ @Test
+ public void can_inject_support_fragment_with_default_tag() {
+ assertThat(activity.mySupportFragmentTag).isNotNull();
+ }
+
+ @Test
+ public void can_inject_support_fragment_with_tag() {
+ assertThat(activity.mySupportFragmentTag2).isNotNull();
+ }
+
+}
diff --git a/AndroidAnnotations/functional-test-1-5/AndroidManifest.xml b/AndroidAnnotations/functional-test-1-5/AndroidManifest.xml
index 6ce1991dfe..c1f95e9191 100644
--- a/AndroidAnnotations/functional-test-1-5/AndroidManifest.xml
+++ b/AndroidAnnotations/functional-test-1-5/AndroidManifest.xml
@@ -68,6 +68,7 @@
+
@@ -82,7 +83,7 @@
+ android:exported="false" />
diff --git a/AndroidAnnotations/functional-test-1-5/res/layout/fragments.xml b/AndroidAnnotations/functional-test-1-5/res/layout/fragments.xml
index 0a22cc686e..9438686888 100644
--- a/AndroidAnnotations/functional-test-1-5/res/layout/fragments.xml
+++ b/AndroidAnnotations/functional-test-1-5/res/layout/fragments.xml
@@ -29,12 +29,4 @@
android:layout_height="fill_parent"
android:layout_weight="1" />
-
-
diff --git a/AndroidAnnotations/functional-test-1-5/res/layout/list_fragment.xml b/AndroidAnnotations/functional-test-1-5/res/layout/list_fragment.xml
new file mode 100644
index 0000000000..5df51dc3c2
--- /dev/null
+++ b/AndroidAnnotations/functional-test-1-5/res/layout/list_fragment.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AndroidAnnotations/functional-test-1-5/res/layout/support_fragments.xml b/AndroidAnnotations/functional-test-1-5/res/layout/support_fragments.xml
new file mode 100644
index 0000000000..cdc228b2b9
--- /dev/null
+++ b/AndroidAnnotations/functional-test-1-5/res/layout/support_fragments.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
diff --git a/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/BeanWithFragments.java b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/BeanWithFragments.java
index 78f1983c26..944f0de44b 100644
--- a/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/BeanWithFragments.java
+++ b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/BeanWithFragments.java
@@ -26,27 +26,13 @@ public class BeanWithFragments {
@FragmentById
public MyFragment myFragment;
- @FragmentById
- public MySupportFragment mySupportFragment;
-
@FragmentById(R.id.myFragment)
public MyFragment myFragment2;
- @FragmentById(R.id.mySupportFragment)
- public MySupportFragment mySupportFragment2;
-
@FragmentByTag
public MyFragment myFragmentTag;
- @FragmentByTag
- public MySupportFragment mySupportFragmentTag;
-
@FragmentByTag("myFragmentTag")
public MyFragment myFragmentTag2;
- @FragmentByTag("mySupportFragmentTag")
- public MySupportFragment mySupportFragmentTag2;
-
-
-
}
diff --git a/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/BeanWithSupportFragments.java b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/BeanWithSupportFragments.java
new file mode 100644
index 0000000000..0cf66015d8
--- /dev/null
+++ b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/BeanWithSupportFragments.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright (C) 2010-2012 eBusiness Information, Excilys Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed To in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.androidannotations.test15.efragment;
+
+import org.androidannotations.annotations.EBean;
+import org.androidannotations.annotations.FragmentById;
+import org.androidannotations.annotations.FragmentByTag;
+import org.androidannotations.test15.R;
+
+@EBean
+public class BeanWithSupportFragments {
+
+ @FragmentById
+ public MySupportFragment mySupportFragment;
+
+ @FragmentById(R.id.mySupportFragment)
+ public MySupportFragment mySupportFragment2;
+
+ @FragmentByTag
+ public MySupportFragment mySupportFragmentTag;
+
+ @FragmentByTag("mySupportFragmentTag")
+ public MySupportFragment mySupportFragmentTag2;
+
+}
diff --git a/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MyFragmentActivity.java b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MyFragmentActivity.java
index f32af52640..baec62c337 100644
--- a/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MyFragmentActivity.java
+++ b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MyFragmentActivity.java
@@ -15,41 +15,30 @@
*/
package org.androidannotations.test15.efragment;
-import android.support.v4.app.FragmentActivity;
-
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.FragmentById;
import org.androidannotations.annotations.FragmentByTag;
import org.androidannotations.test15.R;
+import android.app.Activity;
+
+
@EActivity(R.layout.fragments)
-public class MyFragmentActivity extends FragmentActivity {
+public class MyFragmentActivity extends Activity {
@FragmentById
public MyFragment myFragment;
- @FragmentById
- public MySupportFragment mySupportFragment;
-
@FragmentById(R.id.myFragment)
public MyFragment myFragment2;
- @FragmentById(R.id.mySupportFragment)
- public MySupportFragment mySupportFragment2;
-
@FragmentByTag
public MyFragment myFragmentTag;
- @FragmentByTag
- public MySupportFragment mySupportFragmentTag;
-
@FragmentByTag("myFragmentTag")
public MyFragment myFragmentTag2;
- @FragmentByTag("mySupportFragmentTag")
- public MySupportFragment mySupportFragmentTag2;
-
@Bean
public BeanWithFragments beanWithFragments;
diff --git a/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MyListFragment.java b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MyListFragment.java
new file mode 100644
index 0000000000..e3846e5323
--- /dev/null
+++ b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MyListFragment.java
@@ -0,0 +1,38 @@
+package org.androidannotations.test15.efragment;
+
+import org.androidannotations.annotations.EFragment;
+import org.androidannotations.annotations.ItemClick;
+import org.androidannotations.annotations.ViewById;
+import org.androidannotations.test15.R;
+
+import android.os.Bundle;
+import android.support.v4.app.ListFragment;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+@EFragment(R.layout.list_fragment)
+public class MyListFragment extends ListFragment {
+
+ boolean listItemClicked = false;
+
+ @ViewById(value=android.R.id.list)
+ ListView list;
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ ArrayAdapter adapter;
+
+ adapter = ArrayAdapter.createFromResource(getActivity(), R.array.planets_array, R.layout.simple_spinner_item);
+ adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+
+ list.setAdapter(adapter);
+ }
+
+ @ItemClick
+ void listItemClicked(String string) {
+ listItemClicked = true;
+ }
+
+}
diff --git a/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MySupportFragment.java b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MySupportFragment.java
index 510d508311..85525c1ede 100644
--- a/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MySupportFragment.java
+++ b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MySupportFragment.java
@@ -31,10 +31,11 @@
import org.androidannotations.annotations.Transactional;
import org.androidannotations.annotations.UiThread;
import org.androidannotations.annotations.ViewById;
+import org.androidannotations.test15.R;
import org.androidannotations.test15.ebean.SomeBean;
import org.androidannotations.test15.roboguice.SampleRoboApplication;
-@EFragment
+@EFragment(R.layout.injected)
public class MySupportFragment extends Fragment {
@Bean
diff --git a/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MySupportFragmentActivity.java b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MySupportFragmentActivity.java
new file mode 100644
index 0000000000..4d87befa24
--- /dev/null
+++ b/AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/efragment/MySupportFragmentActivity.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright (C) 2010-2012 eBusiness Information, Excilys Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed To in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.androidannotations.test15.efragment;
+
+import android.support.v4.app.FragmentActivity;
+
+import org.androidannotations.annotations.Bean;
+import org.androidannotations.annotations.EActivity;
+import org.androidannotations.annotations.FragmentById;
+import org.androidannotations.annotations.FragmentByTag;
+import org.androidannotations.test15.R;
+
+@EActivity(R.layout.support_fragments)
+public class MySupportFragmentActivity extends FragmentActivity {
+
+ @FragmentById
+ public MySupportFragment mySupportFragment;
+
+ @FragmentById(R.id.mySupportFragment)
+ public MySupportFragment mySupportFragment2;
+
+ @FragmentByTag
+ public MySupportFragment mySupportFragmentTag;
+
+ @FragmentByTag("mySupportFragmentTag")
+ public MySupportFragment mySupportFragmentTag2;
+
+ @Bean
+ public BeanWithSupportFragments beanWithSupportFragments;
+
+}