New API demo showing how to make a resource reference.

Change-Id: I450d70432debc9d7f58a7f6597628dacc0225ddd
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index 10313fb..a588418 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -36,7 +36,7 @@
     <!-- For android.media.audiofx.Visualizer -->
     <uses-permission android:name="android.permission.RECORD_AUDIO" />
 
-    <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="3" />
+    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13" />
 
     <!-- We will request access to the camera, saying we require a camera
          of some sort but not one with autofocus capability. -->
@@ -907,6 +907,15 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".content.ResourcesLayoutReference"
+                android:label="@string/activity_resources_layout_reference">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+                <category android:name="android.intent.category.EMBED" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".content.ResourcesWidthAndHeight"
                 android:label="@string/activity_resources_width_and_height"
                 android:enabled="@bool/atLeastHoneycombMR2">
diff --git a/samples/ApiDemos/res/layout/resources_layout_reference.xml b/samples/ApiDemos/res/layout/resources_layout_reference.xml
new file mode 100644
index 0000000..2d41143
--- /dev/null
+++ b/samples/ApiDemos/res/layout/resources_layout_reference.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+
+<!-- Demonstrates using -wNNNdp and -hNNNdp resource configs. -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent" android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <TextView android:layout_width="match_parent" android:layout_height="wrap_content"
+        android:layout_weight="0" android:gravity="center_horizontal"
+        android:paddingTop="8dp" android:paddingBottom="8dp"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:text="@string/resources_layout_reference_description"/>
+
+    <TextView android:layout_width="match_parent" android:layout_height="wrap_content"
+        android:layout_weight="0" android:gravity="center_horizontal"
+        android:paddingTop="8dp" android:paddingBottom="8dp"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:text="@string/resources_layout_reference_default"/>
+
+</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/resources_layout_reference_tablet.xml b/samples/ApiDemos/res/layout/resources_layout_reference_tablet.xml
new file mode 100644
index 0000000..a2cf17a
--- /dev/null
+++ b/samples/ApiDemos/res/layout/resources_layout_reference_tablet.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+
+<!-- Demonstrates using -wNNNdp and -hNNNdp resource configs. -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent" android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <TextView android:layout_width="match_parent" android:layout_height="wrap_content"
+        android:layout_weight="0" android:gravity="center_horizontal"
+        android:paddingTop="8dp" android:paddingBottom="8dp"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:text="@string/resources_layout_reference_description"/>
+
+    <TextView android:layout_width="match_parent" android:layout_height="wrap_content"
+        android:layout_weight="0" android:gravity="center_horizontal"
+        android:paddingTop="8dp" android:paddingBottom="8dp"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:text="@string/resources_layout_reference_tablet"/>
+
+</LinearLayout>
diff --git a/samples/ApiDemos/res/values-sw600dp/layout.xml b/samples/ApiDemos/res/values-sw600dp/layout.xml
new file mode 100644
index 0000000..1f9771f
--- /dev/null
+++ b/samples/ApiDemos/res/values-sw600dp/layout.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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>
+    <!-- Define a new configuration for the resources_layout_reference layout,
+         which uses the special tablet layout. -->
+    <item type="layout" name="resources_layout_reference">
+            @layout/resources_layout_reference_tablet</item>
+</resources>
diff --git a/samples/ApiDemos/res/values-xlarge/layout.xml b/samples/ApiDemos/res/values-xlarge/layout.xml
new file mode 100644
index 0000000..1f9771f
--- /dev/null
+++ b/samples/ApiDemos/res/values-xlarge/layout.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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>
+    <!-- Define a new configuration for the resources_layout_reference layout,
+         which uses the special tablet layout. -->
+    <item type="layout" name="resources_layout_reference">
+            @layout/resources_layout_reference_tablet</item>
+</resources>
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index da70d28..8950bb7 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -327,6 +327,13 @@
     <string name="styled_text">Plain, <b>bold</b>, <i>italic</i>, <b><i>bold-italic</i></b></string>
     <string name="styled_text_prog">Assigned programmatically:</string>
 
+    <string name="activity_resources_layout_reference">Content/Resources/Layout Reference</string>
+    <string name="resources_layout_reference_description">Shows how to write layout
+        resource references, so that you can define multiple different configurations of
+        a layout resource that refer to one actual XML definition.</string>
+    <string name="resources_layout_reference_default">Default layout</string>
+    <string name="resources_layout_reference_tablet">Tablet layout</string>
+
     <string name="activity_resources_width_and_height">Content/Resources/Width and Height</string>
     <string name="resources_width_and_height_description">The layouts below use -wNNNdp and
         -hNNNdp to select between different versions based on the size of the screen.</string>
diff --git a/samples/ApiDemos/src/com/example/android/apis/content/ResourcesLayoutReference.java b/samples/ApiDemos/src/com/example/android/apis/content/ResourcesLayoutReference.java
new file mode 100644
index 0000000..0682bcb
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/content/ResourcesLayoutReference.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011 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.example.android.apis.content;
+
+import com.example.android.apis.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class ResourcesLayoutReference extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // This layout uses different configurations to adjust
+        // what is shown based on the smallest width that will occur.
+        setContentView(R.layout.resources_layout_reference);
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/content/_index.html b/samples/ApiDemos/src/com/example/android/apis/content/_index.html
index fc484a9..f49b8d9 100644
--- a/samples/ApiDemos/src/com/example/android/apis/content/_index.html
+++ b/samples/ApiDemos/src/com/example/android/apis/content/_index.html
@@ -8,4 +8,17 @@
 
   <dt><a href="ResourcesSample.html">Resources</a></dt>
   <dd>Demonstrates loading styled strings from a resource file, and extracting the raw text. </dd>
+
+  <dt><a href="ResourcesLayoutReference.html">Resources Layout Reference</a></dt>
+  <dd>Shows how to make references between resources; this examples shows how this
+      can be used to define multiple configurations for a layout resource that
+      reference the same layout XML.</dd>
+
+  <dt><a href="ResourcesSmallestWidth.html">Resources Smallest Width</a></dt>
+  <dd>Shows how you can vary a layout resource based on the device's smallest
+      width configuration</dd>
+
+  <dt><a href="ResourcesWidthAndHeight.html">Resources Width and Height</a></dt>
+  <dd>Shows how you can vary a layout resource based on the device's current
+      width dp and height dp configurations.</dd>
 </dl>