Merge "revisions to NewsReader sample app for AndroidU. Clean up XML markup for clean rendering in HTML docs; Change string resources for two-pane mode to bools; Rename resource files w/ layout info from main.xml to layouts.xml. Add support lib Add HTML page" into ics-mr0
diff --git a/samples/training/multiscreen/newsreader/AndroidManifest.xml b/samples/training/multiscreen/newsreader/AndroidManifest.xml
index 04ddf29..9d92ba6 100644
--- a/samples/training/multiscreen/newsreader/AndroidManifest.xml
+++ b/samples/training/multiscreen/newsreader/AndroidManifest.xml
@@ -19,6 +19,11 @@
       android:versionCode="1"
       android:versionName="1.0">
     <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="14" />
+    <supports-screens
+        android:smallScreens="true"
+        android:normalScreens="true"
+        android:largeScreens="true"
+        android:xlargeScreens="true" />
 
     <application android:icon="@drawable/icon" android:label="@string/app_name"
                  android:logo="@drawable/logo" android:theme="@style/NewsReaderStyle">
@@ -31,10 +36,4 @@
         <activity android:name=".ArticleActivity"
                   android:theme="@style/NewsReaderStyle_NoActionBar" />
     </application>
-    <supports-screens
-        android:smallScreens="true"
-        android:normalScreens="true"
-        android:largeScreens="true"
-        android:xlargeScreens="true"
-    />
 </manifest>
diff --git a/samples/training/multiscreen/newsreader/_index.html b/samples/training/multiscreen/newsreader/_index.html
new file mode 100644
index 0000000..6ddaf6c
--- /dev/null
+++ b/samples/training/multiscreen/newsreader/_index.html
@@ -0,0 +1,12 @@
+<p>A sample app demonstrating best practices to support multiple screen sizes and densities.</p>
+<p>This sample is a companion to the Training class about <a
+href="../../../training/multiscreen/index.html">Designing for Multiple
+Screens</a>.</p>
+
+<p class="note"><strong>Note:</strong> This sample uses the Android Support Library. To build the
+app, be sure to add the <code>libs/android-support-v4.jar</code> file to the project build path. In
+Eclipse, right-click the JAR file in the Package Explorer and select <b>Build Path > Add to Build
+Path</b>.</p>
+
+
+<img alt=""  src="../images/NewsReader.png" />
\ No newline at end of file
diff --git a/samples/training/multiscreen/newsreader/libs/android-support-v4.jar b/samples/training/multiscreen/newsreader/libs/android-support-v4.jar
new file mode 100644
index 0000000..b254ef5
--- /dev/null
+++ b/samples/training/multiscreen/newsreader/libs/android-support-v4.jar
Binary files differ
diff --git a/samples/training/multiscreen/newsreader/res/layout/actionbar_list_item.xml b/samples/training/multiscreen/newsreader/res/layout/actionbar_list_item.xml
index 452d16b..6c860de 100644
--- a/samples/training/multiscreen/newsreader/res/layout/actionbar_list_item.xml
+++ b/samples/training/multiscreen/newsreader/res/layout/actionbar_list_item.xml
@@ -14,11 +14,11 @@
      limitations under the License.
 -->
 
-<TextView
-  xmlns:android="http://schemas.android.com/apk/res/android"
-  android:layout_width="match_parent"
-  android:layout_height="wrap_content"
-  android:textSize="14sp"
-  android:textColor="#01511a"
-  android:padding="5dp">
-</TextView>
+<!-- BEGIN_INCLUDE(all) -->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:textSize="14sp"
+    android:textColor="#01511a"
+    android:padding="5dp" />
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/res/layout/headline_item.xml b/samples/training/multiscreen/newsreader/res/layout/headline_item.xml
index 980e43c..dc3fd59 100644
--- a/samples/training/multiscreen/newsreader/res/layout/headline_item.xml
+++ b/samples/training/multiscreen/newsreader/res/layout/headline_item.xml
@@ -14,11 +14,11 @@
      limitations under the License.
 -->
 
