forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from google/moe_sync_11/15/2016
Moe sync 11/15/2016
- Loading branch information
Showing
23 changed files
with
1,762 additions
and
621 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2016 Google, Inc. | ||
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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>com.google.dagger</groupId> | ||
<artifactId>dagger-parent</artifactId> | ||
<version>HEAD-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>dagger-android</artifactId> | ||
<name>Dagger for Android</name> | ||
|
||
<packaging>aar</packaging> | ||
|
||
<properties> | ||
<java.version>1.6</java.version> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>android-support</id> | ||
<url>file://${env.ANDROID_HOME}/extras/android/m2repository</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.dagger</groupId> | ||
<artifactId>dagger</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.android</groupId> | ||
<artifactId>android</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.android.support</groupId> | ||
<artifactId>support-v4</artifactId> | ||
<type>aar</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.android.support</groupId> | ||
<artifactId>support-annotations</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.simpligility.maven.plugins</groupId> | ||
<artifactId>android-maven-plugin</artifactId> | ||
<extensions>true</extensions> | ||
<configuration> | ||
<sdk> | ||
<platform>${android.latest.version}</platform> | ||
<path>${env.ANDROID_HOME}</path> | ||
</sdk> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
25 changes: 25 additions & 0 deletions
25
android/src/it/functional-tests/src/main/java/test/android/InScope.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (C) 2016 The Dagger Authors. | ||
* | ||
* 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 test.android; | ||
|
||
import java.lang.annotation.Annotation; | ||
import javax.inject.Qualifier; | ||
|
||
@Qualifier | ||
@interface InScope { | ||
Class<? extends Annotation> value(); | ||
} |
35 changes: 35 additions & 0 deletions
35
android/src/it/functional-tests/src/main/java/test/android/ReleaseWhenModerate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2016 The Dagger Authors. | ||
* | ||
* 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 test.android; | ||
|
||
import static android.content.ComponentCallbacks2.TRIM_MEMORY_MODERATE; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
import dagger.android.ReleaseReferencesAt; | ||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
import javax.inject.Scope; | ||
|
||
@Documented | ||
@Retention(RUNTIME) | ||
@Target({TYPE, METHOD}) | ||
@ReleaseReferencesAt(TRIM_MEMORY_MODERATE) | ||
@Scope | ||
@interface ReleaseWhenModerate {} |
35 changes: 35 additions & 0 deletions
35
android/src/it/functional-tests/src/main/java/test/android/ReleaseWhenUiHidden.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2016 The Dagger Authors. | ||
* | ||
* 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 test.android; | ||
|
||
import static android.content.ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
import dagger.android.ReleaseReferencesAt; | ||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
import javax.inject.Scope; | ||
|
||
@Documented | ||
@Retention(RUNTIME) | ||
@Target({TYPE, METHOD}) | ||
@ReleaseReferencesAt(TRIM_MEMORY_UI_HIDDEN) | ||
@Scope | ||
@interface ReleaseWhenUiHidden {} |
35 changes: 35 additions & 0 deletions
35
android/src/it/functional-tests/src/main/java/test/android/TestComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2016 The Dagger Authors. | ||
* | ||
* 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 test.android; | ||
|
||
import dagger.Component; | ||
import dagger.android.AndroidMemorySensitiveReferenceManager; | ||
import javax.inject.Singleton; | ||
|
||
@Singleton | ||
@ReleaseWhenUiHidden | ||
@ReleaseWhenModerate | ||
@Component(modules = TestModule.class) | ||
interface TestComponent { | ||
AndroidMemorySensitiveReferenceManager manager(); | ||
|
||
@InScope(ReleaseWhenUiHidden.class) | ||
Object releasedWhenUiHidden(); | ||
|
||
@InScope(ReleaseWhenModerate.class) | ||
Object releasedWhenModerate(); | ||
} |
42 changes: 42 additions & 0 deletions
42
android/src/it/functional-tests/src/main/java/test/android/TestModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2016 The Dagger Authors. | ||
* | ||
* 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 test.android; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
|
||
@Module | ||
class TestModule { | ||
int releasedWhenUiHiddenCalls; | ||
int releasedWhenModerateCalls; | ||
|
||
@Provides | ||
@ReleaseWhenUiHidden | ||
@InScope(ReleaseWhenUiHidden.class) | ||
Object releasedWhenUiHidden() { | ||
++releasedWhenUiHiddenCalls; | ||
return new Object(); | ||
} | ||
|
||
@Provides | ||
@ReleaseWhenModerate | ||
@InScope(ReleaseWhenModerate.class) | ||
Object releasedWhenModerate() { | ||
++releasedWhenModerateCalls; | ||
return new Object(); | ||
} | ||
} |
Oops, something went wrong.