diff options
Diffstat (limited to 'integration-tests/MultiModuleTestApp/app/src/main')
16 files changed, 379 insertions, 0 deletions
diff --git a/integration-tests/MultiModuleTestApp/app/src/main/AndroidManifest.xml b/integration-tests/MultiModuleTestApp/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..aaa07198 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/AndroidManifest.xml @@ -0,0 +1,37 @@ +<?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.multimoduletestapp" > + + <application + android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme" > + <activity + android:name=".MainActivity" + 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/app/src/main/java/com/android/databinding/multimoduletestapp/MainActivity.java b/integration-tests/MultiModuleTestApp/app/src/main/java/com/android/databinding/multimoduletestapp/MainActivity.java new file mode 100644 index 00000000..f8a012a0 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/java/com/android/databinding/multimoduletestapp/MainActivity.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.multimoduletestapp; + +import com.android.databinding.multimoduletestapp.generated.ActivityMainBinding; +import android.app.Activity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.view.ViewGroup; + +public class MainActivity extends Activity { + ActivityMainBinding mBinder; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mBinder = ActivityMainBinding.inflate(this); + setContentView(mBinder.getRoot()); + } + + public ActivityMainBinding getBinder() { + return mBinder; + } + + + @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_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/app/src/main/java/com/android/databinding/multimoduletestapp/ObservableExtendingLib.java b/integration-tests/MultiModuleTestApp/app/src/main/java/com/android/databinding/multimoduletestapp/ObservableExtendingLib.java new file mode 100644 index 00000000..b558790d --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/java/com/android/databinding/multimoduletestapp/ObservableExtendingLib.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.databinding.multimoduletestapp; + +import com.android.databinding.testlibrary.ObservableInLibrary; + +import android.binding.Bindable; +import com.android.databinding.multimoduletestapp.BR; + +public class ObservableExtendingLib extends ObservableInLibrary { + @Bindable + private String mChildClassField; + + public String getChildClassField() { + return mChildClassField; + } + + public void setChildClassField(String childClassField) { + mChildClassField = childClassField; + notifyPropertyChanged(BR.childClassField); + } +} diff --git a/integration-tests/MultiModuleTestApp/app/src/main/java/com/android/databinding/multimoduletestapp/ObservableInMainApp.java b/integration-tests/MultiModuleTestApp/app/src/main/java/com/android/databinding/multimoduletestapp/ObservableInMainApp.java new file mode 100644 index 00000000..c870fd44 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/java/com/android/databinding/multimoduletestapp/ObservableInMainApp.java @@ -0,0 +1,58 @@ +/* + * 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.multimoduletestapp; + +import android.binding.Bindable; + +import com.android.databinding.library.BaseObservable; +import com.android.databinding.multimoduletestapp.BR; + +public class ObservableInMainApp extends BaseObservable { + @Bindable + private String mAppField1; + @Bindable + private int mAppField2; + @Bindable + private int mSharedField; + + public String getAppField1() { + return mAppField1; + } + + public void setAppField1(String appField1) { + mAppField1 = appField1; + notifyPropertyChanged(BR.appField1); + } + + public int getAppField2() { + return mAppField2; + } + + public void setAppField2(int appField2) { + mAppField2 = appField2; + notifyPropertyChanged(BR.appField2); + } + + public int getSharedField() { + return mSharedField; + } + + public void setSharedField(int sharedField) { + mSharedField = sharedField; + notifyPropertyChanged(BR.sharedField); + } +} diff --git a/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-hdpi/ic_launcher.png b/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..96a442e5 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-mdpi/ic_launcher.png b/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..359047df --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-xhdpi/ic_launcher.png b/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..71c6d760 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..4df18946 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png diff --git a/integration-tests/MultiModuleTestApp/app/src/main/res/layout/activity_main.xml b/integration-tests/MultiModuleTestApp/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..4549e817 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,27 @@ +<!-- + ~ Copyright (C) 2015 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<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=".MainActivity"> + <variable name="foo" type="String"/> + <TextView android:text='@{foo + " " + foo}' android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + +</RelativeLayout> diff --git a/integration-tests/MultiModuleTestApp/app/src/main/res/layout/activity_test_library_main.xml b/integration-tests/MultiModuleTestApp/app/src/main/res/layout/activity_test_library_main.xml new file mode 100644 index 00000000..5a340493 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/res/layout/activity_test_library_main.xml @@ -0,0 +1,27 @@ +<!-- + ~ Copyright (C) 2015 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<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" + > + <TextView android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + +</RelativeLayout> diff --git a/integration-tests/MultiModuleTestApp/app/src/main/res/menu/menu_main.xml b/integration-tests/MultiModuleTestApp/app/src/main/res/menu/menu_main.xml new file mode 100644 index 00000000..4674d4d1 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/res/menu/menu_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=".MainActivity"> + <item android:id="@+id/action_settings" android:title="@string/action_settings" + android:orderInCategory="100" android:showAsAction="never" /> +</menu> diff --git a/integration-tests/MultiModuleTestApp/app/src/main/res/values-v21/styles.xml b/integration-tests/MultiModuleTestApp/app/src/main/res/values-v21/styles.xml new file mode 100644 index 00000000..9b24d4f7 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/res/values-v21/styles.xml @@ -0,0 +1,21 @@ +<?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/integration-tests/MultiModuleTestApp/app/src/main/res/values-w820dp/dimens.xml b/integration-tests/MultiModuleTestApp/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 00000000..4719591c --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/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/app/src/main/res/values/dimens.xml b/integration-tests/MultiModuleTestApp/app/src/main/res/values/dimens.xml new file mode 100644 index 00000000..c06ae3f9 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/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/app/src/main/res/values/strings.xml b/integration-tests/MultiModuleTestApp/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..20d68aa2 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/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">Multi Module Test App</string> + <string name="hello_world">Hello world!</string> + <string name="action_settings">Settings</string> + +</resources> diff --git a/integration-tests/MultiModuleTestApp/app/src/main/res/values/styles.xml b/integration-tests/MultiModuleTestApp/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..7dc23c83 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/main/res/values/styles.xml @@ -0,0 +1,24 @@ +<!-- + ~ Copyright (C) 2015 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<resources> + + <!-- Base application theme. --> + <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> + <!-- Customize your theme here. --> + </style> + +</resources> |