summaryrefslogtreecommitdiffstats
path: root/tools/data-binding/integration-tests/TestApp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/data-binding/integration-tests/TestApp')
-rw-r--r--tools/data-binding/integration-tests/TestApp/.gitignore6
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/.gitignore1
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/build.gradle32
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/proguard-rules.pro17
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/library/DataBinderTrojan.java26
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsListViewBindingAdapterTest.java69
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsSeekBarBindingAdapterTest.java49
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsSpinnerBindingAdapterTest.java59
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ApplicationTest.java27
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AutoCompleteTextViewBindingAdapterTest.java61
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseDataBinderTest.java84
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseLandDataBinderTest.java25
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseObservableTest.java84
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BasicBindingTest.java75
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BasicDependantBindingTest.java80
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindToFinalFieldTest.java38
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindToFinalObservableFieldTest.java45
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindingAdapterTestBase.java76
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BracketTest.java78
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CastTest.java62
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CheckedTextViewBindingAdapterTest.java56
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CompoundButtonBindingAdapterTest.java46
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ConditionalBindingTest.java34
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/FindMethodTest.java103
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/FrameLayoutBindingAdapterTest.java51
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ImageViewBindingAdapterTest.java50
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/IncludeTagTest.java45
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/LandDataBinderTest.java18
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/LinearLayoutBindingAdapterTest.java51
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ListChangeRegistryTest.java237
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/MapChangeRegistryTest.java53
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/NewApiTest.java82
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/NoIdTest.java86
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableArrayListTest.java250
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableArrayMapTest.java213
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableFieldTest.java144
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableWithNotBindableFieldObjectTest.java40
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ProcessBindableTest.java68
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ProgressBarBindingAdapterTest.java59
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/PropertyChangeRegistryTest.java62
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/RadioGroupBindingAdapterTest.java46
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ResourceTest.java86
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/SpinnerBindingAdapterTest.java52
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/SwitchBindingAdapterTest.java56
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TabWidgetBindingAdapterTest.java54
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TableLayoutBindingAdapterTest.java78
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TextViewBindingAdapterTest.java304
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewBindingAdapterTest.java180
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewGroupBindingAdapterTest.java81
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewStubBindingAdapterTest.java46
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/multiconfig/LandscapeConfigTest.java60
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/multiconfig/PortraitConfigTest.java63
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/AndroidManifest.xml25
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/TestActivity.java30
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsListViewBindingObject.java50
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsSeekBarBindingObject.java36
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsSpinnerBindingObject.java43
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AutoCompleteTextViewBindingObject.java42
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/BindableTestObject.java52
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/BindingAdapterBindingObject.java23
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/CheckedTextViewBindingObject.java43
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/CompoundButtonBindingObject.java34
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObject.java40
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObjectBase.java30
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FrameLayoutBindingObject.java34
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ImageViewBindingObject.java53
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/LinearLayoutBindingObject.java45
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/NotBindableVo.java88
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ObservableFieldBindingObject.java45
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ObservableWithNotBindableFieldObject.java28
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ProgressBarBindingObject.java51
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/PublicFinalTestVo.java21
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/PublicFinalWithObservableTestVo.java42
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/RadioGroupBindingObject.java35
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/SpinnerBindingObject.java34
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/SwitchBindingObject.java41
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TabWidgetBindingObject.java56
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TableLayoutBindingObject.java55
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TextViewBindingObject.java319
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewBindingObject.java177
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewGroupBindingObject.java55
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewStubBindingObject.java35
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 19388 bytes
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout-land/multi_res_layout.xml41
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_list_view_adapter_test.xml11
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_seek_bar_adapter_test.xml10
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_spinner_adapter_test.xml10
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/auto_complete_text_view_adapter_test.xml11
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/basic_binding.xml27
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/basic_dependant_binding.xml48
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bind_to_final.xml23
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bind_to_final_observable.xml23
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bracket_test.xml44
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/cast_test.xml20
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/checked_text_view_adapter_test.xml13
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/compound_button_adapter_test.xml11
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/conditional_binding.xml17
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/find_method_test.xml77
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/frame_layout_adapter_test.xml11
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/image_view_adapter_test.xml14
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/included_layout.xml26
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/layout_with_include.xml29
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/linear_layout_adapter_test.xml14
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/multi_res_layout.xml38
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/new_api_layout.xml27
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/no_id_test.xml17
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/observable_field_test.xml52
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/observable_with_not_bindable_field.xml23
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/progress_bar_adapter_test.xml14
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/radio_group_adapter_test.xml18
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/resource_test.xml40
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/spinner_adapter_test.xml12
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/switch_adapter_test.xml13
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/tab_widget_adapter_test.xml14
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/table_layout_adapter_test.xml32
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/text_view_adapter_test.xml69
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_adapter_test.xml73
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_group_adapter_test.xml15
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_stub_adapter_test.xml10
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/values-v21/styles.xml18
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/values/fractions.xml20
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/values/strings.xml22
-rw-r--r--tools/data-binding/integration-tests/TestApp/app/src/main/res/values/styles.xml21
-rw-r--r--tools/data-binding/integration-tests/TestApp/build.gradle29
-rw-r--r--tools/data-binding/integration-tests/TestApp/gradle.properties18
-rw-r--r--tools/data-binding/integration-tests/TestApp/gradle/wrapper/gradle-wrapper.jarbin0 -> 49896 bytes
-rw-r--r--tools/data-binding/integration-tests/TestApp/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xtools/data-binding/integration-tests/TestApp/gradlew164
-rw-r--r--tools/data-binding/integration-tests/TestApp/gradlew.bat90
-rw-r--r--tools/data-binding/integration-tests/TestApp/settings.gradle1
133 files changed, 6846 insertions, 0 deletions
diff --git a/tools/data-binding/integration-tests/TestApp/.gitignore b/tools/data-binding/integration-tests/TestApp/.gitignore
new file mode 100644
index 0000000..afbdab3
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/.gitignore
@@ -0,0 +1,6 @@
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
diff --git a/tools/data-binding/integration-tests/TestApp/app/.gitignore b/tools/data-binding/integration-tests/TestApp/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/tools/data-binding/integration-tests/TestApp/app/build.gradle b/tools/data-binding/integration-tests/TestApp/app/build.gradle
new file mode 100644
index 0000000..8ba8f39
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/build.gradle
@@ -0,0 +1,32 @@
+apply plugin: 'com.android.application'
+apply plugin: 'com.android.databinding'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "22"
+
+ defaultConfig {
+ applicationId "com.android.databinding.testapp"
+ minSdkVersion 7
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ packagingOptions {
+ exclude 'META-INF/services/javax.annotation.processing.Processor'
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile "com.android.databinding:library:$snapshotVersion"
+ compile "com.android.support:support-v4:+"
+ provided "com.android.databinding:annotationprocessor:$snapshotVersion"
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/proguard-rules.pro b/tools/data-binding/integration-tests/TestApp/app/proguard-rules.pro
new file mode 100644
index 0000000..b7210d1
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/yboyar/android/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/library/DataBinderTrojan.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/library/DataBinderTrojan.java
new file mode 100644
index 0000000..eeba4f2
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/library/DataBinderTrojan.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.library;
+
+/**
+ * This helper is used to toggle DataBinder's package private values to change behavior for testing
+ */
+public class DataBinderTrojan {
+ public static void setBuildSdkInt(int level) {
+ DataBinder.SDK_INT = level;
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsListViewBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsListViewBindingAdapterTest.java
new file mode 100644
index 0000000..4c6b037
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsListViewBindingAdapterTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.AbsListViewAdapterTestBinder;
+import com.android.databinding.testapp.vo.AbsListViewBindingObject;
+
+import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
+import android.os.Debug;
+import android.widget.ListView;
+
+public class AbsListViewBindingAdapterTest
+ extends BindingAdapterTestBase<AbsListViewAdapterTestBinder, AbsListViewBindingObject> {
+
+ ListView mView;
+
+ public AbsListViewBindingAdapterTest() {
+ super(AbsListViewAdapterTestBinder.class, AbsListViewBindingObject.class,
+ R.layout.abs_list_view_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testListSelector() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(mBindingObject.getListSelector().getColor(),
+ ((ColorDrawable) mView.getSelector()).getColor());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getListSelector().getColor(),
+ ((ColorDrawable) mView.getSelector()).getColor());
+ }
+ }
+
+ public void testScrollingCache() throws Throwable {
+ assertEquals(mBindingObject.isScrollingCache(), mView.isScrollingCacheEnabled());
+
+ changeValues();
+
+ assertEquals(mBindingObject.isScrollingCache(), mView.isScrollingCacheEnabled());
+ }
+
+ public void testSmoothScrollbar() throws Throwable {
+ assertEquals(mBindingObject.isSmoothScrollbar(), mView.isSmoothScrollbarEnabled());
+
+ changeValues();
+
+ assertEquals(mBindingObject.isSmoothScrollbar(), mView.isSmoothScrollbarEnabled());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsSeekBarBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsSeekBarBindingAdapterTest.java
new file mode 100644
index 0000000..abf842b
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsSeekBarBindingAdapterTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.AbsSeekBarAdapterTestBinder;
+import com.android.databinding.testapp.vo.AbsSeekBarBindingObject;
+
+import android.os.Build;
+import android.widget.SeekBar;
+
+public class AbsSeekBarBindingAdapterTest
+ extends BindingAdapterTestBase<AbsSeekBarAdapterTestBinder, AbsSeekBarBindingObject> {
+
+ SeekBar mView;
+
+ public AbsSeekBarBindingAdapterTest() {
+ super(AbsSeekBarAdapterTestBinder.class, AbsSeekBarBindingObject.class,
+ R.layout.abs_seek_bar_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testThumbTint() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ assertEquals(mBindingObject.getThumbTint(), mView.getThumbTintList().getDefaultColor());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getThumbTint(), mView.getThumbTintList().getDefaultColor());
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsSpinnerBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsSpinnerBindingAdapterTest.java
new file mode 100644
index 0000000..7478672
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AbsSpinnerBindingAdapterTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.AbsSpinnerAdapterTestBinder;
+import com.android.databinding.testapp.vo.AbsSpinnerBindingObject;
+
+import android.os.Build;
+import android.widget.Spinner;
+import android.widget.SpinnerAdapter;
+
+public class AbsSpinnerBindingAdapterTest
+ extends BindingAdapterTestBase<AbsSpinnerAdapterTestBinder, AbsSpinnerBindingObject> {
+
+ Spinner mView;
+
+ public AbsSpinnerBindingAdapterTest() {
+ super(AbsSpinnerAdapterTestBinder.class, AbsSpinnerBindingObject.class,
+ R.layout.abs_spinner_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testEntries() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ validateEntries();
+
+ changeValues();
+
+ validateEntries();
+ }
+ }
+
+ private void validateEntries() {
+ assertEquals(mBindingObject.getEntries().length, mView.getAdapter().getCount());
+ CharSequence[] entries = mBindingObject.getEntries();
+ SpinnerAdapter adapter = mView.getAdapter();
+ for (int i = 0; i < entries.length; i++) {
+ assertEquals(adapter.getItem(i), entries[i]);
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ApplicationTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ApplicationTest.java
new file mode 100644
index 0000000..e1bbd42
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ApplicationTest.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
+ */
+public class ApplicationTest extends ApplicationTestCase<Application> {
+
+ public ApplicationTest() {
+ super(Application.class);
+ }
+} \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AutoCompleteTextViewBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AutoCompleteTextViewBindingAdapterTest.java
new file mode 100644
index 0000000..ba7b4de
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/AutoCompleteTextViewBindingAdapterTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.AutoCompleteTextViewAdapterTestBinder;
+import com.android.databinding.testapp.vo.AutoCompleteTextViewBindingObject;
+
+import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
+import android.widget.AutoCompleteTextView;
+
+public class AutoCompleteTextViewBindingAdapterTest extends
+ BindingAdapterTestBase<AutoCompleteTextViewAdapterTestBinder,
+ AutoCompleteTextViewBindingObject> {
+
+ AutoCompleteTextView mView;
+
+ public AutoCompleteTextViewBindingAdapterTest() {
+ super(AutoCompleteTextViewAdapterTestBinder.class, AutoCompleteTextViewBindingObject.class,
+ R.layout.auto_complete_text_view_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testCompletionThreshold() throws Throwable {
+ assertEquals(mBindingObject.getCompletionThreshold(), mView.getThreshold());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getCompletionThreshold(), mView.getThreshold());
+ }
+
+ public void testPopupBackground() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ assertEquals(mBindingObject.getPopupBackground(),
+ ((ColorDrawable) mView.getDropDownBackground()).getColor());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getPopupBackground(),
+ ((ColorDrawable) mView.getDropDownBackground()).getColor());
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseDataBinderTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseDataBinderTest.java
new file mode 100644
index 0000000..80c2c94
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseDataBinderTest.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.library.DataBinder;
+import com.android.databinding.library.IViewDataBinder;
+
+import android.content.pm.ActivityInfo;
+import android.os.Looper;
+import android.test.ActivityInstrumentationTestCase2;
+
+public class BaseDataBinderTest<T extends IViewDataBinder>
+ extends ActivityInstrumentationTestCase2<TestActivity> {
+ protected Class<T> mBinderClass;
+ private int mLayoutId;
+ private int mOrientation;
+ protected T mBinder;
+
+ public BaseDataBinderTest(final Class<T> binderClass, final int layoutId) {
+ this(binderClass, layoutId, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ }
+
+ public BaseDataBinderTest(final Class<T> binderClass, final int layoutId, final int orientation) {
+ super(TestActivity.class);
+ mBinderClass = binderClass;
+ mLayoutId = layoutId;
+ mOrientation = orientation;
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ getActivity().setRequestedOrientation(mOrientation);
+ createBinder();
+ }
+
+ public boolean isMainThread() {
+ return Looper.myLooper() == Looper.getMainLooper();
+ }
+
+ protected void createBinder() {
+ mBinder = null;
+ getActivity().runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mBinder = DataBinder.createBinder(mBinderClass, getActivity(), mLayoutId, null);
+ getActivity().setContentView(mBinder.getRoot());
+ }
+ });
+ if (!isMainThread()) {
+ getInstrumentation().waitForIdleSync();
+ }
+ assertNotNull(mBinder);
+ }
+
+ protected void assertMethod(Class<?> klass, String methodName) throws NoSuchMethodException {
+ assertEquals(klass, mBinder.getClass().getDeclaredMethod(methodName).getReturnType());
+ }
+
+ protected void assertField(Class<?> klass, String fieldName) throws NoSuchFieldException {
+ assertEquals(klass, mBinder.getClass().getDeclaredField(fieldName).getType());
+ }
+
+ protected void assertNoField(String fieldName) {
+ Exception[] ex = new Exception[1];
+ try {
+ mBinder.getClass().getDeclaredField(fieldName);
+ } catch (NoSuchFieldException e) {
+ ex[0] = e;
+ }
+ assertNotNull(ex[0]);
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseLandDataBinderTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseLandDataBinderTest.java
new file mode 100644
index 0000000..0f983eb
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseLandDataBinderTest.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.library.IViewDataBinder;
+
+import android.content.pm.ActivityInfo;
+
+public class BaseLandDataBinderTest<T extends IViewDataBinder> extends BaseDataBinderTest<T> {
+
+ public BaseLandDataBinderTest(Class<T> binderClass, int layoutId) {
+ super(binderClass, layoutId, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseObservableTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseObservableTest.java
new file mode 100644
index 0000000..a740551
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BaseObservableTest.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.library.BaseObservable;
+import com.android.databinding.testapp.generated.BasicBindingBinder;
+
+import android.binding.Observable;
+import android.binding.OnPropertyChangedListener;
+
+import java.util.ArrayList;
+
+public class BaseObservableTest extends BaseDataBinderTest<BasicBindingBinder> {
+ private BaseObservable mObservable;
+ private ArrayList<Integer> mNotifications = new ArrayList<>();
+ private OnPropertyChangedListener mListener = new OnPropertyChangedListener() {
+ @Override
+ public void onPropertyChanged(Observable observable, int i) {
+ assertEquals(mObservable, observable);
+ mNotifications.add(i);
+ }
+ };
+
+ public BaseObservableTest() {
+ super(BasicBindingBinder.class, R.layout.basic_binding);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ mNotifications.clear();
+ mObservable = new BaseObservable();
+ }
+
+ public void testAddListener() {
+ mObservable.notifyChange();
+ assertTrue(mNotifications.isEmpty());
+ mObservable.addOnPropertyChangedListener(mListener);
+ mObservable.notifyChange();
+ assertFalse(mNotifications.isEmpty());
+ }
+
+ public void testRemoveListener() {
+ // test there is no exception when the listener isn't there
+ mObservable.removeOnPropertyChangedListener(mListener);
+
+ mObservable.addOnPropertyChangedListener(mListener);
+ mObservable.notifyChange();
+ mNotifications.clear();
+ mObservable.removeOnPropertyChangedListener(mListener);
+ mObservable.notifyChange();
+ assertTrue(mNotifications.isEmpty());
+
+ // test there is no exception when the listener isn't there
+ mObservable.removeOnPropertyChangedListener(mListener);
+ }
+
+ public void testNotifyChange() {
+ mObservable.addOnPropertyChangedListener(mListener);
+ mObservable.notifyChange();
+ assertEquals(1, mNotifications.size());
+ assertEquals(0, (int) mNotifications.get(0));
+ }
+
+ public void testNotifyPropertyChanged() {
+ final int expectedId = 100;
+ mObservable.addOnPropertyChangedListener(mListener);
+ mObservable.notifyPropertyChanged(expectedId);
+ assertEquals(1, mNotifications.size());
+ assertEquals(expectedId, (int) mNotifications.get(0));
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BasicBindingTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BasicBindingTest.java
new file mode 100644
index 0000000..a7ba223
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BasicBindingTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.BasicBindingBinder;
+
+import android.test.UiThreadTest;
+
+public class BasicBindingTest extends BaseDataBinderTest<BasicBindingBinder> {
+ public BasicBindingTest() {
+ super(BasicBindingBinder.class, R.layout.basic_binding);
+ }
+
+ @UiThreadTest
+ public void testTextViewContentInInitialization() {
+ assertAB("X", "Y");
+ }
+
+ @UiThreadTest
+ public void testNullValuesInInitialization() {
+ assertAB(null, null);
+ }
+
+ @UiThreadTest
+ public void testSecondIsNullInInitialization() {
+ assertAB(null, "y");
+ }
+
+ @UiThreadTest
+ public void testFirstIsNullInInitialization() {
+ assertAB("x", null);
+ }
+
+ @UiThreadTest
+ public void testTextViewContent() {
+ assertAB("X", "Y");
+ }
+
+ @UiThreadTest
+ public void testNullValues() {
+ assertAB(null, null);
+ }
+
+ @UiThreadTest
+ public void testSecondIsNull() {
+ assertAB(null, "y");
+ }
+
+ @UiThreadTest
+ public void testFirstIsNull() {
+ assertAB("x", null);
+ }
+
+ private void assertAB(String a, String b) {
+ mBinder.setA(a);
+ mBinder.setB(b);
+ rebindAndAssert(a + b);
+ }
+
+ private void rebindAndAssert(String text) {
+ mBinder.rebindDirty();
+ assertEquals(text, mBinder.getTextView().getText().toString());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BasicDependantBindingTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BasicDependantBindingTest.java
new file mode 100644
index 0000000..3a7631b
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BasicDependantBindingTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.BasicDependantBindingBinder;
+import com.android.databinding.testapp.vo.NotBindableVo;
+
+import android.test.UiThreadTest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BasicDependantBindingTest extends BaseDataBinderTest<BasicDependantBindingBinder> {
+
+ public BasicDependantBindingTest() {
+ super(BasicDependantBindingBinder.class, R.layout.basic_dependant_binding);
+ }
+
+ public List<NotBindableVo> permutations(String value) {
+ List<NotBindableVo> result = new ArrayList<>();
+ result.add(null);
+ result.add(new NotBindableVo(null));
+ result.add(new NotBindableVo(value));
+ return result;
+ }
+
+ @UiThreadTest
+ public void testAllPermutations() {
+ List<NotBindableVo> obj1s = permutations("a");
+ List<NotBindableVo> obj2s = permutations("b");
+ for (NotBindableVo obj1 : obj1s) {
+ for (NotBindableVo obj2 : obj2s) {
+ createBinder(); //get a new one
+ testWith(obj1, obj2);
+ createBinder();
+ mBinder.rebindDirty();
+ testWith(obj1, obj2);
+ }
+ }
+ }
+
+ private void testWith(NotBindableVo obj1, NotBindableVo obj2) {
+ mBinder.setObj1(obj1);
+ mBinder.setObj2(obj2);
+ mBinder.rebindDirty();
+ assertValues(safeGet(obj1), safeGet(obj2),
+ obj1 == null ? "" : obj1.mergeStringFields(obj2),
+ obj2 == null ? "" : obj2.mergeStringFields(obj1),
+ (obj1 == null ? null : obj1.getStringValue())
+ + (obj2 == null ? null : obj2.getStringValue())
+ );
+ }
+
+ private String safeGet(NotBindableVo vo) {
+ if (vo == null || vo.getStringValue() == null) {
+ return "";
+ }
+ return vo.getStringValue();
+ }
+
+ private void assertValues(String textView1, String textView2,
+ String mergedView1, String mergedView2, String rawMerge) {
+ assertEquals(textView1, mBinder.getTextView1().getText().toString());
+ assertEquals(textView2, mBinder.getTextView2().getText().toString());
+ assertEquals(mergedView1, mBinder.getMergedTextView1().getText().toString());
+ assertEquals(mergedView2, mBinder.getMergedTextView2().getText().toString());
+ assertEquals(rawMerge, mBinder.getRawStringMerge().getText().toString());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindToFinalFieldTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindToFinalFieldTest.java
new file mode 100644
index 0000000..96ac989
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindToFinalFieldTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.BindToFinalBinder;
+import com.android.databinding.testapp.vo.PublicFinalTestVo;
+
+import android.test.UiThreadTest;
+import android.widget.TextView;
+
+public class BindToFinalFieldTest extends BaseDataBinderTest<BindToFinalBinder>{
+
+ public BindToFinalFieldTest() {
+ super(BindToFinalBinder.class, R.layout.bind_to_final);
+ }
+
+ @UiThreadTest
+ public void testSimple() {
+ final PublicFinalTestVo vo = new PublicFinalTestVo(R.string.app_name);
+ mBinder.setObj(vo);
+ mBinder.rebindDirty();
+ final TextView textView = (TextView) mBinder.getRoot().findViewById(R.id.text_view);
+ assertEquals(getActivity().getResources().getString(R.string.app_name), textView.getText().toString());
+ }
+
+
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindToFinalObservableFieldTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindToFinalObservableFieldTest.java
new file mode 100644
index 0000000..c0aacd0
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindToFinalObservableFieldTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.BindToFinalBinder;
+import com.android.databinding.testapp.generated.BindToFinalObservableBinder;
+import com.android.databinding.testapp.vo.PublicFinalTestVo;
+import com.android.databinding.testapp.vo.PublicFinalWithObservableTestVo;
+
+import android.test.UiThreadTest;
+import android.widget.TextView;
+
+public class BindToFinalObservableFieldTest extends BaseDataBinderTest<BindToFinalObservableBinder>{
+
+ public BindToFinalObservableFieldTest() {
+ super(BindToFinalObservableBinder.class, R.layout.bind_to_final_observable);
+ }
+
+ @UiThreadTest
+ public void testSimple() {
+ final PublicFinalWithObservableTestVo vo = new PublicFinalWithObservableTestVo(R.string.app_name);
+ mBinder.setObj(vo);
+ mBinder.rebindDirty();
+ final TextView textView = (TextView) mBinder.getRoot().findViewById(R.id.text_view);
+ assertEquals(getActivity().getResources().getString(R.string.app_name), textView.getText().toString());
+ vo.myFinalVo.setVal(R.string.rain);
+ mBinder.rebindDirty();
+ assertEquals("The field should be observed and its notify event should've invalidated"
+ + " binder flags.", getActivity().getResources().getString(R.string.rain),
+ textView.getText().toString());
+ }
+
+
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindingAdapterTestBase.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindingAdapterTestBase.java
new file mode 100644
index 0000000..bedfc00
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BindingAdapterTestBase.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.library.IViewDataBinder;
+import com.android.databinding.testapp.vo.BindingAdapterBindingObject;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+public class BindingAdapterTestBase<T extends IViewDataBinder, V extends BindingAdapterBindingObject>
+ extends BaseDataBinderTest<T> {
+ private Class<V> mBindingObjectClass;
+
+ protected V mBindingObject;
+
+ private Method mSetMethod;
+
+ public BindingAdapterTestBase(Class<T> binderClass, Class<V> observableClass, int layoutId) {
+ super(binderClass, layoutId);
+ mBindingObjectClass = observableClass;
+ try {
+ mSetMethod = binderClass.getDeclaredMethod("setObj", observableClass);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ try {
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ mBindingObject = mBindingObjectClass.newInstance();
+ mSetMethod.invoke(mBinder, mBindingObject);
+ mBinder.rebindDirty();
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ } catch (Throwable throwable) {
+ throw new Exception(throwable);
+ }
+ }
+
+ protected void changeValues() throws Throwable {
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mBindingObject.changeValues();
+ mBinder.rebindDirty();
+ }
+ });
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BracketTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BracketTest.java
new file mode 100644
index 0000000..a6dea10
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/BracketTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.BracketTestBinder;
+
+import android.test.UiThreadTest;
+import android.util.LongSparseArray;
+import android.util.SparseArray;
+import android.util.SparseBooleanArray;
+import android.util.SparseIntArray;
+import android.util.SparseLongArray;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+public class BracketTest extends BaseDataBinderTest<BracketTestBinder> {
+ private String[] mArray = {
+ "Hello World"
+ };
+
+ private SparseArray<String> mSparseArray = new SparseArray<>();
+ private SparseIntArray mSparseIntArray = new SparseIntArray();
+ private SparseBooleanArray mSparseBooleanArray = new SparseBooleanArray();
+ private SparseLongArray mSparseLongArray = new SparseLongArray();
+ private LongSparseArray<String> mLongSparseArray = new LongSparseArray<>();
+
+ public BracketTest() {
+ super(BracketTestBinder.class, R.layout.bracket_test);
+ mSparseArray.put(0, "Hello");
+ mLongSparseArray.put(0, "World");
+ mSparseIntArray.put(0, 100);
+ mSparseBooleanArray.put(0, true);
+ mSparseLongArray.put(0, 5);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ try {
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mBinder.setArray(mArray);
+ mBinder.setSparseArray(mSparseArray);
+ mBinder.setSparseIntArray(mSparseIntArray);
+ mBinder.setSparseBooleanArray(mSparseBooleanArray);
+ mBinder.setSparseLongArray(mSparseLongArray);
+ mBinder.setLongSparseArray(mLongSparseArray);
+
+ mBinder.rebindDirty();
+ }
+ });
+ } catch (Throwable throwable) {
+ throw new Exception(throwable);
+ }
+ }
+
+ @UiThreadTest
+ public void testBrackets() {
+ assertEquals("Hello World", mBinder.getArrayText().getText().toString());
+ assertEquals("Hello", mBinder.getSparseArrayText().getText().toString());
+ assertEquals("World", mBinder.getLongSparseArrayText().getText().toString());
+ assertEquals("100", mBinder.getSparseIntArrayText().getText().toString());
+ assertEquals("true", mBinder.getSparseBooleanArrayText().getText().toString());
+ assertEquals("5", mBinder.getSparseLongArrayText().getText().toString());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CastTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CastTest.java
new file mode 100644
index 0000000..0ea053f
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CastTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.CastTestBinder;
+
+import android.support.v4.util.ArrayMap;
+import android.test.UiThreadTest;
+
+import java.util.ArrayList;
+
+public class CastTest extends BaseDataBinderTest<CastTestBinder> {
+ ArrayList<String> mValues = new ArrayList<>();
+ ArrayMap<String, String> mMap = new ArrayMap<>();
+
+ public CastTest() {
+ super(CastTestBinder.class, R.layout.cast_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ try {
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mValues.clear();
+ mValues.add("hello");
+ mValues.add("world");
+ mValues.add("not seen");
+ mMap.clear();
+ mMap.put("hello", "world");
+ mMap.put("world", "hello");
+ mBinder.setList(mValues);
+ mBinder.setMap(mMap);
+ mBinder.rebindDirty();
+ }
+ });
+ } catch (Throwable throwable) {
+ throw new Exception(throwable);
+ }
+ }
+
+ @UiThreadTest
+ public void testCast() throws Throwable {
+ assertEquals("hello", mBinder.getTextView0().getText().toString());
+ assertEquals("world", mBinder.getTextView1().getText().toString());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CheckedTextViewBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CheckedTextViewBindingAdapterTest.java
new file mode 100644
index 0000000..ee88e6b
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CheckedTextViewBindingAdapterTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.CheckedTextViewAdapterTestBinder;
+import com.android.databinding.testapp.vo.CheckedTextViewBindingObject;
+
+import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
+import android.widget.CheckedTextView;
+
+public class CheckedTextViewBindingAdapterTest extends
+ BindingAdapterTestBase<CheckedTextViewAdapterTestBinder, CheckedTextViewBindingObject> {
+
+ CheckedTextView mView;
+
+ public CheckedTextViewBindingAdapterTest() {
+ super(CheckedTextViewAdapterTestBinder.class, CheckedTextViewBindingObject.class,
+ R.layout.checked_text_view_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testView() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ assertEquals(mBindingObject.getCheckMark().getColor(),
+ ((ColorDrawable) mView.getCheckMarkDrawable()).getColor());
+ assertEquals(mBindingObject.getCheckMarkTint(),
+ mView.getCheckMarkTintList().getDefaultColor());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getCheckMark().getColor(),
+ ((ColorDrawable) mView.getCheckMarkDrawable()).getColor());
+ assertEquals(mBindingObject.getCheckMarkTint(),
+ mView.getCheckMarkTintList().getDefaultColor());
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CompoundButtonBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CompoundButtonBindingAdapterTest.java
new file mode 100644
index 0000000..6570f87
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/CompoundButtonBindingAdapterTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.CompoundButtonAdapterTestBinder;
+import com.android.databinding.testapp.vo.CompoundButtonBindingObject;
+
+import android.widget.CompoundButton;
+
+public class CompoundButtonBindingAdapterTest extends
+ BindingAdapterTestBase<CompoundButtonAdapterTestBinder, CompoundButtonBindingObject> {
+
+ CompoundButton mView;
+
+ public CompoundButtonBindingAdapterTest() {
+ super(CompoundButtonAdapterTestBinder.class, CompoundButtonBindingObject.class,
+ R.layout.compound_button_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testCompoundButton() throws Throwable {
+ assertEquals(mBindingObject.getButtonTint(), mView.getButtonTintList().getDefaultColor());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getButtonTint(), mView.getButtonTintList().getDefaultColor());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ConditionalBindingTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ConditionalBindingTest.java
new file mode 100644
index 0000000..4a39680
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ConditionalBindingTest.java
@@ -0,0 +1,34 @@
+package com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.ConditionalBindingBinder;
+import com.android.databinding.testapp.vo.NotBindableVo;
+
+import android.test.UiThreadTest;
+
+public class ConditionalBindingTest extends BaseDataBinderTest<ConditionalBindingBinder>{
+
+ public ConditionalBindingTest() {
+ super(ConditionalBindingBinder.class, R.layout.conditional_binding);
+ }
+
+ @UiThreadTest
+ public void test1() {
+ testCorrectness(true, true);
+ }
+
+ private void testCorrectness(boolean cond1, boolean cond2) {
+ NotBindableVo o1 = new NotBindableVo("a");
+ NotBindableVo o2 = new NotBindableVo("b");
+ NotBindableVo o3 = new NotBindableVo("c");
+ mBinder.setObj1(o1);
+ mBinder.setObj2(o2);
+ mBinder.setObj3(o3);
+ mBinder.setCond1(cond1);
+ mBinder.setCond2(cond2);
+ mBinder.rebindDirty();
+ final String text = mBinder.getTextView().getText().toString();
+ assertEquals(cond1 && cond2, "a".equals(text));
+ assertEquals(cond1 && !cond2, "b".equals(text));
+ assertEquals(!cond1, "c".equals(text));
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/FindMethodTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/FindMethodTest.java
new file mode 100644
index 0000000..4f19701
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/FindMethodTest.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.FindMethodTestBinder;
+import com.android.databinding.testapp.vo.FindMethodBindingObject;
+
+import android.test.UiThreadTest;
+import android.widget.TextView;
+
+public class FindMethodTest
+ extends BindingAdapterTestBase<FindMethodTestBinder, FindMethodBindingObject> {
+
+ public FindMethodTest() {
+ super(FindMethodTestBinder.class, FindMethodBindingObject.class, R.layout.find_method_test);
+ }
+
+ public void testNoArg() throws Throwable {
+ TextView textView = mBinder.getTextView6();
+ assertEquals("no arg", textView.getText().toString());
+ }
+
+ public void testIntArg() throws Throwable {
+ TextView textView = mBinder.getTextView0();
+ assertEquals("1", textView.getText().toString());
+ }
+
+ public void testFloatArg() throws Throwable {
+ TextView textView = mBinder.getTextView1();
+ assertEquals("1.25", textView.getText().toString());
+ }
+
+ public void testStringArg() throws Throwable {
+ TextView textView = mBinder.getTextView2();
+ assertEquals("hello", textView.getText().toString());
+ }
+
+ public void testBoxedArg() throws Throwable {
+ TextView textView = mBinder.getTextView3();
+ assertEquals("1", textView.getText().toString());
+ }
+
+ public void testInheritedMethod() throws Throwable {
+ TextView textView = mBinder.getTextView4();
+ assertEquals("base", textView.getText().toString());
+ }
+
+ public void testInheritedMethodInt() throws Throwable {
+ TextView textView = mBinder.getTextView5();
+ assertEquals("base 2", textView.getText().toString());
+ }
+
+ public void testStaticMethod() throws Throwable {
+ TextView textView = mBinder.getTextView7();
+ assertEquals("world", textView.getText().toString());
+ }
+
+ public void testStaticField() throws Throwable {
+ TextView textView = mBinder.getTextView8();
+ assertEquals("hello world", textView.getText().toString());
+ }
+
+ public void testImportStaticMethod() throws Throwable {
+ TextView textView = mBinder.getTextView9();
+ assertEquals("world", textView.getText().toString());
+ }
+
+ public void testImportStaticField() throws Throwable {
+ TextView textView = mBinder.getTextView10();
+ assertEquals("hello world", textView.getText().toString());
+ }
+
+ public void testAliasStaticMethod() throws Throwable {
+ TextView textView = mBinder.getTextView11();
+ assertEquals("world", textView.getText().toString());
+ }
+
+ public void testAliasStaticField() throws Throwable {
+ TextView textView = mBinder.getTextView12();
+ assertEquals("hello world", textView.getText().toString());
+ }
+
+ @UiThreadTest
+ public void testImports() throws Throwable {
+ mBinder.setObj2(new FindMethodBindingObject.Bar<String>());
+ mBinder.rebindDirty();
+ TextView textView = mBinder.getTextView15();
+ assertEquals("hello", textView.getText().toString());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/FrameLayoutBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/FrameLayoutBindingAdapterTest.java
new file mode 100644
index 0000000..4f1a013
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/FrameLayoutBindingAdapterTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.FrameLayoutAdapterTestBinder;
+import com.android.databinding.testapp.vo.FrameLayoutBindingObject;
+
+import android.os.Build;
+import android.widget.FrameLayout;
+
+public class FrameLayoutBindingAdapterTest
+ extends BindingAdapterTestBase<FrameLayoutAdapterTestBinder, FrameLayoutBindingObject> {
+
+ FrameLayout mView;
+
+ public FrameLayoutBindingAdapterTest() {
+ super(FrameLayoutAdapterTestBinder.class, FrameLayoutBindingObject.class,
+ R.layout.frame_layout_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testTint() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ assertEquals(mBindingObject.getForegroundTint(),
+ mView.getForegroundTintList().getDefaultColor());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getForegroundTint(),
+ mView.getForegroundTintList().getDefaultColor());
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ImageViewBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ImageViewBindingAdapterTest.java
new file mode 100644
index 0000000..1a23bc6
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ImageViewBindingAdapterTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.ImageViewAdapterTestBinder;
+import com.android.databinding.testapp.vo.ImageViewBindingObject;
+
+import android.widget.ImageView;
+
+public class ImageViewBindingAdapterTest
+ extends BindingAdapterTestBase<ImageViewAdapterTestBinder, ImageViewBindingObject> {
+
+ ImageView mView;
+
+ public ImageViewBindingAdapterTest() {
+ super(ImageViewAdapterTestBinder.class, ImageViewBindingObject.class,
+ R.layout.image_view_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testImageView() throws Throwable {
+ assertEquals(mBindingObject.getSrc(), mView.getDrawable());
+ assertEquals(mBindingObject.getTint(), mView.getImageTintList().getDefaultColor());
+ assertEquals(mBindingObject.getTintMode(), mView.getImageTintMode());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getSrc(), mView.getDrawable());
+ assertEquals(mBindingObject.getTint(), mView.getImageTintList().getDefaultColor());
+ assertEquals(mBindingObject.getTintMode(), mView.getImageTintMode());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/IncludeTagTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/IncludeTagTest.java
new file mode 100644
index 0000000..7cff11f
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/IncludeTagTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.LayoutWithIncludeBinder;
+import com.android.databinding.testapp.vo.NotBindableVo;
+
+import android.test.UiThreadTest;
+import android.widget.TextView;
+
+public class IncludeTagTest extends BaseDataBinderTest<LayoutWithIncludeBinder> {
+
+ public IncludeTagTest() {
+ super(LayoutWithIncludeBinder.class, R.layout.layout_with_include);
+ }
+
+ @UiThreadTest
+ public void testIncludeTag() {
+ NotBindableVo vo = new NotBindableVo(3, "a");
+ mBinder.setOuterObject(vo);
+ mBinder.rebindDirty();
+ final TextView outerText = (TextView) mBinder.getRoot().findViewById(R.id.outerTextView);
+ assertEquals("a", outerText.getText());
+ final TextView innerText = (TextView) mBinder.getRoot().findViewById(R.id.innerTextView);
+ assertEquals("modified 3a", innerText.getText().toString());
+
+ vo.setIntValue(5);
+ vo.setStringValue("b");
+ mBinder.invalidateAll();
+ mBinder.rebindDirty();
+ assertEquals("b", outerText.getText());
+ assertEquals("modified 5b", innerText.getText().toString());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/LandDataBinderTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/LandDataBinderTest.java
new file mode 100644
index 0000000..218c799
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/LandDataBinderTest.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+public class LandDataBinderTest {
+
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/LinearLayoutBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/LinearLayoutBindingAdapterTest.java
new file mode 100644
index 0000000..3b44841
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/LinearLayoutBindingAdapterTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.LinearLayoutAdapterTestBinder;
+import com.android.databinding.testapp.vo.LinearLayoutBindingObject;
+
+import android.os.Build;
+import android.widget.LinearLayout;
+
+public class LinearLayoutBindingAdapterTest
+ extends BindingAdapterTestBase<LinearLayoutAdapterTestBinder, LinearLayoutBindingObject> {
+
+ LinearLayout mView;
+
+ public LinearLayoutBindingAdapterTest() {
+ super(LinearLayoutAdapterTestBinder.class, LinearLayoutBindingObject.class,
+ R.layout.linear_layout_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testMeasureWithLargestChild() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(mBindingObject.isMeasureWithLargestChild(),
+ mView.isMeasureWithLargestChildEnabled());
+
+ changeValues();
+
+ assertEquals(mBindingObject.isMeasureWithLargestChild(),
+ mView.isMeasureWithLargestChildEnabled());
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ListChangeRegistryTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ListChangeRegistryTest.java
new file mode 100644
index 0000000..9a25082
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ListChangeRegistryTest.java
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.library.ListChangeRegistry;
+import com.android.databinding.testapp.generated.BasicBindingBinder;
+
+import android.binding.OnListChangedListener;
+
+public class ListChangeRegistryTest extends BaseDataBinderTest<BasicBindingBinder> {
+
+ private ListChangeRegistry mListChangeRegistry;
+
+ private int mCallCount;
+
+ public ListChangeRegistryTest() {
+ super(BasicBindingBinder.class, R.layout.basic_binding);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mListChangeRegistry = new ListChangeRegistry();
+ mCallCount = 0;
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ mListChangeRegistry = null;
+ }
+
+ public void testNotifyChangedAll() {
+ OnListChangedListener listChangedListener = new OnListChangedListener() {
+ @Override
+ public void onChanged() {
+ mCallCount++;
+ }
+
+ @Override
+ public void onItemRangeChanged(int start, int count) {
+ fail("onItemRangeChanged should not be called");
+ }
+
+ @Override
+ public void onItemRangeInserted(int start, int count) {
+ fail("onItemRangeInserted should not be called");
+ }
+
+ @Override
+ public void onItemRangeMoved(int from, int to, int count) {
+ fail("onItemRangeMoved should not be called");
+ }
+
+ @Override
+ public void onItemRangeRemoved(int start, int count) {
+ fail("onItemRangeRemoved should not be called");
+ }
+ };
+
+ mListChangeRegistry.add(listChangedListener);
+ assertEquals(0, mCallCount);
+ mListChangeRegistry.notifyChanged(null);
+ assertEquals(1, mCallCount);
+ }
+
+ public void testNotifyChanged() {
+ final int expectedStart = 10;
+ final int expectedCount = 3;
+
+ OnListChangedListener listChangedListener = new OnListChangedListener() {
+ @Override
+ public void onChanged() {
+ fail("onChanged should not be called");
+ }
+
+ @Override
+ public void onItemRangeChanged(int start, int count) {
+ assertEquals(expectedStart, start);
+ assertEquals(expectedCount, count);
+ mCallCount++;
+ }
+
+ @Override
+ public void onItemRangeInserted(int start, int count) {
+ fail("onItemRangeInserted should not be called");
+ }
+
+ @Override
+ public void onItemRangeMoved(int from, int to, int count) {
+ fail("onItemRangeMoved should not be called");
+ }
+
+ @Override
+ public void onItemRangeRemoved(int start, int count) {
+ fail("onItemRangeRemoved should not be called");
+ }
+ };
+
+ mListChangeRegistry.add(listChangedListener);
+ assertEquals(0, mCallCount);
+ mListChangeRegistry.notifyChanged(null, expectedStart, expectedCount);
+ assertEquals(1, mCallCount);
+ }
+
+ public void testNotifyInserted() {
+ final int expectedStart = 10;
+ final int expectedCount = 3;
+
+ OnListChangedListener listChangedListener = new OnListChangedListener() {
+ @Override
+ public void onChanged() {
+ fail("onChanged should not be called");
+ }
+
+ @Override
+ public void onItemRangeChanged(int start, int count) {
+ fail("onItemRangeChanged should not be called");
+ }
+
+ @Override
+ public void onItemRangeInserted(int start, int count) {
+ assertEquals(expectedStart, start);
+ assertEquals(expectedCount, count);
+ mCallCount++;
+ }
+
+ @Override
+ public void onItemRangeMoved(int from, int to, int count) {
+ fail("onItemRangeMoved should not be called");
+ }
+
+ @Override
+ public void onItemRangeRemoved(int start, int count) {
+ fail("onItemRangeRemoved should not be called");
+ }
+ };
+
+ mListChangeRegistry.add(listChangedListener);
+ assertEquals(0, mCallCount);
+ mListChangeRegistry.notifyInserted(null, expectedStart, expectedCount);
+ assertEquals(1, mCallCount);
+ }
+
+ public void testNotifyMoved() {
+ final int expectedFrom = 10;
+ final int expectedTo = 100;
+ final int expectedCount = 3;
+
+ OnListChangedListener listChangedListener = new OnListChangedListener() {
+ @Override
+ public void onChanged() {
+ fail("onChanged should not be called");
+ }
+
+ @Override
+ public void onItemRangeChanged(int start, int count) {
+ fail("onItemRangeChanged should not be called");
+ }
+
+ @Override
+ public void onItemRangeInserted(int start, int count) {
+ fail("onItemRangeInserted should not be called");
+ }
+
+ @Override
+ public void onItemRangeMoved(int from, int to, int count) {
+ assertEquals(expectedFrom, from);
+ assertEquals(expectedTo, to);
+ assertEquals(expectedCount, count);
+ mCallCount++;
+ }
+
+ @Override
+ public void onItemRangeRemoved(int start, int count) {
+ fail("onItemRangeRemoved should not be called");
+ }
+ };
+
+ mListChangeRegistry.add(listChangedListener);
+ assertEquals(0, mCallCount);
+ mListChangeRegistry.notifyMoved(null, expectedFrom, expectedTo, expectedCount);
+ assertEquals(1, mCallCount);
+ }
+
+ public void testNotifyRemoved() {
+ final int expectedStart = 10;
+ final int expectedCount = 3;
+
+ OnListChangedListener listChangedListener = new OnListChangedListener() {
+ @Override
+ public void onChanged() {
+ fail("onChanged should not be called");
+ }
+
+ @Override
+ public void onItemRangeChanged(int start, int count) {
+ fail("onItemRangeChanged should not be called");
+ }
+
+ @Override
+ public void onItemRangeInserted(int start, int count) {
+ fail("onItemRangeInserted should not be called");
+ }
+
+ @Override
+ public void onItemRangeMoved(int from, int to, int count) {
+ fail("onItemRangeMoved should not be called");
+ }
+
+ @Override
+ public void onItemRangeRemoved(int start, int count) {
+ assertEquals(expectedStart, start);
+ assertEquals(expectedCount, count);
+ mCallCount++;
+ }
+ };
+
+ mListChangeRegistry.add(listChangedListener);
+ assertEquals(0, mCallCount);
+ mListChangeRegistry.notifyRemoved(null, expectedStart, expectedCount);
+ assertEquals(1, mCallCount);
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/MapChangeRegistryTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/MapChangeRegistryTest.java
new file mode 100644
index 0000000..1db9f51
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/MapChangeRegistryTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.library.MapChangeRegistry;
+import com.android.databinding.library.ObservableArrayMap;
+import com.android.databinding.testapp.generated.BasicBindingBinder;
+
+import android.binding.ObservableMap;
+import android.binding.OnMapChangedListener;
+
+public class MapChangeRegistryTest extends BaseDataBinderTest<BasicBindingBinder> {
+
+ private int notificationCount = 0;
+
+ public MapChangeRegistryTest() {
+ super(BasicBindingBinder.class, R.layout.basic_binding);
+ }
+
+ public void testNotifyAllChanged() {
+ MapChangeRegistry mapChangeRegistry = new MapChangeRegistry();
+
+ final ObservableMap<String, Integer> observableObj = new ObservableArrayMap<>();
+
+ final String expectedKey = "key";
+ OnMapChangedListener listener = new OnMapChangedListener<ObservableMap<String, Integer>, String>() {
+ @Override
+ public void onMapChanged(ObservableMap sender, String key) {
+ notificationCount++;
+ assertEquals(observableObj, sender);
+ assertEquals(key, expectedKey);
+ }
+ };
+ mapChangeRegistry.add(listener);
+
+ assertEquals(0, notificationCount);
+ mapChangeRegistry.notifyChange(observableObj, expectedKey);
+ assertEquals(1, notificationCount);
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/NewApiTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/NewApiTest.java
new file mode 100644
index 0000000..9b28237
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/NewApiTest.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.library.DataBinderTrojan;
+import com.android.databinding.testapp.generated.NewApiLayoutBinder;
+
+import android.content.Context;
+import android.os.Build;
+import android.test.UiThreadTest;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+
+public class NewApiTest extends BaseDataBinderTest<NewApiLayoutBinder> {
+ public NewApiTest() {
+ super(NewApiLayoutBinder.class, R.layout.new_api_layout);
+ }
+
+ @UiThreadTest
+ public void testSetElevation() {
+ mBinder.setElevation(3);
+ mBinder.setName("foo");
+ mBinder.setChildren(new ArrayList<View>());
+ mBinder.rebindDirty();
+ assertEquals("foo", mBinder.getTextView().getText().toString());
+ assertEquals(3f, mBinder.getTextView().getElevation());
+ }
+
+ @UiThreadTest
+ public void testSetElevationOlderAPI() {
+ DataBinderTrojan.setBuildSdkInt(1);
+ try {
+ TextView textView = mBinder.getTextView();
+ float originalElevation = textView.getElevation();
+ mBinder.setElevation(3);
+ mBinder.setName("foo2");
+ mBinder.rebindDirty();
+ assertEquals("foo2", textView.getText().toString());
+ assertEquals(originalElevation, textView.getElevation());
+ } finally {
+ DataBinderTrojan.setBuildSdkInt(Build.VERSION.SDK_INT);
+ }
+ }
+
+ @UiThreadTest
+ public void testGeneric() {
+ ArrayList<View> views = new ArrayList<>();
+ mBinder.setChildren(views);
+ mBinder.rebindDirty();
+ assertEquals(1, views.size());
+ assertSame(mBinder.getTextView(), views.get(0));
+ }
+
+ @UiThreadTest
+ public void testGenericOlderApi() {
+ DataBinderTrojan.setBuildSdkInt(1);
+ try {
+ ArrayList<View> views = new ArrayList<>();
+ mBinder.setChildren(views);
+ mBinder.rebindDirty();
+ // we should not call the api on older platforms.
+ assertEquals(0, views.size());
+ } finally {
+ DataBinderTrojan.setBuildSdkInt(Build.VERSION.SDK_INT);
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/NoIdTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/NoIdTest.java
new file mode 100644
index 0000000..93ed941
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/NoIdTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.NoIdTestBinder;
+
+import android.test.UiThreadTest;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+public class NoIdTest extends BaseDataBinderTest<NoIdTestBinder> {
+ public NoIdTest() {
+ super(NoIdTestBinder.class, R.layout.no_id_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ try {
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mBinder.setName("hello");
+ mBinder.setOrientation(LinearLayout.VERTICAL);
+ mBinder.rebindDirty();
+ }
+ });
+ } catch (Throwable throwable) {
+ throw new Exception(throwable);
+ }
+ }
+
+ @UiThreadTest
+ public void testOnRoot() {
+ LinearLayout linearLayout = (LinearLayout) mBinder.getRoot();
+ assertEquals(LinearLayout.VERTICAL, linearLayout.getOrientation());
+ mBinder.setOrientation(LinearLayout.HORIZONTAL);
+ mBinder.rebindDirty();
+ assertEquals(LinearLayout.HORIZONTAL, linearLayout.getOrientation());
+ }
+
+ @UiThreadTest
+ public void testNormal() {
+ LinearLayout linearLayout = (LinearLayout) mBinder.getRoot();
+ TextView view = (TextView) linearLayout.getChildAt(0);
+ assertEquals("hello world", view.getTag());
+ assertEquals("hello", view.getText().toString());
+ mBinder.setName("world");
+ mBinder.rebindDirty();
+ assertEquals("world", view.getText().toString());
+ }
+
+ @UiThreadTest
+ public void testNoTag() {
+ LinearLayout linearLayout = (LinearLayout) mBinder.getRoot();
+ TextView view = (TextView) linearLayout.getChildAt(1);
+ assertNull(view.getTag());
+ }
+
+ @UiThreadTest
+ public void testResourceTag() {
+ LinearLayout linearLayout = (LinearLayout) mBinder.getRoot();
+ TextView view = (TextView) linearLayout.getChildAt(2);
+ String expectedValue = view.getResources().getString(R.string.app_name);
+ assertEquals(expectedValue, view.getTag());
+ }
+
+ @UiThreadTest
+ public void testAndroidResourceTag() {
+ LinearLayout linearLayout = (LinearLayout) mBinder.getRoot();
+ TextView view = (TextView) linearLayout.getChildAt(3);
+ String expectedValue = view.getResources().getString(android.R.string.ok);
+ assertEquals(expectedValue, view.getTag());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableArrayListTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableArrayListTest.java
new file mode 100644
index 0000000..a8d2f00
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableArrayListTest.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.library.ObservableArrayList;
+import com.android.databinding.testapp.generated.BasicBindingBinder;
+
+import android.binding.ObservableList;
+import android.binding.OnListChangedListener;
+
+import java.util.ArrayList;
+
+public class ObservableArrayListTest extends BaseDataBinderTest<BasicBindingBinder> {
+
+ private static final int ALL = 0;
+
+ private static final int CHANGE = 1;
+
+ private static final int INSERT = 2;
+
+ private static final int MOVE = 3;
+
+ private static final int REMOVE = 4;
+
+ private ObservableList<String> mObservable;
+
+ private ArrayList<ListChange> mNotifications = new ArrayList<>();
+
+ private OnListChangedListener mListener = new OnListChangedListener() {
+ @Override
+ public void onChanged() {
+ mNotifications.add(new ListChange(ALL, 0, 0));
+ }
+
+ @Override
+ public void onItemRangeChanged(int start, int count) {
+ mNotifications.add(new ListChange(CHANGE, start, count));
+ }
+
+ @Override
+ public void onItemRangeInserted(int start, int count) {
+ mNotifications.add(new ListChange(INSERT, start, count));
+ }
+
+ @Override
+ public void onItemRangeMoved(int from, int to, int count) {
+ mNotifications.add(new ListChange(MOVE, from, to, count));
+ }
+
+ @Override
+ public void onItemRangeRemoved(int start, int count) {
+ mNotifications.add(new ListChange(REMOVE, start, count));
+ }
+ };
+
+ private static class ListChange {
+
+ public ListChange(int change, int start, int count) {
+ this.start = start;
+ this.count = count;
+ this.from = 0;
+ this.to = 0;
+ this.change = change;
+ }
+
+ public ListChange(int change, int from, int to, int count) {
+ this.from = from;
+ this.to = to;
+ this.count = count;
+ this.start = 0;
+ this.change = change;
+ }
+
+ public final int start;
+
+ public final int count;
+
+ public final int from;
+
+ public final int to;
+
+ public final int change;
+ }
+
+ public ObservableArrayListTest() {
+ super(BasicBindingBinder.class, R.layout.basic_binding);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ mNotifications.clear();
+ mObservable = new ObservableArrayList<>();
+ }
+
+ public void testAddListener() {
+ mObservable.add("Hello");
+ assertTrue(mNotifications.isEmpty());
+ mObservable.addOnListChangedListener(mListener);
+ mObservable.add("World");
+ assertFalse(mNotifications.isEmpty());
+ }
+
+ public void testRemoveListener() {
+ // test there is no exception when the listener isn't there
+ mObservable.removeOnListChangedListener(mListener);
+
+ mObservable.addOnListChangedListener(mListener);
+ mObservable.add("Hello");
+ mNotifications.clear();
+ mObservable.removeOnListChangedListener(mListener);
+ mObservable.add("World");
+ assertTrue(mNotifications.isEmpty());
+
+ // test there is no exception when the listener isn't there
+ mObservable.removeOnListChangedListener(mListener);
+ }
+
+ public void testAdd() {
+ mObservable.addOnListChangedListener(mListener);
+ mObservable.add("Hello");
+ assertEquals(1, mNotifications.size());
+ ListChange change = mNotifications.get(0);
+ assertEquals(INSERT, change.change);
+ assertEquals(0, change.start);
+ assertEquals(1, change.count);
+ assertEquals("Hello", mObservable.get(0));
+ }
+
+ public void testInsert() {
+ mObservable.addOnListChangedListener(mListener);
+ mObservable.add("Hello");
+ mObservable.add(0, "World");
+ mObservable.add(1, "Dang");
+ mObservable.add(3, "End");
+ assertEquals(4, mObservable.size());
+ assertEquals("World", mObservable.get(0));
+ assertEquals("Dang", mObservable.get(1));
+ assertEquals("Hello", mObservable.get(2));
+ assertEquals("End", mObservable.get(3));
+ assertEquals(4, mNotifications.size());
+ ListChange change = mNotifications.get(1);
+ assertEquals(INSERT, change.change);
+ assertEquals(0, change.start);
+ assertEquals(1, change.count);
+ }
+
+ public void testAddAll() {
+ ArrayList<String> toAdd = new ArrayList<>();
+ toAdd.add("Hello");
+ toAdd.add("World");
+ mObservable.add("First");
+ mObservable.addOnListChangedListener(mListener);
+ mObservable.addAll(toAdd);
+ assertEquals(3, mObservable.size());
+ assertEquals("Hello", mObservable.get(1));
+ assertEquals("World", mObservable.get(2));
+ assertEquals(1, mNotifications.size());
+ ListChange change = mNotifications.get(0);
+ assertEquals(INSERT, change.change);
+ assertEquals(1, change.start);
+ assertEquals(2, change.count);
+ }
+
+ public void testInsertAll() {
+ ArrayList<String> toAdd = new ArrayList<>();
+ toAdd.add("Hello");
+ toAdd.add("World");
+ mObservable.add("First");
+ mObservable.addOnListChangedListener(mListener);
+ mObservable.addAll(0, toAdd);
+ assertEquals(3, mObservable.size());
+ assertEquals("Hello", mObservable.get(0));
+ assertEquals("World", mObservable.get(1));
+ assertEquals(1, mNotifications.size());
+ ListChange change = mNotifications.get(0);
+ assertEquals(INSERT, change.change);
+ assertEquals(0, change.start);
+ assertEquals(2, change.count);
+ }
+
+ public void testClear() {
+ mObservable.add("Hello");
+ mObservable.add("World");
+ mObservable.addOnListChangedListener(mListener);
+ mObservable.clear();
+ assertEquals(1, mNotifications.size());
+ ListChange change = mNotifications.get(0);
+ assertEquals(REMOVE, change.change);
+ assertEquals(0, change.start);
+ assertEquals(2, change.count);
+
+ mObservable.clear();
+ // No notification when nothing is cleared.
+ assertEquals(1, mNotifications.size());
+ }
+
+ public void testRemoveIndex() {
+ mObservable.add("Hello");
+ mObservable.add("World");
+ mObservable.addOnListChangedListener(mListener);
+ assertEquals("Hello", mObservable.remove(0));
+ assertEquals(1, mNotifications.size());
+ ListChange change = mNotifications.get(0);
+ assertEquals(REMOVE, change.change);
+ assertEquals(0, change.start);
+ assertEquals(1, change.count);
+ }
+
+ public void testRemoveObject() {
+ mObservable.add("Hello");
+ mObservable.add("World");
+ mObservable.addOnListChangedListener(mListener);
+ assertTrue(mObservable.remove("Hello"));
+ assertEquals(1, mNotifications.size());
+ ListChange change = mNotifications.get(0);
+ assertEquals(REMOVE, change.change);
+ assertEquals(0, change.start);
+ assertEquals(1, change.count);
+
+ assertFalse(mObservable.remove("Hello"));
+ // nothing removed, don't notify
+ assertEquals(1, mNotifications.size());
+ }
+
+ public void testSet() {
+ mObservable.add("Hello");
+ mObservable.add("World");
+ mObservable.addOnListChangedListener(mListener);
+ assertEquals("Hello", mObservable.set(0, "Goodbye"));
+ assertEquals("Goodbye", mObservable.get(0));
+ assertEquals(2, mObservable.size());
+ ListChange change = mNotifications.get(0);
+ assertEquals(CHANGE, change.change);
+ assertEquals(0, change.start);
+ assertEquals(1, change.count);
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableArrayMapTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableArrayMapTest.java
new file mode 100644
index 0000000..e793a02
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableArrayMapTest.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.library.ObservableArrayMap;
+import com.android.databinding.testapp.generated.BasicBindingBinder;
+
+import android.binding.ObservableMap;
+import android.binding.OnMapChangedListener;
+import android.support.v4.util.ArrayMap;
+import android.support.v4.util.SimpleArrayMap;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+public class ObservableArrayMapTest extends BaseDataBinderTest<BasicBindingBinder> {
+
+ private ObservableArrayMap<String, String> mObservable;
+
+ private ArrayList<String> mNotifications = new ArrayList<>();
+
+ private OnMapChangedListener mListener = new OnMapChangedListener() {
+ @Override
+ public void onMapChanged(ObservableMap observableMap, Object o) {
+ assertEquals(mObservable, observableMap);
+ mNotifications.add((String) o);
+ }
+ };
+
+ public ObservableArrayMapTest() {
+ super(BasicBindingBinder.class, R.layout.basic_binding);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ mNotifications.clear();
+ mObservable = new ObservableArrayMap<>();
+ }
+
+ public void testAddListener() {
+ mObservable.put("Hello", "World");
+ assertTrue(mNotifications.isEmpty());
+ mObservable.addOnMapChangedListener(mListener);
+ mObservable.put("Hello", "Goodbye");
+ assertFalse(mNotifications.isEmpty());
+ }
+
+ public void testRemoveListener() {
+ // test there is no exception when the listener isn't there
+ mObservable.removeOnMapChangedListener(mListener);
+
+ mObservable.addOnMapChangedListener(mListener);
+ mObservable.put("Hello", "World");
+ mNotifications.clear();
+ mObservable.removeOnMapChangedListener(mListener);
+ mObservable.put("World", "Hello");
+ assertTrue(mNotifications.isEmpty());
+
+ // test there is no exception when the listener isn't there
+ mObservable.removeOnMapChangedListener(mListener);
+ }
+
+ public void testClear() {
+ mObservable.put("Hello", "World");
+ mObservable.put("World", "Hello");
+ mObservable.addOnMapChangedListener(mListener);
+ mObservable.clear();
+ assertEquals(1, mNotifications.size());
+ assertNull(mNotifications.get(0));
+ assertEquals(0, mObservable.size());
+ assertTrue(mObservable.isEmpty());
+
+ mObservable.clear();
+ // No notification when nothing is cleared.
+ assertEquals(1, mNotifications.size());
+ }
+
+ public void testPut() {
+ mObservable.addOnMapChangedListener(mListener);
+ mObservable.put("Hello", "World");
+ assertEquals(1, mNotifications.size());
+ assertEquals("Hello", mNotifications.get(0));
+ assertEquals("World", mObservable.get("Hello"));
+
+ mObservable.put("Hello", "World2");
+ assertEquals(2, mNotifications.size());
+ assertEquals("Hello", mNotifications.get(1));
+ assertEquals("World2", mObservable.get("Hello"));
+
+ mObservable.put("World", "Hello");
+ assertEquals(3, mNotifications.size());
+ assertEquals("World", mNotifications.get(2));
+ assertEquals("Hello", mObservable.get("World"));
+ }
+
+ public void testPutAll() {
+ Map<String, String> toAdd = new ArrayMap<>();
+ toAdd.put("Hello", "World");
+ toAdd.put("Goodbye", "Cruel World");
+ mObservable.put("Cruel", "World");
+ mObservable.addOnMapChangedListener(mListener);
+ mObservable.putAll(toAdd);
+ assertEquals(3, mObservable.size());
+ assertEquals("World", mObservable.get("Hello"));
+ assertEquals("Cruel World", mObservable.get("Goodbye"));
+ assertEquals(2, mNotifications.size());
+ // order is not guaranteed
+ assertTrue(mNotifications.contains("Hello"));
+ assertTrue(mNotifications.contains("Goodbye"));
+ }
+
+ public void testPutAllSimpleArrayMap() {
+ SimpleArrayMap<String, String> toAdd = new ArrayMap<>();
+ toAdd.put("Hello", "World");
+ toAdd.put("Goodbye", "Cruel World");
+ mObservable.put("Cruel", "World");
+ mObservable.addOnMapChangedListener(mListener);
+ mObservable.putAll(toAdd);
+ assertEquals(3, mObservable.size());
+ assertEquals("World", mObservable.get("Hello"));
+ assertEquals("Cruel World", mObservable.get("Goodbye"));
+ assertEquals(2, mNotifications.size());
+ // order is not guaranteed
+ assertTrue(mNotifications.contains("Hello"));
+ assertTrue(mNotifications.contains("Goodbye"));
+ }
+
+ public void testRemove() {
+ mObservable.put("Hello", "World");
+ mObservable.put("Goodbye", "Cruel World");
+ mObservable.addOnMapChangedListener(mListener);
+ assertEquals("World", mObservable.remove("Hello"));
+ assertEquals(1, mNotifications.size());
+ assertEquals("Hello", mNotifications.get(0));
+
+ assertNull(mObservable.remove("Hello"));
+ // nothing removed, don't notify
+ assertEquals(1, mNotifications.size());
+ }
+
+ public void testRemoveAll() {
+ ArrayList<String> toRemove = new ArrayList<>();
+ toRemove.add("Hello");
+ toRemove.add("Goodbye");
+ mObservable.put("Hello", "World");
+ mObservable.put("Goodbye", "Cruel World");
+ mObservable.put("Cruel", "World");
+ mObservable.addOnMapChangedListener(mListener);
+ assertTrue(mObservable.removeAll(toRemove));
+ assertEquals(2, mNotifications.size());
+ // order is not guaranteed
+ assertTrue(mNotifications.contains("Hello"));
+ assertTrue(mNotifications.contains("Goodbye"));
+
+ assertTrue(mObservable.containsKey("Cruel"));
+
+ // Test nothing removed
+ assertFalse(mObservable.removeAll(toRemove));
+ assertEquals(2, mNotifications.size());
+ }
+
+ public void testRetainAll() {
+ ArrayList<String> toRetain = new ArrayList<>();
+ toRetain.add("Hello");
+ toRetain.add("Goodbye");
+ mObservable.put("Hello", "World");
+ mObservable.put("Goodbye", "Cruel World");
+ mObservable.put("Cruel", "World");
+ mObservable.addOnMapChangedListener(mListener);
+ assertTrue(mObservable.retainAll(toRetain));
+ assertEquals(1, mNotifications.size());
+ assertEquals("Cruel", mNotifications.get(0));
+ assertTrue(mObservable.containsKey("Hello"));
+ assertTrue(mObservable.containsKey("Goodbye"));
+
+ // Test nothing removed
+ assertFalse(mObservable.retainAll(toRetain));
+ assertEquals(1, mNotifications.size());
+ }
+
+ public void testRemoveAt() {
+ mObservable.put("Hello", "World");
+ mObservable.put("Goodbye", "Cruel World");
+ mObservable.addOnMapChangedListener(mListener);
+ String key = mObservable.keyAt(0);
+ String value = mObservable.valueAt(0);
+ assertTrue("Hello".equals(key) || "Goodbye".equals(key));
+ assertEquals(value, mObservable.removeAt(0));
+ assertEquals(1, mNotifications.size());
+ assertEquals(key, mNotifications.get(0));
+ }
+
+ public void testSetValueAt() {
+ mObservable.put("Hello", "World");
+ mObservable.addOnMapChangedListener(mListener);
+ assertEquals("World", mObservable.setValueAt(0, "Cruel World"));
+ assertEquals(1, mNotifications.size());
+ assertEquals("Hello", mNotifications.get(0));
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableFieldTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableFieldTest.java
new file mode 100644
index 0000000..5529696
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableFieldTest.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.ObservableFieldTestBinder;
+import com.android.databinding.testapp.vo.ObservableFieldBindingObject;
+
+import android.test.UiThreadTest;
+import android.widget.TextView;
+
+public class ObservableFieldTest extends BaseDataBinderTest<ObservableFieldTestBinder> {
+ private ObservableFieldBindingObject mObj;
+
+ public ObservableFieldTest() {
+ super(ObservableFieldTestBinder.class, R.layout.observable_field_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ try {
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mObj = new ObservableFieldBindingObject();
+ mBinder.setObj(mObj);
+ mBinder.rebindDirty();
+ }
+ });
+ } catch (Throwable throwable) {
+ throw new Exception(throwable);
+ }
+ }
+
+ @UiThreadTest
+ public void testBoolean() {
+ TextView view = mBinder.getBField();
+ assertEquals("false", view.getText());
+
+ mObj.bField.set(true);
+ mBinder.rebindDirty();
+
+ assertEquals("true", view.getText());
+ }
+
+ @UiThreadTest
+ public void testByte() {
+ TextView view = mBinder.getTField();
+ assertEquals("0", view.getText());
+
+ mObj.tField.set((byte) 1);
+ mBinder.rebindDirty();
+
+ assertEquals("1", view.getText());
+ }
+
+ @UiThreadTest
+ public void testShort() {
+ TextView view = mBinder.getSField();
+ assertEquals("0", view.getText());
+
+ mObj.sField.set((short) 1);
+ mBinder.rebindDirty();
+
+ assertEquals("1", view.getText());
+ }
+
+ @UiThreadTest
+ public void testChar() {
+ TextView view = mBinder.getCField();
+ assertEquals("\u0000", view.getText());
+
+ mObj.cField.set('A');
+ mBinder.rebindDirty();
+
+ assertEquals("A", view.getText());
+ }
+
+ @UiThreadTest
+ public void testInt() {
+ TextView view = mBinder.getIField();
+ assertEquals("0", view.getText());
+
+ mObj.iField.set(1);
+ mBinder.rebindDirty();
+
+ assertEquals("1", view.getText());
+ }
+
+ @UiThreadTest
+ public void testLong() {
+ TextView view = mBinder.getLField();
+ assertEquals("0", view.getText());
+
+ mObj.lField.set(1);
+ mBinder.rebindDirty();
+
+ assertEquals("1", view.getText());
+ }
+
+ @UiThreadTest
+ public void testFloat() {
+ TextView view = mBinder.getFField();
+ assertEquals("0.0", view.getText());
+
+ mObj.fField.set(1);
+ mBinder.rebindDirty();
+
+ assertEquals("1.0", view.getText());
+ }
+
+ @UiThreadTest
+ public void testDouble() {
+ TextView view = mBinder.getDField();
+ assertEquals("0.0", view.getText());
+
+ mObj.dField.set(1);
+ mBinder.rebindDirty();
+
+ assertEquals("1.0", view.getText());
+ }
+
+ @UiThreadTest
+ public void testObject() {
+ TextView view = mBinder.getOField();
+ assertEquals("Hello", view.getText());
+
+ mObj.oField.set("World");
+ mBinder.rebindDirty();
+
+ assertEquals("World", view.getText());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableWithNotBindableFieldObjectTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableWithNotBindableFieldObjectTest.java
new file mode 100644
index 0000000..2a8c377
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ObservableWithNotBindableFieldObjectTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.BaseDataBinderTest;
+import com.android.databinding.testapp.R;
+import com.android.databinding.testapp.generated.ObservableWithNotBindableFieldBinder;
+import com.android.databinding.testapp.vo.ObservableWithNotBindableFieldObject;
+
+import android.test.UiThreadTest;
+
+public class ObservableWithNotBindableFieldObjectTest extends BaseDataBinderTest<ObservableWithNotBindableFieldBinder> {
+
+
+ public ObservableWithNotBindableFieldObjectTest() {
+ super(ObservableWithNotBindableFieldBinder.class, R.layout.observable_with_not_bindable_field);
+ }
+
+ @UiThreadTest
+ public void testSimple() {
+ ObservableWithNotBindableFieldObject obj = new ObservableWithNotBindableFieldObject();
+ mBinder.setObj(obj);
+ mBinder.rebindDirty();
+ assertEquals("", mBinder.getTextView().getText().toString());
+ obj.update("100");
+ mBinder.rebindDirty();
+ assertEquals("100", mBinder.getTextView().getText().toString());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ProcessBindableTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ProcessBindableTest.java
new file mode 100644
index 0000000..e7f430e
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ProcessBindableTest.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.library.PropertyChangeRegistry;
+import com.android.databinding.testapp.generated.BasicBindingBinder;
+
+import android.binding.Observable;
+import android.binding.OnPropertyChangedListener;
+import android.util.ArrayMap;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashSet;
+
+public class ProcessBindableTest extends BaseDataBinderTest<BasicBindingBinder> {
+ private static String[] EXPECTED_BINDING_NAMES = {
+ "bindableField1",
+ "bindableField2",
+ "bindableField3",
+ "bindableField4",
+ "mbindableField5",
+ "bindableField6",
+ "bindableField7",
+ "bindableField8",
+ };
+
+ public ProcessBindableTest() {
+ super(BasicBindingBinder.class, R.layout.basic_binding);
+ }
+
+ public void testFieldsGenerated() throws IllegalAccessException {
+ Field[] fields = android.binding.BR.class.getFields();
+
+ ArrayMap<String, Integer> fieldValues = new ArrayMap<>();
+ int modifiers = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL;
+ for (Field field: fields) {
+ assertTrue(field.getModifiers() == modifiers);
+ String name = field.getName();
+ fieldValues.put(name, field.getInt(null));
+ }
+
+ assertTrue(fieldValues.containsKey("_all"));
+ assertEquals(0, (int) fieldValues.get("_all"));
+ HashSet<Integer> values = new HashSet<>();
+ values.add(0);
+
+ for (String fieldName : EXPECTED_BINDING_NAMES) {
+ assertTrue("missing field: " + fieldName, fieldValues.containsKey(fieldName));
+ assertFalse(values.contains(fieldValues.get(fieldName)));
+ values.add(fieldValues.get(fieldName));
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ProgressBarBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ProgressBarBindingAdapterTest.java
new file mode 100644
index 0000000..86726b7
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ProgressBarBindingAdapterTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.ProgressBarAdapterTestBinder;
+import com.android.databinding.testapp.vo.ProgressBarBindingObject;
+
+import android.os.Build;
+import android.widget.ProgressBar;
+
+public class ProgressBarBindingAdapterTest
+ extends BindingAdapterTestBase<ProgressBarAdapterTestBinder, ProgressBarBindingObject> {
+
+ ProgressBar mView;
+
+ public ProgressBarBindingAdapterTest() {
+ super(ProgressBarAdapterTestBinder.class, ProgressBarBindingObject.class,
+ R.layout.progress_bar_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testTint() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ assertEquals(mBindingObject.getIndeterminateTint(),
+ mView.getIndeterminateTintList().getDefaultColor());
+ assertEquals(mBindingObject.getProgressTint(),
+ mView.getProgressTintList().getDefaultColor());
+ assertEquals(mBindingObject.getSecondaryProgressTint(),
+ mView.getSecondaryProgressTintList().getDefaultColor());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getIndeterminateTint(),
+ mView.getIndeterminateTintList().getDefaultColor());
+ assertEquals(mBindingObject.getProgressTint(),
+ mView.getProgressTintList().getDefaultColor());
+ assertEquals(mBindingObject.getSecondaryProgressTint(),
+ mView.getSecondaryProgressTintList().getDefaultColor());
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/PropertyChangeRegistryTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/PropertyChangeRegistryTest.java
new file mode 100644
index 0000000..7b6197c
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/PropertyChangeRegistryTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.library.PropertyChangeRegistry;
+import com.android.databinding.testapp.generated.BasicBindingBinder;
+
+import android.binding.Observable;
+import android.binding.OnPropertyChangedListener;
+
+public class PropertyChangeRegistryTest extends BaseDataBinderTest<BasicBindingBinder> {
+
+ private int notificationCount = 0;
+
+ public PropertyChangeRegistryTest() {
+ super(BasicBindingBinder.class, R.layout.basic_binding);
+ }
+
+ public void testNotifyChanged() {
+ PropertyChangeRegistry propertyChangeRegistry = new PropertyChangeRegistry();
+
+ final Observable observableObj = new Observable() {
+ @Override
+ public void addOnPropertyChangedListener(
+ OnPropertyChangedListener onPropertyChangedListener) {
+ }
+
+ @Override
+ public void removeOnPropertyChangedListener(
+ OnPropertyChangedListener onPropertyChangedListener) {
+ }
+ };
+
+ final int expectedId = 100;
+ OnPropertyChangedListener listener = new OnPropertyChangedListener() {
+ @Override
+ public void onPropertyChanged(Observable observable, int id) {
+ notificationCount++;
+ assertEquals(expectedId, id);
+ assertEquals(observableObj, observable);
+ }
+ };
+ propertyChangeRegistry.add(listener);
+
+ assertEquals(0, notificationCount);
+ propertyChangeRegistry.notifyChange(observableObj, expectedId);
+ assertEquals(1, notificationCount);
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/RadioGroupBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/RadioGroupBindingAdapterTest.java
new file mode 100644
index 0000000..c4bbc4c
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/RadioGroupBindingAdapterTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.RadioGroupAdapterTestBinder;
+import com.android.databinding.testapp.vo.RadioGroupBindingObject;
+
+import android.widget.RadioGroup;
+
+public class RadioGroupBindingAdapterTest
+ extends BindingAdapterTestBase<RadioGroupAdapterTestBinder, RadioGroupBindingObject> {
+
+ RadioGroup mView;
+
+ public RadioGroupBindingAdapterTest() {
+ super(RadioGroupAdapterTestBinder.class, RadioGroupBindingObject.class,
+ R.layout.radio_group_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testRadioGroup() throws Throwable {
+ assertEquals(mBindingObject.getCheckedButton(), mView.getCheckedRadioButtonId());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getCheckedButton(), mView.getCheckedRadioButtonId());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ResourceTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ResourceTest.java
new file mode 100644
index 0000000..2770c46
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ResourceTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.ResourceTestBinder;
+
+import android.test.UiThreadTest;
+import android.widget.TextView;
+
+public class ResourceTest extends BaseDataBinderTest<ResourceTestBinder> {
+
+ public ResourceTest() {
+ super(ResourceTestBinder.class, R.layout.resource_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mBinder.setCount(0);
+ mBinder.setTitle("Mrs.");
+ mBinder.setLastName("Doubtfire");
+ mBinder.setBase(2);
+ mBinder.setPbase(3);
+ try {
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mBinder.rebindDirty();
+ }
+ });
+ } catch (Throwable throwable) {
+ throw new Exception(throwable);
+ }
+ }
+
+ @UiThreadTest
+ public void testStringFormat() throws Throwable {
+ TextView view = mBinder.getTextView0();
+ assertEquals("Mrs. Doubtfire", view.getText().toString());
+
+ mBinder.setTitle("Mr.");
+ mBinder.rebindDirty();
+ assertEquals("Mr. Doubtfire", view.getText().toString());
+ }
+
+ @UiThreadTest
+ public void testQuantityString() throws Throwable {
+ TextView view = mBinder.getTextView1();
+ assertEquals("oranges", view.getText().toString());
+
+ mBinder.setCount(1);
+ mBinder.rebindDirty();
+ assertEquals("orange", view.getText().toString());
+ }
+
+ @UiThreadTest
+ public void testFractionNoParameters() throws Throwable {
+ TextView view = mBinder.getFractionNoParameters();
+ assertEquals("1.5", view.getText().toString());
+ }
+
+ @UiThreadTest
+ public void testFractionOneParameter() throws Throwable {
+ TextView view = mBinder.getFractionOneParameter();
+ assertEquals("3.0", view.getText().toString());
+ }
+
+ @UiThreadTest
+ public void testFractionTwoParameters() throws Throwable {
+ TextView view = mBinder.getFractionTwoParameters();
+ assertEquals("9.0", view.getText().toString());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/SpinnerBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/SpinnerBindingAdapterTest.java
new file mode 100644
index 0000000..50727b0
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/SpinnerBindingAdapterTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.SpinnerAdapterTestBinder;
+import com.android.databinding.testapp.vo.SpinnerBindingObject;
+
+import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
+import android.widget.Spinner;
+
+public class SpinnerBindingAdapterTest
+ extends BindingAdapterTestBase<SpinnerAdapterTestBinder, SpinnerBindingObject> {
+
+ Spinner mView;
+
+ public SpinnerBindingAdapterTest() {
+ super(SpinnerAdapterTestBinder.class, SpinnerBindingObject.class,
+ R.layout.spinner_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testSpinner() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ assertEquals(mBindingObject.getPopupBackground(),
+ ((ColorDrawable) mView.getPopupBackground()).getColor());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getPopupBackground(),
+ ((ColorDrawable) mView.getPopupBackground()).getColor());
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/SwitchBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/SwitchBindingAdapterTest.java
new file mode 100644
index 0000000..2d136a6
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/SwitchBindingAdapterTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.SwitchAdapterTestBinder;
+import com.android.databinding.testapp.vo.SwitchBindingObject;
+
+import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
+import android.widget.Switch;
+
+public class SwitchBindingAdapterTest
+ extends BindingAdapterTestBase<SwitchAdapterTestBinder, SwitchBindingObject> {
+
+ Switch mView;
+
+ public SwitchBindingAdapterTest() {
+ super(SwitchAdapterTestBinder.class, SwitchBindingObject.class,
+ R.layout.switch_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testSwitch() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ assertEquals(mBindingObject.getThumb(),
+ ((ColorDrawable) mView.getThumbDrawable()).getColor());
+ assertEquals(mBindingObject.getTrack(),
+ ((ColorDrawable) mView.getTrackDrawable()).getColor());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getThumb(),
+ ((ColorDrawable) mView.getThumbDrawable()).getColor());
+ assertEquals(mBindingObject.getTrack(),
+ ((ColorDrawable) mView.getTrackDrawable()).getColor());
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TabWidgetBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TabWidgetBindingAdapterTest.java
new file mode 100644
index 0000000..af0a74e
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TabWidgetBindingAdapterTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.TabWidgetAdapterTestBinder;
+import com.android.databinding.testapp.vo.TabWidgetBindingObject;
+
+import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
+import android.widget.TabWidget;
+
+public class TabWidgetBindingAdapterTest
+ extends BindingAdapterTestBase<TabWidgetAdapterTestBinder, TabWidgetBindingObject> {
+
+ TabWidget mView;
+
+ public TabWidgetBindingAdapterTest() {
+ super(TabWidgetAdapterTestBinder.class, TabWidgetBindingObject.class,
+ R.layout.tab_widget_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testStrip() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ assertEquals(mBindingObject.getDivider().getColor(),
+ ((ColorDrawable) mView.getDividerDrawable()).getColor());
+ assertEquals(mBindingObject.isTabStripEnabled(), mView.isStripEnabled());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getDivider().getColor(),
+ ((ColorDrawable) mView.getDividerDrawable()).getColor());
+ assertEquals(mBindingObject.isTabStripEnabled(), mView.isStripEnabled());
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TableLayoutBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TableLayoutBindingAdapterTest.java
new file mode 100644
index 0000000..06d4d2c
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TableLayoutBindingAdapterTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.TableLayoutAdapterTestBinder;
+import com.android.databinding.testapp.vo.TableLayoutBindingObject;
+
+import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
+import android.widget.TableLayout;
+
+public class TableLayoutBindingAdapterTest
+ extends BindingAdapterTestBase<TableLayoutAdapterTestBinder, TableLayoutBindingObject> {
+
+ TableLayout mView;
+
+ public TableLayoutBindingAdapterTest() {
+ super(TableLayoutAdapterTestBinder.class, TableLayoutBindingObject.class,
+ R.layout.table_layout_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testDivider() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ assertEquals(mBindingObject.getDivider(),
+ ((ColorDrawable) mView.getDividerDrawable()).getColor());
+ changeValues();
+ assertEquals(mBindingObject.getDivider(),
+ ((ColorDrawable) mView.getDividerDrawable()).getColor());
+ }
+ }
+
+ public void testColumns() throws Throwable {
+ assertFalse(mView.isColumnCollapsed(0));
+ assertTrue(mView.isColumnCollapsed(1));
+ assertFalse(mView.isColumnCollapsed(2));
+
+ assertFalse(mView.isColumnShrinkable(0));
+ assertTrue(mView.isColumnShrinkable(1));
+ assertFalse(mView.isColumnShrinkable(2));
+
+ assertFalse(mView.isColumnStretchable(0));
+ assertTrue(mView.isColumnStretchable(1));
+ assertFalse(mView.isColumnStretchable(2));
+
+ changeValues();
+
+ assertFalse(mView.isColumnCollapsed(0));
+ assertFalse(mView.isColumnCollapsed(1));
+ assertFalse(mView.isColumnCollapsed(2));
+
+ assertTrue(mView.isColumnShrinkable(0));
+ assertTrue(mView.isColumnShrinkable(1));
+ assertFalse(mView.isColumnShrinkable(2));
+
+ assertTrue(mView.isColumnStretchable(0));
+ assertTrue(mView.isColumnStretchable(1));
+ assertTrue(mView.isColumnStretchable(2));
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TextViewBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TextViewBindingAdapterTest.java
new file mode 100644
index 0000000..a026910
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/TextViewBindingAdapterTest.java
@@ -0,0 +1,304 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.TextViewAdapterTestBinder;
+import com.android.databinding.testapp.vo.TextViewBindingObject;
+
+import android.annotation.TargetApi;
+import android.binding.adapters.TextViewBindingAdapter;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
+import android.text.Editable;
+import android.text.InputFilter;
+import android.text.InputType;
+import android.text.Spannable;
+import android.text.method.DialerKeyListener;
+import android.text.method.DigitsKeyListener;
+import android.text.method.KeyListener;
+import android.text.method.TextKeyListener;
+import android.widget.TextView;
+
+public class TextViewBindingAdapterTest
+ extends BindingAdapterTestBase<TextViewAdapterTestBinder, TextViewBindingObject> {
+
+ public TextViewBindingAdapterTest() {
+ super(TextViewAdapterTestBinder.class, TextViewBindingObject.class,
+ R.layout.text_view_adapter_test);
+ }
+
+ public void testNumeric() throws Throwable {
+ TextView view = mBinder.getNumericText();
+ assertTrue(view.getKeyListener() instanceof DigitsKeyListener);
+ DigitsKeyListener listener = (DigitsKeyListener) view.getKeyListener();
+ assertEquals(getExpectedNumericType(), listener.getInputType());
+
+ changeValues();
+
+ assertTrue(view.getKeyListener() instanceof DigitsKeyListener);
+ listener = (DigitsKeyListener) view.getKeyListener();
+ assertEquals(getExpectedNumericType(), listener.getInputType());
+ }
+
+ private int getExpectedNumericType() {
+ int expectedType = InputType.TYPE_CLASS_NUMBER;
+ if ((mBindingObject.getNumeric() & TextViewBindingAdapter.SIGNED) != 0) {
+ expectedType |= InputType.TYPE_NUMBER_FLAG_SIGNED;
+ }
+ if ((mBindingObject.getNumeric() & TextViewBindingAdapter.DECIMAL) != 0) {
+ expectedType |= InputType.TYPE_NUMBER_FLAG_DECIMAL;
+ }
+ return expectedType;
+ }
+
+ public void testDrawables() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ TextView view = mBinder.getTextDrawableNormal();
+ assertEquals(mBindingObject.getDrawableLeft(),
+ ((ColorDrawable) view.getCompoundDrawables()[0]).getColor());
+ assertEquals(mBindingObject.getDrawableTop(),
+ ((ColorDrawable) view.getCompoundDrawables()[1]).getColor());
+ assertEquals(mBindingObject.getDrawableRight(),
+ ((ColorDrawable) view.getCompoundDrawables()[2]).getColor());
+ assertEquals(mBindingObject.getDrawableBottom(),
+ ((ColorDrawable) view.getCompoundDrawables()[3]).getColor());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getDrawableLeft(),
+ ((ColorDrawable) view.getCompoundDrawables()[0]).getColor());
+ assertEquals(mBindingObject.getDrawableTop(),
+ ((ColorDrawable) view.getCompoundDrawables()[1]).getColor());
+ assertEquals(mBindingObject.getDrawableRight(),
+ ((ColorDrawable) view.getCompoundDrawables()[2]).getColor());
+ assertEquals(mBindingObject.getDrawableBottom(),
+ ((ColorDrawable) view.getCompoundDrawables()[3]).getColor());
+ }
+ }
+
+ public void testDrawableStartEnd() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ TextView view = mBinder.getTextDrawableStartEnd();
+ assertEquals(mBindingObject.getDrawableStart(),
+ ((ColorDrawable) view.getCompoundDrawablesRelative()[0]).getColor());
+ assertEquals(mBindingObject.getDrawableEnd(),
+ ((ColorDrawable) view.getCompoundDrawablesRelative()[2]).getColor());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getDrawableStart(),
+ ((ColorDrawable) view.getCompoundDrawablesRelative()[0]).getColor());
+ assertEquals(mBindingObject.getDrawableEnd(),
+ ((ColorDrawable) view.getCompoundDrawablesRelative()[2]).getColor());
+ }
+ }
+
+ public void testSimpleProperties() throws Throwable {
+ TextView view = mBinder.getTextView();
+
+ assertEquals(mBindingObject.getAutoLink(), view.getAutoLinkMask());
+ assertEquals(mBindingObject.getDrawablePadding(), view.getCompoundDrawablePadding());
+ assertEquals(mBindingObject.getTextSize(), view.getTextSize());
+ assertEquals(mBindingObject.getTextColorHint(), view.getHintTextColors().getDefaultColor());
+ assertEquals(mBindingObject.getTextColorLink(), view.getLinkTextColors().getDefaultColor());
+ assertEquals(mBindingObject.isAutoText(), isAutoTextEnabled(view));
+ assertEquals(mBindingObject.getCapitalize(), getCapitalization(view));
+ assertEquals(mBindingObject.getImeActionLabel(), view.getImeActionLabel());
+ assertEquals(mBindingObject.getImeActionId(), view.getImeActionId());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ assertEquals(mBindingObject.getTextColorHighlight(), view.getHighlightColor());
+ assertEquals(mBindingObject.getLineSpacingExtra(), view.getLineSpacingExtra());
+ assertEquals(mBindingObject.getLineSpacingMultiplier(),
+ view.getLineSpacingMultiplier());
+ assertEquals(mBindingObject.getShadowColor(), view.getShadowColor());
+ assertEquals(mBindingObject.getShadowDx(), view.getShadowDx());
+ assertEquals(mBindingObject.getShadowDy(), view.getShadowDy());
+ assertEquals(mBindingObject.getShadowRadius(), view.getShadowRadius());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ assertEquals(mBindingObject.getMaxLength(), getMaxLength(view));
+ }
+ }
+
+ changeValues();
+
+ assertEquals(mBindingObject.getAutoLink(), view.getAutoLinkMask());
+ assertEquals(mBindingObject.getDrawablePadding(), view.getCompoundDrawablePadding());
+ assertEquals(mBindingObject.getTextSize(), view.getTextSize());
+ assertEquals(mBindingObject.getTextColorHint(), view.getHintTextColors().getDefaultColor());
+ assertEquals(mBindingObject.getTextColorLink(), view.getLinkTextColors().getDefaultColor());
+ assertEquals(mBindingObject.isAutoText(), isAutoTextEnabled(view));
+ assertEquals(mBindingObject.getCapitalize(), getCapitalization(view));
+ assertEquals(mBindingObject.getImeActionLabel(), view.getImeActionLabel());
+ assertEquals(mBindingObject.getImeActionId(), view.getImeActionId());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ assertEquals(mBindingObject.getTextColorHighlight(), view.getHighlightColor());
+ assertEquals(mBindingObject.getLineSpacingExtra(), view.getLineSpacingExtra());
+ assertEquals(mBindingObject.getLineSpacingMultiplier(),
+ view.getLineSpacingMultiplier());
+ assertEquals(mBindingObject.getShadowColor(), view.getShadowColor());
+ assertEquals(mBindingObject.getShadowDx(), view.getShadowDx());
+ assertEquals(mBindingObject.getShadowDy(), view.getShadowDy());
+ assertEquals(mBindingObject.getShadowRadius(), view.getShadowRadius());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ assertEquals(mBindingObject.getMaxLength(), getMaxLength(view));
+ }
+ }
+
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mBindingObject.setCapitalize(TextKeyListener.Capitalize.CHARACTERS);
+ mBinder.rebindDirty();
+ }
+ });
+
+ assertEquals(mBindingObject.getCapitalize(), getCapitalization(view));
+
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mBindingObject.setCapitalize(TextKeyListener.Capitalize.WORDS);
+ mBinder.rebindDirty();
+ }
+ });
+
+ assertEquals(mBindingObject.getCapitalize(), getCapitalization(view));
+ }
+
+ private static boolean isAutoTextEnabled(TextView view) {
+ KeyListener keyListener = view.getKeyListener();
+ if (keyListener == null) {
+ return false;
+ }
+ if (!(keyListener instanceof TextKeyListener)) {
+ return false;
+ }
+ TextKeyListener textKeyListener = (TextKeyListener) keyListener;
+ return ((textKeyListener.getInputType() & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT) != 0);
+ }
+
+ private static TextKeyListener.Capitalize getCapitalization(TextView view) {
+ KeyListener keyListener = view.getKeyListener();
+ if (keyListener == null) {
+ return TextKeyListener.Capitalize.NONE;
+ }
+ int inputType = keyListener.getInputType();
+ if ((inputType & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0) {
+ return TextKeyListener.Capitalize.CHARACTERS;
+ } else if ((inputType & InputType.TYPE_TEXT_FLAG_CAP_WORDS) != 0) {
+ return TextKeyListener.Capitalize.WORDS;
+ } else if ((inputType & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES) != 0) {
+ return TextKeyListener.Capitalize.SENTENCES;
+ } else {
+ return TextKeyListener.Capitalize.NONE;
+ }
+ }
+
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ private static int getMaxLength(TextView view) {
+ InputFilter[] filters = view.getFilters();
+ for (InputFilter filter : filters) {
+ if (filter instanceof InputFilter.LengthFilter) {
+ InputFilter.LengthFilter lengthFilter = (InputFilter.LengthFilter) filter;
+ return lengthFilter.getMax();
+ }
+ }
+ return -1;
+ }
+
+ public void testAllCaps() throws Throwable {
+ TextView view = mBinder.getTextAllCaps();
+
+ assertEquals(mBindingObject.isTextAllCaps(), view.getTransformationMethod() != null);
+ if (view.getTransformationMethod() != null) {
+ assertEquals("ALL CAPS",
+ view.getTransformationMethod().getTransformation("all caps", view));
+ }
+
+ changeValues();
+
+ assertEquals(mBindingObject.isTextAllCaps(), view.getTransformationMethod() != null);
+ if (view.getTransformationMethod() != null) {
+ assertEquals("ALL CAPS",
+ view.getTransformationMethod().getTransformation("all caps", view));
+ }
+ }
+
+ public void testBufferType() throws Throwable {
+ TextView view = mBinder.getTextBufferType();
+
+ assertEquals(mBindingObject.getBufferType(), getBufferType(view));
+ changeValues();
+ assertEquals(mBindingObject.getBufferType(), getBufferType(view));
+ }
+
+ private static TextView.BufferType getBufferType(TextView view) {
+ CharSequence text = view.getText();
+ if (text instanceof Editable) {
+ return TextView.BufferType.EDITABLE;
+ }
+ if (text instanceof Spannable) {
+ return TextView.BufferType.SPANNABLE;
+ }
+ return TextView.BufferType.NORMAL;
+ }
+
+ public void testInputType() throws Throwable {
+ TextView view = mBinder.getTextInputType();
+ assertEquals(mBindingObject.getInputType(), view.getInputType());
+ changeValues();
+ assertEquals(mBindingObject.getInputType(), view.getInputType());
+ }
+
+ public void testDigits() throws Throwable {
+ TextView view = mBinder.getTextDigits();
+ assertEquals(mBindingObject.getDigits(), getDigits(view));
+ changeValues();
+ assertEquals(mBindingObject.getDigits(), getDigits(view));
+ }
+
+ private static String getDigits(TextView textView) {
+ KeyListener keyListener = textView.getKeyListener();
+ if (!(keyListener instanceof DigitsKeyListener)) {
+ return null;
+ }
+ DigitsKeyListener digitsKeyListener = (DigitsKeyListener) keyListener;
+ String input = "abcdefghijklmnopqrstuvwxyz";
+ Spannable spannable = Spannable.Factory.getInstance().newSpannable(input);
+ return digitsKeyListener.filter(input, 0, input.length(), spannable, 0, input.length())
+ .toString();
+ }
+
+ public void testPhoneNumber() throws Throwable {
+ TextView textView = mBinder.getTextPhoneNumber();
+ assertEquals(mBindingObject.isPhoneNumber(), isPhoneNumber(textView));
+ changeValues();
+ assertEquals(mBindingObject.isPhoneNumber(), isPhoneNumber(textView));
+ }
+
+ private static boolean isPhoneNumber(TextView view) {
+ KeyListener keyListener = view.getKeyListener();
+ return (keyListener instanceof DialerKeyListener);
+ }
+
+ public void testInputMethod() throws Throwable {
+ TextView textView = mBinder.getTextInputMethod();
+ assertTrue(TextViewBindingObject.KeyListener1.class.isInstance(textView.getKeyListener()));
+ changeValues();
+ assertTrue(TextViewBindingObject.KeyListener2.class.isInstance(textView.getKeyListener()));
+ }
+
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewBindingAdapterTest.java
new file mode 100644
index 0000000..4bde05c
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewBindingAdapterTest.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.ViewAdapterTestBinder;
+import com.android.databinding.testapp.vo.ViewBindingObject;
+
+import android.content.res.ColorStateList;
+import android.os.Build;
+import android.test.UiThreadTest;
+import android.view.View;
+
+public class ViewBindingAdapterTest extends BindingAdapterTestBase<ViewAdapterTestBinder, ViewBindingObject> {
+
+ public ViewBindingAdapterTest() {
+ super(ViewAdapterTestBinder.class, ViewBindingObject.class, R.layout.view_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testPadding() throws Throwable {
+ View view = mBinder.getPadding();
+ assertEquals(mBindingObject.getPadding(), view.getPaddingBottom());
+ assertEquals(mBindingObject.getPadding(), view.getPaddingTop());
+ assertEquals(mBindingObject.getPadding(), view.getPaddingRight());
+ assertEquals(mBindingObject.getPadding(), view.getPaddingLeft());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getPadding(), view.getPaddingBottom());
+ assertEquals(mBindingObject.getPadding(), view.getPaddingTop());
+ assertEquals(mBindingObject.getPadding(), view.getPaddingRight());
+ assertEquals(mBindingObject.getPadding(), view.getPaddingLeft());
+ }
+
+ public void testPaddingLeftRight() throws Throwable {
+ View view = mBinder.getPaddingLeftRight();
+ assertEquals(mBindingObject.getPaddingLeft(), view.getPaddingLeft());
+ assertEquals(mBindingObject.getPaddingRight(), view.getPaddingRight());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getPaddingLeft(), view.getPaddingLeft());
+ assertEquals(mBindingObject.getPaddingRight(), view.getPaddingRight());
+ }
+
+ public void testPaddingStartEnd() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ View view = mBinder.getPaddingStartEnd();
+ assertEquals(mBindingObject.getPaddingStart(), view.getPaddingStart());
+ assertEquals(mBindingObject.getPaddingEnd(), view.getPaddingEnd());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getPaddingStart(), view.getPaddingStart());
+ assertEquals(mBindingObject.getPaddingEnd(), view.getPaddingEnd());
+ }
+ }
+
+ public void testPaddingTopBottom() throws Throwable {
+ View view = mBinder.getPaddingTopBottom();
+ assertEquals(mBindingObject.getPaddingTop(), view.getPaddingTop());
+ assertEquals(mBindingObject.getPaddingBottom(), view.getPaddingBottom());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getPaddingTop(), view.getPaddingTop());
+ assertEquals(mBindingObject.getPaddingBottom(), view.getPaddingBottom());
+ }
+
+ public void testBackgroundTint() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ View view = mBinder.getBackgroundTint();
+ assertNotNull(view.getBackgroundTintList());
+ ColorStateList colorStateList = view.getBackgroundTintList();
+ assertEquals(mBindingObject.getBackgroundTint(), colorStateList.getDefaultColor());
+
+ changeValues();
+
+ assertNotNull(view.getBackgroundTintList());
+ colorStateList = view.getBackgroundTintList();
+ assertEquals(mBindingObject.getBackgroundTint(), colorStateList.getDefaultColor());
+ }
+ }
+
+ public void testFadeScrollbars() throws Throwable {
+ View view = mBinder.getFadeScrollbars();
+ assertEquals(mBindingObject.getFadeScrollbars(), view.isScrollbarFadingEnabled());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getFadeScrollbars(), view.isScrollbarFadingEnabled());
+ }
+
+ public void testNextFocus() throws Throwable {
+ View view = mBinder.getNextFocus();
+
+ assertEquals(mBindingObject.getNextFocusDown(), view.getNextFocusDownId());
+ assertEquals(mBindingObject.getNextFocusUp(), view.getNextFocusUpId());
+ assertEquals(mBindingObject.getNextFocusLeft(), view.getNextFocusLeftId());
+ assertEquals(mBindingObject.getNextFocusRight(), view.getNextFocusRightId());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(mBindingObject.getNextFocusForward(), view.getNextFocusForwardId());
+ }
+
+ changeValues();
+
+ assertEquals(mBindingObject.getNextFocusDown(), view.getNextFocusDownId());
+ assertEquals(mBindingObject.getNextFocusUp(), view.getNextFocusUpId());
+ assertEquals(mBindingObject.getNextFocusLeft(), view.getNextFocusLeftId());
+ assertEquals(mBindingObject.getNextFocusRight(), view.getNextFocusRightId());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(mBindingObject.getNextFocusForward(), view.getNextFocusForwardId());
+ }
+ }
+
+ public void testRequiresFadingEdge() throws Throwable {
+ View view = mBinder.getRequiresFadingEdge();
+
+ assertTrue(view.isVerticalFadingEdgeEnabled());
+ assertFalse(view.isHorizontalFadingEdgeEnabled());
+
+ changeValues();
+
+ assertFalse(view.isVerticalFadingEdgeEnabled());
+ assertTrue(view.isHorizontalFadingEdgeEnabled());
+ }
+
+ public void testScrollbar() throws Throwable {
+ View view = mBinder.getScrollbar();
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ assertEquals(mBindingObject.getScrollbarDefaultDelayBeforeFade(),
+ view.getScrollBarDefaultDelayBeforeFade());
+ assertEquals(mBindingObject.getScrollbarFadeDuration(), view.getScrollBarFadeDuration());
+ assertEquals(mBindingObject.getScrollbarSize(), view.getScrollBarSize());
+ }
+ assertEquals(mBindingObject.getScrollbarStyle(), view.getScrollBarStyle());
+
+ changeValues();
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ assertEquals(mBindingObject.getScrollbarDefaultDelayBeforeFade(),
+ view.getScrollBarDefaultDelayBeforeFade());
+ assertEquals(mBindingObject.getScrollbarFadeDuration(), view.getScrollBarFadeDuration());
+ assertEquals(mBindingObject.getScrollbarSize(), view.getScrollBarSize());
+ }
+ assertEquals(mBindingObject.getScrollbarStyle(), view.getScrollBarStyle());
+ }
+
+ public void testTransformPivot() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ View view = mBinder.getTransformPivot();
+
+ assertEquals(mBindingObject.getTransformPivotX(), view.getPivotX());
+ assertEquals(mBindingObject.getTransformPivotY(), view.getPivotY());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getTransformPivotX(), view.getPivotX());
+ assertEquals(mBindingObject.getTransformPivotY(), view.getPivotY());
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewGroupBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewGroupBindingAdapterTest.java
new file mode 100644
index 0000000..acc7b01
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewGroupBindingAdapterTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.ViewGroupAdapterTestBinder;
+import com.android.databinding.testapp.vo.ViewGroupBindingObject;
+
+import android.os.Build;
+import android.view.ViewGroup;
+
+public class ViewGroupBindingAdapterTest
+ extends BindingAdapterTestBase<ViewGroupAdapterTestBinder, ViewGroupBindingObject> {
+
+ ViewGroup mView;
+
+ public ViewGroupBindingAdapterTest() {
+ super(ViewGroupAdapterTestBinder.class, ViewGroupBindingObject.class,
+ R.layout.view_group_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testDrawnWithCache() throws Throwable {
+ assertEquals(mBindingObject.isAlwaysDrawnWithCache(),
+ mView.isAlwaysDrawnWithCacheEnabled());
+
+ changeValues();
+
+ assertEquals(mBindingObject.isAlwaysDrawnWithCache(),
+ mView.isAlwaysDrawnWithCacheEnabled());
+ }
+
+ public void testAnimationCache() throws Throwable {
+ assertEquals(mBindingObject.isAnimationCache(), mView.isAnimationCacheEnabled());
+
+ changeValues();
+
+ assertEquals(mBindingObject.isAnimationCache(), mView.isAnimationCacheEnabled());
+ }
+
+ public void testSplitMotionEvents() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(mBindingObject.isSplitMotionEvents(),
+ mView.isMotionEventSplittingEnabled());
+
+ changeValues();
+
+ assertEquals(mBindingObject.isSplitMotionEvents(),
+ mView.isMotionEventSplittingEnabled());
+ }
+ }
+
+ public void testAnimateLayoutChanges() throws Throwable {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(mBindingObject.isAnimateLayoutChanges(),
+ mView.getLayoutTransition() != null);
+
+ changeValues();
+
+ assertEquals(mBindingObject.isAnimateLayoutChanges(),
+ mView.getLayoutTransition() != null);
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewStubBindingAdapterTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewStubBindingAdapterTest.java
new file mode 100644
index 0000000..c30ec20
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/ViewStubBindingAdapterTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import com.android.databinding.testapp.generated.ViewStubAdapterTestBinder;
+import com.android.databinding.testapp.vo.ViewStubBindingObject;
+
+import android.view.ViewStub;
+
+public class ViewStubBindingAdapterTest
+ extends BindingAdapterTestBase<ViewStubAdapterTestBinder, ViewStubBindingObject> {
+
+ ViewStub mView;
+
+ public ViewStubBindingAdapterTest() {
+ super(ViewStubAdapterTestBinder.class, ViewStubBindingObject.class,
+ R.layout.view_stub_adapter_test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mView = mBinder.getView();
+ }
+
+ public void testLayout() throws Throwable {
+ assertEquals(mBindingObject.getLayout(), mView.getLayoutResource());
+
+ changeValues();
+
+ assertEquals(mBindingObject.getLayout(), mView.getLayoutResource());
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/multiconfig/LandscapeConfigTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/multiconfig/LandscapeConfigTest.java
new file mode 100644
index 0000000..f171321
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/multiconfig/LandscapeConfigTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp.multiconfig;
+
+import com.android.databinding.library.IViewDataBinder;
+import com.android.databinding.testapp.BaseLandDataBinderTest;
+import com.android.databinding.testapp.R;
+import com.android.databinding.testapp.generated.BasicBindingBinder;
+import com.android.databinding.testapp.generated.ConditionalBindingBinder;
+import com.android.databinding.testapp.generated.IncludedLayoutBinder;
+import com.android.databinding.testapp.generated.MultiResLayoutBinder;
+import com.android.databinding.testapp.vo.NotBindableVo;
+
+import android.view.View;
+import android.widget.TextView;
+
+public class LandscapeConfigTest extends BaseLandDataBinderTest<MultiResLayoutBinder> {
+
+ public LandscapeConfigTest() {
+ super(MultiResLayoutBinder.class, R.layout.multi_res_layout);
+ }
+
+ public void testSharedViewIdAndVariableInheritance()
+ throws InterruptedException, NoSuchMethodException, NoSuchFieldException {
+ assertEquals("MultiResLayoutBinderLandImpl", mBinder.getClass().getSimpleName());
+ assertMethod(TextView.class, "getObjectInLandTextView");
+ assertMethod(TextView.class, "getObjectInDefaultTextView");
+ assertMethod(View.class, "getObjectInDefaultTextView2");
+
+ assertField(TextView.class, "mObjectInLandTextView");
+ assertField(TextView.class, "mObjectInDefaultTextView");
+ assertField(TextView.class, "mObjectInDefaultTextView2");
+
+ assertField(NotBindableVo.class, "mObjectInLand");
+ assertField(NotBindableVo.class, "mObjectInDefault");
+
+ // includes
+ assertMethod(IViewDataBinder.class, "getIncludedLayoutConflict");
+ assertMethod(BasicBindingBinder.class, "getIncludedLayoutShared");
+ assertMethod(ConditionalBindingBinder.class, "getIncludedLayoutPort");
+ assertMethod(ConditionalBindingBinder.class, "getIncludedLayoutLand");
+
+ assertField(IncludedLayoutBinder.class, "mIncludedLayoutConflict");
+ assertField(BasicBindingBinder.class, "mIncludedLayoutShared");
+ assertField(ConditionalBindingBinder.class, "mIncludedLayoutLand");
+
+ assertNoField("mIncludedLayoutPort");
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/multiconfig/PortraitConfigTest.java b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/multiconfig/PortraitConfigTest.java
new file mode 100644
index 0000000..8790f04
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/androidTest/java/com/android/databinding/testapp/multiconfig/PortraitConfigTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp.multiconfig;
+
+import com.android.databinding.library.IViewDataBinder;
+import com.android.databinding.testapp.BaseDataBinderTest;
+import com.android.databinding.testapp.R;
+import com.android.databinding.testapp.generated.BasicBindingBinder;
+import com.android.databinding.testapp.generated.ConditionalBindingBinder;
+import com.android.databinding.testapp.generated.IncludedLayoutBinder;
+import com.android.databinding.testapp.generated.MultiResLayoutBinder;
+import com.android.databinding.testapp.vo.NotBindableVo;
+
+import android.content.pm.ActivityInfo;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.TextView;
+
+public class PortraitConfigTest extends BaseDataBinderTest<MultiResLayoutBinder> {
+ public PortraitConfigTest() {
+ super(MultiResLayoutBinder.class, R.layout.multi_res_layout, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ }
+
+ public void testSharedViewIdAndVariableInheritance()
+ throws InterruptedException, NoSuchMethodException, NoSuchFieldException {
+ assertEquals("MultiResLayoutBinderImpl", mBinder.getClass().getSimpleName());
+ assertEquals("MultiResLayoutBinderImpl", mBinder.getClass().getSimpleName());
+ assertMethod(TextView.class, "getObjectInLandTextView");
+ assertMethod(TextView.class, "getObjectInDefaultTextView");
+ assertMethod(View.class, "getObjectInDefaultTextView2");
+
+ assertNoField("mObjectInLandTextView");
+ assertField(TextView.class, "mObjectInDefaultTextView");
+ assertField(EditText.class, "mObjectInDefaultTextView2");
+
+ assertNoField("mObjectInLand");
+ assertField(NotBindableVo.class, "mObjectInDefault");
+
+
+ // includes
+ assertMethod(IViewDataBinder.class, "getIncludedLayoutConflict");
+ assertMethod(BasicBindingBinder.class, "getIncludedLayoutShared");
+ assertMethod(ConditionalBindingBinder.class, "getIncludedLayoutPort");
+ assertMethod(ConditionalBindingBinder.class, "getIncludedLayoutLand");
+
+ assertField(BasicBindingBinder.class, "mIncludedLayoutConflict");
+ assertField(BasicBindingBinder.class, "mIncludedLayoutShared");
+ assertField(ConditionalBindingBinder.class, "mIncludedLayoutPort");
+
+ assertNoField("mIncludedLayoutLand");
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/AndroidManifest.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..ae2581a
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/AndroidManifest.xml
@@ -0,0 +1,25 @@
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.databinding.testapp">
+
+ <application android:allowBackup="true"
+ android:label="@string/app_name"
+ android:icon="@drawable/ic_launcher"
+ >
+ <activity android:name=".TestActivity"
+ android:screenOrientation="portrait"/>
+ </application>
+
+</manifest>
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/TestActivity.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/TestActivity.java
new file mode 100644
index 0000000..fa9dd42
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/TestActivity.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.WindowManager;
+
+public class TestActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsListViewBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsListViewBindingObject.java
new file mode 100644
index 0000000..ff0bfbd
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsListViewBindingObject.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+
+public class AbsListViewBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private ColorDrawable mListSelector = new ColorDrawable(0xFFFF0000);
+ @Bindable
+ private boolean mScrollingCache;
+ @Bindable
+ private boolean mSmoothScrollbar;
+
+ public ColorDrawable getListSelector() {
+ return mListSelector;
+ }
+
+ public boolean isScrollingCache() {
+ return mScrollingCache;
+ }
+
+ public boolean isSmoothScrollbar() {
+ return mSmoothScrollbar;
+ }
+
+ public void changeValues() {
+ mListSelector = new ColorDrawable(0xFFFFFFFF);
+ mScrollingCache = true;
+ mSmoothScrollbar = true;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsSeekBarBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsSeekBarBindingObject.java
new file mode 100644
index 0000000..bc62445
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsSeekBarBindingObject.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+
+public class AbsSeekBarBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int mThumbTint = 0xFFFF0000;
+
+ public int getThumbTint() {
+ return mThumbTint;
+ }
+
+ public void changeValues() {
+ mThumbTint = 0xFF00FF00;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsSpinnerBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsSpinnerBindingObject.java
new file mode 100644
index 0000000..6e35436
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AbsSpinnerBindingObject.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+
+public class AbsSpinnerBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private CharSequence[] mEntries = {
+ "hello",
+ "world",
+ };
+
+ private static final CharSequence[] CHANGED_VALUES = {
+ "goodbye",
+ "cruel",
+ "world"
+ };
+
+ public CharSequence[] getEntries() {
+ return mEntries;
+ }
+
+ public void changeValues() {
+ mEntries = CHANGED_VALUES;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AutoCompleteTextViewBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AutoCompleteTextViewBindingObject.java
new file mode 100644
index 0000000..66e2003
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/AutoCompleteTextViewBindingObject.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+
+public class AutoCompleteTextViewBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int mPopupBackground;
+
+ @Bindable
+ private int mCompletionThreshold = 1;
+
+ public int getCompletionThreshold() {
+ return mCompletionThreshold;
+ }
+
+ public int getPopupBackground() {
+ return mPopupBackground;
+ }
+
+ public void changeValues() {
+ mPopupBackground = 0xFF23456;
+ mCompletionThreshold = 5;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/BindableTestObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/BindableTestObject.java
new file mode 100644
index 0000000..63ef9c1
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/BindableTestObject.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import android.binding.Bindable;
+
+public class BindableTestObject {
+ @Bindable
+ public int bindableField1;
+
+ @Bindable
+ private int bindableField2;
+
+ private int bindableField3;
+
+ @Bindable
+ public int m_bindableField4;
+
+ @Bindable
+ public int mbindableField5;
+
+ @Bindable
+ public int _bindableField6;
+
+ @Bindable
+ public int _BindableField7;
+
+ @Bindable
+ public int mBindableField8;
+
+ public int getBindableField2() {
+ return bindableField2;
+ }
+
+ @Bindable
+ public int getBindableField3() {
+ return bindableField3;
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/BindingAdapterBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/BindingAdapterBindingObject.java
new file mode 100644
index 0000000..bd93070
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/BindingAdapterBindingObject.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+public abstract class BindingAdapterBindingObject extends BaseObservable {
+
+ public abstract void changeValues();
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/CheckedTextViewBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/CheckedTextViewBindingObject.java
new file mode 100644
index 0000000..6dc3dad
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/CheckedTextViewBindingObject.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+import android.graphics.drawable.ColorDrawable;
+
+public class CheckedTextViewBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private ColorDrawable mCheckMark = new ColorDrawable(0xFF123456);
+
+ @Bindable
+ private int mCheckMarkTint = 0xDead_Beef;
+
+ public ColorDrawable getCheckMark() {
+ return mCheckMark;
+ }
+
+ public int getCheckMarkTint() {
+ return mCheckMarkTint;
+ }
+
+ public void changeValues() {
+ mCheckMark = new ColorDrawable(0xFF111111);
+ mCheckMarkTint = 0xFF222222;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/CompoundButtonBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/CompoundButtonBindingObject.java
new file mode 100644
index 0000000..80052f4
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/CompoundButtonBindingObject.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+
+public class CompoundButtonBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int mButtonTint;
+
+ public int getButtonTint() {
+ return mButtonTint;
+ }
+
+ public void changeValues() {
+ mButtonTint = 0xFF111111;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObject.java
new file mode 100644
index 0000000..1cf9b09
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObject.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+public class FindMethodBindingObject extends FindMethodBindingObjectBase {
+ public String method() { return "no arg"; }
+
+ public String method(int i) { return String.valueOf(i); }
+
+ public String method(float f) { return String.valueOf(f); }
+
+ public String method(String value) { return value; }
+
+ public static String staticMethod() { return "world"; }
+
+ public static Foo foo = new Foo();
+
+ public static Bar<String> bar = new Bar<>();
+
+ public static class Foo {
+ public final String bar = "hello world";
+ }
+
+ public static class Bar<T> {
+ public T method(T value) { return value; }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObjectBase.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObjectBase.java
new file mode 100644
index 0000000..142a3fe
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObjectBase.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+public class FindMethodBindingObjectBase extends BindingAdapterBindingObject {
+ public String inheritedMethod() {
+ return "base";
+ }
+
+ public String inheritedMethod(int i) {
+ return "base " + i;
+ }
+
+ @Override
+ public void changeValues() {
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FrameLayoutBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FrameLayoutBindingObject.java
new file mode 100644
index 0000000..788c53c
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/FrameLayoutBindingObject.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+
+public class FrameLayoutBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int foregroundTint;
+
+ public int getForegroundTint() {
+ return foregroundTint;
+ }
+
+ public void changeValues() {
+ foregroundTint = 0xFF111111;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ImageViewBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ImageViewBindingObject.java
new file mode 100644
index 0000000..73990d3
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ImageViewBindingObject.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+
+public class ImageViewBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int mTint;
+
+ @Bindable
+ private Drawable mSrc;
+
+ @Bindable
+ private PorterDuff.Mode mTintMode = PorterDuff.Mode.DARKEN;
+
+ public int getTint() {
+ return mTint;
+ }
+
+ public Drawable getSrc() {
+ return mSrc;
+ }
+
+ public PorterDuff.Mode getTintMode() {
+ return mTintMode;
+ }
+
+ public void changeValues() {
+ mTint = 0xFF111111;
+ mSrc = new ColorDrawable(0xFF00FF00);
+ mTintMode = PorterDuff.Mode.LIGHTEN;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/LinearLayoutBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/LinearLayoutBindingObject.java
new file mode 100644
index 0000000..1755fe8
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/LinearLayoutBindingObject.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+
+public class LinearLayoutBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int mDivider;
+
+ @Bindable
+ private boolean mMeasureWithLargestChild;
+
+ public int getDivider() {
+ return mDivider;
+ }
+
+ public boolean isMeasureWithLargestChild() {
+ return mMeasureWithLargestChild;
+ }
+
+ public void changeValues() {
+ mDivider = 0xFF111111;
+ mMeasureWithLargestChild = true;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/NotBindableVo.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/NotBindableVo.java
new file mode 100644
index 0000000..a8ec026
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/NotBindableVo.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp.vo;
+
+public class NotBindableVo {
+ private int mIntValue;
+ private int mIntValueGetCount;
+ private boolean mBoolValue;
+ private int mBoolValueGetCount;
+ private String mStringValue;
+ private int mStringValueGetCount;
+ private final String mFinalString = "this has final content";
+ public final int publicField = 3;
+
+ public NotBindableVo() {
+ }
+
+ public NotBindableVo(int intValue) {
+ this.mIntValue = intValue;
+ }
+
+ public NotBindableVo(String stringValue) {
+ this.mStringValue = stringValue;
+ }
+
+ public NotBindableVo(int intValue, String stringValue) {
+ this.mIntValue = intValue;
+ this.mStringValue = stringValue;
+ }
+
+ public int getIntValue() {
+ mIntValueGetCount ++;
+ return mIntValue;
+ }
+
+ public String getFinalString() {
+ return mFinalString;
+ }
+
+ public void setIntValue(int intValue) {
+ this.mIntValue = intValue;
+ }
+
+ public String getStringValue() {
+ mStringValueGetCount ++;
+ return mStringValue;
+ }
+
+ public void setStringValue(String stringValue) {
+ this.mStringValue = stringValue;
+ }
+
+ public String mergeStringFields(NotBindableVo other) {
+ return mStringValue + (other == null ? "" : other.mStringValue);
+ }
+
+ public boolean getBoolValue() {
+ mBoolValueGetCount ++;
+ return mBoolValue;
+ }
+
+ public void setBoolValue(boolean boolValue) {
+ mBoolValue = boolValue;
+ }
+
+ public int getIntValueGetCount() {
+ return mIntValueGetCount;
+ }
+
+ public int getBoolValueGetCount() {
+ return mBoolValueGetCount;
+ }
+
+ public int getStringValueGetCount() {
+ return mStringValueGetCount;
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ObservableFieldBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ObservableFieldBindingObject.java
new file mode 100644
index 0000000..651a8cf
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ObservableFieldBindingObject.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+import com.android.databinding.library.ObservableBoolean;
+import com.android.databinding.library.ObservableByte;
+import com.android.databinding.library.ObservableChar;
+import com.android.databinding.library.ObservableDouble;
+import com.android.databinding.library.ObservableField;
+import com.android.databinding.library.ObservableFloat;
+import com.android.databinding.library.ObservableInt;
+import com.android.databinding.library.ObservableLong;
+import com.android.databinding.library.ObservableShort;
+
+import android.binding.Bindable;
+
+public class ObservableFieldBindingObject {
+ public final ObservableBoolean bField = new ObservableBoolean();
+ public final ObservableByte tField = new ObservableByte();
+ public final ObservableShort sField = new ObservableShort();
+ public final ObservableChar cField = new ObservableChar();
+ public final ObservableInt iField = new ObservableInt();
+ public final ObservableLong lField = new ObservableLong();
+ public final ObservableFloat fField = new ObservableFloat();
+ public final ObservableDouble dField = new ObservableDouble();
+ public final ObservableField<String> oField = new ObservableField<>();
+
+ public ObservableFieldBindingObject() {
+ oField.set("Hello");
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ObservableWithNotBindableFieldObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ObservableWithNotBindableFieldObject.java
new file mode 100644
index 0000000..1128421
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ObservableWithNotBindableFieldObject.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+public class ObservableWithNotBindableFieldObject extends BaseObservable {
+ private String data;
+ public void update(String data) {
+ this.data = data;
+ notifyChange();
+ }
+
+ public String getData() {
+ return data;
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ProgressBarBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ProgressBarBindingObject.java
new file mode 100644
index 0000000..189b388
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ProgressBarBindingObject.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+import com.android.databinding.testapp.R;
+
+import android.binding.Bindable;
+
+public class ProgressBarBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int mIndeterminateTint;
+
+ @Bindable
+ private int mProgressTint;
+
+ @Bindable
+ private int mSecondaryProgressTint;
+
+ public int getIndeterminateTint() {
+ return mIndeterminateTint;
+ }
+
+ public int getProgressTint() {
+ return mProgressTint;
+ }
+
+ public int getSecondaryProgressTint() {
+ return mSecondaryProgressTint;
+ }
+
+ public void changeValues() {
+ mIndeterminateTint = 0xFF111111;
+ mProgressTint = 0xFF222222;
+ mSecondaryProgressTint = 0xFF333333;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/PublicFinalTestVo.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/PublicFinalTestVo.java
new file mode 100644
index 0000000..118717c
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/PublicFinalTestVo.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp.vo;
+
+public class PublicFinalTestVo {
+ public final int myField;
+ public PublicFinalTestVo(int field) {
+ myField = field;
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/PublicFinalWithObservableTestVo.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/PublicFinalWithObservableTestVo.java
new file mode 100644
index 0000000..dd415de
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/PublicFinalWithObservableTestVo.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+import com.android.databinding.testapp.R;
+
+import android.binding.Bindable;
+
+public class PublicFinalWithObservableTestVo {
+ public final int myField;
+ public final MyVo myFinalVo = new MyVo();
+
+ public PublicFinalWithObservableTestVo(int field) {
+ myField = field;
+ }
+
+ public static class MyVo extends BaseObservable {
+ @Bindable
+ private int val = R.string.app_name;
+
+ public int getVal() {
+ return val;
+ }
+
+ public void setVal(int val) {
+ this.val = val;
+ notifyPropertyChanged(android.binding.BR.val);
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/RadioGroupBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/RadioGroupBindingObject.java
new file mode 100644
index 0000000..1ddcb2f
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/RadioGroupBindingObject.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+import com.android.databinding.testapp.R;
+
+import android.binding.Bindable;
+
+public class RadioGroupBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int mCheckedButton = R.id.choiceOne;
+
+ public int getCheckedButton() {
+ return mCheckedButton;
+ }
+
+ public void changeValues() {
+ mCheckedButton = R.id.choiceTwo;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/SpinnerBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/SpinnerBindingObject.java
new file mode 100644
index 0000000..39b07f5
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/SpinnerBindingObject.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+
+public class SpinnerBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int mPopupBackground = 0xFF123456;
+
+ public int getPopupBackground() {
+ return mPopupBackground;
+ }
+
+ public void changeValues() {
+ mPopupBackground = 0xFF111111;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/SwitchBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/SwitchBindingObject.java
new file mode 100644
index 0000000..1097b8e
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/SwitchBindingObject.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+
+public class SwitchBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int mThumb;
+ @Bindable
+ private int mTrack;
+
+ public int getThumb() {
+ return mThumb;
+ }
+
+ public int getTrack() {
+ return mTrack;
+ }
+
+ public void changeValues() {
+ mThumb = 0xFF111111;
+ mTrack = 0xFF333333;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TabWidgetBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TabWidgetBindingObject.java
new file mode 100644
index 0000000..d4937a5
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TabWidgetBindingObject.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+import android.graphics.drawable.ColorDrawable;
+
+public class TabWidgetBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private ColorDrawable mDivider = new ColorDrawable(0xFF0000FF);
+ @Bindable
+ private boolean mTabStripEnabled;
+ @Bindable
+ private ColorDrawable mTabStripLeft = new ColorDrawable(0xFF00FF00);
+ @Bindable
+ private ColorDrawable mTabStripRight = new ColorDrawable(0xFFFF0000);
+
+ public ColorDrawable getDivider() {
+ return mDivider;
+ }
+
+ public ColorDrawable getTabStripLeft() {
+ return mTabStripLeft;
+ }
+
+ public ColorDrawable getTabStripRight() {
+ return mTabStripRight;
+ }
+
+ public boolean isTabStripEnabled() {
+ return mTabStripEnabled;
+ }
+
+ public void changeValues() {
+ mDivider = new ColorDrawable(0xFF111111);
+ mTabStripEnabled = true;
+ mTabStripLeft = new ColorDrawable(0xFF222222);
+ mTabStripRight = new ColorDrawable(0xFF333333);
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TableLayoutBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TableLayoutBindingObject.java
new file mode 100644
index 0000000..ab45800
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TableLayoutBindingObject.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+
+public class TableLayoutBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private String mCollapseColumns = "1";
+ @Bindable
+ private String mShrinkColumns = "1";
+ @Bindable
+ private String mStretchColumns = "1";
+ @Bindable
+ private int mDivider = 0xFF112233;
+
+ public String getCollapseColumns() {
+ return mCollapseColumns;
+ }
+
+ public String getShrinkColumns() {
+ return mShrinkColumns;
+ }
+
+ public String getStretchColumns() {
+ return mStretchColumns;
+ }
+
+ public int getDivider() {
+ return mDivider;
+ }
+
+ public void changeValues() {
+ mCollapseColumns = "";
+ mShrinkColumns = "1,0";
+ mStretchColumns = "*";
+ mDivider = 0xFF445566;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TextViewBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TextViewBindingObject.java
new file mode 100644
index 0000000..b98ded2
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/TextViewBindingObject.java
@@ -0,0 +1,319 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import android.binding.Bindable;
+import android.binding.adapters.TextViewBindingAdapter;
+import android.text.Editable;
+import android.text.InputType;
+import android.text.method.KeyListener;
+import android.text.method.TextKeyListener;
+import android.text.util.Linkify;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.TextView;
+
+public class TextViewBindingObject extends BindingAdapterBindingObject {
+
+ @Bindable
+ private int mAutoLink = Linkify.WEB_URLS;
+
+ @Bindable
+ private int mDrawablePadding;
+
+ @Bindable
+ private int mInputType = InputType.TYPE_CLASS_PHONE;
+
+ @Bindable
+ private boolean mScrollHorizontally;
+
+ @Bindable
+ private boolean mTextAllCaps;
+
+ @Bindable
+ private int mTextColorHighlight;
+
+ @Bindable
+ private int mTextColorHint;
+
+ @Bindable
+ private int mTextColorLink;
+
+ @Bindable
+ private boolean mAutoText;
+
+ @Bindable
+ private TextKeyListener.Capitalize mCapitalize = TextKeyListener.Capitalize.NONE;
+
+ @Bindable
+ private TextView.BufferType mBufferType = TextView.BufferType.NORMAL;
+
+ @Bindable
+ private String mDigits = "abcdefg";
+
+ @Bindable
+ private int mNumeric = TextViewBindingAdapter.DECIMAL;
+
+ @Bindable
+ private boolean mPhoneNumber;
+
+ @Bindable
+ private int mDrawableBottom;
+
+ @Bindable
+ private int mDrawableTop;
+
+ @Bindable
+ private int mDrawableLeft;
+
+ @Bindable
+ private int mDrawableRight;
+
+ @Bindable
+ private int mDrawableStart;
+
+ @Bindable
+ private int mDrawableEnd;
+
+ @Bindable
+ private String mImeActionLabel;
+
+ @Bindable
+ private int mImeActionId;
+
+ @Bindable
+ private String mInputMethod
+ = "com.android.databinding.testapp.vo.TextViewBindingObject$KeyListener1";
+
+ @Bindable
+ private float mLineSpacingExtra;
+
+ @Bindable
+ private float mLineSpacingMultiplier;
+
+ @Bindable
+ private int mMaxLength;
+
+ @Bindable
+ private int mShadowColor;
+
+ @Bindable
+ private float mShadowDx;
+
+ @Bindable
+ private float mShadowDy;
+
+ @Bindable
+ private float mShadowRadius;
+
+ @Bindable
+ private float mTextSize = 10f;
+
+ public TextView.BufferType getBufferType() {
+ return mBufferType;
+ }
+
+ public float getLineSpacingExtra() {
+ return mLineSpacingExtra;
+ }
+
+ public float getLineSpacingMultiplier() {
+ return mLineSpacingMultiplier;
+ }
+
+ public float getShadowDx() {
+ return mShadowDx;
+ }
+
+ public float getShadowDy() {
+ return mShadowDy;
+ }
+
+ public float getShadowRadius() {
+ return mShadowRadius;
+ }
+
+ public float getTextSize() {
+ return mTextSize;
+ }
+
+ public int getAutoLink() {
+ return mAutoLink;
+ }
+
+ public int getDrawableBottom() {
+ return mDrawableBottom;
+ }
+
+ public int getDrawableEnd() {
+ return mDrawableEnd;
+ }
+
+ public int getDrawableLeft() {
+ return mDrawableLeft;
+ }
+
+ public int getDrawablePadding() {
+ return mDrawablePadding;
+ }
+
+ public int getDrawableRight() {
+ return mDrawableRight;
+ }
+
+ public int getDrawableStart() {
+ return mDrawableStart;
+ }
+
+ public int getDrawableTop() {
+ return mDrawableTop;
+ }
+
+ public int getImeActionId() {
+ return mImeActionId;
+ }
+
+ public int getInputType() {
+ return mInputType;
+ }
+
+ public int getMaxLength() {
+ return mMaxLength;
+ }
+
+ public int getNumeric() {
+ return mNumeric;
+ }
+
+ public int getShadowColor() {
+ return mShadowColor;
+ }
+
+ public int getTextColorHighlight() {
+ return mTextColorHighlight;
+ }
+
+ public int getTextColorHint() {
+ return mTextColorHint;
+ }
+
+ public int getTextColorLink() {
+ return mTextColorLink;
+ }
+
+ public String getDigits() {
+ return mDigits;
+ }
+
+ public String getImeActionLabel() {
+ return mImeActionLabel;
+ }
+
+ public String getInputMethod() {
+ return mInputMethod;
+ }
+
+ public boolean isAutoText() {
+ return mAutoText;
+ }
+
+ public TextKeyListener.Capitalize getCapitalize() {
+ return mCapitalize;
+ }
+
+ public void setCapitalize(TextKeyListener.Capitalize capitalize) {
+ mCapitalize = capitalize;
+ notifyPropertyChanged(android.binding.BR.capitalize);
+ }
+
+ public boolean isPhoneNumber() {
+ return mPhoneNumber;
+ }
+
+ public boolean isScrollHorizontally() {
+ return mScrollHorizontally;
+ }
+
+ public boolean isTextAllCaps() {
+ return mTextAllCaps;
+ }
+
+ public void changeValues() {
+ mAutoLink = Linkify.EMAIL_ADDRESSES;
+ mDrawablePadding = 10;
+ mInputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS;
+ mScrollHorizontally = true;
+ mTextAllCaps = true;
+ mTextColorHighlight = 0xFF00FF00;
+ mTextColorHint = 0xFFFF0000;
+ mTextColorLink = 0xFF0000FF;
+ mAutoText = true;
+ mCapitalize = TextKeyListener.Capitalize.SENTENCES;
+ mBufferType = TextView.BufferType.SPANNABLE;
+ mDigits = "hijklmno";
+ mNumeric = TextViewBindingAdapter.SIGNED;
+ mPhoneNumber = true;
+ mDrawableBottom = 0xFF880088;
+ mDrawableTop = 0xFF111111;
+ mDrawableLeft = 0xFF222222;
+ mDrawableRight = 0xFF333333;
+ mDrawableStart = 0xFF444444;
+ mDrawableEnd = 0xFF555555;
+ mImeActionLabel = "Hello World";
+ mImeActionId = 3;
+ mInputMethod = "com.android.databinding.testapp.vo.TextViewBindingObject$KeyListener2";
+ mLineSpacingExtra = 2;
+ mLineSpacingMultiplier = 3;
+ mMaxLength = 100;
+ mShadowColor = 0xFF666666;
+ mShadowDx = 2;
+ mShadowDy = 3;
+ mShadowRadius = 4;
+ mTextSize = 20f;
+ notifyChange();
+ }
+
+ public static class KeyListener1 implements KeyListener {
+
+ @Override
+ public int getInputType() {
+ return InputType.TYPE_CLASS_TEXT;
+ }
+
+ @Override
+ public boolean onKeyDown(View view, Editable text, int keyCode, KeyEvent event) {
+ return false;
+ }
+
+ @Override
+ public boolean onKeyUp(View view, Editable text, int keyCode, KeyEvent event) {
+ return false;
+ }
+
+ @Override
+ public boolean onKeyOther(View view, Editable text, KeyEvent event) {
+ return false;
+ }
+
+ @Override
+ public void clearMetaKeyState(View view, Editable content, int states) {
+ }
+ }
+
+ public static class KeyListener2 extends KeyListener1 {
+
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewBindingObject.java
new file mode 100644
index 0000000..8486382
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewBindingObject.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+import com.android.databinding.testapp.R;
+
+import android.binding.Bindable;
+import android.binding.adapters.ViewBindingAdapter;
+import android.view.View;
+
+public class ViewBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int mBackgroundTint = 0xFF00FF00;
+ @Bindable
+ private boolean mFadeScrollbars = false;
+ @Bindable
+ private int mNextFocusForward = R.id.padding;
+ @Bindable
+ private int mNextFocusLeft = R.id.paddingStartEnd;
+ @Bindable
+ private int mNextFocusRight = R.id.paddingTopBottom;
+ @Bindable
+ private int mNextFocusUp = R.id.backgroundTint;
+ @Bindable
+ private int mNextFocusDown = R.id.fadeScrollbars;
+ @Bindable
+ private int mRequiresFadingEdge = ViewBindingAdapter.FADING_EDGE_VERTICAL;
+ @Bindable
+ private int mScrollbarDefaultDelayBeforeFade = 300;
+ @Bindable
+ private int mScrollbarFadeDuration = 400;
+ @Bindable
+ private int mScrollbarSize = 10;
+ @Bindable
+ private int mScrollbarStyle = View.SCROLLBARS_INSIDE_OVERLAY;
+ @Bindable
+ private float mTransformPivotX = 9;
+ @Bindable
+ private float mTransformPivotY = 8;
+ @Bindable
+ private int mPadding = 11;
+ @Bindable
+ private int mPaddingBottom = 12;
+ @Bindable
+ private int mPaddingTop = 13;
+ @Bindable
+ private int mPaddingLeft = 14;
+ @Bindable
+ private int mPaddingRight = 15;
+ @Bindable
+ private int mPaddingStart = 16;
+ @Bindable
+ private int mPaddingEnd = 17;
+
+ public int getBackgroundTint() {
+ return mBackgroundTint;
+ }
+
+ public int getScrollbarFadeDuration() {
+ return mScrollbarFadeDuration;
+ }
+
+ public boolean getFadeScrollbars() {
+ return mFadeScrollbars;
+ }
+
+ public int getNextFocusDown() {
+ return mNextFocusDown;
+ }
+
+ public int getNextFocusForward() {
+ return mNextFocusForward;
+ }
+
+ public int getNextFocusLeft() {
+ return mNextFocusLeft;
+ }
+
+ public int getNextFocusRight() {
+ return mNextFocusRight;
+ }
+
+ public int getNextFocusUp() {
+ return mNextFocusUp;
+ }
+
+ public int getRequiresFadingEdge() {
+ return mRequiresFadingEdge;
+ }
+
+ public int getScrollbarDefaultDelayBeforeFade() {
+ return mScrollbarDefaultDelayBeforeFade;
+ }
+
+ public int getScrollbarSize() {
+ return mScrollbarSize;
+ }
+
+ public int getScrollbarStyle() {
+ return mScrollbarStyle;
+ }
+
+ public float getTransformPivotX() {
+ return mTransformPivotX;
+ }
+
+ public float getTransformPivotY() {
+ return mTransformPivotY;
+ }
+
+ public int getPadding() {
+ return mPadding;
+ }
+
+ public int getPaddingBottom() {
+ return mPaddingBottom;
+ }
+
+ public int getPaddingEnd() {
+ return mPaddingEnd;
+ }
+
+ public int getPaddingLeft() {
+ return mPaddingLeft;
+ }
+
+ public int getPaddingRight() {
+ return mPaddingRight;
+ }
+
+ public int getPaddingStart() {
+ return mPaddingStart;
+ }
+
+ public int getPaddingTop() {
+ return mPaddingTop;
+ }
+
+ public void changeValues() {
+ mBackgroundTint = 0xFFFF0000;
+ mFadeScrollbars = true;
+ mNextFocusForward = R.id.paddingStartEnd;
+ mNextFocusLeft = R.id.paddingTopBottom;
+ mNextFocusRight = R.id.backgroundTint;
+ mNextFocusUp = R.id.fadeScrollbars;
+ mNextFocusDown = R.id.padding;
+ mRequiresFadingEdge = ViewBindingAdapter.FADING_EDGE_HORIZONTAL;
+ mScrollbarDefaultDelayBeforeFade = 400;
+ mScrollbarFadeDuration = 500;
+ mScrollbarSize = 11;
+ mScrollbarStyle = View.SCROLLBARS_INSIDE_INSET;
+ mTransformPivotX = 7;
+ mTransformPivotY = 6;
+ mPadding = 110;
+ mPaddingBottom = 120;
+ mPaddingTop = 130;
+ mPaddingLeft = 140;
+ mPaddingRight = 150;
+ mPaddingStart = 160;
+ mPaddingEnd = 170;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewGroupBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewGroupBindingObject.java
new file mode 100644
index 0000000..f0ee752
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewGroupBindingObject.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+
+import android.binding.Bindable;
+
+public class ViewGroupBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private boolean mAlwaysDrawnWithCache;
+ @Bindable
+ private boolean mAnimationCache;
+ @Bindable
+ private boolean mSplitMotionEvents;
+ @Bindable
+ private boolean mAnimateLayoutChanges;
+
+ public boolean isAlwaysDrawnWithCache() {
+ return mAlwaysDrawnWithCache;
+ }
+
+ public boolean isAnimationCache() {
+ return mAnimationCache;
+ }
+
+ public boolean isSplitMotionEvents() {
+ return mSplitMotionEvents;
+ }
+
+ public boolean isAnimateLayoutChanges() {
+ return mAnimateLayoutChanges;
+ }
+
+ public void changeValues() {
+ mAlwaysDrawnWithCache = true;
+ mAnimationCache = true;
+ mAnimateLayoutChanges = true;
+ mSplitMotionEvents = true;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewStubBindingObject.java b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewStubBindingObject.java
new file mode 100644
index 0000000..5b0774f
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/java/com/android/databinding/testapp/vo/ViewStubBindingObject.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * 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 com.android.databinding.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+import com.android.databinding.testapp.R;
+
+import android.binding.Bindable;
+
+public class ViewStubBindingObject extends BindingAdapterBindingObject {
+ @Bindable
+ private int mLayout = R.layout.table_layout_adapter_test;
+
+ public int getLayout() {
+ return mLayout;
+ }
+
+ public void changeValues() {
+ mLayout = R.layout.auto_complete_text_view_adapter_test;
+ notifyChange();
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-hdpi/ic_launcher.png b/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..96a442e
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-mdpi/ic_launcher.png b/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..359047d
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-xhdpi/ic_launcher.png b/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..71c6d76
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4df1894
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout-land/multi_res_layout.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout-land/multi_res_layout.xml
new file mode 100644
index 0000000..caf0389
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout-land/multi_res_layout.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:bind="http://schemas.android.com/apk/res-auto"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="objectInLand" type="com.android.databinding.testapp.vo.NotBindableVo"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/objectInLandTextView"
+ android:text="@{objectInLand.stringValue}"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/objectInDefaultTextView"
+ android:text="@{objectInDefault.stringValue}"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/objectInDefaultTextView2"
+ android:text="@{objectInDefault.stringValue}"/>
+
+ <include layout="@layout/included_layout" android:id="@+id/includedLayoutConflict"
+ bind:innerObject="@{objectInLand}"
+ bind:innerValue="@{`modified ` + objectInLand.intValue}"
+ />
+ <include layout="@layout/basic_binding" android:id="@+id/includedLayoutShared"
+ bind:a="@{objectInDefault.stringValue}"
+ />
+ <include layout="@layout/conditional_binding" android:id="@+id/includedLayoutLand"
+ bind:obj2="@{objectInDefault}"
+ />
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_list_view_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_list_view_adapter_test.xml
new file mode 100644
index 0000000..5f81f37
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_list_view_adapter_test.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ListView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:listSelector="@{obj.listSelector}"
+ android:scrollingCache="@{obj.scrollingCache}"
+ android:smoothScrollbar="@{obj.smoothScrollbar}"
+ >
+ <variable name="obj" type="com.android.databinding.testapp.vo.AbsListViewBindingObject"/>
+</ListView> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_seek_bar_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_seek_bar_adapter_test.xml
new file mode 100644
index 0000000..ee1e645
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_seek_bar_adapter_test.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.AbsSeekBarBindingObject"/>
+ <SeekBar android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:thumbTint="@{obj.thumbTint}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_spinner_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_spinner_adapter_test.xml
new file mode 100644
index 0000000..840eb04
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/abs_spinner_adapter_test.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.AbsSpinnerBindingObject"/>
+ <Spinner android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:entries="@{obj.entries}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/auto_complete_text_view_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/auto_complete_text_view_adapter_test.xml
new file mode 100644
index 0000000..9bbbe81
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/auto_complete_text_view_adapter_test.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.AutoCompleteTextViewBindingObject"/>
+ <AutoCompleteTextView android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:completionThreshold="@{obj.completionThreshold}"
+ android:popupBackground="@{obj.popupBackground}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/basic_binding.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/basic_binding.xml
new file mode 100644
index 0000000..d59f1d0
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/basic_binding.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:bind="http://schemas.android.com/apk/res-auto"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="a" type="String"/>
+ <variable name="b" type="String"/>
+ <TextView
+ android:id="@+id/textView"
+ android:text="@{a + b}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/basic_dependant_binding.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/basic_dependant_binding.xml
new file mode 100644
index 0000000..f6478c1
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/basic_dependant_binding.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:bind="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj1" type="com.android.databinding.testapp.vo.NotBindableVo"/>
+ <variable name="obj2" type="com.android.databinding.testapp.vo.NotBindableVo"/>
+ <TextView
+ android:id="@+id/textView1"
+ android:text="@{obj1.stringValue}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ <TextView
+ android:id="@+id/textView2"
+ android:text="@{obj2.stringValue}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ <TextView
+ android:id="@+id/mergedTextView1"
+ android:text="@{obj1.mergeStringFields(obj2)}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ <TextView
+ android:id="@+id/mergedTextView2"
+ android:text="@{obj2.mergeStringFields(obj1)}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <TextView
+ android:id="@+id/rawStringMerge"
+ android:text="@{obj1.stringValue + obj2.stringValue}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bind_to_final.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bind_to_final.xml
new file mode 100644
index 0000000..4bf6263
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bind_to_final.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.PublicFinalTestVo"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/text_view"
+ android:text="@{obj.myField}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bind_to_final_observable.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bind_to_final_observable.xml
new file mode 100644
index 0000000..38c7cc2
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bind_to_final_observable.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.PublicFinalWithObservableTestVo"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/text_view"
+ android:text="@{obj.myFinalVo.val}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bracket_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bracket_test.xml
new file mode 100644
index 0000000..07a99d1
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/bracket_test.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ >
+ <variable name="array" type="String[]"/>
+ <variable name="sparseArray" type="android.util.SparseArray&lt;String>"/>
+ <variable name="sparseBooleanArray" type="android.util.SparseBooleanArray"/>
+ <variable name="sparseIntArray" type="android.util.SparseIntArray"/>
+ <variable name="sparseLongArray" type="android.util.SparseLongArray"/>
+ <variable name="longSparseArray" type="android.util.LongSparseArray&lt;String>"/>
+
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/arrayText"
+ android:text="@{array[0]}"/>
+
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/sparseArrayText"
+ android:text='@{sparseArray[0]}'/>
+
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/sparseBooleanArrayText"
+ android:text='@{"" + sparseBooleanArray[0]}'/>
+
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/sparseIntArrayText"
+ android:text='@{"" + sparseIntArray[0]}'/>
+
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/sparseLongArrayText"
+ android:text='@{"" + sparseLongArray[0]}'/>
+
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/longSparseArrayText"
+ android:text='@{longSparseArray[0]}'/>
+
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/cast_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/cast_test.xml
new file mode 100644
index 0000000..e8d3c48
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/cast_test.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <import type="java.util.Collection"/>
+ <import type="java.util.ArrayList"/>
+ <import type="java.util.Map"/>
+ <variable name="list" type="Collection&lt;String&gt;"/>
+ <variable name="map" type="Object"/>
+
+ <TextView
+ android:id="@+id/textView0"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{((ArrayList&lt;String&gt;)list)[0]}"/>
+ <TextView
+ android:id="@+id/textView1"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{((Map&lt;String, String&gt;)map)[`hello`]}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/checked_text_view_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/checked_text_view_adapter_test.xml
new file mode 100644
index 0000000..431418b
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/checked_text_view_adapter_test.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.CheckedTextViewBindingObject"/>
+ <CheckedTextView
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:checkMark="@{obj.checkMark}"
+ android:checkMarkTint="@{obj.checkMarkTint}"/>
+
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/compound_button_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/compound_button_adapter_test.xml
new file mode 100644
index 0000000..021b3e6
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/compound_button_adapter_test.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.CompoundButtonBindingObject"/>
+ <CheckBox
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:buttonTint="@{obj.buttonTint}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/conditional_binding.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/conditional_binding.xml
new file mode 100644
index 0000000..f8d3012
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/conditional_binding.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:bind="http://schemas.android.com/apk/res-auto"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj1" type="com.android.databinding.testapp.vo.NotBindableVo"/>
+ <variable name="obj2" type="com.android.databinding.testapp.vo.NotBindableVo"/>
+ <variable name="obj3" type="com.android.databinding.testapp.vo.NotBindableVo"/>
+ <variable name="cond1" type="boolean"/>
+ <variable name="cond2" type="boolean"/>
+ <TextView
+ android:id="@+id/textView"
+ android:text="@{cond1 ? cond2 ? obj1.stringValue : obj2.stringValue : obj3.stringValue}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/find_method_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/find_method_test.xml
new file mode 100644
index 0000000..25c8c91
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/find_method_test.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.FindMethodBindingObject"/>
+ <import type="com.android.databinding.testapp.vo.FindMethodBindingObject.Bar"/>
+ <variable name="obj2" type="Bar&lt;String&gt;"/>
+ <import type="com.android.databinding.testapp.vo.FindMethodBindingObject"/>
+ <import type="com.android.databinding.testapp.vo.FindMethodBindingObject" alias="FMBO"/>
+ <TextView
+ android:id="@+id/textView0"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{obj.method(1)}"/>
+ <TextView
+ android:id="@+id/textView1"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{obj.method(1.25f}"/>
+ <TextView
+ android:id="@+id/textView2"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{obj.method(`hello`}"/>
+ <TextView
+ android:id="@+id/textView3"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{obj.method((java.lang.Integer) 1)}"/>
+ <TextView
+ android:id="@+id/textView4"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{obj.inheritedMethod()}"/>
+ <TextView
+ android:id="@+id/textView5"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{obj.inheritedMethod(2)}"/>
+ <TextView
+ android:id="@+id/textView6"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{obj.method()}"/>
+ <TextView
+ android:id="@+id/textView7"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{com.android.databinding.testapp.vo.FindMethodBindingObject.staticMethod()}"/>
+ <TextView
+ android:id="@+id/textView8"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{com.android.databinding.testapp.vo.FindMethodBindingObject.foo.bar}"/>
+ <TextView
+ android:id="@+id/textView9"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{FindMethodBindingObject.staticMethod()}"/>
+ <TextView
+ android:id="@+id/textView10"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{FindMethodBindingObject.foo.bar}"/>
+ <TextView
+ android:id="@+id/textView11"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{FMBO.staticMethod()}"/>
+ <TextView
+ android:id="@+id/textView12"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{FMBO.foo.bar}"/>
+ <!-- The following are just to test duplicate expressions -->
+ <TextView
+ android:id="@+id/textView13"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{FMBO.staticMethod()}"/>
+ <TextView
+ android:id="@+id/textView14"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{FMBO.foo.bar}"/>
+ <!-- Imported classes -->
+ <TextView
+ android:id="@+id/textView15"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{obj2.method(`hello`)}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/frame_layout_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/frame_layout_adapter_test.xml
new file mode 100644
index 0000000..253287b
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/frame_layout_adapter_test.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.FrameLayoutBindingObject"/>
+ <FrameLayout
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:foregroundTint="@{obj.foregroundTint}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/image_view_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/image_view_adapter_test.xml
new file mode 100644
index 0000000..c79c8fc
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/image_view_adapter_test.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.ImageViewBindingObject"/>
+ <ImageView
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:src="@{obj.src}"
+ android:tint="@{obj.tint}"
+ android:tintMode="@{obj.tintMode}"
+ />
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/included_layout.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/included_layout.xml
new file mode 100644
index 0000000..8402154
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/included_layout.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:bind="http://schemas.android.com/apk/res-auto"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="innerObject" type="com.android.databinding.testapp.vo.NotBindableVo"/>
+ <variable name="innerValue" type="java.lang.String"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/innerTextView"
+ android:text="@{innerValue + innerObject.stringValue}"
+ />
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/layout_with_include.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/layout_with_include.xml
new file mode 100644
index 0000000..626f981
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/layout_with_include.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:bind="http://schemas.android.com/apk/res-auto"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="outerObject" type="com.android.databinding.testapp.vo.NotBindableVo"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/outerTextView"
+ android:text="@{outerObject.stringValue}"/>
+ <!-- TODO test id collision-->
+ <include layout="@layout/included_layout" android:id="@+id/includedLayout"
+ bind:innerObject="@{outerObject}"
+ bind:innerValue="@{`modified ` + outerObject.intValue}"
+ />
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/linear_layout_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/linear_layout_adapter_test.xml
new file mode 100644
index 0000000..f5775a0
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/linear_layout_adapter_test.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.LinearLayoutBindingObject"/>
+ <LinearLayout
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:orientation="horizontal"
+ android:divider="@{obj.divider}"
+ android:measureWithLargestChild="@{obj.measureWithLargestChild}"
+ />
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/multi_res_layout.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/multi_res_layout.xml
new file mode 100644
index 0000000..1d153ed
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/multi_res_layout.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:bind="http://schemas.android.com/apk/res-auto"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="objectInDefault" type="com.android.databinding.testapp.vo.NotBindableVo"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/objectInDefaultTextView"
+ android:text="@{objectInDefault.stringValue}"/>
+ <EditText android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/objectInDefaultTextView2"
+ android:text="@{objectInDefault.stringValue}"/>
+
+ <include layout="@layout/basic_binding" android:id="@+id/includedLayoutConflict"
+ bind:a="@{objectInDefault.stringValue}"
+ />
+ <include layout="@layout/basic_binding" android:id="@+id/includedLayoutShared"
+ bind:a="@{objectInDefault.stringValue}"
+ />
+ <include layout="@layout/conditional_binding" android:id="@+id/includedLayoutPort"
+ bind:cond1="@{objectInDefault == null}"
+ />
+
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/new_api_layout.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/new_api_layout.xml
new file mode 100644
index 0000000..686676b
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/new_api_layout.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/myContainer"
+ android:addChildrenForAccessibility="@{children}"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="elevation" type="float"/>
+ <variable name="name" type="java.lang.String"/>
+ <variable name="children" type="java.util.ArrayList&lt;android.view.View>"/>
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/textView"
+ android:text="@{name}" android:elevation="@{elevation}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/no_id_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/no_id_test.xml
new file mode 100644
index 0000000..ec513ea
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/no_id_test.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="@{orientation}"
+ >
+ <variable name="name" type="String"/>
+ <variable name="orientation" type="int"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{name}" android:tag="hello world"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{name}"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{name}" android:tag="@string/app_name"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@{name}" android:tag="@android:string/ok"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/observable_field_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/observable_field_test.xml
new file mode 100644
index 0000000..61dff3e
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/observable_field_test.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.ObservableFieldBindingObject"/>
+ <TextView
+ android:id="@+id/bField"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{`` + obj.bField}"/>
+ <TextView
+ android:id="@+id/tField"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{`` + obj.tField}"/>
+ <TextView
+ android:id="@+id/sField"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{`` + obj.sField}"/>
+ <TextView
+ android:id="@+id/cField"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{`` + obj.cField}"/>
+ <TextView
+ android:id="@+id/iField"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{`` + obj.iField}"/>
+ <TextView
+ android:id="@+id/lField"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{`` + obj.lField}"/>
+ <TextView
+ android:id="@+id/fField"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{`` + obj.fField}"/>
+ <TextView
+ android:id="@+id/dField"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{`` + obj.dField}"/>
+ <TextView
+ android:id="@+id/oField"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{obj.oField}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/observable_with_not_bindable_field.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/observable_with_not_bindable_field.xml
new file mode 100644
index 0000000..5f27399
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/observable_with_not_bindable_field.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.ObservableWithNotBindableFieldObject"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/text_view"
+ android:text="@{obj.data}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/progress_bar_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/progress_bar_adapter_test.xml
new file mode 100644
index 0000000..0ccd17f
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/progress_bar_adapter_test.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.ProgressBarBindingObject"/>
+ <ProgressBar
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:indeterminateTint="@{obj.indeterminateTint}"
+ android:progressTint="@{obj.progressTint}"
+ android:secondaryProgressTint="@{obj.secondaryProgressTint}"
+ />
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/radio_group_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/radio_group_adapter_test.xml
new file mode 100644
index 0000000..da20f3d
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/radio_group_adapter_test.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.RadioGroupBindingObject"/>
+ <RadioGroup
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:checkedButton="@{obj.checkedButton}"
+ >
+ <RadioButton android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:text="One" android:id="@+id/choiceOne"/>
+ <RadioButton android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:text="Two" android:id="@+id/choiceTwo"/>
+ </RadioGroup>
+
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/resource_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/resource_test.xml
new file mode 100644
index 0000000..dd59771
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/resource_test.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ >
+ <variable name="count" type="int"/>
+ <variable name="title" type="String"/>
+ <variable name="lastName" type="String"/>
+ <variable name="base" type="int"/>
+ <variable name="pbase" type="int"/>
+
+ <TextView
+ android:id="@+id/textView0"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{@string/nameWithTitle(title, lastName)}"/>
+
+ <TextView
+ android:id="@+id/textView1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{@plurals/orange(count)}"/>
+ <TextView
+ android:id="@+id/fractionNoParameters"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{`` + @fraction/myFraction}"/>
+ <TextView
+ android:id="@+id/fractionOneParameter"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{`` + @fraction/myFraction(base)}"/>
+ <TextView
+ android:id="@+id/fractionTwoParameters"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{`` + @fraction/myParentFraction(base, pbase)}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/spinner_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/spinner_adapter_test.xml
new file mode 100644
index 0000000..1c50b2e
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/spinner_adapter_test.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.SpinnerBindingObject"/>
+ <Spinner
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:popupBackground="@{obj.popupBackground}"
+ />
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/switch_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/switch_adapter_test.xml
new file mode 100644
index 0000000..6989d16
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/switch_adapter_test.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.SwitchBindingObject"/>
+ <Switch
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:thumb="@{obj.thumb}"
+ android:track="@{obj.track}"
+ />
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/tab_widget_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/tab_widget_adapter_test.xml
new file mode 100644
index 0000000..fcb9995
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/tab_widget_adapter_test.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.TabWidgetBindingObject"/>
+ <TabWidget android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:divider="@{obj.divider}"
+ android:tabStripEnabled="@{obj.tabStripEnabled}"
+ android:tabStripLeft="@{obj.tabStripLeft}"
+ android:tabStripRight="@{obj.tabStripRight}"
+ />
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/table_layout_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/table_layout_adapter_test.xml
new file mode 100644
index 0000000..112dc9c
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/table_layout_adapter_test.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.TableLayoutBindingObject"/>
+ <TableLayout
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:divider="@{obj.divider}"
+ android:collapseColumns="@{obj.collapseColumns}"
+ android:shrinkColumns="@{obj.shrinkColumns}"
+ android:stretchColumns="@{obj.stretchColumns}"
+ >
+ <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="Hello"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="Happy"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="World"/>
+ </TableRow>
+ <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="Goodbye"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="Cruel"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="World"/>
+ </TableRow>
+ </TableLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/text_view_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/text_view_adapter_test.xml
new file mode 100644
index 0000000..c030cc7
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/text_view_adapter_test.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.TextViewBindingObject"/>
+ <TextView android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/numericText"
+ android:numeric="@{obj.numeric}"
+ />
+ <TextView android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/textDrawableNormal"
+ android:drawableBottom="@{obj.drawableBottom}"
+ android:drawableLeft="@{obj.drawableLeft}"
+ android:drawableRight="@{obj.drawableRight}"
+ android:drawableTop="@{obj.drawableTop}"
+ />
+ <TextView android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/textDrawableStartEnd"
+ android:drawableStart="@{obj.drawableStart}"
+ android:drawableEnd="@{obj.drawableEnd}"
+ />
+ <TextView android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/textView"
+ android:autoLink="@{obj.autoLink}"
+ android:drawablePadding="@{obj.drawablePadding}"
+ android:scrollHorizontally="@{obj.scrollHorizontally}"
+ android:textColorHighlight="@{obj.textColorHighlight}"
+ android:textColorHint="@{obj.textColorHint}"
+ android:textColorLink="@{obj.textColorLink}"
+ android:autoText="@{obj.autoText}"
+ android:capitalize="@{obj.capitalize}"
+ android:imeActionLabel="@{obj.imeActionLabel}"
+ android:imeActionId="@{obj.imeActionId}"
+ android:lineSpacingExtra="@{obj.lineSpacingExtra}"
+ android:lineSpacingMultiplier="@{obj.lineSpacingMultiplier}"
+ android:maxLength="@{obj.maxLength}"
+ android:shadowColor="@{obj.shadowColor}"
+ android:shadowDx="@{obj.shadowDx}"
+ android:shadowDy="@{obj.shadowDy}"
+ android:shadowRadius="@{obj.shadowRadius}"
+ android:textSize="@{obj.textSize}"
+ />
+ <TextView android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/textAllCaps"
+ android:textAllCaps="@{obj.textAllCaps}"
+ />
+ <TextView android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/textBufferType"
+ android:bufferType="@{obj.bufferType}"
+ />
+ <TextView android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/textInputType"
+ android:inputType="@{obj.inputType}"
+ />
+ <TextView android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/textDigits"
+ android:digits="@{obj.digits}"
+ />
+ <TextView android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/textPhoneNumber"
+ android:phoneNumber="@{obj.phoneNumber}"
+ />
+ <TextView android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/textInputMethod"
+ android:inputMethod="@{obj.inputMethod}"
+ />
+
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_adapter_test.xml
new file mode 100644
index 0000000..037869f
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_adapter_test.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ >
+ <variable name="obj" type="com.android.databinding.testapp.vo.ViewBindingObject"/>
+ <View
+ android:id="@+id/padding"
+ android:layout_width="10dp"
+ android:layout_height="10dp"
+ android:padding="@{obj.padding}"
+ />
+ <View
+ android:id="@+id/paddingStartEnd"
+ android:layout_width="10dp"
+ android:layout_height="10dp"
+ android:paddingEnd="@{obj.paddingEnd}"
+ android:paddingStart="@{obj.paddingStart}"
+ />
+ <View
+ android:id="@+id/paddingTopBottom"
+ android:layout_width="10dp"
+ android:layout_height="10dp"
+ android:paddingBottom="@{obj.paddingBottom}"
+ android:paddingTop="@{obj.paddingTop}"
+ />
+ <View
+ android:id="@+id/paddingLeftRight"
+ android:layout_width="10dp"
+ android:layout_height="10dp"
+ android:paddingLeft="@{obj.paddingLeft}"
+ android:paddingRight="@{obj.paddingRight}"
+ />
+ <View
+ android:id="@+id/backgroundTint"
+ android:backgroundTint="@{obj.backgroundTint}"
+ android:layout_width="10dp"
+ android:layout_height="10dp"/>
+ <View
+ android:id="@+id/fadeScrollbars"
+ android:fadeScrollbars="@{obj.fadeScrollbars}"
+ android:layout_width="10dp"
+ android:layout_height="10dp"/>
+ <View
+ android:id="@+id/nextFocus"
+ android:nextFocusForward="@{obj.nextFocusForward}"
+ android:nextFocusLeft="@{obj.nextFocusLeft}"
+ android:nextFocusRight="@{obj.nextFocusRight}"
+ android:nextFocusUp="@{obj.nextFocusUp}"
+ android:nextFocusDown="@{obj.nextFocusDown}"
+ android:layout_width="10dp"
+ android:layout_height="10dp"/>
+ <View
+ android:id="@+id/requiresFadingEdge"
+ android:requiresFadingEdge="@{obj.requiresFadingEdge}"
+ android:layout_width="10dp"
+ android:layout_height="10dp"/>
+ <View
+ android:id="@+id/scrollbar"
+ android:scrollbarDefaultDelayBeforeFade="@{obj.scrollbarDefaultDelayBeforeFade}"
+ android:scrollbarFadeDuration="@{obj.scrollbarFadeDuration}"
+ android:scrollbarSize="@{obj.scrollbarSize}"
+ android:scrollbarStyle="@{obj.scrollbarStyle}"
+ android:layout_width="10dp"
+ android:layout_height="10dp"/>
+ <View
+ android:id="@+id/transformPivot"
+ android:transformPivotX="@{obj.transformPivotX}"
+ android:transformPivotY="@{obj.transformPivotY}"
+ android:layout_width="10dp"
+ android:layout_height="10dp"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_group_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_group_adapter_test.xml
new file mode 100644
index 0000000..36f9dca
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_group_adapter_test.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.ViewGroupBindingObject"/>
+ <FrameLayout android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:alwaysDrawnWithCache="@{obj.alwaysDrawnWithCache}"
+ android:animationCache="@{obj.animationCache}"
+ android:splitMotionEvents="@{obj.splitMotionEvents}"
+ android:animateLayoutChanges="@{obj.animateLayoutChanges}"
+ />
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_stub_adapter_test.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_stub_adapter_test.xml
new file mode 100644
index 0000000..3011883
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/layout/view_stub_adapter_test.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.ViewStubBindingObject"/>
+ <ViewStub android:layout_width="match_parent" android:layout_height="match_parent"
+ android:id="@+id/view"
+ android:layout="@{obj.layout}"/>
+</LinearLayout> \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/values-v21/styles.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 0000000..0a2c6be
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<resources>
+ <style name="AppTheme" parent="android:Theme.Material.Light">
+ </style>
+</resources>
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/values/fractions.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/values/fractions.xml
new file mode 100644
index 0000000..8817316
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/values/fractions.xml
@@ -0,0 +1,20 @@
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<resources>
+
+ <!-- Base application theme. -->
+ <fraction name="myFraction">150%</fraction>
+ <fraction name="myParentFraction">300%p</fraction>
+
+</resources>
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/values/strings.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..e53e327
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/values/strings.xml
@@ -0,0 +1,22 @@
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<resources>
+ <string name="app_name">TestApp</string>
+ <string name="rain">Rain</string>
+ <string name="nameWithTitle">%1$s %2$s</string>
+ <plurals name="orange">
+ <item quantity="one">orange</item>
+ <item quantity="other">oranges</item>
+ </plurals>
+</resources>
diff --git a/tools/data-binding/integration-tests/TestApp/app/src/main/res/values/styles.xml b/tools/data-binding/integration-tests/TestApp/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..c0d5471
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/app/src/main/res/values/styles.xml
@@ -0,0 +1,21 @@
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~ 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.
+ -->
+
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="android:Theme.Holo">
+ <!-- Customize your theme here. -->
+ </style>
+
+</resources>
diff --git a/tools/data-binding/integration-tests/TestApp/build.gradle b/tools/data-binding/integration-tests/TestApp/build.gradle
new file mode 100644
index 0000000..c603029
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/build.gradle
@@ -0,0 +1,29 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+ext {
+ snapshotVersion = "0.3-SNAPSHOT"
+ androidPluginVersion = "1.0.0"
+}
+
+buildscript {
+ repositories {
+ jcenter()
+ maven {
+ url "$projectDir/../../maven-repo"
+ }
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.1.3'
+ classpath "com.android.databinding:dataBinder:0.3-SNAPSHOT"
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ maven {
+ url "$projectDir/../../../maven-repo"
+ }
+ }
+}
diff --git a/tools/data-binding/integration-tests/TestApp/gradle.properties b/tools/data-binding/integration-tests/TestApp/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true \ No newline at end of file
diff --git a/tools/data-binding/integration-tests/TestApp/gradle/wrapper/gradle-wrapper.jar b/tools/data-binding/integration-tests/TestApp/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/tools/data-binding/integration-tests/TestApp/gradle/wrapper/gradle-wrapper.properties b/tools/data-binding/integration-tests/TestApp/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..0c71e76
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Apr 10 15:27:10 PDT 2013
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
diff --git a/tools/data-binding/integration-tests/TestApp/gradlew b/tools/data-binding/integration-tests/TestApp/gradlew
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/tools/data-binding/integration-tests/TestApp/gradlew.bat b/tools/data-binding/integration-tests/TestApp/gradlew.bat
new file mode 100644
index 0000000..aec9973
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/tools/data-binding/integration-tests/TestApp/settings.gradle b/tools/data-binding/integration-tests/TestApp/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/tools/data-binding/integration-tests/TestApp/settings.gradle
@@ -0,0 +1 @@
+include ':app'