summaryrefslogtreecommitdiff
path: root/integration-tests/IndependentLibrary/app
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests/IndependentLibrary/app')
-rw-r--r--integration-tests/IndependentLibrary/app/.gitignore1
-rw-r--r--integration-tests/IndependentLibrary/app/build.gradle60
-rw-r--r--integration-tests/IndependentLibrary/app/proguard-rules.pro17
-rw-r--r--integration-tests/IndependentLibrary/app/src/androidTest/java/com/android/databinding/test/independentlibrary/ApplicationTest.java29
-rw-r--r--integration-tests/IndependentLibrary/app/src/androidTest/java/com/android/databinding/test/independentlibrary/LibraryActivityTest.java41
-rw-r--r--integration-tests/IndependentLibrary/app/src/main/AndroidManifest.xml24
-rw-r--r--integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/LibraryActivity.java36
-rw-r--r--integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/LibraryAdapter.java26
-rw-r--r--integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/vo/MyBindableObject.java36
-rw-r--r--integration-tests/IndependentLibrary/app/src/main/res/layout/library_layout.xml25
-rw-r--r--integration-tests/IndependentLibrary/app/src/main/res/values/strings.xml18
11 files changed, 313 insertions, 0 deletions
diff --git a/integration-tests/IndependentLibrary/app/.gitignore b/integration-tests/IndependentLibrary/app/.gitignore
new file mode 100644
index 00000000..796b96d1
--- /dev/null
+++ b/integration-tests/IndependentLibrary/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/integration-tests/IndependentLibrary/app/build.gradle b/integration-tests/IndependentLibrary/app/build.gradle
new file mode 100644
index 00000000..552e1a52
--- /dev/null
+++ b/integration-tests/IndependentLibrary/app/build.gradle
@@ -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.
+ */
+apply plugin: 'maven'
+apply plugin: 'com.android.library'
+apply plugin: 'com.android.databinding'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "21.1.2"
+
+ defaultConfig {
+ 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'
+ exclude 'META-INF/LICENSE.txt'
+ exclude 'META-INF/NOTICE.txt'
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile "com.android.databinding:library:${config.snapshotVersion}"
+ provided "com.android.databinding:annotationprocessor:${config.snapshotVersion}"
+}
+
+uploadArchives {
+ repositories {
+ mavenDeployer {
+ repository(url: "file://${config.mavenRepoDir}")
+ pom.artifactId = 'independent-library'
+ pom.version = config.snapshotVersion
+ pom.groupId = config.testGroup
+ }
+ }
+}
+
+connectedCheck.dependsOn uploadArchives \ No newline at end of file
diff --git a/integration-tests/IndependentLibrary/app/proguard-rules.pro b/integration-tests/IndependentLibrary/app/proguard-rules.pro
new file mode 100644
index 00000000..b7210d1d
--- /dev/null
+++ b/integration-tests/IndependentLibrary/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/integration-tests/IndependentLibrary/app/src/androidTest/java/com/android/databinding/test/independentlibrary/ApplicationTest.java b/integration-tests/IndependentLibrary/app/src/androidTest/java/com/android/databinding/test/independentlibrary/ApplicationTest.java
new file mode 100644
index 00000000..0b267a3a
--- /dev/null
+++ b/integration-tests/IndependentLibrary/app/src/androidTest/java/com/android/databinding/test/independentlibrary/ApplicationTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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.test.independentlibrary;
+
+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/integration-tests/IndependentLibrary/app/src/androidTest/java/com/android/databinding/test/independentlibrary/LibraryActivityTest.java b/integration-tests/IndependentLibrary/app/src/androidTest/java/com/android/databinding/test/independentlibrary/LibraryActivityTest.java
new file mode 100644
index 00000000..939d1bae
--- /dev/null
+++ b/integration-tests/IndependentLibrary/app/src/androidTest/java/com/android/databinding/test/independentlibrary/LibraryActivityTest.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.test.independentlibrary;
+
+import android.test.ActivityInstrumentationTestCase2;
+import android.view.View;
+import android.widget.TextView;
+
+public class LibraryActivityTest extends ActivityInstrumentationTestCase2<LibraryActivity> {
+ public LibraryActivityTest() {
+ super(LibraryActivity.class);
+ }
+
+ public void testTextViewContents() throws Throwable {
+ final LibraryActivity activity = getActivity();
+ assertNotNull("test sanity", activity);
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ TextView textView = (TextView) activity.findViewById(R.id.fooTextView);
+ final String expected = LibraryActivity.FIELD_VALUE + " " +
+ LibraryActivity.FIELD_VALUE;
+ assertEquals(expected, textView.getText().toString());
+ }
+ });
+ }
+}
diff --git a/integration-tests/IndependentLibrary/app/src/main/AndroidManifest.xml b/integration-tests/IndependentLibrary/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..ff2388c2
--- /dev/null
+++ b/integration-tests/IndependentLibrary/app/src/main/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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.test.independentlibrary">
+
+ <application android:allowBackup="true"
+ android:label="@string/app_name">
+ <activity android:name=".LibraryActivity"/>
+ </application>
+
+</manifest>
diff --git a/integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/LibraryActivity.java b/integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/LibraryActivity.java
new file mode 100644
index 00000000..2d2e0240
--- /dev/null
+++ b/integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/LibraryActivity.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.test.independentlibrary;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+import com.android.databinding.test.independentlibrary.vo.MyBindableObject;
+import com.android.databinding.test.independentlibrary.generated.LibraryLayoutBinding;
+public class LibraryActivity extends Activity {
+ public static final String FIELD_VALUE = "BAR";
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ LibraryLayoutBinding binding = LibraryLayoutBinding.inflate(this);
+ setContentView(binding.getRoot());
+ MyBindableObject object = new MyBindableObject();
+ object.setField(FIELD_VALUE);
+ binding.setFoo(object);
+ binding.executePendingBindings();
+ }
+}
diff --git a/integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/LibraryAdapter.java b/integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/LibraryAdapter.java
new file mode 100644
index 00000000..e7a2ea65
--- /dev/null
+++ b/integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/LibraryAdapter.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.test.independentlibrary;
+
+import android.binding.BindingAdapter;
+import android.view.View;
+
+public class LibraryAdapter {
+ @BindingAdapter("myTagAttr")
+ public static void set(View view, String someTag) {
+ view.setTag(someTag);
+ }
+}
diff --git a/integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/vo/MyBindableObject.java b/integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/vo/MyBindableObject.java
new file mode 100644
index 00000000..c4c5cc8b
--- /dev/null
+++ b/integration-tests/IndependentLibrary/app/src/main/java/com/android/databinding/test/independentlibrary/vo/MyBindableObject.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.test.independentlibrary.vo;
+
+import com.android.databinding.library.BaseObservable;
+import com.android.databinding.test.independentlibrary.BR;
+
+import android.binding.Bindable;
+
+public class MyBindableObject extends BaseObservable {
+ @Bindable
+ private String mField;
+
+ public String getField() {
+ return mField;
+ }
+
+ public void setField(String field) {
+ mField = field;
+ notifyPropertyChanged(BR.field);
+ }
+}
diff --git a/integration-tests/IndependentLibrary/app/src/main/res/layout/library_layout.xml b/integration-tests/IndependentLibrary/app/src/main/res/layout/library_layout.xml
new file mode 100644
index 00000000..a7ba2857
--- /dev/null
+++ b/integration-tests/IndependentLibrary/app/src/main/res/layout/library_layout.xml
@@ -0,0 +1,25 @@
+<?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="foo" type="com.android.databinding.test.independentlibrary.vo.MyBindableObject"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/fooTextView"
+ android:text='@{foo.field + " " + foo.field}'/>
+</LinearLayout> \ No newline at end of file
diff --git a/integration-tests/IndependentLibrary/app/src/main/res/values/strings.xml b/integration-tests/IndependentLibrary/app/src/main/res/values/strings.xml
new file mode 100644
index 00000000..8e6caf7b
--- /dev/null
+++ b/integration-tests/IndependentLibrary/app/src/main/res/values/strings.xml
@@ -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.
+ -->
+
+<resources>
+ <string name="app_name">IndependentLibrary</string>
+</resources>