-<TextView
-  xmlns:android="http://schemas.android.com/apk/res/android"
-  android:layout_width="match_parent"
-  android:layout_height="wrap_content"
-  android:textSize="16sp"
-  android:textColor="#01511a"
-  android:padding="10dp">
-</TextView>
+<!-- BEGIN_INCLUDE(all) -->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:textSize="16sp"
+    android:textColor="#01511a"
+    android:padding="10dp" />
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/res/layout/onepane.xml b/samples/training/multiscreen/newsreader/res/layout/onepane.xml
index 83eeb86..4198d2e 100644
--- a/samples/training/multiscreen/newsreader/res/layout/onepane.xml
+++ b/samples/training/multiscreen/newsreader/res/layout/onepane.xml
@@ -14,14 +14,15 @@
      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">
+<!-- BEGIN_INCLUDE(all) -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
-  <fragment android:id="@+id/headlines" android:layout_height="fill_parent"
-    android:name="com.example.android.newsreader.HeadlinesFragment"
-    android:layout_width="match_parent" />
-
+    <fragment android:id="@+id/headlines"
+              android:layout_height="fill_parent"
+              android:name="com.example.android.newsreader.HeadlinesFragment"
+              android:layout_width="match_parent" />
 </LinearLayout>
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/res/layout/onepane_with_bar.xml b/samples/training/multiscreen/newsreader/res/layout/onepane_with_bar.xml
index 0ff3a24..4eb4016 100644
--- a/samples/training/multiscreen/newsreader/res/layout/onepane_with_bar.xml
+++ b/samples/training/multiscreen/newsreader/res/layout/onepane_with_bar.xml
@@ -14,19 +14,37 @@
      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">
-    <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1"  android:gravity="center" android:layout_height="50dp">
-        <ImageView android:id="@+id/imageView1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/logo" android:paddingRight="30dp" android:layout_gravity="left" android:layout_weight="0"></ImageView>
-        <View android:layout_height="wrap_content" android:id="@+id/view1" android:layout_width="wrap_content" android:layout_weight="1"></View>
-        <Button android:id="@+id/categorybutton" android:text="one" android:background="@drawable/button_bg" android:layout_height="match_parent" android:layout_weight="0" android:layout_width="120dp" style="@style/CategoryButtonStyle"/>
+<!-- BEGIN_INCLUDE(all) -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <LinearLayout android:layout_width="match_parent" 
+                  android:id="@+id/linearLayout1"  
+                  android:gravity="center"
+                  android:layout_height="50dp">
+        <ImageView android:id="@+id/imageView1" 
+                   android:layout_height="wrap_content"
+                   android:layout_width="wrap_content"
+                   android:src="@drawable/logo"
+                   android:paddingRight="30dp"
+                   android:layout_gravity="left"
+                   android:layout_weight="0" />
+        <View android:layout_height="wrap_content" 
+              android:id="@+id/view1"
+              android:layout_width="wrap_content"
+              android:layout_weight="1" />
+        <Button android:id="@+id/categorybutton"
+                android:background="@drawable/button_bg"
+                android:layout_height="match_parent"
+                android:layout_weight="0"
+                android:layout_width="120dp"
+                style="@style/CategoryButtonStyle"/>
     </LinearLayout>
 
-    <fragment android:id="@+id/headlines" android:layout_height="fill_parent"
+    <fragment android:id="@+id/headlines" 
+              android:layout_height="fill_parent"
               android:name="com.example.android.newsreader.HeadlinesFragment"
               android:layout_width="match_parent" />
-
 </LinearLayout>
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/res/layout/twopanes.xml b/samples/training/multiscreen/newsreader/res/layout/twopanes.xml
index 96c958a..624776c 100644
--- a/samples/training/multiscreen/newsreader/res/layout/twopanes.xml
+++ b/samples/training/multiscreen/newsreader/res/layout/twopanes.xml
@@ -14,14 +14,19 @@
      limitations under the License.
 -->
 
-<LinearLayout
-  xmlns:android="http://schemas.android.com/apk/res/android"
-  android:layout_width="fill_parent"
-  android:layout_height="fill_parent" android:orientation="horizontal">
-    <fragment android:id="@+id/headlines" android:layout_height="fill_parent"
+<!-- BEGIN_INCLUDE(all) -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="horizontal">
+    <fragment android:id="@+id/headlines"
+              android:layout_height="fill_parent"
               android:name="com.example.android.newsreader.HeadlinesFragment"
