Add ActionBarCompat sample (CL 1 of 2)

Change-Id: Ie41aee3fc805bf73ef0cd673049fcb608b59275c
diff --git a/build/sdk.atree b/build/sdk.atree
index df15126..ca51ec5 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -153,6 +153,7 @@
 #
 development/samples/AccessibilityService       samples/${PLATFORM_NAME}/AccessibilityService
 development/samples/AccelerometerPlay          samples/${PLATFORM_NAME}/AccelerometerPlay
+development/samples/ActionBarCompat            samples/${PLATFORM_NAME}/ActionBarCompat
 development/samples/AndroidBeam                samples/${PLATFORM_NAME}/AndroidBeam
 development/samples/ApiDemos                   samples/${PLATFORM_NAME}/ApiDemos
 development/samples/BackupRestore              samples/${PLATFORM_NAME}/BackupRestore
diff --git a/samples/ActionBarCompat/Android.mk b/samples/ActionBarCompat/Android.mk
new file mode 100644
index 0000000..d9da54a
--- /dev/null
+++ b/samples/ActionBarCompat/Android.mk
@@ -0,0 +1,16 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := samples
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := ActionBarCompat
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
+
+# Use the following include to make our test apk.
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/samples/ActionBarCompat/AndroidManifest.xml b/samples/ActionBarCompat/AndroidManifest.xml
new file mode 100644
index 0000000..1a48274
--- /dev/null
+++ b/samples/ActionBarCompat/AndroidManifest.xml
@@ -0,0 +1,34 @@
+<!--
+  Copyright 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.
+  -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.example.android.actionbarcompat"
+    android:versionCode="1"
+    android:versionName="1.0">
+
+    <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="14" />
+
+    <application android:label="@string/app_name"
+        android:icon="@drawable/ic_launcher"
+        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/samples/ActionBarCompat/_index.html b/samples/ActionBarCompat/_index.html
new file mode 100644
index 0000000..8808de1
--- /dev/null
+++ b/samples/ActionBarCompat/_index.html
@@ -0,0 +1,25 @@
+<!--
+  Copyright 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.
+  -->
+
+<p>This sample shows how to use the action bar design pattern on pre-API 11 devices and the built-in
+<a href="../../../reference/android/app/ActionBar.html">ActionBar</a> on devices supporting API
+11 or greater. The example 'compatible' action bar, instantiated on pre-Android 3.0 devices,
+uses the same <a href="../../../guide/topics/resources/menu-resource.html">menu resource</a>-based
+action item definition mechanism as the new framework API, even supporting the
+<code>android:showAsAction</code> attribute to a limited extent.</p>
+
+<img alt="" src="../images/ActionBarCompat1.png" height="320" />
+<img alt="" src="../images/ActionBarCompat2.png" height="320" />
diff --git a/samples/ActionBarCompat/res/drawable-hdpi/actionbar_shadow.9.png b/samples/ActionBarCompat/res/drawable-hdpi/actionbar_shadow.9.png
new file mode 100644
index 0000000..3c80a3f
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-hdpi/actionbar_shadow.9.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-hdpi/ic_action_refresh.png b/samples/ActionBarCompat/res/drawable-hdpi/ic_action_refresh.png
new file mode 100644
index 0000000..efe99e0
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-hdpi/ic_action_refresh.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-hdpi/ic_action_search.png b/samples/ActionBarCompat/res/drawable-hdpi/ic_action_search.png
new file mode 100644
index 0000000..f6719d2
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-hdpi/ic_action_search.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-hdpi/ic_action_share.png b/samples/ActionBarCompat/res/drawable-hdpi/ic_action_share.png
new file mode 100644
index 0000000..7d0b872
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-hdpi/ic_action_share.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-hdpi/ic_home.png b/samples/ActionBarCompat/res/drawable-hdpi/ic_home.png
new file mode 100644
index 0000000..7e52ff5
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-hdpi/ic_home.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-hdpi/ic_launcher.png b/samples/ActionBarCompat/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 0000000..e4b0492
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-hdpi/ic_menu_share.png b/samples/ActionBarCompat/res/drawable-hdpi/ic_menu_share.png
new file mode 100755
index 0000000..a78bf7a
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-hdpi/ic_menu_share.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-mdpi/actionbar_shadow.9.png b/samples/ActionBarCompat/res/drawable-mdpi/actionbar_shadow.9.png
new file mode 100644
index 0000000..cae1778
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-mdpi/actionbar_shadow.9.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-mdpi/ic_action_refresh.png b/samples/ActionBarCompat/res/drawable-mdpi/ic_action_refresh.png
new file mode 100644
index 0000000..a85eee3
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-mdpi/ic_action_refresh.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-mdpi/ic_action_search.png b/samples/ActionBarCompat/res/drawable-mdpi/ic_action_search.png
new file mode 100755
index 0000000..45d2398
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-mdpi/ic_action_search.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-mdpi/ic_action_share.png b/samples/ActionBarCompat/res/drawable-mdpi/ic_action_share.png
new file mode 100644
index 0000000..26a39bd
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-mdpi/ic_action_share.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-mdpi/ic_home.png b/samples/ActionBarCompat/res/drawable-mdpi/ic_home.png
new file mode 100644
index 0000000..949b4aa
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-mdpi/ic_home.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-mdpi/ic_launcher.png b/samples/ActionBarCompat/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 0000000..78d0e29
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-mdpi/ic_menu_share.png b/samples/ActionBarCompat/res/drawable-mdpi/ic_menu_share.png
new file mode 100755
index 0000000..3329b6b
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-mdpi/ic_menu_share.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-xhdpi/actionbar_shadow.9.png b/samples/ActionBarCompat/res/drawable-xhdpi/actionbar_shadow.9.png
new file mode 100644
index 0000000..30778e3
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-xhdpi/actionbar_shadow.9.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-xhdpi/ic_action_refresh.png b/samples/ActionBarCompat/res/drawable-xhdpi/ic_action_refresh.png
new file mode 100644
index 0000000..6ce9376
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-xhdpi/ic_action_refresh.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-xhdpi/ic_action_search.png b/samples/ActionBarCompat/res/drawable-xhdpi/ic_action_search.png
new file mode 100644
index 0000000..f89c4e9
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-xhdpi/ic_action_search.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-xhdpi/ic_action_share.png b/samples/ActionBarCompat/res/drawable-xhdpi/ic_action_share.png
new file mode 100644
index 0000000..47b27d1
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-xhdpi/ic_action_share.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-xhdpi/ic_home.png b/samples/ActionBarCompat/res/drawable-xhdpi/ic_home.png
new file mode 100644
index 0000000..03eb53d
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-xhdpi/ic_home.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable-xhdpi/ic_launcher.png b/samples/ActionBarCompat/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 0000000..485f7be
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/ActionBarCompat/res/drawable/actionbar_compat_item.xml b/samples/ActionBarCompat/res/drawable/actionbar_compat_item.xml
new file mode 100644
index 0000000..4b3960c
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable/actionbar_compat_item.xml
@@ -0,0 +1,23 @@
+<!--
+  Copyright 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.
+  -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:drawable="@drawable/actionbar_compat_item_pressed"
+        android:state_pressed="true" />
+    <item android:drawable="@drawable/actionbar_compat_item_focused"
+        android:state_focused="true" />
+    <item android:drawable="@android:color/transparent" />
+</selector>
diff --git a/samples/ActionBarCompat/res/drawable/actionbar_compat_item_focused.xml b/samples/ActionBarCompat/res/drawable/actionbar_compat_item_focused.xml
new file mode 100644
index 0000000..04811d3
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable/actionbar_compat_item_focused.xml
@@ -0,0 +1,19 @@
+<!--
+  Copyright 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.
+  -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="#ef7000" />
+</shape>
diff --git a/samples/ActionBarCompat/res/drawable/actionbar_compat_item_pressed.xml b/samples/ActionBarCompat/res/drawable/actionbar_compat_item_pressed.xml
new file mode 100644
index 0000000..72ff4b4
--- /dev/null
+++ b/samples/ActionBarCompat/res/drawable/actionbar_compat_item_pressed.xml
@@ -0,0 +1,19 @@
+<!--
+  Copyright 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.
+  -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="#eda700" />
+</shape>
diff --git a/samples/ActionBarCompat/res/layout-v11/actionbar_indeterminate_progress.xml b/samples/ActionBarCompat/res/layout-v11/actionbar_indeterminate_progress.xml
new file mode 100644
index 0000000..c05750e
--- /dev/null
+++ b/samples/ActionBarCompat/res/layout-v11/actionbar_indeterminate_progress.xml
@@ -0,0 +1,27 @@
+<!--
+  Copyright 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.
+  -->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:gravity="center">
+    <ProgressBar android:layout_width="32dp"
+        android:layout_height="32dp"
+        android:layout_marginLeft="12dp"
+        android:layout_marginRight="12dp"
+        android:layout_gravity="center"
+        style="?android:attr/indeterminateProgressStyle" />
+</FrameLayout>
diff --git a/samples/ActionBarCompat/res/layout/actionbar_compat.xml b/samples/ActionBarCompat/res/layout/actionbar_compat.xml
new file mode 100644
index 0000000..ae6c44b
--- /dev/null
+++ b/samples/ActionBarCompat/res/layout/actionbar_compat.xml
@@ -0,0 +1,21 @@
+<!--
+  Copyright 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.
+  -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@id/actionbar_compat"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="horizontal" />
diff --git a/samples/ActionBarCompat/res/layout/main.xml b/samples/ActionBarCompat/res/layout/main.xml
new file mode 100644
index 0000000..a58a346
--- /dev/null
+++ b/samples/ActionBarCompat/res/layout/main.xml
@@ -0,0 +1,25 @@
+<!--
+  Copyright 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.
+  -->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+    <Button android:id="@+id/toggle_title"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:text="@string/toggle_title" />
+</FrameLayout>
diff --git a/samples/ActionBarCompat/res/menu/main.xml b/samples/ActionBarCompat/res/menu/main.xml
new file mode 100644
index 0000000..a306a3c
--- /dev/null
+++ b/samples/ActionBarCompat/res/menu/main.xml
@@ -0,0 +1,34 @@
+<!--
+  Copyright 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.
+  -->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/menu_refresh"
+        android:title="@string/menu_refresh"
+        android:icon="@drawable/ic_action_refresh"
+        android:orderInCategory="1"
+        android:showAsAction="always" />
+    <item android:id="@+id/menu_search"
+        android:title="@string/menu_search"
+        android:icon="@drawable/ic_action_search"
+        android:orderInCategory="0"
+        android:showAsAction="always" />
+
+    <item android:id="@+id/menu_share"
+        android:title="@string/menu_share"
+        android:icon="@drawable/ic_menu_share"
+        android:orderInCategory="1"
+        android:showAsAction="never" />
+</menu>
diff --git a/samples/ActionBarCompat/res/values-v11/styles.xml b/samples/ActionBarCompat/res/values-v11/styles.xml
new file mode 100644
index 0000000..dc1aa7c
--- /dev/null
+++ b/samples/ActionBarCompat/res/values-v11/styles.xml
@@ -0,0 +1,34 @@
+<!--
+  Copyright 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>
+
+    <style name="AppTheme" parent="android:style/Theme.Holo.Light">
+        <item name="android:actionBarStyle">@style/ActionBar</item>
+        <item name="android:windowContentOverlay">@drawable/actionbar_shadow</item>
+    </style>
+
+    <style name="ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
+        <item name="android:background">#eee</item>
+        <item name="android:titleTextStyle">@style/ActionBarTitle</item>
+        <item name="android:icon">@drawable/ic_home</item>
+    </style>
+
+    <style name="ActionBarTitle">
+        <item name="android:textColor">@color/actionbar_title_color</item>
+    </style>
+
+</resources>
diff --git a/samples/ActionBarCompat/res/values-v13/styles.xml b/samples/ActionBarCompat/res/values-v13/styles.xml
new file mode 100644
index 0000000..8a042b4
--- /dev/null
+++ b/samples/ActionBarCompat/res/values-v13/styles.xml
@@ -0,0 +1,23 @@
+<!--
+  Copyright 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>
+
+    <style name="ActionBarTitle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
+        <item name="android:textColor">@color/actionbar_title_color</item>
+    </style>
+
+</resources>
diff --git a/samples/ActionBarCompat/res/values/attrs.xml b/samples/ActionBarCompat/res/values/attrs.xml
new file mode 100644
index 0000000..c59822c
--- /dev/null
+++ b/samples/ActionBarCompat/res/values/attrs.xml
@@ -0,0 +1,31 @@
+<!--
+  Copyright 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>
+
+    <declare-styleable name="AppTheme">
+        <attr name="actionbarCompatTitleStyle" format="reference" />
+        <attr name="actionbarCompatItemStyle" format="reference" />
+        <attr name="actionbarCompatItemHomeStyle" format="reference" />
+        <attr name="actionbarCompatProgressIndicatorStyle" format="reference" />
+    </declare-styleable>
+
+    <declare-styleable name="BezelImageView">
+        <attr name="maskDrawable" format="reference" />
+        <attr name="borderDrawable" format="reference" />
+    </declare-styleable>
+
+</resources>
diff --git a/samples/ActionBarCompat/res/values/colors.xml b/samples/ActionBarCompat/res/values/colors.xml
new file mode 100644
index 0000000..4edc6d6
--- /dev/null
+++ b/samples/ActionBarCompat/res/values/colors.xml
@@ -0,0 +1,19 @@
+<!--
+  Copyright 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>
+    <color name="actionbar_title_color">#224894</color>
+</resources>
diff --git a/samples/ActionBarCompat/res/values/dimens.xml b/samples/ActionBarCompat/res/values/dimens.xml
new file mode 100644
index 0000000..67c8436
--- /dev/null
+++ b/samples/ActionBarCompat/res/values/dimens.xml
@@ -0,0 +1,21 @@
+<!--
+  Copyright 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>
+    <dimen name="actionbar_compat_height">48dp</dimen>
+    <dimen name="actionbar_compat_button_width">48dp</dimen>
+    <dimen name="actionbar_compat_button_home_width">56dp</dimen>
+</resources>
diff --git a/samples/ActionBarCompat/res/values/ids.xml b/samples/ActionBarCompat/res/values/ids.xml
new file mode 100644
index 0000000..e0a4745
--- /dev/null
+++ b/samples/ActionBarCompat/res/values/ids.xml
@@ -0,0 +1,23 @@
+<!--
+  Copyright 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 type="id" name="actionbar_compat" />
+    <item type="id" name="actionbar_compat_title" />
+    <item type="id" name="actionbar_compat_item_refresh_progress" />
+    <item type="id" name="actionbar_compat_item_refresh" />
+    <item type="id" name="menu_refresh" />
+</resources>
diff --git a/samples/ActionBarCompat/res/values/strings.xml b/samples/ActionBarCompat/res/values/strings.xml
new file mode 100644
index 0000000..234aa78
--- /dev/null
+++ b/samples/ActionBarCompat/res/values/strings.xml
@@ -0,0 +1,25 @@
+<!--
+  Copyright 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>
+    <string name="app_name">Action Bar Demo</string>
+    <string name="alternate_title">An alternate title that is long</string>
+    <string name="toggle_title">Toggle title</string>
+
+    <string name="menu_refresh">Refresh</string>
+    <string name="menu_search">Search</string>
+    <string name="menu_share">Share</string>
+</resources>
diff --git a/samples/ActionBarCompat/res/values/styles.xml b/samples/ActionBarCompat/res/values/styles.xml
new file mode 100644
index 0000000..5d0c029
--- /dev/null
+++ b/samples/ActionBarCompat/res/values/styles.xml
@@ -0,0 +1,66 @@
+<!--
+  Copyright 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>
+
+    <style name="AppTheme" parent="android:style/Theme.Light">
+        <item name="android:windowTitleSize">@dimen/actionbar_compat_height</item>
+        <item name="android:windowTitleBackgroundStyle">@style/ActionBarCompat</item>
+        <item name="android:windowContentOverlay">@drawable/actionbar_shadow</item>
+
+        <!-- for programmatic instantiation -->
+        <item name="actionbarCompatTitleStyle">@style/ActionBarCompatTitle</item>
+        <item name="actionbarCompatItemStyle">@style/ActionBarCompatItem</item>
+        <item name="actionbarCompatItemHomeStyle">@style/ActionBarCompatHomeItem</item>
+        <item name="actionbarCompatProgressIndicatorStyle">@style/ActionBarCompatProgressIndicator</item>
+    </style>
+
+    <style name="ActionBarCompat">
+        <item name="android:background">#eee</item>
+    </style>
+
+    <style name="ActionBarCompatItemBase">
+        <!-- layout_width/height must be set in code -->
+        <item name="android:scaleType">center</item>
+        <item name="android:background">@drawable/actionbar_compat_item</item>
+    </style>
+
+    <style name="ActionBarCompatProgressIndicator" parent="android:style/Widget.ProgressBar.Large">
+        <item name="android:indeterminate">true</item>
+    </style>
+
+    <style name="ActionBarCompatTitleBase">
+        <item name="android:id">@id/actionbar_compat_title</item>
+        <!-- layout_width/height/weight must be set in code -->
+        <item name="android:gravity">center_vertical</item>
+        <item name="android:textSize">18sp</item>
+        <item name="android:paddingLeft">6dp</item>
+        <item name="android:paddingRight">6dp</item>
+        <item name="android:singleLine">true</item>
+        <item name="android:ellipsize">marquee</item>
+    </style>
+
+    <style name="ActionBarCompatTitle" parent="style/ActionBarCompatTitleBase">
+        <item name="android:textColor">@color/actionbar_title_color</item>
+    </style>
+
+    <style name="ActionBarCompatItem" parent="style/ActionBarCompatItemBase">
+    </style>
+
+    <style name="ActionBarCompatHomeItem" parent="style/ActionBarCompatItemBase">
+    </style>
+
+</resources>
diff --git a/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarActivity.java b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarActivity.java
new file mode 100644
index 0000000..251e411
--- /dev/null
+++ b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarActivity.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 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.actionbarcompat;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+
+/**
+ * A base activity that defers common functionality across app activities to an {@link
+ * ActionBarHelper}.
+ *
+ * NOTE: dynamically marking menu items as invisible/visible is not currently supported.
+ *
+ * NOTE: this may used with the Android Compatibility Package by extending
+ * android.support.v4.app.FragmentActivity instead of {@link Activity}.
+ */
+public abstract class ActionBarActivity extends Activity {
+    final ActionBarHelper mActionBarHelper = ActionBarHelper.createInstance(this);
+
+    /**
+     * Returns the {@link ActionBarHelper} for this activity.
+     */
+    protected ActionBarHelper getActionBarHelper() {
+        return mActionBarHelper;
+    }
+
+    /**{@inheritDoc}*/
+    @Override
+    public MenuInflater getMenuInflater() {
+        return mActionBarHelper.getMenuInflater(super.getMenuInflater());
+    }
+
+    /**{@inheritDoc}*/
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mActionBarHelper.onCreate(savedInstanceState);
+    }
+
+    /**{@inheritDoc}*/
+    @Override
+    protected void onPostCreate(Bundle savedInstanceState) {
+        super.onPostCreate(savedInstanceState);
+        mActionBarHelper.onPostCreate(savedInstanceState);
+    }
+
+    /**
+     * Base action bar-aware implementation for
+     * {@link Activity#onCreateOptionsMenu(android.view.Menu)}.
+     *
+     * Note: marking menu items as invisible/visible is not currently supported.
+     */
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        boolean retValue = false;
+        retValue |= mActionBarHelper.onCreateOptionsMenu(menu);
+        retValue |= super.onCreateOptionsMenu(menu);
+        return retValue;
+    }
+
+    /**{@inheritDoc}*/
+    @Override
+    protected void onTitleChanged(CharSequence title, int color) {
+        mActionBarHelper.onTitleChanged(title, color);
+        super.onTitleChanged(title, color);
+    }
+}
diff --git a/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelper.java b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelper.java
new file mode 100644
index 0000000..075f993
--- /dev/null
+++ b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelper.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 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.actionbarcompat;
+
+import android.app.Activity;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+
+/**
+ * An abstract class that handles some common action bar-related functionality in the app. This
+ * class provides functionality useful for both phones and tablets, and does not require any Android
+ * 3.0-specific features, although it uses them if available.
+ *
+ * Two implementations of this class are {@link ActionBarHelperBase} for a pre-Honeycomb version of
+ * the action bar, and {@link ActionBarHelperHoneycomb}, which uses the built-in ActionBar features
+ * in Android 3.0 and later.
+ */
+public abstract class ActionBarHelper {
+    protected Activity mActivity;
+
+    /**
+     * Factory method for creating {@link ActionBarHelper} objects for a
+     * given activity. Depending on which device the app is running, either a basic helper or
+     * Honeycomb-specific helper will be returned.
+     */
+    public static ActionBarHelper createInstance(Activity activity) {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+            return new ActionBarHelperICS(activity);
+        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+            return new ActionBarHelperHoneycomb(activity);
+        } else {
+            return new ActionBarHelperBase(activity);
+        }
+    }
+
+    protected ActionBarHelper(Activity activity) {
+        mActivity = activity;
+    }
+
+    /**
+     * Action bar helper code to be run in {@link Activity#onCreate(android.os.Bundle)}.
+     */
+    public void onCreate(Bundle savedInstanceState) {
+    }
+
+    /**
+     * Action bar helper code to be run in {@link Activity#onPostCreate(android.os.Bundle)}.
+     */
+    public void onPostCreate(Bundle savedInstanceState) {
+    }
+
+    /**
+     * Action bar helper code to be run in {@link Activity#onCreateOptionsMenu(android.view.Menu)}.
+     *
+     * NOTE: Setting the visibility of menu items in <em>menu</em> is not currently supported.
+     */
+    public boolean onCreateOptionsMenu(Menu menu) {
+        return true;
+    }
+
+    /**
+     * Action bar helper code to be run in {@link Activity#onTitleChanged(CharSequence, int)}.
+     */
+    protected void onTitleChanged(CharSequence title, int color) {
+    }
+
+    /**
+     * Sets the indeterminate loading state of the item with ID {@link R.id.menu_refresh}.
+     * (where the item ID was menu_refresh).
+     */
+    public abstract void setRefreshActionItemState(boolean refreshing);
+
+    /**
+     * Returns a {@link MenuInflater} for use when inflating menus. The implementation of this
+     * method in {@link ActionBarHelperBase} returns a wrapped menu inflater that can read
+     * action bar metadata from a menu resource pre-Honeycomb.
+     */
+    public MenuInflater getMenuInflater(MenuInflater superMenuInflater) {
+        return superMenuInflater;
+    }
+}
diff --git a/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelperBase.java b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelperBase.java
new file mode 100644
index 0000000..f70b54a
--- /dev/null
+++ b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelperBase.java
@@ -0,0 +1,301 @@
+/*
+ * Copyright 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.actionbarcompat;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.XmlResourceParser;
+import android.os.Bundle;
+import android.view.InflateException;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A class that implements the action bar pattern for pre-Honeycomb devices.
+ */
+public class ActionBarHelperBase extends ActionBarHelper {
+    private static final String MENU_RES_NAMESPACE = "http://schemas.android.com/apk/res/android";
+    private static final String MENU_ATTR_ID = "id";
+    private static final String MENU_ATTR_SHOW_AS_ACTION = "showAsAction";
+
+    protected Set<Integer> mActionItemIds = new HashSet<Integer>();
+
+    protected ActionBarHelperBase(Activity activity) {
+        super(activity);
+    }
+
+    /**{@inheritDoc}*/
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        mActivity.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
+    }
+
+    /**{@inheritDoc}*/
+    @Override
+    public void onPostCreate(Bundle savedInstanceState) {
+        mActivity.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
+                R.layout.actionbar_compat);
+        setupActionBar();
+
+        SimpleMenu menu = new SimpleMenu(mActivity);
+        mActivity.onCreatePanelMenu(Window.FEATURE_OPTIONS_PANEL, menu);
+        mActivity.onPrepareOptionsMenu(menu);
+        for (int i = 0; i < menu.size(); i++) {
+            MenuItem item = menu.getItem(i);
+            if (mActionItemIds.contains(item.getItemId())) {
+                addActionItemCompatFromMenuItem(item);
+            }
+        }
+    }
+
+    /**
+     * Sets up the compatibility action bar with the given title.
+     */
+    private void setupActionBar() {
+        final ViewGroup actionBarCompat = getActionBarCompat();
+        if (actionBarCompat == null) {
+            return;
+        }
+
+        LinearLayout.LayoutParams springLayoutParams = new LinearLayout.LayoutParams(
+                0, ViewGroup.LayoutParams.FILL_PARENT);
+        springLayoutParams.weight = 1;
+
+        // Add Home button
+        SimpleMenu tempMenu = new SimpleMenu(mActivity);
+        SimpleMenuItem homeItem = new SimpleMenuItem(
+                tempMenu, android.R.id.home, 0, mActivity.getString(R.string.app_name));
+        homeItem.setIcon(R.drawable.ic_home);
+        addActionItemCompatFromMenuItem(homeItem);
+
+        // Add title text
+        TextView titleText = new TextView(mActivity, null, R.attr.actionbarCompatTitleStyle);
+        titleText.setLayoutParams(springLayoutParams);
+        titleText.setText(mActivity.getTitle());
+        actionBarCompat.addView(titleText);
+    }
+
+    /**{@inheritDoc}*/
+    @Override
+    public void setRefreshActionItemState(boolean refreshing) {
+        View refreshButton = mActivity.findViewById(R.id.actionbar_compat_item_refresh);
+        View refreshIndicator = mActivity.findViewById(
+                R.id.actionbar_compat_item_refresh_progress);
+
+        if (refreshButton != null) {
+            refreshButton.setVisibility(refreshing ? View.GONE : View.VISIBLE);
+        }
+        if (refreshIndicator != null) {
+            refreshIndicator.setVisibility(refreshing ? View.VISIBLE : View.GONE);
+        }
+    }
+
+    /**
+     * Action bar helper code to be run in {@link Activity#onCreateOptionsMenu(android.view.Menu)}.
+     *
+     * NOTE: This code will mark on-screen menu items as invisible.
+     */
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        // Hides on-screen action items from the options menu.
+        for (Integer id : mActionItemIds) {
+            menu.findItem(id).setVisible(false);
+        }
+        return true;
+    }
+
+    /**{@inheritDoc}*/
+    @Override
+    protected void onTitleChanged(CharSequence title, int color) {
+        TextView titleView = (TextView) mActivity.findViewById(R.id.actionbar_compat_title);
+        if (titleView != null) {
+            titleView.setText(title);
+        }
+    }
+
+    /**
+     * Returns a {@link android.view.MenuInflater} that can read action bar metadata on
+     * pre-Honeycomb devices.
+     */
+    public MenuInflater getMenuInflater(MenuInflater superMenuInflater) {
+        return new WrappedMenuInflater(mActivity, superMenuInflater);
+    }
+
+    /**
+     * Returns the {@link android.view.ViewGroup} for the action bar on phones (compatibility action
+     * bar). Can return null, and will return null on Honeycomb.
+     */
+    private ViewGroup getActionBarCompat() {
+        return (ViewGroup) mActivity.findViewById(R.id.actionbar_compat);
+    }
+
+    /**
+     * Adds an action button to the compatibility action bar, using menu information from a {@link
+     * android.view.MenuItem}. If the menu item ID is <code>menu_refresh</code>, the menu item's
+     * state can be changed to show a loading spinner using
+     * {@link com.example.android.actionbarcompat.ActionBarHelperBase#setRefreshActionItemState(boolean)}.
+     */
+    private View addActionItemCompatFromMenuItem(final MenuItem item) {
+        final int itemId = item.getItemId();
+
+        final ViewGroup actionBar = getActionBarCompat();
+        if (actionBar == null) {
+            return null;
+        }
+
+        // Create the button
+        ImageButton actionButton = new ImageButton(mActivity, null,
+                itemId == android.R.id.home
+                        ? R.attr.actionbarCompatItemHomeStyle
+                        : R.attr.actionbarCompatItemStyle);
+        actionButton.setLayoutParams(new ViewGroup.LayoutParams(
+                (int) mActivity.getResources().getDimension(
+                        itemId == android.R.id.home
+                                ? R.dimen.actionbar_compat_button_home_width
+                                : R.dimen.actionbar_compat_button_width),
+                ViewGroup.LayoutParams.FILL_PARENT));
+        if (itemId == R.id.menu_refresh) {
+            actionButton.setId(R.id.actionbar_compat_item_refresh);
+        }
+        actionButton.setImageDrawable(item.getIcon());
+        actionButton.setScaleType(ImageView.ScaleType.CENTER);
+        actionButton.setContentDescription(item.getTitle());
+        actionButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View view) {
+                mActivity.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, item);
+            }
+        });
+
+        actionBar.addView(actionButton);
+
+        if (item.getItemId() == R.id.menu_refresh) {
+            // Refresh buttons should be stateful, and allow for indeterminate progress indicators,
+            // so add those.
+            ProgressBar indicator = new ProgressBar(mActivity, null,
+                    R.attr.actionbarCompatProgressIndicatorStyle);
+
+            final int buttonWidth = mActivity.getResources().getDimensionPixelSize(
+                    R.dimen.actionbar_compat_button_width);
+            final int buttonHeight = mActivity.getResources().getDimensionPixelSize(
+                    R.dimen.actionbar_compat_height);
+            final int progressIndicatorWidth = buttonWidth / 2;
+
+            LinearLayout.LayoutParams indicatorLayoutParams = new LinearLayout.LayoutParams(
+                    progressIndicatorWidth, progressIndicatorWidth);
+            indicatorLayoutParams.setMargins(
+                    (buttonWidth - progressIndicatorWidth) / 2,
+                    (buttonHeight - progressIndicatorWidth) / 2,
+                    (buttonWidth - progressIndicatorWidth) / 2,
+                    0);
+            indicator.setLayoutParams(indicatorLayoutParams);
+            indicator.setVisibility(View.GONE);
+            indicator.setId(R.id.actionbar_compat_item_refresh_progress);
+            actionBar.addView(indicator);
+        }
+
+        return actionButton;
+    }
+
+    /**
+     * A {@link android.view.MenuInflater} that reads action bar metadata.
+     */
+    private class WrappedMenuInflater extends MenuInflater {
+        MenuInflater mInflater;
+
+        public WrappedMenuInflater(Context context, MenuInflater inflater) {
+            super(context);
+            mInflater = inflater;
+        }
+
+        @Override
+        public void inflate(int menuRes, Menu menu) {
+            loadActionBarMetadata(menuRes);
+            mInflater.inflate(menuRes, menu);
+        }
+
+        /**
+         * Loads action bar metadata from a menu resource, storing a list of menu item IDs that
+         * should be shown on-screen (i.e. those with showAsAction set to always or ifRoom).
+         * @param menuResId
+         */
+        private void loadActionBarMetadata(int menuResId) {
+            XmlResourceParser parser = null;
+            try {
+                parser = mActivity.getResources().getXml(menuResId);
+
+                int eventType = parser.getEventType();
+                int itemId;
+                int showAsAction;
+
+                boolean eof = false;
+                while (!eof) {
+                    switch (eventType) {
+                        case XmlPullParser.START_TAG:
+                            if (!parser.getName().equals("item")) {
+                                break;
+                            }
+
+                            itemId = parser.getAttributeResourceValue(MENU_RES_NAMESPACE,
+                                    MENU_ATTR_ID, 0);
+                            if (itemId == 0) {
+                                break;
+                            }
+
+                            showAsAction = parser.getAttributeIntValue(MENU_RES_NAMESPACE,
+                                    MENU_ATTR_SHOW_AS_ACTION, -1);
+                            if (showAsAction == MenuItem.SHOW_AS_ACTION_ALWAYS ||
+                                    showAsAction == MenuItem.SHOW_AS_ACTION_IF_ROOM) {
+                                mActionItemIds.add(itemId);
+                            }
+                            break;
+
+                        case XmlPullParser.END_DOCUMENT:
+                            eof = true;
+                            break;
+                    }
+
+                    eventType = parser.next();
+                }
+            } catch (XmlPullParserException e) {
+                throw new InflateException("Error inflating menu XML", e);
+            } catch (IOException e) {
+                throw new InflateException("Error inflating menu XML", e);
+            } finally {
+                if (parser != null) {
+                    parser.close();
+                }
+            }
+        }
+
+    }
+}
diff --git a/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelperHoneycomb.java b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelperHoneycomb.java
new file mode 100644
index 0000000..16fba69
--- /dev/null
+++ b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelperHoneycomb.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 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.actionbarcompat;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+
+/**
+ * An extension of {@link ActionBarHelper} that provides Android 3.0-specific functionality for
+ * Honeycomb tablets. It thus requires API level 11.
+ */
+public class ActionBarHelperHoneycomb extends ActionBarHelper {
+    private Menu mOptionsMenu;
+    private View mRefreshIndeterminateProgressView = null;
+
+    protected ActionBarHelperHoneycomb(Activity activity) {
+        super(activity);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        mOptionsMenu = menu;
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    @Override
+    public void setRefreshActionItemState(boolean refreshing) {
+        // On Honeycomb, we can set the state of the refresh button by giving it a custom
+        // action view.
+        if (mOptionsMenu == null) {
+            return;
+        }
+
+        final MenuItem refreshItem = mOptionsMenu.findItem(R.id.menu_refresh);
+        if (refreshItem != null) {
+            if (refreshing) {
+                if (mRefreshIndeterminateProgressView == null) {
+                    LayoutInflater inflater = (LayoutInflater)
+                            getActionBarThemedContext().getSystemService(
+                                    Context.LAYOUT_INFLATER_SERVICE);
+                    mRefreshIndeterminateProgressView = inflater.inflate(
+                            R.layout.actionbar_indeterminate_progress, null);
+                }
+
+                refreshItem.setActionView(mRefreshIndeterminateProgressView);
+            } else {
+                refreshItem.setActionView(null);
+            }
+        }
+    }
+
+    /**
+     * Returns a {@link Context} suitable for inflating layouts for the action bar. The
+     * implementation for this method in {@link ActionBarHelperICS} asks the action bar for a
+     * themed context.
+     */
+    protected Context getActionBarThemedContext() {
+        return mActivity;
+    }
+}
diff --git a/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelperICS.java b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelperICS.java
new file mode 100644
index 0000000..d2239db
--- /dev/null
+++ b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/ActionBarHelperICS.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 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.actionbarcompat;
+
+import android.app.Activity;
+import android.content.Context;
+import android.view.Menu;
+import android.view.MenuItem;
+
+/**
+ * An extension of {@link com.example.android.actionbarcompat.ActionBarHelper} that provides Android
+ * 4.0-specific functionality for IceCreamSandwich devices. It thus requires API level 14.
+ */
+public class ActionBarHelperICS extends ActionBarHelperHoneycomb {
+    protected ActionBarHelperICS(Activity activity) {
+        super(activity);
+    }
+
+    @Override
+    protected Context getActionBarThemedContext() {
+        return mActivity.getActionBar().getThemedContext();
+    }
+}
diff --git a/samples/ActionBarCompat/src/com/example/android/actionbarcompat/MainActivity.java b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/MainActivity.java
new file mode 100644
index 0000000..facf1ae
--- /dev/null
+++ b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/MainActivity.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 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.actionbarcompat;
+
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Toast;
+
+public class MainActivity extends ActionBarActivity {
+    private boolean mAlternateTitle = false;
+
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.main);
+
+        findViewById(R.id.toggle_title).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                if (mAlternateTitle) {
+                    setTitle(R.string.app_name);
+                } else {
+                    setTitle(R.string.alternate_title);
+                }
+                mAlternateTitle = !mAlternateTitle;
+            }
+        });
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        MenuInflater menuInflater = getMenuInflater();
+        menuInflater.inflate(R.menu.main, menu);
+
+        // Calling super after populating the menu is necessary here to ensure that the
+        // action bar helpers have a chance to handle this event.
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case android.R.id.home:
+                Toast.makeText(this, "Tapped home", Toast.LENGTH_SHORT).show();
+                break;
+
+            case R.id.menu_refresh:
+                Toast.makeText(this, "Fake refreshing...", Toast.LENGTH_SHORT).show();
+                getActionBarHelper().setRefreshActionItemState(true);
+                getWindow().getDecorView().postDelayed(
+                        new Runnable() {
+                            @Override
+                            public void run() {
+                                getActionBarHelper().setRefreshActionItemState(false);
+                            }
+                        }, 1000);
+                break;
+
+            case R.id.menu_search:
+                Toast.makeText(this, "Tapped search", Toast.LENGTH_SHORT).show();
+                break;
+
+            case R.id.menu_share:
+                Toast.makeText(this, "Tapped share", Toast.LENGTH_SHORT).show();
+                break;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+}
diff --git a/samples/ActionBarCompat/src/com/example/android/actionbarcompat/SimpleMenu.java b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/SimpleMenu.java
new file mode 100644
index 0000000..8b694d0
--- /dev/null
+++ b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/SimpleMenu.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright 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.actionbarcompat;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.SubMenu;
+
+import java.util.ArrayList;
+
+/**
+ * A <em>really</em> dumb implementation of the {@link android.view.Menu} interface, that's only
+ * useful for our actionbar-compat purposes. See
+ * <code>com.android.internal.view.menu.MenuBuilder</code> in AOSP for a more complete
+ * implementation.
+ */
+public class SimpleMenu implements Menu {
+
+    private Context mContext;
+    private Resources mResources;
+
+    private ArrayList<SimpleMenuItem> mItems;
+
+    public SimpleMenu(Context context) {
+        mContext = context;
+        mResources = context.getResources();
+        mItems = new ArrayList<SimpleMenuItem>();
+    }
+
+    public Context getContext() {
+        return mContext;
+    }
+
+    public Resources getResources() {
+        return mResources;
+    }
+
+    public MenuItem add(CharSequence title) {
+        return addInternal(0, 0, title);
+    }
+
+    public MenuItem add(int titleRes) {
+        return addInternal(0, 0, mResources.getString(titleRes));
+    }
+
+    public MenuItem add(int groupId, int itemId, int order, CharSequence title) {
+        return addInternal(itemId, order, title);
+    }
+
+    public MenuItem add(int groupId, int itemId, int order, int titleRes) {
+        return addInternal(itemId, order, mResources.getString(titleRes));
+    }
+
+    /**
+     * Adds an item to the menu.  The other add methods funnel to this.
+     */
+    private MenuItem addInternal(int itemId, int order, CharSequence title) {
+        final SimpleMenuItem item = new SimpleMenuItem(this, itemId, order, title);
+        mItems.add(findInsertIndex(mItems, order), item);
+        return item;
+    }
+
+    private static int findInsertIndex(ArrayList<? extends MenuItem> items, int order) {
+        for (int i = items.size() - 1; i >= 0; i--) {
+            MenuItem item = items.get(i);
+            if (item.getOrder() <= order) {
+                return i + 1;
+            }
+        }
+
+        return 0;
+    }
+
+    public int findItemIndex(int id) {
+        final int size = size();
+
+        for (int i = 0; i < size; i++) {
+            SimpleMenuItem item = mItems.get(i);
+            if (item.getItemId() == id) {
+                return i;
+            }
+        }
+
+        return -1;
+    }
+
+    public void removeItem(int itemId) {
+        removeItemAtInt(findItemIndex(itemId));
+    }
+
+    private void removeItemAtInt(int index) {
+        if ((index < 0) || (index >= mItems.size())) {
+            return;
+        }
+        mItems.remove(index);
+    }
+
+    public void clear() {
+        mItems.clear();
+    }
+
+    public MenuItem findItem(int id) {
+        final int size = size();
+        for (int i = 0; i < size; i++) {
+            SimpleMenuItem item = mItems.get(i);
+            if (item.getItemId() == id) {
+                return item;
+            }
+        }
+
+        return null;
+    }
+
+    public int size() {
+        return mItems.size();
+    }
+
+    public MenuItem getItem(int index) {
+        return mItems.get(index);
+    }
+
+    // Unsupported operations.
+
+    public SubMenu addSubMenu(CharSequence charSequence) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public SubMenu addSubMenu(int titleRes) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public SubMenu addSubMenu(int groupId, int itemId, int order, CharSequence title) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public SubMenu addSubMenu(int groupId, int itemId, int order, int titleRes) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public int addIntentOptions(int i, int i1, int i2, ComponentName componentName,
+            Intent[] intents, Intent intent, int i3, MenuItem[] menuItems) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public void removeGroup(int i) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public void setGroupCheckable(int i, boolean b, boolean b1) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public void setGroupVisible(int i, boolean b) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public void setGroupEnabled(int i, boolean b) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public boolean hasVisibleItems() {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public void close() {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public boolean performShortcut(int i, KeyEvent keyEvent, int i1) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public boolean isShortcutKey(int i, KeyEvent keyEvent) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public boolean performIdentifierAction(int i, int i1) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+
+    public void setQwertyMode(boolean b) {
+        throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
+    }
+}
diff --git a/samples/ActionBarCompat/src/com/example/android/actionbarcompat/SimpleMenuItem.java b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/SimpleMenuItem.java
new file mode 100644
index 0000000..425ba72
--- /dev/null
+++ b/samples/ActionBarCompat/src/com/example/android/actionbarcompat/SimpleMenuItem.java
@@ -0,0 +1,261 @@
+/*
+ * Copyright 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.actionbarcompat;
+
+import android.content.Intent;
+import android.graphics.drawable.Drawable;
+import android.view.ActionProvider;
+import android.view.ContextMenu;
+import android.view.MenuItem;
+import android.view.SubMenu;
+import android.view.View;
+
+/**
+ * A <em>really</em> dumb implementation of the {@link android.view.MenuItem} interface, that's only
+ * useful for our actionbar-compat purposes. See
+ * <code>com.android.internal.view.menu.MenuItemImpl</code> in AOSP for a more complete
+ * implementation.
+ */
+public class SimpleMenuItem implements MenuItem {
+
+    private SimpleMenu mMenu;
+
+    private final int mId;
+    private final int mOrder;
+    private CharSequence mTitle;
+    private CharSequence mTitleCondensed;
+    private Drawable mIconDrawable;
+    private int mIconResId = 0;
+    private boolean mEnabled = true;
+
+    public SimpleMenuItem(SimpleMenu menu, int id, int order, CharSequence title) {
+        mMenu = menu;
+        mId = id;
+        mOrder = order;
+        mTitle = title;
+    }
+
+    public int getItemId() {
+        return mId;
+    }
+
+    public int getOrder() {
+        return mOrder;
+    }
+
+    public MenuItem setTitle(CharSequence title) {
+        mTitle = title;
+        return this;
+    }
+
+    public MenuItem setTitle(int titleRes) {
+        return setTitle(mMenu.getContext().getString(titleRes));
+    }
+
+    public CharSequence getTitle() {
+        return mTitle;
+    }
+
+    public MenuItem setTitleCondensed(CharSequence title) {
+        mTitleCondensed = title;
+        return this;
+    }
+
+    public CharSequence getTitleCondensed() {
+        return mTitleCondensed != null ? mTitleCondensed : mTitle;
+    }
+
+    public MenuItem setIcon(Drawable icon) {
+        mIconResId = 0;
+        mIconDrawable = icon;
+        return this;
+    }
+
+    public MenuItem setIcon(int iconResId) {
+        mIconDrawable = null;
+        mIconResId = iconResId;
+        return this;
+    }
+
+    public Drawable getIcon() {
+        if (mIconDrawable != null) {
+            return mIconDrawable;
+        }
+
+        if (mIconResId != 0) {
+            return mMenu.getResources().getDrawable(mIconResId);
+        }
+
+        return null;
+    }
+
+    public MenuItem setEnabled(boolean enabled) {
+        mEnabled = enabled;
+        return this;
+    }
+
+    public boolean isEnabled() {
+        return mEnabled;
+    }
+
+    // No-op operations. We use no-ops to allow inflation from menu XML.
+
+    public int getGroupId() {
+        // Noop
+        return 0;
+    }
+
+    public View getActionView() {
+        // Noop
+        return null;
+    }
+
+    public MenuItem setActionProvider(ActionProvider actionProvider) {
+        // Noop
+        return this;
+    }
+
+    public ActionProvider getActionProvider() {
+        // Noop
+        return null;
+    }
+
+    public boolean expandActionView() {
+        // Noop
+        return false;
+    }
+
+    public boolean collapseActionView() {
+        // Noop
+        return false;
+    }
+
+    public boolean isActionViewExpanded() {
+        // Noop
+        return false;
+    }
+
+    @Override
+    public MenuItem setOnActionExpandListener(OnActionExpandListener onActionExpandListener) {
+        // Noop
+        return this;
+    }
+
+    public MenuItem setIntent(Intent intent) {
+        // Noop
+        return this;
+    }
+
+    public Intent getIntent() {
+        // Noop
+        return null;
+    }
+
+    public MenuItem setShortcut(char c, char c1) {
+        // Noop
+        return this;
+    }
+
+    public MenuItem setNumericShortcut(char c) {
+        // Noop
+        return this;
+    }
+
+    public char getNumericShortcut() {
+        // Noop
+        return 0;
+    }
+
+    public MenuItem setAlphabeticShortcut(char c) {
+        // Noop
+        return this;
+    }
+
+    public char getAlphabeticShortcut() {
+        // Noop
+        return 0;
+    }
+
+    public MenuItem setCheckable(boolean b) {
+        // Noop
+        return this;
+    }
+
+    public boolean isCheckable() {
+        // Noop
+        return false;
+    }
+
+    public MenuItem setChecked(boolean b) {
+        // Noop
+        return this;
+    }
+
+    public boolean isChecked() {
+        // Noop
+        return false;
+    }
+
+    public MenuItem setVisible(boolean b) {
+        // Noop
+        return this;
+    }
+
+    public boolean isVisible() {
+        // Noop
+        return true;
+    }
+
+    public boolean hasSubMenu() {
+        // Noop
+        return false;
+    }
+
+    public SubMenu getSubMenu() {
+        // Noop
+        return null;
+    }
+
+    public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
+        // Noop
+        return this;
+    }
+
+    public ContextMenu.ContextMenuInfo getMenuInfo() {
+        // Noop
+        return null;
+    }
+
+    public void setShowAsAction(int i) {
+        // Noop
+    }
+
+    public MenuItem setShowAsActionFlags(int i) {
+        // Noop
+        return null;
+    }
+
+    public MenuItem setActionView(View view) {
+        // Noop
+        return this;
+    }
+
+    public MenuItem setActionView(int i) {
+        // Noop
+        return this;
+    }
+}