diff options
Diffstat (limited to 'tools/data-binding/TestApp')
125 files changed, 0 insertions, 6565 deletions
diff --git a/tools/data-binding/TestApp/.gitignore b/tools/data-binding/TestApp/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/tools/data-binding/TestApp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/tools/data-binding/TestApp/build.gradle b/tools/data-binding/TestApp/build.gradle deleted file mode 100644 index aa4cd0d..0000000 --- a/tools/data-binding/TestApp/build.gradle +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ -buildscript { - repositories { - jcenter() - mavenLocal() - } - dependencies { - classpath "com.android.tools.build:gradle:$androidPluginVersion" - classpath "com.android.databinding:dataBinder:$version" - } -} -apply plugin: 'com.android.application' -apply plugin: 'com.android.databinding' - -repositories { - jcenter() -} - -android { - compileSdkVersion 21 - buildToolsVersion "21.1.0" - - defaultConfig { - applicationId "com.android.databinding.testapp" - minSdkVersion 8 - targetSdkVersion 21 - versionCode 1 - versionName "1.0" - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - 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 project(":library") - compile "com.android.support:support-v4:+" - provided project(":annotationprocessor") -} diff --git a/tools/data-binding/TestApp/proguard-rules.pro b/tools/data-binding/TestApp/proguard-rules.pro deleted file mode 100644 index 2913b9d..0000000 --- a/tools/data-binding/TestApp/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/yboyar/android/local-sdk/android-sdk_eng.yboyar_mac-x86/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/TestApp/src/androidTest/java/com/android/databinding/library/DataBinderTrojan.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/library/DataBinderTrojan.java deleted file mode 100644 index eeba4f2..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/library/DataBinderTrojan.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/AbsListViewBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/AbsListViewBindingAdapterTest.java deleted file mode 100644 index 0217e90..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/AbsListViewBindingAdapterTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.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/TestApp/src/androidTest/java/com/android/databinding/testapp/AbsSeekBarBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/AbsSeekBarBindingAdapterTest.java deleted file mode 100644 index abf842b..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/AbsSeekBarBindingAdapterTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/AbsSpinnerBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/AbsSpinnerBindingAdapterTest.java deleted file mode 100644 index 7478672..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/AbsSpinnerBindingAdapterTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ApplicationTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ApplicationTest.java deleted file mode 100644 index e1bbd42..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ApplicationTest.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/AutoCompleteTextViewBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/AutoCompleteTextViewBindingAdapterTest.java deleted file mode 100644 index ba7b4de..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/AutoCompleteTextViewBindingAdapterTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/BaseDataBinderTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BaseDataBinderTest.java deleted file mode 100644 index 80c2c94..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BaseDataBinderTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/BaseLandDataBinderTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BaseLandDataBinderTest.java deleted file mode 100644 index 0f983eb..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BaseLandDataBinderTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/BaseObservableTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BaseObservableTest.java deleted file mode 100644 index a740551..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BaseObservableTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/BasicBindingTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BasicBindingTest.java deleted file mode 100644 index a7ba223..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BasicBindingTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/BasicDependantBindingTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BasicDependantBindingTest.java deleted file mode 100644 index 3a7631b..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BasicDependantBindingTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/BindToFinalFieldTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BindToFinalFieldTest.java deleted file mode 100644 index 96ac989..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BindToFinalFieldTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/BindToFinalObservableFieldTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BindToFinalObservableFieldTest.java deleted file mode 100644 index c0aacd0..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BindToFinalObservableFieldTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/BindingAdapterTestBase.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BindingAdapterTestBase.java deleted file mode 100644 index bedfc00..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BindingAdapterTestBase.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/BracketTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BracketTest.java deleted file mode 100644 index a6dea10..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BracketTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/CastTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/CastTest.java deleted file mode 100644 index 0ea053f..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/CastTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/CheckedTextViewBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/CheckedTextViewBindingAdapterTest.java deleted file mode 100644 index ee88e6b..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/CheckedTextViewBindingAdapterTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/CompoundButtonBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/CompoundButtonBindingAdapterTest.java deleted file mode 100644 index 6570f87..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/CompoundButtonBindingAdapterTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ConditionalBindingTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ConditionalBindingTest.java deleted file mode 100644 index 4a39680..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ConditionalBindingTest.java +++ /dev/null @@ -1,34 +0,0 @@ -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/TestApp/src/androidTest/java/com/android/databinding/testapp/FindMethodTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/FindMethodTest.java deleted file mode 100644 index 4f19701..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/FindMethodTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/FrameLayoutBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/FrameLayoutBindingAdapterTest.java deleted file mode 100644 index 4f1a013..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/FrameLayoutBindingAdapterTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ImageViewBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ImageViewBindingAdapterTest.java deleted file mode 100644 index 1a23bc6..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ImageViewBindingAdapterTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/IncludeTagTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/IncludeTagTest.java deleted file mode 100644 index 7cff11f..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/IncludeTagTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/LandDataBinderTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/LandDataBinderTest.java deleted file mode 100644 index 218c799..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/LandDataBinderTest.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/LinearLayoutBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/LinearLayoutBindingAdapterTest.java deleted file mode 100644 index 3b44841..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/LinearLayoutBindingAdapterTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ListChangeRegistryTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ListChangeRegistryTest.java deleted file mode 100644 index 9a25082..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ListChangeRegistryTest.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/MapChangeRegistryTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/MapChangeRegistryTest.java deleted file mode 100644 index 1db9f51..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/MapChangeRegistryTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/NewApiTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/NewApiTest.java deleted file mode 100644 index 9b28237..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/NewApiTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/NoIdTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/NoIdTest.java deleted file mode 100644 index 93ed941..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/NoIdTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ObservableArrayListTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ObservableArrayListTest.java deleted file mode 100644 index a8d2f00..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ObservableArrayListTest.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ObservableArrayMapTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ObservableArrayMapTest.java deleted file mode 100644 index e793a02..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ObservableArrayMapTest.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ObservableFieldTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ObservableFieldTest.java deleted file mode 100644 index 5529696..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ObservableFieldTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ProcessBindableTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ProcessBindableTest.java deleted file mode 100644 index e7f430e..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ProcessBindableTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ProgressBarBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ProgressBarBindingAdapterTest.java deleted file mode 100644 index 86726b7..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ProgressBarBindingAdapterTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/PropertyChangeRegistryTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/PropertyChangeRegistryTest.java deleted file mode 100644 index 7b6197c..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/PropertyChangeRegistryTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/RadioGroupBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/RadioGroupBindingAdapterTest.java deleted file mode 100644 index c4bbc4c..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/RadioGroupBindingAdapterTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ResourceTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ResourceTest.java deleted file mode 100644 index 2770c46..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ResourceTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/SpinnerBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/SpinnerBindingAdapterTest.java deleted file mode 100644 index 50727b0..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/SpinnerBindingAdapterTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/SwitchBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/SwitchBindingAdapterTest.java deleted file mode 100644 index 2d136a6..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/SwitchBindingAdapterTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/TabWidgetBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/TabWidgetBindingAdapterTest.java deleted file mode 100644 index af0a74e..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/TabWidgetBindingAdapterTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/TableLayoutBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/TableLayoutBindingAdapterTest.java deleted file mode 100644 index 06d4d2c..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/TableLayoutBindingAdapterTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/TextViewBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/TextViewBindingAdapterTest.java deleted file mode 100644 index a026910..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/TextViewBindingAdapterTest.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ViewBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ViewBindingAdapterTest.java deleted file mode 100644 index 4bde05c..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ViewBindingAdapterTest.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ViewGroupBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ViewGroupBindingAdapterTest.java deleted file mode 100644 index acc7b01..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ViewGroupBindingAdapterTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/ViewStubBindingAdapterTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ViewStubBindingAdapterTest.java deleted file mode 100644 index c30ec20..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/ViewStubBindingAdapterTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/com/android/databinding/testapp/vo/ObservableWithNotBindableFieldObjectTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/com/android/databinding/testapp/vo/ObservableWithNotBindableFieldObjectTest.java deleted file mode 100644 index 31ea135..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/com/android/databinding/testapp/vo/ObservableWithNotBindableFieldObjectTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.com.android.databinding.testapp.vo; - -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/TestApp/src/androidTest/java/com/android/databinding/testapp/multiconfig/LandscapeConfigTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/multiconfig/LandscapeConfigTest.java deleted file mode 100644 index f171321..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/multiconfig/LandscapeConfigTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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/TestApp/src/androidTest/java/com/android/databinding/testapp/multiconfig/PortraitConfigTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/multiconfig/PortraitConfigTest.java deleted file mode 100644 index 8790f04..0000000 --- a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/multiconfig/PortraitConfigTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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/TestApp/src/main/AndroidManifest.xml b/tools/data-binding/TestApp/src/main/AndroidManifest.xml deleted file mode 100644 index ae2581a..0000000 --- a/tools/data-binding/TestApp/src/main/AndroidManifest.xml +++ /dev/null @@ -1,25 +0,0 @@ -<!-- - ~ 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/TestApp/src/main/java/com/android/databinding/testapp/TestActivity.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/TestActivity.java deleted file mode 100644 index fa9dd42..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/TestActivity.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/AbsListViewBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/AbsListViewBindingObject.java deleted file mode 100644 index ff0bfbd..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/AbsListViewBindingObject.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/AbsSeekBarBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/AbsSeekBarBindingObject.java deleted file mode 100644 index bc62445..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/AbsSeekBarBindingObject.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/AbsSpinnerBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/AbsSpinnerBindingObject.java deleted file mode 100644 index 6e35436..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/AbsSpinnerBindingObject.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/AutoCompleteTextViewBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/AutoCompleteTextViewBindingObject.java deleted file mode 100644 index 66e2003..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/AutoCompleteTextViewBindingObject.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/BindableTestObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/BindableTestObject.java deleted file mode 100644 index 63ef9c1..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/BindableTestObject.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/BindingAdapterBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/BindingAdapterBindingObject.java deleted file mode 100644 index bd93070..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/BindingAdapterBindingObject.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/CheckedTextViewBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/CheckedTextViewBindingObject.java deleted file mode 100644 index 6dc3dad..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/CheckedTextViewBindingObject.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/CompoundButtonBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/CompoundButtonBindingObject.java deleted file mode 100644 index 80052f4..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/CompoundButtonBindingObject.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObject.java deleted file mode 100644 index 1cf9b09..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObject.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObjectBase.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObjectBase.java deleted file mode 100644 index 142a3fe..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/FindMethodBindingObjectBase.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/FrameLayoutBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/FrameLayoutBindingObject.java deleted file mode 100644 index 788c53c..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/FrameLayoutBindingObject.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/ImageViewBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ImageViewBindingObject.java deleted file mode 100644 index 73990d3..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ImageViewBindingObject.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/LinearLayoutBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/LinearLayoutBindingObject.java deleted file mode 100644 index 1755fe8..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/LinearLayoutBindingObject.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/NotBindableVo.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/NotBindableVo.java deleted file mode 100644 index a8ec026..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/NotBindableVo.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/ObservableFieldBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ObservableFieldBindingObject.java deleted file mode 100644 index 651a8cf..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ObservableFieldBindingObject.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/ObservableWithNotBindableFieldObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ObservableWithNotBindableFieldObject.java deleted file mode 100644 index 1128421..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ObservableWithNotBindableFieldObject.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/ProgressBarBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ProgressBarBindingObject.java deleted file mode 100644 index 189b388..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ProgressBarBindingObject.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/PublicFinalTestVo.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/PublicFinalTestVo.java deleted file mode 100644 index 118717c..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/PublicFinalTestVo.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/PublicFinalWithObservableTestVo.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/PublicFinalWithObservableTestVo.java deleted file mode 100644 index dd415de..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/PublicFinalWithObservableTestVo.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/RadioGroupBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/RadioGroupBindingObject.java deleted file mode 100644 index 1ddcb2f..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/RadioGroupBindingObject.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/SpinnerBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/SpinnerBindingObject.java deleted file mode 100644 index 39b07f5..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/SpinnerBindingObject.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/SwitchBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/SwitchBindingObject.java deleted file mode 100644 index 1097b8e..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/SwitchBindingObject.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/TabWidgetBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/TabWidgetBindingObject.java deleted file mode 100644 index d4937a5..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/TabWidgetBindingObject.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/TableLayoutBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/TableLayoutBindingObject.java deleted file mode 100644 index ab45800..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/TableLayoutBindingObject.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/TextViewBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/TextViewBindingObject.java deleted file mode 100644 index b98ded2..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/TextViewBindingObject.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/ViewBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ViewBindingObject.java deleted file mode 100644 index 8486382..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ViewBindingObject.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/ViewGroupBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ViewGroupBindingObject.java deleted file mode 100644 index f0ee752..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ViewGroupBindingObject.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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/TestApp/src/main/java/com/android/databinding/testapp/vo/ViewStubBindingObject.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ViewStubBindingObject.java deleted file mode 100644 index 5b0774f..0000000 --- a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/ViewStubBindingObject.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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/TestApp/src/main/res/drawable-hdpi/ic_launcher.png b/tools/data-binding/TestApp/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 96a442e..0000000 --- a/tools/data-binding/TestApp/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/tools/data-binding/TestApp/src/main/res/drawable-mdpi/ic_launcher.png b/tools/data-binding/TestApp/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 359047d..0000000 --- a/tools/data-binding/TestApp/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/tools/data-binding/TestApp/src/main/res/drawable-xhdpi/ic_launcher.png b/tools/data-binding/TestApp/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 71c6d76..0000000 --- a/tools/data-binding/TestApp/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/tools/data-binding/TestApp/src/main/res/drawable-xxhdpi/ic_launcher.png b/tools/data-binding/TestApp/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 4df1894..0000000 --- a/tools/data-binding/TestApp/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/tools/data-binding/TestApp/src/main/res/layout-land/multi_res_layout.xml b/tools/data-binding/TestApp/src/main/res/layout-land/multi_res_layout.xml deleted file mode 100644 index caf0389..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout-land/multi_res_layout.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?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/TestApp/src/main/res/layout/abs_list_view_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/abs_list_view_adapter_test.xml deleted file mode 100644 index 5f81f37..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/abs_list_view_adapter_test.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?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/TestApp/src/main/res/layout/abs_seek_bar_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/abs_seek_bar_adapter_test.xml deleted file mode 100644 index ee1e645..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/abs_seek_bar_adapter_test.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?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/TestApp/src/main/res/layout/abs_spinner_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/abs_spinner_adapter_test.xml deleted file mode 100644 index 840eb04..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/abs_spinner_adapter_test.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?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/TestApp/src/main/res/layout/auto_complete_text_view_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/auto_complete_text_view_adapter_test.xml deleted file mode 100644 index 9bbbe81..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/auto_complete_text_view_adapter_test.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?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/TestApp/src/main/res/layout/basic_binding.xml b/tools/data-binding/TestApp/src/main/res/layout/basic_binding.xml deleted file mode 100644 index d59f1d0..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/basic_binding.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?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/TestApp/src/main/res/layout/basic_dependant_binding.xml b/tools/data-binding/TestApp/src/main/res/layout/basic_dependant_binding.xml deleted file mode 100644 index f6478c1..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/basic_dependant_binding.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?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/TestApp/src/main/res/layout/bind_to_final.xml b/tools/data-binding/TestApp/src/main/res/layout/bind_to_final.xml deleted file mode 100644 index 4bf6263..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/bind_to_final.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?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/TestApp/src/main/res/layout/bind_to_final_observable.xml b/tools/data-binding/TestApp/src/main/res/layout/bind_to_final_observable.xml deleted file mode 100644 index 38c7cc2..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/bind_to_final_observable.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?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/TestApp/src/main/res/layout/bracket_test.xml b/tools/data-binding/TestApp/src/main/res/layout/bracket_test.xml deleted file mode 100644 index 07a99d1..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/bracket_test.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?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<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<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/TestApp/src/main/res/layout/cast_test.xml b/tools/data-binding/TestApp/src/main/res/layout/cast_test.xml deleted file mode 100644 index e8d3c48..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/cast_test.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?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<String>"/> - <variable name="map" type="Object"/> - - <TextView - android:id="@+id/textView0" - android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@{((ArrayList<String>)list)[0]}"/> - <TextView - android:id="@+id/textView1" - android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@{((Map<String, String>)map)[`hello`]}"/> -</LinearLayout>
\ No newline at end of file diff --git a/tools/data-binding/TestApp/src/main/res/layout/checked_text_view_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/checked_text_view_adapter_test.xml deleted file mode 100644 index 431418b..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/checked_text_view_adapter_test.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?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/TestApp/src/main/res/layout/compound_button_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/compound_button_adapter_test.xml deleted file mode 100644 index 021b3e6..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/compound_button_adapter_test.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?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/TestApp/src/main/res/layout/conditional_binding.xml b/tools/data-binding/TestApp/src/main/res/layout/conditional_binding.xml deleted file mode 100644 index f8d3012..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/conditional_binding.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?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/TestApp/src/main/res/layout/find_method_test.xml b/tools/data-binding/TestApp/src/main/res/layout/find_method_test.xml deleted file mode 100644 index 25c8c91..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/find_method_test.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?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<String>"/> - <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/TestApp/src/main/res/layout/frame_layout_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/frame_layout_adapter_test.xml deleted file mode 100644 index 253287b..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/frame_layout_adapter_test.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?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/TestApp/src/main/res/layout/image_view_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/image_view_adapter_test.xml deleted file mode 100644 index c79c8fc..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/image_view_adapter_test.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?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/TestApp/src/main/res/layout/included_layout.xml b/tools/data-binding/TestApp/src/main/res/layout/included_layout.xml deleted file mode 100644 index 8402154..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/included_layout.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?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/TestApp/src/main/res/layout/layout_with_include.xml b/tools/data-binding/TestApp/src/main/res/layout/layout_with_include.xml deleted file mode 100644 index 626f981..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/layout_with_include.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?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/TestApp/src/main/res/layout/linear_layout_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/linear_layout_adapter_test.xml deleted file mode 100644 index f5775a0..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/linear_layout_adapter_test.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?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/TestApp/src/main/res/layout/multi_res_layout.xml b/tools/data-binding/TestApp/src/main/res/layout/multi_res_layout.xml deleted file mode 100644 index 1d153ed..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/multi_res_layout.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?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/TestApp/src/main/res/layout/new_api_layout.xml b/tools/data-binding/TestApp/src/main/res/layout/new_api_layout.xml deleted file mode 100644 index 686676b..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/new_api_layout.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?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<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/TestApp/src/main/res/layout/no_id_test.xml b/tools/data-binding/TestApp/src/main/res/layout/no_id_test.xml deleted file mode 100644 index ec513ea..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/no_id_test.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?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/TestApp/src/main/res/layout/observable_field_test.xml b/tools/data-binding/TestApp/src/main/res/layout/observable_field_test.xml deleted file mode 100644 index 61dff3e..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/observable_field_test.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?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/TestApp/src/main/res/layout/observable_with_not_bindable_field.xml b/tools/data-binding/TestApp/src/main/res/layout/observable_with_not_bindable_field.xml deleted file mode 100644 index 5f27399..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/observable_with_not_bindable_field.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?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/TestApp/src/main/res/layout/progress_bar_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/progress_bar_adapter_test.xml deleted file mode 100644 index 0ccd17f..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/progress_bar_adapter_test.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?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/TestApp/src/main/res/layout/radio_group_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/radio_group_adapter_test.xml deleted file mode 100644 index da20f3d..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/radio_group_adapter_test.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?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/TestApp/src/main/res/layout/resource_test.xml b/tools/data-binding/TestApp/src/main/res/layout/resource_test.xml deleted file mode 100644 index dd59771..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/resource_test.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?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/TestApp/src/main/res/layout/spinner_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/spinner_adapter_test.xml deleted file mode 100644 index 1c50b2e..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/spinner_adapter_test.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?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/TestApp/src/main/res/layout/switch_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/switch_adapter_test.xml deleted file mode 100644 index 6989d16..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/switch_adapter_test.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?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/TestApp/src/main/res/layout/tab_widget_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/tab_widget_adapter_test.xml deleted file mode 100644 index fcb9995..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/tab_widget_adapter_test.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?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/TestApp/src/main/res/layout/table_layout_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/table_layout_adapter_test.xml deleted file mode 100644 index 112dc9c..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/table_layout_adapter_test.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?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/TestApp/src/main/res/layout/text_view_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/text_view_adapter_test.xml deleted file mode 100644 index c030cc7..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/text_view_adapter_test.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?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/TestApp/src/main/res/layout/view_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/view_adapter_test.xml deleted file mode 100644 index 037869f..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/view_adapter_test.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?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/TestApp/src/main/res/layout/view_group_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/view_group_adapter_test.xml deleted file mode 100644 index 36f9dca..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/view_group_adapter_test.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?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/TestApp/src/main/res/layout/view_stub_adapter_test.xml b/tools/data-binding/TestApp/src/main/res/layout/view_stub_adapter_test.xml deleted file mode 100644 index 3011883..0000000 --- a/tools/data-binding/TestApp/src/main/res/layout/view_stub_adapter_test.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?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/TestApp/src/main/res/values-v21/styles.xml b/tools/data-binding/TestApp/src/main/res/values-v21/styles.xml deleted file mode 100644 index 0a2c6be..0000000 --- a/tools/data-binding/TestApp/src/main/res/values-v21/styles.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?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/TestApp/src/main/res/values/fractions.xml b/tools/data-binding/TestApp/src/main/res/values/fractions.xml deleted file mode 100644 index 8817316..0000000 --- a/tools/data-binding/TestApp/src/main/res/values/fractions.xml +++ /dev/null @@ -1,20 +0,0 @@ -<!-- - ~ 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/TestApp/src/main/res/values/strings.xml b/tools/data-binding/TestApp/src/main/res/values/strings.xml deleted file mode 100644 index e53e327..0000000 --- a/tools/data-binding/TestApp/src/main/res/values/strings.xml +++ /dev/null @@ -1,22 +0,0 @@ -<!-- - ~ 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/TestApp/src/main/res/values/styles.xml b/tools/data-binding/TestApp/src/main/res/values/styles.xml deleted file mode 100644 index c0d5471..0000000 --- a/tools/data-binding/TestApp/src/main/res/values/styles.xml +++ /dev/null @@ -1,21 +0,0 @@ -<!-- - ~ 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> |