Skip to content

Commit a6edbf1

Browse files
committed
Adding a processor to facilitate integration between AndroidAnnotations and Dagger
1 parent 419e810 commit a6edbf1

26 files changed

Lines changed: 529 additions & 287 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/test/java=UTF-8
4+
encoding/<project>=UTF-8

‎cleanandroidcode-it/pom.xml‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
<packaging>apk</packaging>
1414
<name>cleanandroidcode-it - Integration tests</name>
1515

16-
<properties>
17-
<platform.api>16</platform.api>
18-
</properties>
19-
2016
<dependencies>
2117
<dependency>
2218
<groupId>com.google.android</groupId>
@@ -30,42 +26,18 @@
3026
<groupId>info.piwai.cleanandroidcode</groupId>
3127
<artifactId>cleanandroidcode</artifactId>
3228
<type>apk</type>
33-
<version>1.0-SNAPSHOT</version>
3429
</dependency>
3530
<dependency>
3631
<groupId>info.piwai.cleanandroidcode</groupId>
3732
<artifactId>cleanandroidcode</artifactId>
3833
<type>jar</type>
39-
<version>1.0-SNAPSHOT</version>
40-
</dependency>
41-
<dependency>
42-
<groupId>junit</groupId>
43-
<artifactId>junit</artifactId>
4434
</dependency>
4535
</dependencies>
4636
<build>
4737
<plugins>
4838
<plugin>
4939
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
5040
<artifactId>android-maven-plugin</artifactId>
51-
<configuration>
52-
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
53-
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
54-
<resourceDirectory>${project.basedir}/res</resourceDirectory>
55-
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
56-
<sdk>
57-
<platform>${platform.api}</platform>
58-
</sdk>
59-
<undeployBeforeDeploy>true</undeployBeforeDeploy>
60-
</configuration>
61-
<extensions>true</extensions>
62-
</plugin>
63-
<plugin>
64-
<artifactId>maven-compiler-plugin</artifactId>
65-
<configuration>
66-
<source>1.6</source>
67-
<target>1.6</target>
68-
</configuration>
6941
</plugin>
7042
</plugins>
7143
</build>
Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
11
package info.piwai.cleanandroidcode;
22

3-
import android.annotation.SuppressLint;
4-
import android.app.Activity;
3+
import android.support.v4.app.Fragment;
4+
import android.support.v4.app.FragmentActivity;
55
import android.test.ActivityInstrumentationTestCase2;
66
import android.test.UiThreadTest;
7+
import android.view.View;
78

8-
/*
9-
* TODO use support fragment
10-
*/
11-
@SuppressLint("NewApi")
129
public class HelloAndroidActivityTest extends ActivityInstrumentationTestCase2<HelloAndroidActivity_> {
1310

1411
public HelloAndroidActivityTest() {
1512
super(HelloAndroidActivity_.class);
1613
}
1714

18-
public void testActivity() {
19-
HelloAndroidActivity activity = getActivity();
20-
assertNotNull(activity);
21-
}
22-
2315
@UiThreadTest
24-
public void testClickEventPropagated() {
25-
Activity activity = getActivity();
26-
String beforeClick = activity.getTitle().toString();
27-
HelloFragment fragment = (HelloFragment) activity.getFragmentManager().findFragmentById(R.id.hello_fragment);
28-
fragment.fragmentButton.performClick();
29-
String afterClick = activity.getTitle().toString();
30-
assertFalse(beforeClick.equals(afterClick));
31-
fragment.fragmentButton.performClick();
32-
String afterClick2 = activity.getTitle().toString();
33-
assertFalse(afterClick.equals(afterClick2));
16+
public void test_click_on_fragment_changes_title() {
17+
FragmentActivity activity = getActivity();
18+
Fragment fragment = activity.getSupportFragmentManager().findFragmentById(R.id.hello_fragment);
19+
View fragmentButton = fragment.getView().findViewById(R.id.fragment_button);
20+
21+
fragmentButton.performClick();
22+
23+
String title = activity.getTitle().toString();
24+
25+
assertTrue("Title should start with [Button clicked]. Title is [" + title + "]", title.startsWith("Button clicked"));
3426
}
3527

3628
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10+
<attributes>
11+
<attribute name="optional" value="true"/>
12+
<attribute name="maven.pomderived" value="true"/>
13+
</attributes>
14+
</classpathentry>
15+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
16+
<attributes>
17+
<attribute name="maven.pomderived" value="true"/>
18+
</attributes>
19+
</classpathentry>
20+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
21+
<attributes>
22+
<attribute name="maven.pomderived" value="true"/>
23+
</attributes>
24+
</classpathentry>
25+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
26+
<attributes>
27+
<attribute name="maven.pomderived" value="true"/>
28+
</attributes>
29+
</classpathentry>
30+
<classpathentry kind="output" path="target/classes"/>
31+
</classpath>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>cleanandroidcode-processor</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/main/resources=UTF-8
4+
encoding//src/test/java=UTF-8
5+
encoding/<project>=UTF-8
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3+
org.eclipse.jdt.core.compiler.compliance=1.6
4+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5+
org.eclipse.jdt.core.compiler.source=1.6
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

‎cleanandroidcode-processor/pom.xml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0"?>
2+
<project
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4+
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<artifactId>cleanandroidcode-parent</artifactId>
9+
<groupId>info.piwai.cleanandroidcode</groupId>
10+
<version>1.0-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>cleanandroidcode-processor</artifactId>
14+
<name>CleanAndroidCode Annotation Processor</name>
15+
16+
<build>
17+
<plugins>
18+
<plugin>
19+
<artifactId>maven-compiler-plugin</artifactId>
20+
<configuration>
21+
<compilerArgument>-proc:none</compilerArgument>
22+
</configuration>
23+
</plugin>
24+
</plugins>
25+
</build>
26+
</project>

0 commit comments

Comments
 (0)