diff options
45 files changed, 437 insertions, 260 deletions
diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 96cc43ef..0103dd1c 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -18,5 +18,15 @@ <processorPath useClasspath="true" /> </profile> </annotationProcessing> + <bytecodeTargetLevel> + <module name="baseLibrary_main" target="1.6" /> + <module name="baseLibrary_test" target="1.6" /> + <module name="compilationTests_main" target="1.6" /> + <module name="compilationTests_test" target="1.6" /> + <module name="compiler_main" target="1.8" /> + <module name="compiler_test" target="1.8" /> + <module name="compilerCommon_main" target="1.8" /> + <module name="compilerCommon_test" target="1.8" /> + </bytecodeTargetLevel> </component> </project>
\ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index c9e59e10..0dce8633 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -5,7 +5,7 @@ <GradleProjectSettings> <option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="externalProjectPath" value="$PROJECT_DIR$" /> - <option name="gradleJvm" value="1.6" /> + <option name="gradleJvm" value="1.8" /> <option name="modules"> <set> <option value="$PROJECT_DIR$" /> @@ -17,16 +17,6 @@ </set> </option> <option name="useAutoImport" value="true" /> - <option name="myModules"> - <set> - <option value="$PROJECT_DIR$" /> - <option value="$PROJECT_DIR$/baseLibrary" /> - <option value="$PROJECT_DIR$/compilationTests" /> - <option value="$PROJECT_DIR$/compiler" /> - <option value="$PROJECT_DIR$/compilerCommon" /> - <option value="$PROJECT_DIR$/dataBinding" /> - </set> - </option> </GradleProjectSettings> </option> </component> diff --git a/.idea/misc.xml b/.idea/misc.xml index caac6524..e48072ee 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,41 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> - <component name="EntryPointsManager"> - <entry_points version="2.0" /> + <component name="ProjectInspectionProfilesVisibleTreeState"> + <entry key="Project Default"> + <profile-state> + <expanded-state> + <State> + <id /> + </State> + <State> + <id>Class structureJava</id> + </State> + <State> + <id>Code maturity issuesJava</id> + </State> + <State> + <id>Java</id> + </State> + <State> + <id>Java language level migration aidsJava</id> + </State> + <State> + <id>Javadoc issuesJava</id> + </State> + <State> + <id>Performance issuesJava</id> + </State> + <State> + <id>Threading issuesJava</id> + </State> + </expanded-state> + <selected-state> + <State> + <id>BashSupport</id> + </State> + </selected-state> + </profile-state> + </entry> </component> <component name="ProjectLevelVcsManager" settingsEditedManually="false"> <OptionsSetting value="true" id="Add" /> @@ -13,7 +47,7 @@ <ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Remove" /> </component> - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK"> - <output url="file://$PROJECT_DIR$/classes" /> + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> + <output url="file://$PROJECT_DIR$/build/classes" /> </component> </project>
\ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 7eefe600..a3acbc51 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,12 +2,20 @@ <project version="4"> <component name="ProjectModuleManager"> <modules> - <module fileurl="file://$PROJECT_DIR$/baseLibrary/baseLibrary.iml" filepath="$PROJECT_DIR$/baseLibrary/baseLibrary.iml" /> - <module fileurl="file://$PROJECT_DIR$/compilationTests/compilationTests.iml" filepath="$PROJECT_DIR$/compilationTests/compilationTests.iml" /> - <module fileurl="file://$PROJECT_DIR$/compiler/compiler.iml" filepath="$PROJECT_DIR$/compiler/compiler.iml" /> - <module fileurl="file://$PROJECT_DIR$/compilerCommon/compilerCommon.iml" filepath="$PROJECT_DIR$/compilerCommon/compilerCommon.iml" /> - <module fileurl="file://$PROJECT_DIR$/data-binding.iml" filepath="$PROJECT_DIR$/data-binding.iml" /> - <module fileurl="file://$PROJECT_DIR$/dataBinding/dataBinding.iml" filepath="$PROJECT_DIR$/dataBinding/dataBinding.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/baseLibrary/baseLibrary.iml" filepath="$PROJECT_DIR$/.idea/modules/baseLibrary/baseLibrary.iml" group="dataBinding/baseLibrary" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/baseLibrary/baseLibrary_main.iml" filepath="$PROJECT_DIR$/.idea/modules/baseLibrary/baseLibrary_main.iml" group="dataBinding/baseLibrary" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/baseLibrary/baseLibrary_test.iml" filepath="$PROJECT_DIR$/.idea/modules/baseLibrary/baseLibrary_test.iml" group="dataBinding/baseLibrary" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/compilationTests/compilationTests.iml" filepath="$PROJECT_DIR$/.idea/modules/compilationTests/compilationTests.iml" group="dataBinding/compilationTests" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/compilationTests/compilationTests_main.iml" filepath="$PROJECT_DIR$/.idea/modules/compilationTests/compilationTests_main.iml" group="dataBinding/compilationTests" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/compilationTests/compilationTests_test.iml" filepath="$PROJECT_DIR$/.idea/modules/compilationTests/compilationTests_test.iml" group="dataBinding/compilationTests" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/compiler/compiler.iml" filepath="$PROJECT_DIR$/.idea/modules/compiler/compiler.iml" group="dataBinding/compiler" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/compilerCommon/compilerCommon.iml" filepath="$PROJECT_DIR$/.idea/modules/compilerCommon/compilerCommon.iml" group="dataBinding/compilerCommon" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/compilerCommon/compilerCommon_main.iml" filepath="$PROJECT_DIR$/.idea/modules/compilerCommon/compilerCommon_main.iml" group="dataBinding/compilerCommon" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/compilerCommon/compilerCommon_test.iml" filepath="$PROJECT_DIR$/.idea/modules/compilerCommon/compilerCommon_test.iml" group="dataBinding/compilerCommon" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/compiler/compiler_main.iml" filepath="$PROJECT_DIR$/.idea/modules/compiler/compiler_main.iml" group="dataBinding/compiler" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/compiler/compiler_test.iml" filepath="$PROJECT_DIR$/.idea/modules/compiler/compiler_test.iml" group="dataBinding/compiler" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/data-binding.iml" filepath="$PROJECT_DIR$/.idea/modules/data-binding.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/dataBinding/dataBinding.iml" filepath="$PROJECT_DIR$/.idea/modules/dataBinding/dataBinding.iml" group="dataBinding" /> </modules> </component> </project>
\ No newline at end of file diff --git a/.idea/modules/baseLibrary/baseLibrary.iml b/.idea/modules/baseLibrary/baseLibrary.iml new file mode 100644 index 00000000..019a989b --- /dev/null +++ b/.idea/modules/baseLibrary/baseLibrary.iml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:baseLibrary" external.linked.project.path="$MODULE_DIR$/../../../baseLibrary" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.version="2.2.0-dev" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../baseLibrary"> + <excludeFolder url="file://$MODULE_DIR$/../../../baseLibrary/.gradle" /> + <excludeFolder url="file://$MODULE_DIR$/../../../baseLibrary/build" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/modules/baseLibrary/baseLibrary_main.iml b/.idea/modules/baseLibrary/baseLibrary_main.iml new file mode 100644 index 00000000..4d93153a --- /dev/null +++ b/.idea/modules/baseLibrary/baseLibrary_main.iml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:baseLibrary:main" external.linked.project.path="$MODULE_DIR$/../../../baseLibrary" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.type="sourceSet" external.system.module.version="2.2.0-dev" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false"> + <output url="file://$MODULE_DIR$/../../../baseLibrary/build/classes/main" /> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../baseLibrary/src/main"> + <sourceFolder url="file://$MODULE_DIR$/../../../baseLibrary/src/main/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/../../../baseLibrary/src/main/resources" type="java-resource" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/modules/baseLibrary/baseLibrary_test.iml b/.idea/modules/baseLibrary/baseLibrary_test.iml new file mode 100644 index 00000000..bc70242f --- /dev/null +++ b/.idea/modules/baseLibrary/baseLibrary_test.iml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:baseLibrary:test" external.linked.project.path="$MODULE_DIR$/../../../baseLibrary" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.type="sourceSet" external.system.module.version="2.2.0-dev" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false"> + <output-test url="file://$MODULE_DIR$/../../../baseLibrary/build/classes/test" /> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../baseLibrary/src/test"> + <sourceFolder url="file://$MODULE_DIR$/../../../baseLibrary/src/test/java" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/../../../baseLibrary/src/test/resources" type="java-test-resource" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="baseLibrary_main" /> + <orderEntry type="library" name="Gradle: junit:junit:4.12" level="project" /> + <orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" /> + </component> + <component name="TestModuleProperties" production-module="baseLibrary_main" /> +</module>
\ No newline at end of file diff --git a/.idea/modules/compilationTests/compilationTests.iml b/.idea/modules/compilationTests/compilationTests.iml new file mode 100644 index 00000000..bedf7d94 --- /dev/null +++ b/.idea/modules/compilationTests/compilationTests.iml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:compilationTests" external.linked.project.path="$MODULE_DIR$/../../../compilationTests" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="data-binding.dataBinding" external.system.module.version="1.0" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../compilationTests"> + <excludeFolder url="file://$MODULE_DIR$/../../../compilationTests/.gradle" /> + <excludeFolder url="file://$MODULE_DIR$/../../../compilationTests/build" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/modules/compilationTests/compilationTests_main.iml b/.idea/modules/compilationTests/compilationTests_main.iml new file mode 100644 index 00000000..def742ce --- /dev/null +++ b/.idea/modules/compilationTests/compilationTests_main.iml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:compilationTests:main" external.linked.project.path="$MODULE_DIR$/../../../compilationTests" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="data-binding.dataBinding" external.system.module.type="sourceSet" external.system.module.version="1.0" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false"> + <output url="file://$MODULE_DIR$/../../../compilationTests/build/classes/main" /> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../compilationTests/src/main"> + <sourceFolder url="file://$MODULE_DIR$/../../../compilationTests/src/main/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/../../../compilationTests/src/main/resources" type="java-resource" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/modules/compilationTests/compilationTests_test.iml b/.idea/modules/compilationTests/compilationTests_test.iml new file mode 100644 index 00000000..5241cc7f --- /dev/null +++ b/.idea/modules/compilationTests/compilationTests_test.iml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:compilationTests:test" external.linked.project.path="$MODULE_DIR$/../../../compilationTests" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="data-binding.dataBinding" external.system.module.type="sourceSet" external.system.module.version="1.0" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false"> + <output-test url="file://$MODULE_DIR$/../../../compilationTests/build/classes/test" /> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../compilationTests/src/test"> + <sourceFolder url="file://$MODULE_DIR$/../../../compilationTests/src/test/java" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/../../../compilationTests/src/test/resources" type="java-test-resource" /> + </content> + <content url="file://$MODULE_DIR$/../../../compiler/src/test/java/android"> + <sourceFolder url="file://$MODULE_DIR$/../../../compiler/src/test/java/android/databinding/tool/reflection/java" isTestSource="true" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="compilationTests_main" /> + <orderEntry type="module" module-name="baseLibrary_main" /> + <orderEntry type="library" name="Gradle: junit:junit:4.12" level="project" /> + <orderEntry type="library" name="Gradle: org.apache.commons:commons-lang3:3.3.2" level="project" /> + <orderEntry type="library" name="Gradle: commons-io:commons-io:2.4" level="project" /> + <orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.10" level="project" /> + <orderEntry type="module" module-name="compilerCommon_main" /> + <orderEntry type="module" module-name="compiler_main" /> + <orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" /> + <orderEntry type="library" name="Gradle: org.antlr:antlr4:4.5.3" level="project" /> + <orderEntry type="library" name="Gradle: com.googlecode.juniversalchardet:juniversalchardet:1.0.3" level="project" /> + <orderEntry type="library" name="Gradle: com.google.guava:guava:17.0" level="project" /> + <orderEntry type="library" name="Gradle: com.android.tools:annotations:24.5.0" level="project" /> + <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.0.0" level="project" /> + <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-runtime:1.0.0" level="project" /> + </component> + <component name="TestModuleProperties" production-module="compilationTests_main" /> +</module>
\ No newline at end of file diff --git a/.idea/modules/compiler/compiler.iml b/.idea/modules/compiler/compiler.iml new file mode 100644 index 00000000..50b5884c --- /dev/null +++ b/.idea/modules/compiler/compiler.iml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:compiler" external.linked.project.path="$MODULE_DIR$/../../../compiler" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.version="2.2.0-dev" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../compiler"> + <excludeFolder url="file://$MODULE_DIR$/../../../compiler/.gradle" /> + <excludeFolder url="file://$MODULE_DIR$/../../../compiler/build" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/modules/compiler/compiler_main.iml b/.idea/modules/compiler/compiler_main.iml new file mode 100644 index 00000000..abf84114 --- /dev/null +++ b/.idea/modules/compiler/compiler_main.iml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:compiler:main" external.linked.project.path="$MODULE_DIR$/../../../compiler" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.type="sourceSet" external.system.module.version="2.2.0-dev" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> + <output url="file://$MODULE_DIR$/../../../compiler/build/classes/main" /> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../compiler/src/main"> + <sourceFolder url="file://$MODULE_DIR$/../../../compiler/src/main/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/../../../compiler/src/main/kotlin" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/../../../compiler/src/main/resources" type="java-resource" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="compilerCommon_main" /> + <orderEntry type="module" module-name="baseLibrary_main" /> + <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.0.0" level="project" /> + <orderEntry type="library" name="Gradle: commons-io:commons-io:2.4" level="project" /> + <orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.10" level="project" /> + <orderEntry type="library" name="Gradle: org.antlr:antlr4:4.5.3" level="project" /> + <orderEntry type="library" name="Gradle: com.googlecode.juniversalchardet:juniversalchardet:1.0.3" level="project" /> + <orderEntry type="library" name="Gradle: com.google.guava:guava:17.0" level="project" /> + <orderEntry type="library" name="Gradle: com.android.tools:annotations:24.5.0" level="project" /> + <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-runtime:1.0.0" level="project" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/modules/compiler/compiler_test.iml b/.idea/modules/compiler/compiler_test.iml new file mode 100644 index 00000000..433185ee --- /dev/null +++ b/.idea/modules/compiler/compiler_test.iml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:compiler:test" external.linked.project.path="$MODULE_DIR$/../../../compiler" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.type="sourceSet" external.system.module.version="2.2.0-dev" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> + <output-test url="file://$MODULE_DIR$/../../../compiler/build/classes/test" /> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../compiler/src/test/java"> + <sourceFolder url="file://$MODULE_DIR$/../../../compiler/src/test/java" isTestSource="true" /> + </content> + <content url="file://$MODULE_DIR$/../../../compiler/src/test/kotlin"> + <sourceFolder url="file://$MODULE_DIR$/../../../compiler/src/test/kotlin" isTestSource="true" /> + </content> + <content url="file://$MODULE_DIR$/../../../compiler/src/test/resources"> + <sourceFolder url="file://$MODULE_DIR$/../../../compiler/src/test/resources" type="java-test-resource" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="compiler_main" /> + <orderEntry type="module" module-name="compilerCommon_main" /> + <orderEntry type="module" module-name="baseLibrary_main" /> + <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.0.0" level="project" /> + <orderEntry type="library" name="Gradle: commons-io:commons-io:2.4" level="project" /> + <orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.10" level="project" /> + <orderEntry type="library" name="Gradle: org.antlr:antlr4:4.5.3" level="project" /> + <orderEntry type="library" name="Gradle: com.googlecode.juniversalchardet:juniversalchardet:1.0.3" level="project" /> + <orderEntry type="library" name="Gradle: junit:junit:4.12" level="project" /> + <orderEntry type="library" name="Gradle: com.google.guava:guava:17.0" level="project" /> + <orderEntry type="library" name="Gradle: com.android.tools:annotations:24.5.0" level="project" /> + <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-runtime:1.0.0" level="project" /> + <orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" /> + </component> + <component name="TestModuleProperties" production-module="compiler_main" /> +</module>
\ No newline at end of file diff --git a/.idea/modules/compilerCommon/compilerCommon.iml b/.idea/modules/compilerCommon/compilerCommon.iml new file mode 100644 index 00000000..27fdbd49 --- /dev/null +++ b/.idea/modules/compilerCommon/compilerCommon.iml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:compilerCommon" external.linked.project.path="$MODULE_DIR$/../../../compilerCommon" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.version="2.2.0-dev" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../compilerCommon"> + <excludeFolder url="file://$MODULE_DIR$/../../../compilerCommon/.gradle" /> + <excludeFolder url="file://$MODULE_DIR$/../../../compilerCommon/build" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/modules/compilerCommon/compilerCommon_main.iml b/.idea/modules/compilerCommon/compilerCommon_main.iml new file mode 100644 index 00000000..4978e298 --- /dev/null +++ b/.idea/modules/compilerCommon/compilerCommon_main.iml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:compilerCommon:main" external.linked.project.path="$MODULE_DIR$/../../../compilerCommon" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.type="sourceSet" external.system.module.version="2.2.0-dev" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> + <output url="file://$MODULE_DIR$/../../../compilerCommon/build/classes/main" /> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../compilerCommon/src/main"> + <sourceFolder url="file://$MODULE_DIR$/../../../compilerCommon/src/main/grammar-gen" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/../../../compilerCommon/src/main/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/../../../compilerCommon/src/main/xml-gen" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/../../../compilerCommon/src/main/resources" type="java-resource" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="baseLibrary_main" /> + <orderEntry type="library" name="Gradle: org.antlr:antlr4:4.5.3" level="project" /> + <orderEntry type="library" name="Gradle: commons-io:commons-io:2.4" level="project" /> + <orderEntry type="library" name="Gradle: com.googlecode.juniversalchardet:juniversalchardet:1.0.3" level="project" /> + <orderEntry type="library" name="Gradle: com.google.guava:guava:17.0" level="project" /> + <orderEntry type="library" name="Gradle: com.android.tools:annotations:24.5.0" level="project" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/modules/compilerCommon/compilerCommon_test.iml b/.idea/modules/compilerCommon/compilerCommon_test.iml new file mode 100644 index 00000000..26e89c6f --- /dev/null +++ b/.idea/modules/compilerCommon/compilerCommon_test.iml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding:compilerCommon:test" external.linked.project.path="$MODULE_DIR$/../../../compilerCommon" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.type="sourceSet" external.system.module.version="2.2.0-dev" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> + <output-test url="file://$MODULE_DIR$/../../../compilerCommon/build/classes/test" /> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../compilerCommon/src/test"> + <sourceFolder url="file://$MODULE_DIR$/../../../compilerCommon/src/test/java" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/../../../compilerCommon/src/test/resources" type="java-test-resource" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="compilerCommon_main" /> + <orderEntry type="module" module-name="baseLibrary_main" /> + <orderEntry type="library" name="Gradle: org.antlr:antlr4:4.5.3" level="project" /> + <orderEntry type="library" name="Gradle: commons-io:commons-io:2.4" level="project" /> + <orderEntry type="library" name="Gradle: com.googlecode.juniversalchardet:juniversalchardet:1.0.3" level="project" /> + <orderEntry type="library" name="Gradle: com.google.guava:guava:17.0" level="project" /> + <orderEntry type="library" name="Gradle: com.android.tools:annotations:24.5.0" level="project" /> + <orderEntry type="library" name="Gradle: junit:junit:4.12" level="project" /> + <orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" /> + </component> + <component name="TestModuleProperties" production-module="compilerCommon_main" /> +</module>
\ No newline at end of file diff --git a/.idea/modules/data-binding.iml b/.idea/modules/data-binding.iml new file mode 100644 index 00000000..2bbad644 --- /dev/null +++ b/.idea/modules/data-binding.iml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id="data-binding" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$/../.."> + <excludeFolder url="file://$MODULE_DIR$/../../.gradle" /> + <excludeFolder url="file://$MODULE_DIR$/../../build" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/modules/dataBinding/dataBinding.iml b/.idea/modules/dataBinding/dataBinding.iml new file mode 100644 index 00000000..d0099f24 --- /dev/null +++ b/.idea/modules/dataBinding/dataBinding.iml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":dataBinding" external.linked.project.path="$MODULE_DIR$/../../../dataBinding" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.version="2.2.0-dev" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$/../../../dataBinding"> + <excludeFolder url="file://$MODULE_DIR$/../../../dataBinding/.gradle" /> + <excludeFolder url="file://$MODULE_DIR$/../../../dataBinding/build" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>
\ No newline at end of file diff --git a/baseLibrary/baseLibrary.iml b/baseLibrary/baseLibrary.iml deleted file mode 100644 index c6163c1f..00000000 --- a/baseLibrary/baseLibrary.iml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id=":dataBinding:baseLibrary" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.version="1.1" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/build/classes/main" /> - <output-test url="file://$MODULE_DIR$/build/classes/test" /> - <exclude-output /> - <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> - <excludeFolder url="file://$MODULE_DIR$/.gradle" /> - <excludeFolder url="file://$MODULE_DIR$/build" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" /> - </component> -</module>
\ No newline at end of file diff --git a/baseLibrary/build.gradle b/baseLibrary/build.gradle index 7489e0d1..8cbfd6d5 100644 --- a/baseLibrary/build.gradle +++ b/baseLibrary/build.gradle @@ -62,6 +62,10 @@ task prebuildJar(type : Copy) { } } +javadoc { + options.addStringOption('Xdoclint:none', '-quiet') +} + project.ext.pomName = 'Data Binding Base Library' project.ext.pomDesc = 'Shared library between Data Binding runtime lib and compiler' -enablePublishing(this, true)
\ No newline at end of file +enablePublishing(this, true) diff --git a/baseLibrary/db-baseLibrary.iml b/baseLibrary/db-baseLibrary.iml index 7cf99832..1804bc90 100644 --- a/baseLibrary/db-baseLibrary.iml +++ b/baseLibrary/db-baseLibrary.iml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <module relativePaths="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true"> <exclude-output /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> diff --git a/baseLibrary/src/main/java/android/databinding/package.html b/baseLibrary/src/main/java/android/databinding/package.html new file mode 100644 index 00000000..0415b4c6 --- /dev/null +++ b/baseLibrary/src/main/java/android/databinding/package.html @@ -0,0 +1,13 @@ +<html> +<body> +<p>Contains components used when developing applications with data binding.</p> + +<p>Android data binding operates primarily at compile time, processing expressions +found in the layout file and generating code in the application. This package +contains common code that will be included with the application, just like +support library components.</p> + +<p>See the <a href="{@docRoot}/tools/data-binding/guide.html">Data Binding Guide</a> +to get started using data binding.</p> +</body> +</html> diff --git a/build.gradle b/build.gradle index c3ce95a3..2aa4ea4b 100644 --- a/build.gradle +++ b/build.gradle @@ -230,7 +230,7 @@ def fullJar(project) { doLast { def jarJarLibrary = new File(dataBindingConfig.externalPrebuiltsBase, - 'tools/common/m2/repository/com/googlecode/jarjar/jarjar/1.3/jarjar-1.3.jar'). + 'tools/common/m2/repository/com/googlecode/jarjar/jarjar/1.4/jarjar-1.4.jar'). getCanonicalPath() // in Ant ant.taskdef(name: "jarjarIt", diff --git a/compilationTests/compilationTests.iml b/compilationTests/compilationTests.iml deleted file mode 100644 index 751bf1e8..00000000 --- a/compilationTests/compilationTests.iml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id=":dataBinding:compilationTests" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="data-binding.dataBinding" external.system.module.version="1.0" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/build/classes/main" /> - <output-test url="file://$MODULE_DIR$/build/classes/test" /> - <exclude-output /> - <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> - <excludeFolder url="file://$MODULE_DIR$/.gradle" /> - <excludeFolder url="file://$MODULE_DIR$/build" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="compilerCommon" scope="TEST" /> - <orderEntry type="module" module-name="baseLibrary" scope="TEST" /> - <orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: org.apache.commons:commons-lang3:3.3.2" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: commons-io:commons-io:2.4" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: commons-codec:commons-codec:1.10" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: com.tunnelvisionlabs:antlr4:4.5" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: com.googlecode.juniversalchardet:juniversalchardet:1.0.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: com.tunnelvisionlabs:antlr4-runtime:4.5" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: com.tunnelvisionlabs:antlr4-annotations:4.5" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: org.antlr:antlr-runtime:3.5.2" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: org.antlr:ST4:4.0.8" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: org.abego.treelayout:org.abego.treelayout.core:1.0.1" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: com.google.guava:guava:17.0" level="project" /> - </component> -</module>
\ No newline at end of file diff --git a/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java b/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java index a4c7af9c..ee5467e2 100644 --- a/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java +++ b/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java @@ -396,7 +396,7 @@ public class SimpleCompilationTest extends BaseCompilationTest { } ModelMethod modelMethod = injectedClass.getMethod( method.getName(), args, Modifier.isStatic(method.getModifiers()), false); - assertNotNull(modelMethod); + assertNotNull("Method " + method + " not found", modelMethod); } } } diff --git a/compiler/build.gradle b/compiler/build.gradle index 0b2c6b25..cd4eac27 100644 --- a/compiler/build.gradle +++ b/compiler/build.gradle @@ -60,7 +60,9 @@ uploadArchives { } } - +javadoc { + options.addStringOption('Xdoclint:none', '-quiet') +} project.ext.pomName = 'Data Binding Annotation Processor' project.ext.pomDesc = 'The annotation processor for Data Binding. Generates binding classes for runtime.' diff --git a/compiler/compiler.iml b/compiler/compiler.iml deleted file mode 100644 index adf86190..00000000 --- a/compiler/compiler.iml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id=":dataBinding:compiler" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.version="1.1" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/build/classes/main" /> - <output-test url="file://$MODULE_DIR$/build/classes/test" /> - <exclude-output /> - <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/kotlin" isTestSource="true" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> - <excludeFolder url="file://$MODULE_DIR$/.gradle" /> - <excludeFolder url="file://$MODULE_DIR$/build" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="compilerCommon" /> - <orderEntry type="module" module-name="baseLibrary" /> - <orderEntry type="library" name="Gradle: commons-io:commons-io:2.4" level="project" /> - <orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.10" level="project" /> - <orderEntry type="library" name="Gradle: com.tunnelvisionlabs:antlr4:4.5" level="project" /> - <orderEntry type="library" name="Gradle: com.googlecode.juniversalchardet:juniversalchardet:1.0.3" level="project" /> - <orderEntry type="library" name="Gradle: com.tunnelvisionlabs:antlr4-runtime:4.5" level="project" /> - <orderEntry type="library" name="Gradle: com.tunnelvisionlabs:antlr4-annotations:4.5" level="project" /> - <orderEntry type="library" name="Gradle: org.antlr:antlr-runtime:3.5.2" level="project" /> - <orderEntry type="library" name="Gradle: org.antlr:ST4:4.0.8" level="project" /> - <orderEntry type="library" name="Gradle: org.abego.treelayout:org.abego.treelayout.core:1.0.1" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" /> - <orderEntry type="library" name="Gradle: com.google.guava:guava:17.0" level="project" /> - <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.0.0-beta-4584" level="project" /> - <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-runtime:1.0.0-beta-4584" level="project" /> - </component> -</module>
\ No newline at end of file diff --git a/compiler/db-compiler.iml b/compiler/db-compiler.iml index 2f3a0d27..d47a5828 100644 --- a/compiler/db-compiler.iml +++ b/compiler/db-compiler.iml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <module relativePaths="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true"> <exclude-output /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> diff --git a/compiler/src/main/java/android/databinding/tool/CompilerChef.java b/compiler/src/main/java/android/databinding/tool/CompilerChef.java index 611f3b8f..c167207a 100644 --- a/compiler/src/main/java/android/databinding/tool/CompilerChef.java +++ b/compiler/src/main/java/android/databinding/tool/CompilerChef.java @@ -135,6 +135,11 @@ public class CompilerChef { "java.lang.Object"); injectedClass.addMethod(new InjectedMethod(injectedClass, true, "getColorFromResource", "int", "android.view.View", "int")); + injectedClass.addMethod(new InjectedMethod(injectedClass, true, + "getColorStateListFromResource", "android.content.res.ColorStateList", + "android.view.View", "int")); + injectedClass.addMethod(new InjectedMethod(injectedClass, true, "getDrawableFromResource", + "android.graphics.drawable.Drawable", "android.view.View", "int")); injectedClass.addMethod(new InjectedMethod(injectedClass, true, "parse", "boolean", "java.lang.String", "boolean")); injectedClass.addMethod(new InjectedMethod(injectedClass, true, "parse", diff --git a/compiler/src/main/java/android/databinding/tool/ExpressionParser.java b/compiler/src/main/java/android/databinding/tool/ExpressionParser.java index 8deebc4d..18fb8399 100644 --- a/compiler/src/main/java/android/databinding/tool/ExpressionParser.java +++ b/compiler/src/main/java/android/databinding/tool/ExpressionParser.java @@ -50,11 +50,12 @@ public class ExpressionParser { visitor = new ExpressionVisitor(mModel); } - public Expr parse(String input, @Nullable Location locationInFile) { + public Expr parse(String input, @Nullable Location locationInFile, BindingTarget target) { ANTLRInputStream inputStream = new ANTLRInputStream(input); BindingExpressionLexer lexer = new BindingExpressionLexer(inputStream); CommonTokenStream tokenStream = new CommonTokenStream(lexer); final BindingExpressionParser parser = new BindingExpressionParser(tokenStream); + visitor.setBindingTarget(target); parser.addErrorListener(new BaseErrorListener() { @Override public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, diff --git a/compiler/src/main/java/android/databinding/tool/ExpressionVisitor.java b/compiler/src/main/java/android/databinding/tool/ExpressionVisitor.java index 87426c0f..d273f387 100644 --- a/compiler/src/main/java/android/databinding/tool/ExpressionVisitor.java +++ b/compiler/src/main/java/android/databinding/tool/ExpressionVisitor.java @@ -47,6 +47,7 @@ class ExpressionVisitor extends BindingExpressionBaseVisitor<Expr> { private ExprModel mModel; private ParseTreeListener mParseTreeListener; private ArrayDeque<ExprModel> mModelStack = new ArrayDeque<ExprModel>(); + private BindingTarget mTarget; ExpressionVisitor(ExprModel model) { mModel = model; @@ -56,6 +57,10 @@ class ExpressionVisitor extends BindingExpressionBaseVisitor<Expr> { mParseTreeListener = parseTreeListener; } + public void setBindingTarget(BindingTarget bindingTarget) { + mTarget = bindingTarget; + } + private void onEnter(ParserRuleContext context) { if (mParseTreeListener != null) { mParseTreeListener.enterEveryRule(context); @@ -398,7 +403,7 @@ class ExpressionVisitor extends BindingExpressionBaseVisitor<Expr> { final int startIndex = Math.max(1, colonIndex + 1); final String resourceType = resourceReference.substring(startIndex, slashIndex).trim(); final String resourceName = resourceReference.substring(slashIndex + 1).trim(); - return mModel.resourceExpr(packageName, resourceType, resourceName, args); + return mModel.resourceExpr(mTarget, packageName, resourceType, resourceName, args); } finally { onExit(ctx); } diff --git a/compiler/src/main/java/android/databinding/tool/LayoutBinder.java b/compiler/src/main/java/android/databinding/tool/LayoutBinder.java index c7704682..bcbafda6 100644 --- a/compiler/src/main/java/android/databinding/tool/LayoutBinder.java +++ b/compiler/src/main/java/android/databinding/tool/LayoutBinder.java @@ -222,7 +222,8 @@ public class LayoutBinder implements FileScopeProvider { try { Scope.enter(bindingBundle.getValueLocation()); Expr expr = parse(bindingBundle.getExpr(), - bindingBundle.getValueLocation()); + bindingBundle.getValueLocation(), + bindingTarget); bindingTarget.addBinding(bindingBundle.getName(), expr); if (bindingBundle.isTwoWay()) { bindingTarget.addInverseBinding(bindingBundle.getName(), expr, @@ -295,8 +296,8 @@ public class LayoutBinder implements FileScopeProvider { return target; } - public Expr parse(String input, @Nullable Location locationInFile) { - final Expr parsed = mExpressionParser.parse(input, locationInFile); + public Expr parse(String input, @Nullable Location locationInFile, BindingTarget target) { + final Expr parsed = mExpressionParser.parse(input, locationInFile, target); parsed.setBindingExpression(true); return parsed; } diff --git a/compiler/src/main/java/android/databinding/tool/expr/ExprModel.java b/compiler/src/main/java/android/databinding/tool/expr/ExprModel.java index 87169cee..34b25690 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/ExprModel.java +++ b/compiler/src/main/java/android/databinding/tool/expr/ExprModel.java @@ -273,9 +273,9 @@ public class ExprModel { return register(new UnaryExpr(op, expr)); } - public Expr resourceExpr(String packageName, String resourceType, String resourceName, - List<Expr> args) { - return register(new ResourceExpr(packageName, resourceType, resourceName, args)); + public Expr resourceExpr(BindingTarget target, String packageName, String resourceType, + String resourceName, List<Expr> args) { + return register(new ResourceExpr(target, packageName, resourceType, resourceName, args)); } public Expr bracketExpr(Expr variableExpr, Expr argExpr) { diff --git a/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java b/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java index 2ecf5fb0..df36cf63 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java @@ -15,9 +15,11 @@ */ package android.databinding.tool.expr; +import android.databinding.tool.BindingTarget; import android.databinding.tool.reflection.ModelAnalyzer; import android.databinding.tool.reflection.ModelClass; import android.databinding.tool.writer.KCode; +import android.databinding.tool.writer.LayoutBinderWriterKt; import java.util.HashMap; import java.util.List; @@ -45,9 +47,12 @@ public class ResourceExpr extends Expr { protected final String mResourceId; - public ResourceExpr(String packageName, String resourceType, String resourceName, - List<Expr> args) { + protected final BindingTarget mTarget; + + public ResourceExpr(BindingTarget target, String packageName, String resourceType, + String resourceName, List<Expr> args) { super(args); + mTarget = target; if ("android".equals(packageName)) { mPackage = "android."; } else { @@ -121,7 +126,11 @@ public class ResourceExpr extends Expr { @Override protected String computeUniqueKey() { String base = toString(); - return join(base, computeChildrenKey()); + String view = ""; + if (requiresView()) { + view = LayoutBinderWriterKt.getFieldName(mTarget); + } + return join(base, view, computeChildrenKey()); } @Override @@ -132,7 +141,7 @@ public class ResourceExpr extends Expr { @Override public Expr cloneToModel(ExprModel model) { String pkg = mPackage.isEmpty() ? "" : "android"; - return model.resourceExpr(pkg, mResourceType, mResourceId, + return model.resourceExpr(mTarget, pkg, mResourceType, mResourceId, cloneToModel(model, getChildren())); } @@ -146,19 +155,31 @@ public class ResourceExpr extends Expr { computeUniqueKey(); } + private boolean requiresView() { + return !mTarget.isBinder() && !("anim".equals(mResourceType) || + "animator".equals(mResourceType) || + "id".equals(mResourceType) || + "interpolator".equals(mResourceType) || + "layout".equals(mResourceType) || + "stateListAnimator".equals(mResourceType) || + "transition".equals(mResourceType)); + } + public String toJava() { final String context = "getRoot().getContext()"; - final String resources = "getRoot().getResources()"; + final String viewName = requiresView() ? LayoutBinderWriterKt.getFieldName(mTarget) : + "getRoot()"; + final String resources = viewName + ".getResources()"; final String resourceName = mPackage + "R." + getResourceObject() + "." + mResourceId; if ("anim".equals(mResourceType)) return "android.view.animation.AnimationUtils.loadAnimation(" + context + ", " + resourceName + ")"; if ("animator".equals(mResourceType)) return "android.animation.AnimatorInflater.loadAnimator(" + context + ", " + resourceName + ")"; if ("bool".equals(mResourceType)) return resources + ".getBoolean(" + resourceName + ")"; - if ("color".equals(mResourceType)) return "android.databinding.DynamicUtil.getColorFromResource(getRoot(), " + resourceName + ")"; - if ("colorStateList".equals(mResourceType)) return "getColorStateListFromResource(" + resourceName + ")"; + if ("color".equals(mResourceType)) return "android.databinding.DynamicUtil.getColorFromResource(" + viewName + ", " + resourceName + ")"; + if ("colorStateList".equals(mResourceType)) return "android.databinding.DynamicUtil.getColorStateListFromResource(" + viewName + ", " + resourceName + ")"; if ("dimen".equals(mResourceType)) return resources + ".getDimension(" + resourceName + ")"; if ("dimenOffset".equals(mResourceType)) return resources + ".getDimensionPixelOffset(" + resourceName + ")"; if ("dimenSize".equals(mResourceType)) return resources + ".getDimensionPixelSize(" + resourceName + ")"; - if ("drawable".equals(mResourceType)) return "getDrawableFromResource(" + resourceName + ")"; + if ("drawable".equals(mResourceType)) return "android.databinding.DynamicUtil.getDrawableFromResource(" + viewName + ", " + resourceName + ")"; if ("fraction".equals(mResourceType)) { String base = getChildCode(0, "1"); String pbase = getChildCode(1, "1"); @@ -174,11 +195,11 @@ public class ResourceExpr extends Expr { if (getChildren().isEmpty()) { return resourceName; } else { - return makeParameterCall(resourceName, "getQuantityString"); + return makeParameterCall(resources, resourceName, "getQuantityString"); } } if ("stateListAnimator".equals(mResourceType)) return "android.animation.AnimatorInflater.loadStateListAnimator(" + context + ", " + resourceName + ")"; - if ("string".equals(mResourceType)) return makeParameterCall(resourceName, "getString"); + if ("string".equals(mResourceType)) return makeParameterCall(resources, resourceName, "getString"); if ("stringArray".equals(mResourceType)) return resources + ".getStringArray(" + resourceName + ")"; if ("transition".equals(mResourceType)) return "android.transition.TransitionInflater.from(" + context + ").inflateTransition(" + resourceName + ")"; if ("typedArray".equals(mResourceType)) return resources + ".obtainTypedArray(" + resourceName + ")"; @@ -196,9 +217,9 @@ public class ResourceExpr extends Expr { } } - private String makeParameterCall(String resourceName, String methodCall) { - StringBuilder sb = new StringBuilder("getRoot().getResources()."); - sb.append(methodCall).append("(").append(resourceName); + private String makeParameterCall(String resources, String resourceName, String methodCall) { + StringBuilder sb = new StringBuilder(resources); + sb.append('.').append(methodCall).append("(").append(resourceName); for (Expr expr : getChildren()) { sb.append(", ").append(expr.toCode().generate()); } diff --git a/compiler/src/main/kotlin/android/databinding/tool/writer/DynamicUtilWriter.kt b/compiler/src/main/kotlin/android/databinding/tool/writer/DynamicUtilWriter.kt index 8d76b030..e7314606 100644 --- a/compiler/src/main/kotlin/android/databinding/tool/writer/DynamicUtilWriter.kt +++ b/compiler/src/main/kotlin/android/databinding/tool/writer/DynamicUtilWriter.kt @@ -8,13 +8,33 @@ class DynamicUtilWriter() { nl("") block("public class DynamicUtil") { nl("@SuppressWarnings(\"deprecation\")") - block("public static int getColorFromResource(final android.view.View root, final int resourceId)") { + block("public static int getColorFromResource(final android.view.View view, final int resourceId)") { if (targetSdk >= 23) { block("if (VERSION.SDK_INT >= VERSION_CODES.M)") { - nl("return root.getContext().getColor(resourceId);") + nl("return view.getContext().getColor(resourceId);") } } - nl("return root.getResources().getColor(resourceId);") + nl("return view.getResources().getColor(resourceId);") + } + + nl("@SuppressWarnings(\"deprecation\")") + block("public static android.content.res.ColorStateList getColorStateListFromResource(final android.view.View view, final int resourceId)") { + if (targetSdk >= 23) { + block("if (VERSION.SDK_INT >= VERSION_CODES.M)") { + nl("return view.getContext().getColorStateList(resourceId);") + } + } + nl("return view.getResources().getColorStateList(resourceId);") + } + + nl("@SuppressWarnings(\"deprecation\")") + block("public static android.graphics.drawable.Drawable getDrawableFromResource(final android.view.View view, final int resourceId)") { + if (targetSdk >= 21) { + block("if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP)") { + nl("return view.getContext().getDrawable(resourceId);") + } + } + nl("return view.getResources().getDrawable(resourceId);") } block("public static boolean parse(String str, boolean fallback)") { diff --git a/compiler/src/test/java/android/databinding/tool/ExpressionVisitorTest.java b/compiler/src/test/java/android/databinding/tool/ExpressionVisitorTest.java index 84b032af..3d3d8fed 100644 --- a/compiler/src/test/java/android/databinding/tool/ExpressionVisitorTest.java +++ b/compiler/src/test/java/android/databinding/tool/ExpressionVisitorTest.java @@ -51,7 +51,7 @@ public class ExpressionVisitorTest { } private <T extends Expr> T parse(String input, Class<T> klass) { - final Expr parsed = mParser.parse(input, null); + final Expr parsed = mParser.parse(input, null, null); assertSame(klass, parsed.getClass()); return (T) parsed; } @@ -89,7 +89,7 @@ public class ExpressionVisitorTest { @Test public void testComparison() { - final Expr res = mParser.parse("3 " + mOp + " 5", null); + final Expr res = mParser.parse("3 " + mOp + " 5", null, null); assertEquals(3, mParser.getModel().size()); assertTrue(res instanceof ComparisonExpr); // 0 because they are both static @@ -180,7 +180,7 @@ public class ExpressionVisitorTest { assertEquals(0, parsed.getArgs().size()); assertEquals(1, parsed.getDependencies().size()); final Dependency dep = parsed.getDependencies().get(0); - assertSame(mParser.parse("user", null), dep.getOther()); + assertSame(mParser.parse("user", null, null), dep.getOther()); assertFalse(dep.isConditional()); } diff --git a/compiler/src/test/java/android/databinding/tool/LayoutBinderTest.java b/compiler/src/test/java/android/databinding/tool/LayoutBinderTest.java index c7f81ab1..564ecef4 100644 --- a/compiler/src/test/java/android/databinding/tool/LayoutBinderTest.java +++ b/compiler/src/test/java/android/databinding/tool/LayoutBinderTest.java @@ -77,8 +77,8 @@ public class LayoutBinderTest { int originalSize = mExprModel.size(); mLayoutBinder.addVariable("user", "android.databinding.tool2.LayoutBinderTest.TestUser", null); - mLayoutBinder.parse("user.name", null); - mLayoutBinder.parse("user.lastName", null); + mLayoutBinder.parse("user.name", null, null); + mLayoutBinder.parse("user.lastName", null, null); assertEquals(originalSize + 3, mExprModel.size()); final List<Expr> bindingExprs = mExprModel.getBindingExpressions(); assertEquals(2, bindingExprs.size()); @@ -94,7 +94,7 @@ public class LayoutBinderTest { public void testParseWithMethods() { mLayoutBinder.addVariable("user", "android.databinding.tool.LayoutBinderTest.TestUser", null); - mLayoutBinder.parse("user.fullName", null); + mLayoutBinder.parse("user.fullName", null, null); Expr item = mExprModel.getBindingExpressions().get(0); assertTrue(item instanceof FieldAccessExpr); IdentifierExpr id = mExprModel.identifier("user"); diff --git a/compiler/src/test/java/android/databinding/tool/expr/ExecutionPathTest.java b/compiler/src/test/java/android/databinding/tool/expr/ExecutionPathTest.java index 2bb8832f..d6fb4707 100644 --- a/compiler/src/test/java/android/databinding/tool/expr/ExecutionPathTest.java +++ b/compiler/src/test/java/android/databinding/tool/expr/ExecutionPathTest.java @@ -57,7 +57,7 @@ public class ExecutionPathTest { public void simpleExpr() { MockLayoutBinder lb = new MockLayoutBinder(); ExprModel model = lb.getModel(); - Expr parsed = lb.parse(mExpression, null); + Expr parsed = lb.parse(mExpression, null, null); List<ExecutionPath> paths = new ArrayList<ExecutionPath>(); ExecutionPath root = ExecutionPath.createRoot(); paths.add(root); diff --git a/compiler/src/test/java/android/databinding/tool/expr/ExprModelTest.java b/compiler/src/test/java/android/databinding/tool/expr/ExprModelTest.java index e20dea74..a661c30f 100644 --- a/compiler/src/test/java/android/databinding/tool/expr/ExprModelTest.java +++ b/compiler/src/test/java/android/databinding/tool/expr/ExprModelTest.java @@ -154,7 +154,7 @@ public class ExprModelTest { IdentifierExpr a = lb.addVariable("a", "java.lang.String", null); IdentifierExpr b = lb.addVariable("b", "java.lang.String", null); IdentifierExpr c = lb.addVariable("c", "java.lang.String", null); - lb.parse("a == null ? b : c", null); + lb.parse("a == null ? b : c", null, null); mExprModel.comparison("==", a, mExprModel.symbol("null", Object.class)); lb.getModel().seal(); List<Expr> shouldRead = getShouldRead(); @@ -303,7 +303,7 @@ public class ExprModelTest { IdentifierExpr c = lb.addVariable("c", "java.lang.String", null); IdentifierExpr d = lb.addVariable("d", "java.lang.String", null); IdentifierExpr e = lb.addVariable("e", "java.lang.String", null); - final Expr aTernary = lb.parse("a == null ? b == null ? c : d : e", null); + final Expr aTernary = lb.parse("a == null ? b == null ? c : d : e", null, null); assertTrue(aTernary instanceof TernaryExpr); final Expr bTernary = ((TernaryExpr) aTernary).getIfTrue(); assertTrue(bTernary instanceof TernaryExpr); @@ -1132,7 +1132,7 @@ public class ExprModelTest { } private <T extends Expr> T parse(LayoutBinder binder, String input, Class<T> klass) { - final Expr parsed = binder.parse(input, null); + final Expr parsed = binder.parse(input, null, null); assertTrue(klass.isAssignableFrom(parsed.getClass())); return (T) parsed; } diff --git a/compilerCommon/compilerCommon.iml b/compilerCommon/compilerCommon.iml deleted file mode 100644 index d9cc2c61..00000000 --- a/compilerCommon/compilerCommon.iml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id=":dataBinding:compilerCommon" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.version="1.1" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/build/classes/main" /> - <output-test url="file://$MODULE_DIR$/build/classes/test" /> - <exclude-output /> - <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src/main/grammar-gen" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/xml-gen" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> - <excludeFolder url="file://$MODULE_DIR$/.gradle" /> - <excludeFolder url="file://$MODULE_DIR$/build" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="baseLibrary" /> - <orderEntry type="library" name="Gradle: com.tunnelvisionlabs:antlr4:4.5" level="project" /> - <orderEntry type="library" name="Gradle: commons-io:commons-io:2.4" level="project" /> - <orderEntry type="library" name="Gradle: com.googlecode.juniversalchardet:juniversalchardet:1.0.3" level="project" /> - <orderEntry type="library" name="Gradle: com.tunnelvisionlabs:antlr4-runtime:4.5" level="project" /> - <orderEntry type="library" name="Gradle: com.tunnelvisionlabs:antlr4-annotations:4.5" level="project" /> - <orderEntry type="library" name="Gradle: org.antlr:antlr-runtime:3.5.2" level="project" /> - <orderEntry type="library" name="Gradle: org.antlr:ST4:4.0.8" level="project" /> - <orderEntry type="library" name="Gradle: org.abego.treelayout:org.abego.treelayout.core:1.0.1" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12" level="project" /> - <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" /> - <orderEntry type="library" name="Gradle: com.google.guava:guava:17.0" level="project" /> - </component> -</module>
\ No newline at end of file diff --git a/compilerCommon/db-compilerCommon-base.iml b/compilerCommon/db-compilerCommon-base.iml index 38f8122f..bc880d54 100644 --- a/compilerCommon/db-compilerCommon-base.iml +++ b/compilerCommon/db-compilerCommon-base.iml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <module relativePaths="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true"> <exclude-output /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> @@ -16,7 +16,7 @@ <orderEntry type="module-library" exported=""> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/com/tunnelvisionlabs/antlr4/4.5/antlr4-4.5.jar!/" /> + <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/org/antlr/antlr4/4.5.3/antlr4-4.5.3.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -45,42 +45,6 @@ <orderEntry type="module-library" exported=""> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/com/tunnelvisionlabs/antlr4-runtime/4.5/antlr4-runtime-4.5.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library" exported=""> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/com/tunnelvisionlabs/antlr4-annotations/4.5/antlr4-annotations-4.5.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library" exported=""> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/org/antlr/antlr-runtime/3.5.2/antlr-runtime-3.5.2.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library" exported=""> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/org/antlr/ST4/4.0.8/ST4-4.0.8.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library" exported=""> - <library> - <CLASSES> <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/org/abego/treelayout/org.abego.treelayout.core/1.0.1/org.abego.treelayout.core-1.0.1.jar!/" /> </CLASSES> <JAVADOC /> @@ -110,5 +74,6 @@ </library> </orderEntry> <orderEntry type="library" exported="" name="guava-tools" level="project" /> + <orderEntry type="module" module-name="android-annotations" /> </component> </module>
\ No newline at end of file diff --git a/compilerCommon/db-compilerCommon.iml b/compilerCommon/db-compilerCommon.iml index 3b18b8a9..eb533639 100644 --- a/compilerCommon/db-compilerCommon.iml +++ b/compilerCommon/db-compilerCommon.iml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <module relativePaths="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true"> <exclude-output /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> @@ -25,8 +25,7 @@ <SOURCES /> </library> </orderEntry> - <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="antlr4-runtime-4.5.3" level="project" /> <orderEntry type="module-library" scope="TEST"> <library> <CLASSES> @@ -49,5 +48,6 @@ </SOURCES> </library> </orderEntry> + <orderEntry type="module" module-name="android-annotations" exported="" /> </component> </module>
\ No newline at end of file diff --git a/data-binding.iml b/data-binding.iml deleted file mode 100644 index bebe401a..00000000 --- a/data-binding.iml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id="data-binding" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/build" /> - <output-test url="file://$MODULE_DIR$/build" /> - <exclude-output /> - <content url="file://$MODULE_DIR$"> - <excludeFolder url="file://$MODULE_DIR$/.gradle" /> - <excludeFolder url="file://$MODULE_DIR$/build" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module>
\ No newline at end of file diff --git a/dataBinding/dataBinding.iml b/dataBinding/dataBinding.iml deleted file mode 100644 index 0d65182c..00000000 --- a/dataBinding/dataBinding.iml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id=":dataBinding" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.android.databinding" external.system.module.version="1.1" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/build" /> - <output-test url="file://$MODULE_DIR$/build" /> - <exclude-output /> - <content url="file://$MODULE_DIR$"> - <excludeFolder url="file://$MODULE_DIR$/.gradle" /> - <excludeFolder url="file://$MODULE_DIR$/build" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module>
\ No newline at end of file diff --git a/extensions/library/src/main/java/android/databinding/ViewDataBinding.java b/extensions/library/src/main/java/android/databinding/ViewDataBinding.java index 7829c0d1..f50267b8 100644 --- a/extensions/library/src/main/java/android/databinding/ViewDataBinding.java +++ b/extensions/library/src/main/java/android/databinding/ViewDataBinding.java @@ -640,29 +640,29 @@ public abstract class ViewDataBinding extends BaseObservable { } /** @hide */ - protected int getColorFromResource(int resourceId) { + protected static int getColorFromResource(View view, int resourceId) { if (VERSION.SDK_INT >= VERSION_CODES.M) { - return getRoot().getContext().getColor(resourceId); + return view.getContext().getColor(resourceId); } else { - return getRoot().getResources().getColor(resourceId); + return view.getResources().getColor(resourceId); } } /** @hide */ - protected ColorStateList getColorStateListFromResource(int resourceId) { + protected static ColorStateList getColorStateListFromResource(View view, int resourceId) { if (VERSION.SDK_INT >= VERSION_CODES.M) { - return getRoot().getContext().getColorStateList(resourceId); + return view.getContext().getColorStateList(resourceId); } else { - return getRoot().getResources().getColorStateList(resourceId); + return view.getResources().getColorStateList(resourceId); } } /** @hide */ - protected Drawable getDrawableFromResource(int resourceId) { + protected static Drawable getDrawableFromResource(View view, int resourceId) { if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { - return getRoot().getContext().getDrawable(resourceId); + return view.getContext().getDrawable(resourceId); } else { - return getRoot().getResources().getDrawable(resourceId); + return view.getResources().getDrawable(resourceId); } } |