-              android:layout_width="400dp" android:layout_marginRight="10dp"/>
-    <fragment android:id="@+id/article" android:layout_height="fill_parent"
+              android:layout_width="400dp"
+              android:layout_marginRight="10dp"/>
+    <fragment android:id="@+id/article"
+              android:layout_height="fill_parent"
               android:name="com.example.android.newsreader.ArticleFragment"
               android:layout_width="fill_parent" />
 </LinearLayout>
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/res/layout/twopanes_narrow.xml b/samples/training/multiscreen/newsreader/res/layout/twopanes_narrow.xml
index 98d9516..b444071 100644
--- a/samples/training/multiscreen/newsreader/res/layout/twopanes_narrow.xml
+++ b/samples/training/multiscreen/newsreader/res/layout/twopanes_narrow.xml
@@ -14,14 +14,19 @@
      limitations under the License.
 -->
 
-<LinearLayout
-  xmlns:android="http://schemas.android.com/apk/res/android"
-  android:layout_width="fill_parent"
-  android:layout_height="fill_parent" android:orientation="horizontal">
-    <fragment android:id="@+id/headlines" android:layout_height="fill_parent"
+<!-- BEGIN_INCLUDE(all) -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="horizontal">
+    <fragment android:id="@+id/headlines"
+              android:layout_height="fill_parent"
               android:name="com.example.android.newsreader.HeadlinesFragment"
-              android:layout_width="200dp" android:layout_marginRight="10dp"/>
-    <fragment android:id="@+id/article" android:layout_height="fill_parent"
+              android:layout_width="200dp"
+              android:layout_marginRight="10dp"/>
+    <fragment android:id="@+id/article"
+              android:layout_height="fill_parent"
               android:name="com.example.android.newsreader.ArticleFragment"
               android:layout_width="fill_parent" />
 </LinearLayout>
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/res/values-sw600dp-land/main.xml b/samples/training/multiscreen/newsreader/res/values-sw600dp-land/layouts.xml
similarity index 88%
rename from samples/training/multiscreen/newsreader/res/values-sw600dp-land/main.xml
rename to samples/training/multiscreen/newsreader/res/values-sw600dp-land/layouts.xml
index 85e5966..9a4dc8c 100644
--- a/samples/training/multiscreen/newsreader/res/values-sw600dp-land/main.xml
+++ b/samples/training/multiscreen/newsreader/res/values-sw600dp-land/layouts.xml
@@ -14,7 +14,9 @@
      limitations under the License.
 -->
 
+<!-- BEGIN_INCLUDE(all) -->
 <resources>
     <item name="main_layout" type="layout">@layout/twopanes</item>
-    <string name="has_two_panes">true</string>
+    <bool name="has_two_panes">true</bool>
 </resources>
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/res/values-sw600dp-port/main.xml b/samples/training/multiscreen/newsreader/res/values-sw600dp-port/layouts.xml
similarity index 88%
rename from samples/training/multiscreen/newsreader/res/values-sw600dp-port/main.xml
rename to samples/training/multiscreen/newsreader/res/values-sw600dp-port/layouts.xml
index 4d032dd..0db5cbb 100644
--- a/samples/training/multiscreen/newsreader/res/values-sw600dp-port/main.xml
+++ b/samples/training/multiscreen/newsreader/res/values-sw600dp-port/layouts.xml
@@ -14,7 +14,9 @@
      limitations under the License.
 -->
 
+<!-- BEGIN_INCLUDE(all) -->
 <resources>
     <item name="main_layout" type="layout">@layout/onepane</item>
-    <string name="has_two_panes">false</string>
+    <bool name="has_two_panes">false</bool>
 </resources>
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/res/values-sw600dp-port/main.xml b/samples/training/multiscreen/newsreader/res/values-v11/layouts.xml
similarity index 88%
copy from samples/training/multiscreen/newsreader/res/values-sw600dp-port/main.xml
copy to samples/training/multiscreen/newsreader/res/values-v11/layouts.xml
index 4d032dd..0db5cbb 100644
--- a/samples/training/multiscreen/newsreader/res/values-sw600dp-port/main.xml
+++ b/samples/training/multiscreen/newsreader/res/values-v11/layouts.xml
@@ -14,7 +14,9 @@
      limitations under the License.
 -->
 
+<!-- BEGIN_INCLUDE(all) -->
 <resources>
     <item name="main_layout" type="layout">@layout/onepane</item>
