diff options
Diffstat (limited to 'integration-tests/MultiModuleTestApp/testlibrary/src/main')
13 files changed, 302 insertions, 0 deletions
diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/AndroidManifest.xml b/integration-tests/MultiModuleTestApp/testlibrary/src/main/AndroidManifest.xml new file mode 100644 index 00000000..263d6632 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/AndroidManifest.xml @@ -0,0 +1,36 @@ +<?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. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.databinding.testlibrary" > + + <application + android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" > + <activity + android:name=".TestLibraryMainActivity" + android:label="@string/app_name" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + +</manifest> diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/java/com/android/databinding/testlibrary/ObservableInLibrary.java b/integration-tests/MultiModuleTestApp/testlibrary/src/main/java/com/android/databinding/testlibrary/ObservableInLibrary.java new file mode 100644 index 00000000..f5470f10 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/java/com/android/databinding/testlibrary/ObservableInLibrary.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.databinding.testlibrary; + +import android.binding.Bindable; + +import com.android.databinding.library.BaseObservable; +import com.android.databinding.testlibrary.BR; + +public class ObservableInLibrary extends BaseObservable { + + @Bindable + private String mLibField1; + + @Bindable + private String mLibField2; + + @Bindable + private int mSharedField; + + public String getLibField1() { + return mLibField1; + } + + public void setLibField1(String libField1) { + mLibField1 = libField1; + notifyPropertyChanged(BR.libField1); + } + + public String getLibField2() { + return mLibField2; + } + + public void setLibField2(String libField2) { + mLibField2 = libField2; + notifyPropertyChanged(BR.libField2); + } + + public int getSharedField() { + return mSharedField; + } + + public void setSharedField(int sharedField) { + mSharedField = sharedField; + notifyPropertyChanged(BR.sharedField); + } +} diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/java/com/android/databinding/testlibrary/TestLibObject.java b/integration-tests/MultiModuleTestApp/testlibrary/src/main/java/com/android/databinding/testlibrary/TestLibObject.java new file mode 100644 index 00000000..330b870a --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/java/com/android/databinding/testlibrary/TestLibObject.java @@ -0,0 +1,32 @@ +/* + * 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.testlibrary; + +import android.binding.Bindable; + +public class TestLibObject { + @Bindable + private String mField; + + public String getField() { + return mField; + } + + public void setField(String field) { + this.mField = field; + } +} diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/java/com/android/databinding/testlibrary/TestLibraryMainActivity.java b/integration-tests/MultiModuleTestApp/testlibrary/src/main/java/com/android/databinding/testlibrary/TestLibraryMainActivity.java new file mode 100644 index 00000000..812b222b --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/java/com/android/databinding/testlibrary/TestLibraryMainActivity.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.databinding.testlibrary; + +import android.app.Activity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import com.android.databinding.testlibrary.R; +import com.android.databinding.testlibrary.generated.ActivityTestLibraryMainBinding; +public class TestLibraryMainActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + ActivityTestLibraryMainBinding binder = ActivityTestLibraryMainBinding.inflate(this); + setContentView(binder.getRoot()); + + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_test_library_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-hdpi/ic_launcher.png b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..96a442e5 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-mdpi/ic_launcher.png b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..359047df --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-xhdpi/ic_launcher.png b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..71c6d760 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-xxhdpi/ic_launcher.png b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..4df18946 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/drawable-xxhdpi/ic_launcher.png diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/layout/activity_test_library_main.xml b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/layout/activity_test_library_main.xml new file mode 100644 index 00000000..b731cc03 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/layout/activity_test_library_main.xml @@ -0,0 +1,29 @@ +<!-- + ~ Copyright (C) 2015 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" + android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + android:paddingBottom="@dimen/activity_vertical_margin" + tools:context=".TestLibraryMainActivity"> + <variable name="obj1" type="com.android.databinding.testlibrary.TestLibObject"/> + + <TextView android:text="@{obj1.field}" android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + +</RelativeLayout> diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/menu/menu_test_library_main.xml b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/menu/menu_test_library_main.xml new file mode 100644 index 00000000..68d936d4 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/menu/menu_test_library_main.xml @@ -0,0 +1,21 @@ +<!-- + ~ Copyright (C) 2015 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" tools:context=".TestLibraryMainActivity"> + <item android:id="@+id/action_settings" android:title="@string/action_settings" + android:orderInCategory="100" android:showAsAction="never" /> +</menu> diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/values-w820dp/dimens.xml b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 00000000..4719591c --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,22 @@ +<!-- + ~ Copyright (C) 2015 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<resources> + <!-- Example customization of dimensions originally defined in res/values/dimens.xml + (such as screen margins) for screens with more than 820dp of available width. This + would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). --> + <dimen name="activity_horizontal_margin">64dp</dimen> +</resources> diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/values/dimens.xml b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/values/dimens.xml new file mode 100644 index 00000000..c06ae3f9 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/values/dimens.xml @@ -0,0 +1,21 @@ +<!-- + ~ Copyright (C) 2015 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<resources> + <!-- Default screen margins, per the Android Design guidelines. --> + <dimen name="activity_horizontal_margin">16dp</dimen> + <dimen name="activity_vertical_margin">16dp</dimen> +</resources> diff --git a/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/values/strings.xml b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/values/strings.xml new file mode 100644 index 00000000..d930ddb6 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/testlibrary/src/main/res/values/strings.xml @@ -0,0 +1,24 @@ +<?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> + + <string name="app_name">Test Library</string> + <string name="hello_world">Hello world!</string> + <string name="action_settings">Settings</string> + +</resources> |