-    <string name="has_two_panes">false</string>
+    <bool name="has_two_panes">false</bool>
 </resources>
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/res/values-v11/main.xml b/samples/training/multiscreen/newsreader/res/values-v11/main.xml
deleted file mode 100644
index cb82bb8..0000000
--- a/samples/training/multiscreen/newsreader/res/values-v11/main.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?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>
-    <item name="main_layout" type="layout">@layout/onepane</item>
-</resources>
diff --git a/samples/training/multiscreen/newsreader/res/values-sw600dp-land/main.xml b/samples/training/multiscreen/newsreader/res/values-xlarge-land/layouts.xml
similarity index 88%
copy from samples/training/multiscreen/newsreader/res/values-sw600dp-land/main.xml
copy to samples/training/multiscreen/newsreader/res/values-xlarge-land/layouts.xml
index 85e5966..9a4dc8c 100644
--- a/samples/training/multiscreen/newsreader/res/values-sw600dp-land/main.xml
+++ b/samples/training/multiscreen/newsreader/res/values-xlarge-land/layouts.xml
@@ -14,7 +14,9 @@
      limitations under the License.
 -->
 
+<!-- BEGIN_INCLUDE(all) -->
 <resources>
     <item name="main_layout" type="layout">@layout/twopanes</item>
-    <string name="has_two_panes">true</string>
+    <bool name="has_two_panes">true</bool>
 </resources>
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/res/values-xlarge-land/main.xml b/samples/training/multiscreen/newsreader/res/values-xlarge-land/main.xml
deleted file mode 100644
index 85e5966..0000000
--- a/samples/training/multiscreen/newsreader/res/values-xlarge-land/main.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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>
-    <item name="main_layout" type="layout">@layout/twopanes</item>
-    <string name="has_two_panes">true</string>
-</resources>
diff --git a/samples/training/multiscreen/newsreader/res/values-xlarge-port/main.xml b/samples/training/multiscreen/newsreader/res/values-xlarge-port/layouts.xml
similarity index 88%
rename from samples/training/multiscreen/newsreader/res/values-xlarge-port/main.xml
rename to samples/training/multiscreen/newsreader/res/values-xlarge-port/layouts.xml
index 90e6a4a..39c4645 100644
--- a/samples/training/multiscreen/newsreader/res/values-xlarge-port/main.xml
+++ b/samples/training/multiscreen/newsreader/res/values-xlarge-port/layouts.xml
@@ -14,7 +14,9 @@
      limitations under the License.
 -->
 
+<!-- BEGIN_INCLUDE(all) -->
 <resources>
     <item name="main_layout" type="layout">@layout/twopanes_narrow</item>
-    <string name="has_two_panes">true</string>
+    <bool name="has_two_panes">true</bool>
 </resources>
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/res/values/main.xml b/samples/training/multiscreen/newsreader/res/values/layouts.xml
similarity index 88%
rename from samples/training/multiscreen/newsreader/res/values/main.xml
rename to samples/training/multiscreen/newsreader/res/values/layouts.xml
index c598762..3f2cf58 100644
--- a/samples/training/multiscreen/newsreader/res/values/main.xml
+++ b/samples/training/multiscreen/newsreader/res/values/layouts.xml
@@ -14,7 +14,9 @@
      limitations under the License.
 -->
 
+<!-- BEGIN_INCLUDE(all) -->
 <resources>
     <item name="main_layout" type="layout">@layout/onepane_with_bar</item>
-    <string name="has_two_panes">false</string>
+    <bool name="has_two_panes">false</bool>
 </resources>
+<!-- END_INCLUDE(all) -->
diff --git a/samples/training/multiscreen/newsreader/src/com/example/android/newsreader/ArticleActivity.java b/samples/training/multiscreen/newsreader/src/com/example/android/newsreader/ArticleActivity.java
index 2aff792..9e63c3f 100644
--- a/samples/training/multiscreen/newsreader/src/com/example/android/newsreader/ArticleActivity.java
+++ b/samples/training/multiscreen/newsreader/src/com/example/android/newsreader/ArticleActivity.java
@@ -47,11 +47,8 @@
         mCatIndex = getIntent().getExtras().getInt("catIndex", 0);
         mArtIndex = getIntent().getExtras().getInt("artIndex", 0);
 
-        // If we are in two-pane layout mode and the device is in landscape orientation, we are
-        // no longer necessary
-        if (getResources().getString(R.string.has_two_panes).equals("true") &&
-                    getResources().getConfiguration().orientation ==
-                    Configuration.ORIENTATION_LANDSCAPE) {
+        // If we are in two-pane layout mode, this activity is no longer necessary
+        if (getResources().getBoolean(R.bool.has_two_panes)) {
             finish();
             return;
         }