Merge "Added BasicMediaRouter sample based on the PresentationWithMediaRouterActivity API demo." into jb-mr2-dev
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2dd1573
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,39 @@
+# built application files
+*.apk
+*.ap_
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
+
+# generated files
+bin/
+out/
+gen/
+
+# Libraries used by the app
+# Can explicitly add if we want, but shouldn't do so blindly.  Licenses, bloat, etc.
+/libs
+
+
+# Build stuff (auto-generated by android update project ...)
+build.xml
+ant.properties
+local.properties
+project.properties
+
+# Eclipse project files
+.classpath
+.project
+
+# idea project files
+.idea/
+.idea/.name
+*.iml
+*.ipr
+*.iws
+
+#gitignore file
+.gitignore
diff --git a/common/src/com/example/android/common/Pools.java b/common/src/com/example/android/common/Pools.java
new file mode 100644
index 0000000..b31749a
--- /dev/null
+++ b/common/src/com/example/android/common/Pools.java
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2009 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.common;
+
+/**
+ * Helper class for creating pools of objects. Creating new objects is an
+ * expensive operation, which can lead to significant performance overhead if
+ * new objects of the same type are allocated and destroyed during run time.
+ * These performance issues can be mitigated by reusing unused objects and
+ * reinitializing them, rather than destroying and removing them from memory.
+ * <p>
+ * The object pool pattern provided by the {@link Pool} interface facilitates
+ * the reuse of objects by keeping unused ('released') objects in memory and
+ * making them available for use. This can provide a significant performance
+ * improvement, as objects are only created once and returned to the Pool when
+ * no longer required, rather than destroyed and reallocated. Object
+ * {@link Pools} keep track of these unused objects. An object pool provides two
+ * basic methods for access:
+ * <ul>
+ * <li><b>{@link Pool#acquire()}:</b> Returns an used object if one is
+ * available.</li>
+ * <li><b> {@link Pool#release(Object)}:</b> Adds the given object to the pool,
+ * ready to be reallocated in acquire().</li>
+ * </ul>
+ * <p>
+ * This class contains the interface defining a {@link Pool}, an implementation
+ * based on a fixed length array ({@link SimplePool}) and a synchronized pool
+ * for use with concurrency ({@link SynchronizedPool}).
+ * <p>
+ * A {@link SimplePool} can be used like this:
+ *
+ * <pre>
+ * public class MyPooledClass {
+ *
+ *     private static final SynchronizedPool<MyPooledClass> sPool =
+ *             new SynchronizedPool<MyPooledClass>(10);
+ *
+ *     public static MyPooledClass obtain() {
+ *         MyPooledClass instance = sPool.acquire();
+ *         return (instance != null) ? instance : new MyPooledClass();
+ *     }
+ *
+ *     public void recycle() {
+ *          // Clear state if needed.
+ *          sPool.release(this);
+ *     }
+ *
+ *     . . .
+ * }
+ * </pre>
+ */
+public final class Pools {
+
+    /**
+     * Interface for managing a pool of objects.
+     *
+     * @param T The pooled type.
+     */
+    public static interface Pool<T> {
+
+        /**
+         * Retrieves an object from the pool. Returns null if the pool is empty
+         * and no object is available.
+         *
+         * @return An instance from the pool if available, null otherwise.
+         */
+        public T acquire();
+
+        /**
+         * Releases an instance to the pool. This marks the object as reusable
+         * and makes it available through a call to {@link #acquire()}. An
+         * object should not be modified or accessed once it has been released.
+         *
+         * @param instance The instance to release.
+         * @return True if the instance was put in the pool.
+         * @throws IllegalStateException If the instance is already in the pool.
+         */
+        public boolean release(T instance);
+    }
+
+    private Pools() {
+        /* do nothing - hiding constructor */
+    }
+
+    /**
+     * Simple (non-synchronized) pool of objects. This class provides a simple,
+     * fixed sized pool of objects.
+     *
+     * @param T The pooled type.
+     */
+    public static class SimplePool<T> implements Pool<T> {
+        private final Object[] mPool;
+
+        private int mPoolSize;
+
+        /**
+         * Creates a new instance. The parameter defines the maximum number of
+         * objects that can be held in this pool.
+         *
+         * @param maxPoolSize The max pool size.
+         * @throws IllegalArgumentException If the max pool size is less than
+         *             zero.
+         */
+        public SimplePool(int maxPoolSize) {
+            if (maxPoolSize <= 0) {
+                throw new IllegalArgumentException("The max pool size must be > 0");
+            }
+            mPool = new Object[maxPoolSize];
+        }
+
+        /**
+         * Returns an object from the pool or null if the pool is empty.
+         *
+         * @return An object from the pool or null if no object is available.
+         */
+        @Override
+        @SuppressWarnings("unchecked")
+        public T acquire() {
+            if (mPoolSize > 0) {
+                final int lastPooledIndex = mPoolSize - 1;
+                T instance = (T) mPool[lastPooledIndex];
+                mPool[lastPooledIndex] = null;
+                mPoolSize--;
+                return instance;
+            }
+            return null;
+        }
+
+        /**
+         * Adds an object to the pool. If the pool is already full (its
+         * allocated size has been exceeded), the object is not added and false
+         * is returned. A linear check is performed to ensure that the object is
+         * not already held in the pool.
+         *
+         * @param instance The element to release.
+         * @return True if the object was added to the pool.
+         * @throws IllegalStateException If the object already exists in the
+         *             pool.
+         */
+        @Override
+        public boolean release(T instance) {
+            if (isInPool(instance)) {
+                throw new IllegalStateException("Already in the pool!");
+            }
+            if (mPoolSize < mPool.length) {
+                mPool[mPoolSize] = instance;
+                mPoolSize++;
+                return true;
+            }
+            return false;
+        }
+
+        /**
+         * Checks if the object already exists in the pool.
+         * @param instance The element to look for.
+         * @return True if the object exists in the pool.
+         */
+        private boolean isInPool(T instance) {
+            for (int i = 0; i < mPoolSize; i++) {
+                if (mPool[i] == instance) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Synchronized pool of objects. Based on the implementation of a fixed size
+     * pool in {@link SimplePool}, this class provides synchronized concurrent
+     * access to the pool.
+     *
+     * @param T The pooled type.
+     */
+    public static class SynchronizedPool<T> extends SimplePool<T> {
+        private final Object mLock = new Object();
+
+        /**
+         * Creates a new instance.
+         *
+         * @param maxPoolSize The max pool size.
+         * @throws IllegalArgumentException If the max pool size is less than
+         *             zero.
+         */
+        public SynchronizedPool(int maxPoolSize) {
+            super(maxPoolSize);
+        }
+
+        /**
+         * Returns an object from the pool or null if the pool is empty.
+         * <p>
+         * Access to the pool is synchronized.
+         *
+         * @return An object from the pool or null if no object is available.
+         */
+        @Override
+        public T acquire() {
+            synchronized (mLock) {
+                return super.acquire();
+            }
+        }
+
+        /**
+         * Adds an object to the pool. If the pool is already full (its
+         * allocated size has been exceeded), the object is not added and false
+         * is returned. A linear check is performed to ensure that the object is
+         * not already held in the pool.
+         * <p>
+         * Access to the pool is synchronized.
+         *
+         * @param element The element to be released
+         * @return True if the object was added to the pool.
+         * @throws IllegalStateException If the object already exists in the
+         *             pool.
+         */
+        @Override
+        public boolean release(T element) {
+            synchronized (mLock) {
+                return super.release(element);
+            }
+        }
+    }
+}
diff --git a/ui/actionbar/DoneBar/AndroidManifest.xml b/ui/actionbar/DoneBar/AndroidManifest.xml
new file mode 100755
index 0000000..5536a9b
--- /dev/null
+++ b/ui/actionbar/DoneBar/AndroidManifest.xml
@@ -0,0 +1,45 @@
+<!--
+  Copyright 2013 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.donebar"
+    android:versionCode="1"
+    android:versionName="1.0">
+
+    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
+
+    <application android:label="@string/app_name"
+        android:icon="@drawable/ic_launcher"
+        android:theme="@style/Theme.Sample"
+        android:allowBackup="true">
+
+        <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>
+
+        <activity android:name=".DoneBarActivity"
+            android:parentActivityName=".MainActivity" />
+
+        <activity android:name=".DoneButtonActivity"
+            android:parentActivityName=".MainActivity" />
+
+    </application>
+
+</manifest>
diff --git a/ui/actionbar/DoneBar/big_icon.png b/ui/actionbar/DoneBar/big_icon.png
new file mode 100644
index 0000000..78bb426
--- /dev/null
+++ b/ui/actionbar/DoneBar/big_icon.png
Binary files differ
diff --git a/ui/actionbar/DoneBar/res/drawable-hdpi/ic_action_cancel.png b/ui/actionbar/DoneBar/res/drawable-hdpi/ic_action_cancel.png
new file mode 100644
index 0000000..cde36e1
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/drawable-hdpi/ic_action_cancel.png
Binary files differ
diff --git a/ui/actionbar/DoneBar/res/drawable-hdpi/ic_action_done.png b/ui/actionbar/DoneBar/res/drawable-hdpi/ic_action_done.png
new file mode 100644
index 0000000..58bf972
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/drawable-hdpi/ic_action_done.png
Binary files differ
diff --git a/ui/actionbar/DoneBar/res/drawable-hdpi/ic_launcher.png b/ui/actionbar/DoneBar/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..b1efaf4
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/ui/actionbar/DoneBar/res/drawable-mdpi/ic_action_cancel.png b/ui/actionbar/DoneBar/res/drawable-mdpi/ic_action_cancel.png
new file mode 100644
index 0000000..9f4c3d6
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/drawable-mdpi/ic_action_cancel.png
Binary files differ
diff --git a/ui/actionbar/DoneBar/res/drawable-mdpi/ic_action_done.png b/ui/actionbar/DoneBar/res/drawable-mdpi/ic_action_done.png
new file mode 100644
index 0000000..cf5fab3
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/drawable-mdpi/ic_action_done.png
Binary files differ
diff --git a/ui/actionbar/DoneBar/res/drawable-mdpi/ic_launcher.png b/ui/actionbar/DoneBar/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..f5f9244
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/ui/actionbar/DoneBar/res/drawable-xhdpi/ic_action_cancel.png b/ui/actionbar/DoneBar/res/drawable-xhdpi/ic_action_cancel.png
new file mode 100644
index 0000000..ca7d159
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/drawable-xhdpi/ic_action_cancel.png
Binary files differ
diff --git a/ui/actionbar/DoneBar/res/drawable-xhdpi/ic_action_done.png b/ui/actionbar/DoneBar/res/drawable-xhdpi/ic_action_done.png
new file mode 100644
index 0000000..b891571
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/drawable-xhdpi/ic_action_done.png
Binary files differ
diff --git a/ui/actionbar/DoneBar/res/drawable-xhdpi/ic_launcher.png b/ui/actionbar/DoneBar/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..5d07b3f
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/actionbar/DoneBar/res/drawable-xxhdpi/ic_launcher.png b/ui/actionbar/DoneBar/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..6ef21e1
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/actionbar/DoneBar/res/layout/actionbar_custom_view_done.xml b/ui/actionbar/DoneBar/res/layout/actionbar_custom_view_done.xml
new file mode 100644
index 0000000..44c1d61
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/layout/actionbar_custom_view_done.xml
@@ -0,0 +1,26 @@
+<!--
+  Copyright 2013 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:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal"
+    android:divider="?android:attr/dividerVertical"
+    android:showDividers="end"
+    android:dividerPadding="12dp">
+
+    <include layout="@layout/include_done_button" />
+</LinearLayout>
diff --git a/ui/actionbar/DoneBar/res/layout/actionbar_custom_view_done_cancel.xml b/ui/actionbar/DoneBar/res/layout/actionbar_custom_view_done_cancel.xml
new file mode 100644
index 0000000..5cecdf0
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/layout/actionbar_custom_view_done_cancel.xml
@@ -0,0 +1,27 @@
+<!--
+  Copyright 2013 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:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal"
+    android:divider="?android:attr/dividerVertical"
+    android:showDividers="middle"
+    android:dividerPadding="12dp">
+
+    <include layout="@layout/include_cancel_button" />
+    <include layout="@layout/include_done_button" />
+</LinearLayout>
diff --git a/ui/actionbar/DoneBar/res/layout/activity_done_bar.xml b/ui/actionbar/DoneBar/res/layout/activity_done_bar.xml
new file mode 100755
index 0000000..cb8980f
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/layout/activity_done_bar.xml
@@ -0,0 +1,32 @@
+<!--
+  Copyright 2013 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.
+  -->
+
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout style="@style/Widget.SampleContentContainer"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+
+        <TextView style="@style/Widget.SampleMessage"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/done_bar_description" />
+
+    </LinearLayout>
+</ScrollView>
diff --git a/ui/actionbar/DoneBar/res/layout/activity_done_button.xml b/ui/actionbar/DoneBar/res/layout/activity_done_button.xml
new file mode 100755
index 0000000..3e20455
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/layout/activity_done_button.xml
@@ -0,0 +1,32 @@
+<!--
+  Copyright 2013 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.
+  -->
+
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout style="@style/Widget.SampleContentContainer"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+
+        <TextView style="@style/Widget.SampleMessage"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/done_button_description" />
+
+    </LinearLayout>
+</ScrollView>
diff --git a/ui/actionbar/DoneBar/res/layout/activity_main.xml b/ui/actionbar/DoneBar/res/layout/activity_main.xml
new file mode 100755
index 0000000..e342ca3
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/layout/activity_main.xml
@@ -0,0 +1,58 @@
+<!--
+  Copyright 2013 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.
+  -->
+
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout style="@style/Widget.SampleContentContainer"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+
+        <TextView style="@style/Widget.SampleMessage"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/intro_message" />
+
+        <Button style="@style/Widget.SampleButton"
+            android:id="@+id/done_bar_link"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/margin_large"
+            android:layout_marginBottom="@dimen/margin_small"
+            android:text="@string/done_bar_title" />
+
+        <TextView style="@style/Widget.SampleMessage"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/done_bar_description" />
+
+        <Button style="@style/Widget.SampleButton"
+            android:id="@+id/done_button_link"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/margin_large"
+            android:layout_marginBottom="@dimen/margin_small"
+            android:text="@string/done_button_title" />
+
+        <TextView style="@style/Widget.SampleMessage"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/done_button_description" />
+
+    </LinearLayout>
+</ScrollView>
diff --git a/ui/actionbar/DoneBar/res/layout/include_cancel_button.xml b/ui/actionbar/DoneBar/res/layout/include_cancel_button.xml
new file mode 100644
index 0000000..bffffa6
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/layout/include_cancel_button.xml
@@ -0,0 +1,33 @@
+<!--
+  Copyright 2013 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"
+    style="?android:actionButtonStyle"
+    android:id="@+id/actionbar_cancel"
+    android:layout_width="0dp"
+    android:layout_height="match_parent"
+    android:layout_weight="1">
+
+    <TextView style="?android:actionBarTabTextStyle"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:paddingRight="20dp"
+        android:drawableLeft="@drawable/ic_action_cancel"
+        android:drawablePadding="8dp"
+        android:gravity="center_vertical"
+        android:text="@string/cancel" />
+</FrameLayout>
diff --git a/ui/actionbar/DoneBar/res/layout/include_done_button.xml b/ui/actionbar/DoneBar/res/layout/include_done_button.xml
new file mode 100644
index 0000000..9207733
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/layout/include_done_button.xml
@@ -0,0 +1,33 @@
+<!--
+  Copyright 2013 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"
+    style="?android:actionButtonStyle"
+    android:id="@+id/actionbar_done"
+    android:layout_width="0dp"
+    android:layout_height="match_parent"
+    android:layout_weight="1">
+
+    <TextView style="?android:actionBarTabTextStyle"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:paddingRight="20dp"
+        android:drawableLeft="@drawable/ic_action_done"
+        android:drawablePadding="8dp"
+        android:gravity="center_vertical"
+        android:text="@string/done" />
+</FrameLayout>
diff --git a/ui/actionbar/DoneBar/res/menu/cancel.xml b/ui/actionbar/DoneBar/res/menu/cancel.xml
new file mode 100644
index 0000000..18e3eed
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/menu/cancel.xml
@@ -0,0 +1,22 @@
+<!--
+  Copyright 2013 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/cancel"
+        android:title="@string/cancel"
+        android:icon="@drawable/ic_action_cancel"
+        android:showAsAction="never" />
+</menu>
diff --git a/ui/actionbar/DoneBar/res/values-sw600dp/styles.xml b/ui/actionbar/DoneBar/res/values-sw600dp/styles.xml
new file mode 100644
index 0000000..8b7fa45
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/values-sw600dp/styles.xml
@@ -0,0 +1,39 @@
+<!--
+  Copyright 2013 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="Widget.SampleContentContainer">
+        <item name="android:paddingTop">@dimen/margin_medium</item>
+        <item name="android:paddingBottom">@dimen/margin_medium</item>
+        <item name="android:paddingLeft">@dimen/margin_huge</item>
+        <item name="android:paddingRight">@dimen/margin_huge</item>
+    </style>
+
+    <style name="Widget.SampleMessage">
+        <item name="android:textAppearance">?android:textAppearanceLarge</item>
+        <item name="android:lineSpacingMultiplier">1.2</item>
+    </style>
+
+    <style name="Widget.SampleButton" parent="android:Widget.Holo.Light.Button">
+        <item name="android:textAppearance">?android:textAppearanceLarge</item>
+        <item name="android:paddingTop">@dimen/margin_medium</item>
+        <item name="android:paddingBottom">@dimen/margin_medium</item>
+        <item name="android:paddingLeft">@dimen/margin_large</item>
+        <item name="android:paddingRight">@dimen/margin_large</item>
+    </style>
+
+</resources>
diff --git a/ui/actionbar/DoneBar/res/values/dimens.xml b/ui/actionbar/DoneBar/res/values/dimens.xml
new file mode 100644
index 0000000..952c220
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/values/dimens.xml
@@ -0,0 +1,27 @@
+<!--
+  Copyright 2013 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 standard dimensions to comply with Holo-style grids and rhythm. -->
+
+    <dimen name="margin_tiny">4dp</dimen>
+    <dimen name="margin_small">8dp</dimen>
+    <dimen name="margin_medium">16dp</dimen>
+    <dimen name="margin_large">32dp</dimen>
+    <dimen name="margin_huge">64dp</dimen>
+
+</resources>
diff --git a/ui/actionbar/DoneBar/res/values/strings.xml b/ui/actionbar/DoneBar/res/values/strings.xml
new file mode 100755
index 0000000..b56d75a
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/values/strings.xml
@@ -0,0 +1,32 @@
+<!--
+  Copyright 2013 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">Done Bar</string>
+
+    <!-- Sample UI messages -->
+    <string name="intro_message">This sample demonstrates two alternative presentations of the action bar that are well-suited for <b>simple data entry scenarios</b>.</string>
+
+    <string name="done_bar_title">Done bar</string>
+    <string name="done_bar_description">In this presentation, a <b>done bar</b> replaces the action bar entirely, providing two direct actions to persist or dismiss changes. This is suitable for cases where no additional view details or actions are needed in the action bar.</string>
+
+    <string name="done_button_title">Done button</string>
+    <string name="done_button_description">In this presentation, a <b>done button</b> replaces the action bar\'s <i>Up</i> affordance and app icon, while the cancel action is made available in the action overflow. This is well-suited to scenarios where additional view details or actions may be needed in the action bar.</string>
+
+    <!-- Done bar strings -->
+    <string name="done">Done</string>
+    <string name="cancel">Cancel</string>
+</resources>
diff --git a/ui/actionbar/DoneBar/res/values/styles.xml b/ui/actionbar/DoneBar/res/values/styles.xml
new file mode 100644
index 0000000..80895ef
--- /dev/null
+++ b/ui/actionbar/DoneBar/res/values/styles.xml
@@ -0,0 +1,42 @@
+<!--
+  Copyright 2013 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>
+
+    <!-- Activity themes -->
+
+    <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+    <style name="Theme.Sample" parent="Theme.Base" />
+
+    <!-- Widget styling -->
+
+    <style name="Widget" />
+
+    <style name="Widget.SampleContentContainer">
+        <item name="android:padding">@dimen/margin_medium</item>
+    </style>
+
+    <style name="Widget.SampleMessage">
+        <item name="android:textAppearance">?android:textAppearanceMedium</item>
+        <item name="android:lineSpacingMultiplier">1.1</item>
+    </style>
+
+    <style name="Widget.SampleButton" parent="android:Widget.Holo.Light.Button">
+        <item name="android:textAppearance">?android:textAppearanceMedium</item>
+    </style>
+
+</resources>
diff --git a/ui/actionbar/DoneBar/src/com/example/android/donebar/DoneBarActivity.java b/ui/actionbar/DoneBar/src/com/example/android/donebar/DoneBarActivity.java
new file mode 100644
index 0000000..f2a2b00
--- /dev/null
+++ b/ui/actionbar/DoneBar/src/com/example/android/donebar/DoneBarActivity.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2013 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.donebar;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * A sample activity demonstrating the "done bar" alternative action bar presentation. For a more
+ * detailed description see {@link R.string.done_bar_description}.
+ */
+public class DoneBarActivity extends Activity {
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // BEGIN_INCLUDE (inflate_set_custom_view)
+        // Inflate a "Done/Cancel" custom action bar view.
+        final LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext()
+                .getSystemService(LAYOUT_INFLATER_SERVICE);
+        final View customActionBarView = inflater.inflate(
+                R.layout.actionbar_custom_view_done_cancel, null);
+        customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(
+                new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        // "Done"
+                        finish();
+                    }
+                });
+        customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener(
+                new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        // "Cancel"
+                        finish();
+                    }
+                });
+
+        // Show the custom action bar view and hide the normal Home icon and title.
+        final ActionBar actionBar = getActionBar();
+        actionBar.setDisplayOptions(
+                ActionBar.DISPLAY_SHOW_CUSTOM,
+                ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME
+                        | ActionBar.DISPLAY_SHOW_TITLE);
+        actionBar.setCustomView(customActionBarView,
+                new ActionBar.LayoutParams(
+                        ViewGroup.LayoutParams.MATCH_PARENT,
+                        ViewGroup.LayoutParams.MATCH_PARENT));
+        // END_INCLUDE (inflate_set_custom_view)
+
+        setContentView(R.layout.activity_done_bar);
+    }
+}
diff --git a/ui/actionbar/DoneBar/src/com/example/android/donebar/DoneButtonActivity.java b/ui/actionbar/DoneBar/src/com/example/android/donebar/DoneButtonActivity.java
new file mode 100644
index 0000000..303d1ed
--- /dev/null
+++ b/ui/actionbar/DoneBar/src/com/example/android/donebar/DoneButtonActivity.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2013 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.donebar;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+
+/**
+ * A sample activity demonstrating the "done button" alternative action bar presentation. For a more
+ * detailed description see {@link R.string.done_button_description}.
+ */
+public class DoneButtonActivity extends Activity {
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // BEGIN_INCLUDE (inflate_set_custom_view)
+        // Inflate a "Done" custom action bar view to serve as the "Up" affordance.
+        final LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext()
+                .getSystemService(LAYOUT_INFLATER_SERVICE);
+        final View customActionBarView = inflater.inflate(
+                R.layout.actionbar_custom_view_done, null);
+        customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(
+                new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        // "Done"
+                        finish();
+                    }
+                });
+
+        // Show the custom action bar view and hide the normal Home icon and title.
+        final ActionBar actionBar = getActionBar();
+        actionBar.setDisplayOptions(
+                ActionBar.DISPLAY_SHOW_CUSTOM,
+                ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME
+                        | ActionBar.DISPLAY_SHOW_TITLE);
+        actionBar.setCustomView(customActionBarView);
+        // END_INCLUDE (inflate_set_custom_view)
+
+        setContentView(R.layout.activity_done_button);
+    }
+
+    // BEGIN_INCLUDE (handle_cancel)
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+        getMenuInflater().inflate(R.menu.cancel, menu);
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.cancel:
+                // "Cancel"
+                finish();
+                return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+    // END_INCLUDE (handle_cancel)
+}
diff --git a/ui/actionbar/DoneBar/src/com/example/android/donebar/MainActivity.java b/ui/actionbar/DoneBar/src/com/example/android/donebar/MainActivity.java
new file mode 100755
index 0000000..ff188df
--- /dev/null
+++ b/ui/actionbar/DoneBar/src/com/example/android/donebar/MainActivity.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2013 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.donebar;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+
+/**
+ * A simple launcher activity describing the alternative action bar presentations and allowing the
+ * user to navigate to a demo of each.
+ */
+public class MainActivity extends Activity {
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+
+        findViewById(R.id.done_bar_link).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                startActivity(new Intent(MainActivity.this, DoneBarActivity.class));
+            }
+        });
+
+        findViewById(R.id.done_button_link).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                startActivity(new Intent(MainActivity.this, DoneButtonActivity.class));
+            }
+        });
+    }
+}
diff --git a/ui/holo/BorderlessButtons/AndroidManifest.xml b/ui/holo/BorderlessButtons/AndroidManifest.xml
new file mode 100755
index 0000000..34b2898
--- /dev/null
+++ b/ui/holo/BorderlessButtons/AndroidManifest.xml
@@ -0,0 +1,48 @@
+<!--
+  Copyright 2013 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.borderlessbuttons"
+    android:versionCode="1"
+    android:versionName="1.0">
+
+    <!--
+      This sample requires API 11 for use of theme attributes such as ?android:buttonBarStyle
+      and ?android:borderlessButtonStyle, as well as LinearLayout's android:showDividers attribute.
+      A similar effect can be achieved by setting a clickable view's background to
+      ?android:selectableItemBackground.
+
+      This sample requires API 14 for use of theme attributes such as
+      ?android:listPreferredItemPaddingLeft.
+    -->
+    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
+
+    <application android:label="@string/app_name"
+        android:icon="@drawable/ic_launcher"
+        android:theme="@style/Theme.Sample"
+        android:allowBackup="true">
+
+        <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/ui/holo/BorderlessButtons/big_icon.png b/ui/holo/BorderlessButtons/big_icon.png
new file mode 100644
index 0000000..a8b32a9
--- /dev/null
+++ b/ui/holo/BorderlessButtons/big_icon.png
Binary files differ
diff --git a/ui/holo/BorderlessButtons/res/drawable-hdpi/ic_action_delete.png b/ui/holo/BorderlessButtons/res/drawable-hdpi/ic_action_delete.png
new file mode 100644
index 0000000..e9ce89e
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/drawable-hdpi/ic_action_delete.png
Binary files differ
diff --git a/ui/holo/BorderlessButtons/res/drawable-hdpi/ic_launcher.png b/ui/holo/BorderlessButtons/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..05591fd
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/ui/holo/BorderlessButtons/res/drawable-mdpi/ic_action_delete.png b/ui/holo/BorderlessButtons/res/drawable-mdpi/ic_action_delete.png
new file mode 100644
index 0000000..cedb108
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/drawable-mdpi/ic_action_delete.png
Binary files differ
diff --git a/ui/holo/BorderlessButtons/res/drawable-mdpi/ic_launcher.png b/ui/holo/BorderlessButtons/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..ed81674
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/ui/holo/BorderlessButtons/res/drawable-xhdpi/ic_action_delete.png b/ui/holo/BorderlessButtons/res/drawable-xhdpi/ic_action_delete.png
new file mode 100644
index 0000000..98c73da
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/drawable-xhdpi/ic_action_delete.png
Binary files differ
diff --git a/ui/holo/BorderlessButtons/res/drawable-xhdpi/ic_launcher.png b/ui/holo/BorderlessButtons/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..0fef898
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/holo/BorderlessButtons/res/drawable-xxhdpi/ic_launcher.png b/ui/holo/BorderlessButtons/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..cccd5d4
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/holo/BorderlessButtons/res/layout/activity_main.xml b/ui/holo/BorderlessButtons/res/layout/activity_main.xml
new file mode 100755
index 0000000..eacbf4b
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/layout/activity_main.xml
@@ -0,0 +1,87 @@
+<!--
+  Copyright 2013 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.
+  -->
+
+<!--
+    The top-level LinearLayout uses a horizontal divider to visually
+    distinguish the top description box, list, and bottom button bar.
+
+    android:showDividers="middle" draws dividers between each child view and
+    android:divider="?android:dividerHorizontal" indicates that the standard
+    horizontal system divider (set in the activity's theme) should be used to
+    draw the divider.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:divider="?android:dividerHorizontal"
+    android:showDividers="middle">
+
+    <TextView style="@style/Widget.DescriptionBar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="@string/intro_message" />
+
+    <!--
+        Remember to use padding on your ListViews to adhere to the standard
+        metrics described in the Android Design guidelines. When doing so,
+        you should set the android:scrollbarStyle such that the scrollbar
+        doesn'isn't inset.
+    -->
+    <ListView android:id="@android:id/list"
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1"
+        android:paddingLeft="@dimen/page_margin"
+        android:paddingRight="@dimen/page_margin"
+        android:scrollbarStyle="outsideOverlay" />
+
+    <!--
+        When using the Holo theme (setting your activity or app theme to
+        Theme.Holo or one of its descendants), a LinearLayout with the
+        ?android:buttonBarStyle will draw dividers (with padding) between
+        buttons.
+    -->
+    <LinearLayout style="?android:buttonBarStyle"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+
+        <!--
+            Make sure to apply the ?android:buttonBarStyle to each button
+            in the button bar.
+
+            In the Holo theme, this style is very similar to
+            ?android:borderlessButtonStyle, but designed for use specifically
+            in horizontal button bars.
+        -->
+        <Button style="?android:buttonBarButtonStyle"
+            android:id="@+id/cancel_button"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="@string/cancel" />
+
+        <Button style="?android:buttonBarButtonStyle"
+            android:id="@+id/ok_button"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="@string/ok" />
+
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/ui/holo/BorderlessButtons/res/layout/list_item.xml b/ui/holo/BorderlessButtons/res/layout/list_item.xml
new file mode 100644
index 0000000..1966be9
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/layout/list_item.xml
@@ -0,0 +1,87 @@
+<!--
+  Copyright 2013 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.
+  -->
+
+<!--
+    For list items that contain secondary actions (in this case, 'delete'),
+    it's important to use dividers to distinguish the primary touch target from
+    the secondary action. This is done using android:showDividers and its
+    related attributes.
+
+    The android:dividerPadding attribute insets the divider line by the given
+    amount on each side (in this case, top and bottom). Divider padding helps
+    establish visual hierarchy when several dividers are used in a screen. In
+    this case, the padding helps separate this vertical divider from horizontal
+    list item separators in the main ListView, and establishes a stronger
+    relationship between the delete action and the primary target to its left.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="horizontal"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:listPreferredItemHeight"
+    android:divider="?android:dividerVertical"
+    android:dividerPadding="8dp"
+    android:showDividers="middle">
+
+    <!--
+        Any view or view group can become interactive by simply setting the
+        android:clickable and android:focusable attributes to true.
+
+        When doing this, make sure to provide adequate touch feedback by also
+        setting the view background to ?android:selectableItemBackground. When
+        using the Holo theme, this drawable is transparent by default, but
+        changes to a translucent color overlay when the view is pressed or
+        focused.
+    -->
+    <LinearLayout android:id="@+id/primary_target"
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:orientation="vertical"
+        android:paddingLeft="?android:listPreferredItemPaddingLeft"
+        android:paddingRight="?android:listPreferredItemPaddingRight"
+        android:clickable="true"
+        android:focusable="true"
+        android:gravity="center_vertical"
+        android:background="?android:selectableItemBackground">
+
+        <TextView style="?android:textAppearanceListItemSmall"
+            android:id="@android:id/text1"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/dummy_title" />
+
+        <TextView style="?android:textAppearanceSmall"
+            android:id="@android:id/text2"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/dummy_subtitle" />
+
+    </LinearLayout>
+
+    <!--
+        When using the Holo theme, setting a Button or ImageButton to
+        ?android:borderlessButtonStyle removes its border and sets the
+        background to ?android:selectableItemBackground, as described above.
+    -->
+    <ImageButton android:id="@+id/secondary_action"
+        style="?android:borderlessButtonStyle"
+        android:layout_width="@dimen/standard_touch_target_size"
+        android:layout_height="match_parent"
+        android:src="@drawable/ic_action_delete"
+        android:contentDescription="@string/delete_content_description" />
+
+</LinearLayout>
diff --git a/ui/holo/BorderlessButtons/res/menu/main.xml b/ui/holo/BorderlessButtons/res/menu/main.xml
new file mode 100644
index 0000000..54f0d3f
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/menu/main.xml
@@ -0,0 +1,22 @@
+<!--
+  Copyright 2013 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/docs_link"
+        android:title="@string/docs_link_title"
+        android:showAsAction="never" />
+</menu>
diff --git a/ui/holo/BorderlessButtons/res/values-sw600dp/dimens.xml b/ui/holo/BorderlessButtons/res/values-sw600dp/dimens.xml
new file mode 100644
index 0000000..0e00174
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/values-sw600dp/dimens.xml
@@ -0,0 +1,21 @@
+<!--
+  Copyright 2013 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="page_margin">@dimen/margin_huge</dimen>
+
+</resources>
diff --git a/ui/holo/BorderlessButtons/res/values-sw600dp/styles.xml b/ui/holo/BorderlessButtons/res/values-sw600dp/styles.xml
new file mode 100644
index 0000000..9ce5eb3
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/values-sw600dp/styles.xml
@@ -0,0 +1,29 @@
+<!--
+  Copyright 2013 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="Widget.DescriptionBar">
+        <item name="android:background">#fb3</item>
+        <item name="android:paddingTop">@dimen/margin_medium</item>
+        <item name="android:paddingBottom">@dimen/margin_medium</item>
+        <item name="android:paddingLeft">@dimen/page_margin</item>
+        <item name="android:paddingRight">@dimen/page_margin</item>
+        <item name="android:textAppearance">?android:textAppearanceLarge</item>
+        <item name="android:lineSpacingMultiplier">1.2</item>
+    </style>
+
+</resources>
diff --git a/ui/holo/BorderlessButtons/res/values/dimens.xml b/ui/holo/BorderlessButtons/res/values/dimens.xml
new file mode 100644
index 0000000..be5bb40
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/values/dimens.xml
@@ -0,0 +1,33 @@
+<!--
+  Copyright 2013 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 standard dimensions to comply with Holo-style grids and rhythm. -->
+
+    <dimen name="margin_tiny">4dp</dimen>
+    <dimen name="margin_small">8dp</dimen>
+    <dimen name="margin_medium">16dp</dimen>
+    <dimen name="margin_large">32dp</dimen>
+    <dimen name="margin_huge">64dp</dimen>
+
+    <dimen name="standard_touch_target_size">48dp</dimen>
+
+    <!-- Meta-dimension that switches on screen size -->
+
+    <dimen name="page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/ui/holo/BorderlessButtons/res/values/strings.xml b/ui/holo/BorderlessButtons/res/values/strings.xml
new file mode 100755
index 0000000..c685088
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/values/strings.xml
@@ -0,0 +1,33 @@
+<!--
+  Copyright 2013 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">Borderless Buttons</string>
+    <string name="intro_message">This sample demonstrates the use of <b>borderless buttons</b>, <b>bottom button bars</b> (<i>OK</i> and <i>Cancel</i>) and <b>dividers</b> to establish visual structure.</string>
+
+    <string name="cancel">Cancel</string>
+    <string name="ok">OK</string>
+
+    <string name="dummy_title">Dummy title</string>
+    <string name="dummy_subtitle">Dummy subtitle</string>
+
+    <string name="delete_content_description">Delete</string>
+
+    <string name="touched_primary_message">Touched primary list item target.</string>
+    <string name="touched_secondary_message">Touched secondary list item target (delete).</string>
+
+    <string name="docs_link_title">Design docs: borderless buttons</string>
+</resources>
diff --git a/ui/holo/BorderlessButtons/res/values/styles.xml b/ui/holo/BorderlessButtons/res/values/styles.xml
new file mode 100644
index 0000000..469816c
--- /dev/null
+++ b/ui/holo/BorderlessButtons/res/values/styles.xml
@@ -0,0 +1,39 @@
+<!--
+  Copyright 2013 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>
+
+    <!-- Activity themes -->
+
+    <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+    <style name="Theme.Sample" parent="Theme.Base" />
+
+    <!-- Widget styling -->
+
+    <style name="Widget" />
+
+    <style name="Widget.DescriptionBar">
+        <item name="android:background">#fb3</item>
+        <item name="android:paddingTop">@dimen/margin_medium</item>
+        <item name="android:paddingBottom">@dimen/margin_medium</item>
+        <item name="android:paddingLeft">@dimen/page_margin</item>
+        <item name="android:paddingRight">@dimen/page_margin</item>
+        <item name="android:textAppearance">?android:textAppearanceMedium</item>
+        <item name="android:lineSpacingMultiplier">1.1</item>
+    </style>
+
+</resources>
diff --git a/ui/holo/BorderlessButtons/src/com/example/android/borderlessbuttons/MainActivity.java b/ui/holo/BorderlessButtons/src/com/example/android/borderlessbuttons/MainActivity.java
new file mode 100755
index 0000000..9f27997
--- /dev/null
+++ b/ui/holo/BorderlessButtons/src/com/example/android/borderlessbuttons/MainActivity.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2013 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.borderlessbuttons;
+
+import android.app.ListActivity;
+import android.content.ActivityNotFoundException;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.Toast;
+
+/**
+ * This activity demonstrates the <b>borderless button</b> styling from the Holo visual language.
+ * The most interesting bits in this sample are in the layout files (res/layout/).
+ * <p>
+ * See <a href="http://developer.android.com/design/building-blocks/buttons.html#borderless">
+ * borderless buttons</a> at the Android Design guide for a discussion of this visual style.
+ */
+public class MainActivity extends ListActivity {
+    private static final Uri DOCS_URI = Uri.parse(
+            "http://developer.android.com/design/building-blocks/buttons.html#borderless");
+
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+
+        setListAdapter(mListAdapter);
+
+        findViewById(R.id.cancel_button).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                finish();
+            }
+        });
+
+        findViewById(R.id.ok_button).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                finish();
+            }
+        });
+    }
+
+    private BaseAdapter mListAdapter = new BaseAdapter() {
+        @Override
+        public int getCount() {
+            return 10;
+        }
+
+        @Override
+        public Object getItem(int position) {
+            return null;
+        }
+
+        @Override
+        public long getItemId(int position) {
+            return position + 1;
+        }
+
+        @Override
+        public View getView(int position, View convertView, ViewGroup container) {
+            if (convertView == null) {
+                convertView = getLayoutInflater().inflate(R.layout.list_item, container, false);
+            }
+
+            // Because the list item contains multiple touch targets, you should not override
+            // onListItemClick. Instead, set a click listener for each target individually.
+
+            convertView.findViewById(R.id.primary_target).setOnClickListener(
+                    new View.OnClickListener() {
+                        @Override
+                        public void onClick(View view) {
+                            Toast.makeText(MainActivity.this,
+                                    R.string.touched_primary_message,
+                                    Toast.LENGTH_SHORT).show();
+                        }
+                    });
+
+            convertView.findViewById(R.id.secondary_action).setOnClickListener(
+                    new View.OnClickListener() {
+                        @Override
+                        public void onClick(View view) {
+                            Toast.makeText(MainActivity.this,
+                                    R.string.touched_secondary_message,
+                                    Toast.LENGTH_SHORT).show();
+                        }
+                    });
+            return convertView;
+        }
+    };
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+        getMenuInflater().inflate(R.menu.main, menu);
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.docs_link:
+                try {
+                    startActivity(new Intent(Intent.ACTION_VIEW, DOCS_URI));
+                } catch (ActivityNotFoundException ignored) {
+                }
+                return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+}
diff --git a/ui/lists/CustomChoiceList/AndroidManifest.xml b/ui/lists/CustomChoiceList/AndroidManifest.xml
new file mode 100755
index 0000000..8c194f5
--- /dev/null
+++ b/ui/lists/CustomChoiceList/AndroidManifest.xml
@@ -0,0 +1,39 @@
+<!--
+  Copyright 2013 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.customchoicelist"
+    android:versionCode="1"
+    android:versionName="1.0">
+
+    <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="17" />
+
+    <application android:label="@string/app_name"
+        android:icon="@drawable/ic_launcher"
+        android:theme="@style/Theme.Sample"
+        android:allowBackup="true">
+
+        <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/ui/lists/CustomChoiceList/res/color/hideable_text_color.xml b/ui/lists/CustomChoiceList/res/color/hideable_text_color.xml
new file mode 100644
index 0000000..c48bb38
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/color/hideable_text_color.xml
@@ -0,0 +1,23 @@
+<!--
+  Copyright 2013 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.
+  -->
+
+<!--
+    This color state list changes from gray to blue depending on its state (checked or not checked).
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_checked="false" android:color="#6000" />
+    <item android:color="#09c" />
+</selector>
diff --git a/ui/lists/CustomChoiceList/res/drawable-hdpi/ic_launcher.png b/ui/lists/CustomChoiceList/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..230b1c3
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/ui/lists/CustomChoiceList/res/drawable-mdpi/ic_launcher.png b/ui/lists/CustomChoiceList/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..dc56d26
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/ui/lists/CustomChoiceList/res/drawable-xhdpi/ic_hideable_item_checked.png b/ui/lists/CustomChoiceList/res/drawable-xhdpi/ic_hideable_item_checked.png
new file mode 100644
index 0000000..9346d8a
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/drawable-xhdpi/ic_hideable_item_checked.png
Binary files differ
diff --git a/ui/lists/CustomChoiceList/res/drawable-xhdpi/ic_hideable_item_unchecked.png b/ui/lists/CustomChoiceList/res/drawable-xhdpi/ic_hideable_item_unchecked.png
new file mode 100644
index 0000000..d45b374
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/drawable-xhdpi/ic_hideable_item_unchecked.png
Binary files differ
diff --git a/ui/lists/CustomChoiceList/res/drawable-xhdpi/ic_launcher.png b/ui/lists/CustomChoiceList/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..a71e6ca
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/lists/CustomChoiceList/res/drawable-xxhdpi/ic_launcher.png b/ui/lists/CustomChoiceList/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..051f1e3
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/lists/CustomChoiceList/res/drawable/ic_hideable_item.xml b/ui/lists/CustomChoiceList/res/drawable/ic_hideable_item.xml
new file mode 100644
index 0000000..bc5ea54
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/drawable/ic_hideable_item.xml
@@ -0,0 +1,24 @@
+<!--
+  Copyright 2013 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.
+  -->
+
+<!--
+    This state list drawable changes from an outline of an eye (ic_hideable_item_unchecked) to a
+    blue eye with iris (ic_hideable_item_checked) depending on its state (checked or not checked).
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_checked="false" android:drawable="@drawable/ic_hideable_item_unchecked" />
+    <item android:drawable="@drawable/ic_hideable_item_checked" />
+</selector>
diff --git a/ui/lists/CustomChoiceList/res/layout/activity_main.xml b/ui/lists/CustomChoiceList/res/layout/activity_main.xml
new file mode 100755
index 0000000..17a69e4
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/layout/activity_main.xml
@@ -0,0 +1,54 @@
+<!--
+  Copyright 2013 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:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:showDividers="middle"
+    android:divider="?android:dividerHorizontal">
+
+    <TextView style="@style/Widget.DescriptionBar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="@string/intro_message" />
+
+    <!--
+        When a ListView has a choiceMode set, it will allow users to "choose"
+        one or more items. The framework provides default list item layouts
+        that show standard radio buttons or check boxes next to a
+        single line of text:
+
+        android.R.layout.simple_list_item_single_choice and
+        android.R.layout.simple_list_item_multiple_choice.
+
+        In some cases, you may want to customize this layout. When doing so,
+        the root view must implement the Checkable interface.
+
+        Lastly, remember to use padding on your ListViews to adhere to the standard
+        metrics described in the Android Design guidelines. When doing so,
+        you should set the android:scrollbarStyle such that the scrollbar
+        doesn'isn't inset.
+    -->
+    <ListView android:id="@android:id/list"
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1"
+        android:paddingLeft="@dimen/page_margin"
+        android:paddingRight="@dimen/page_margin"
+        android:scrollbarStyle="outsideOverlay"
+        android:choiceMode="multipleChoice" />
+</LinearLayout>
diff --git a/ui/lists/CustomChoiceList/res/layout/list_item.xml b/ui/lists/CustomChoiceList/res/layout/list_item.xml
new file mode 100644
index 0000000..ecbd63d
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/layout/list_item.xml
@@ -0,0 +1,62 @@
+<!--
+  Copyright 2013 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.
+  -->
+
+<!--
+    The ListView from activity_main.xml has a choiceMode set, meaning that when a user
+    selects a list item, the ListView will set the state for that item's root view
+    (this CheckableLinearLayout) to "checked". Note that this requires that the root view
+    implements the Checkable interface. Once the root view is checked, any children that
+    have the duplicateParentState attribute set will inherit this "checked" state.
+-->
+<com.example.android.customchoicelist.CheckableLinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="horizontal"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingLeft="8dp"
+    android:paddingRight="8dp"
+    android:minHeight="?android:listPreferredItemHeight"
+    android:gravity="center_vertical">
+
+    <!--
+        The duplicateParentState attribute on this TextView, along with the color state list
+        used in the textColor attribute causes its text color to change when its parent
+        is checked or unchecked.
+    -->
+    <TextView android:id="@android:id/text1"
+        android:duplicateParentState="true"
+        android:layout_width="0dp"
+        android:layout_weight="1"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:textAppearanceMedium"
+        android:textColor="@color/hideable_text_color" />
+
+    <!--
+        The duplicateParentState attribute on this ImageView, along with the state list
+        drawable in the src attribute causes its image to change when its parent
+        is checked or unchecked.
+
+        To use the standard radio or checkmark image, set the src to
+        ?android:listChoiceIndicatorMultiple or ?android:listChoiceIndicatorSingle. These
+        are system theme attributes that reference a state list drawable.
+    -->
+    <ImageView android:src="@drawable/ic_hideable_item"
+        android:duplicateParentState="true"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="16dp" />
+
+</com.example.android.customchoicelist.CheckableLinearLayout>
diff --git a/ui/lists/CustomChoiceList/res/values-sw600dp/dimens.xml b/ui/lists/CustomChoiceList/res/values-sw600dp/dimens.xml
new file mode 100644
index 0000000..0e00174
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/values-sw600dp/dimens.xml
@@ -0,0 +1,21 @@
+<!--
+  Copyright 2013 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="page_margin">@dimen/margin_huge</dimen>
+
+</resources>
diff --git a/ui/lists/CustomChoiceList/res/values-sw600dp/styles.xml b/ui/lists/CustomChoiceList/res/values-sw600dp/styles.xml
new file mode 100644
index 0000000..9ce5eb3
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/values-sw600dp/styles.xml
@@ -0,0 +1,29 @@
+<!--
+  Copyright 2013 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="Widget.DescriptionBar">
+        <item name="android:background">#fb3</item>
+        <item name="android:paddingTop">@dimen/margin_medium</item>
+        <item name="android:paddingBottom">@dimen/margin_medium</item>
+        <item name="android:paddingLeft">@dimen/page_margin</item>
+        <item name="android:paddingRight">@dimen/page_margin</item>
+        <item name="android:textAppearance">?android:textAppearanceLarge</item>
+        <item name="android:lineSpacingMultiplier">1.2</item>
+    </style>
+
+</resources>
diff --git a/ui/lists/CustomChoiceList/res/values-v11/styles.xml b/ui/lists/CustomChoiceList/res/values-v11/styles.xml
new file mode 100644
index 0000000..3dff32a
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/values-v11/styles.xml
@@ -0,0 +1,21 @@
+<!--
+  Copyright 2013 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="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/ui/lists/CustomChoiceList/res/values/dimens.xml b/ui/lists/CustomChoiceList/res/values/dimens.xml
new file mode 100644
index 0000000..8bb8753
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/values/dimens.xml
@@ -0,0 +1,31 @@
+<!--
+  Copyright 2013 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 standard dimensions to comply with Holo-style grids and rhythm. -->
+
+    <dimen name="margin_tiny">4dp</dimen>
+    <dimen name="margin_small">8dp</dimen>
+    <dimen name="margin_medium">16dp</dimen>
+    <dimen name="margin_large">32dp</dimen>
+    <dimen name="margin_huge">64dp</dimen>
+
+    <!-- Meta-dimension that switches on screen size -->
+
+    <dimen name="page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/ui/lists/CustomChoiceList/res/values/strings.xml b/ui/lists/CustomChoiceList/res/values/strings.xml
new file mode 100755
index 0000000..54389e2
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/values/strings.xml
@@ -0,0 +1,20 @@
+<!--
+  Copyright 2013 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">Custom Choice List</string>
+    <string name="intro_message">This sample demonstrates how to create <b>custom checkable layouts</b>, for use with <i>ListView</i>\'s <i>choiceMode</i> attribute.</string>
+</resources>
diff --git a/ui/lists/CustomChoiceList/res/values/styles.xml b/ui/lists/CustomChoiceList/res/values/styles.xml
new file mode 100644
index 0000000..e0a12d3
--- /dev/null
+++ b/ui/lists/CustomChoiceList/res/values/styles.xml
@@ -0,0 +1,39 @@
+<!--
+  Copyright 2013 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>
+
+    <!-- Activity themes -->
+
+    <style name="Theme.Base" parent="android:Theme.Light" />
+
+    <style name="Theme.Sample" parent="Theme.Base" />
+
+    <!-- Widget styling -->
+
+    <style name="Widget" />
+
+    <style name="Widget.DescriptionBar">
+        <item name="android:background">#fb3</item>
+        <item name="android:paddingTop">@dimen/margin_medium</item>
+        <item name="android:paddingBottom">@dimen/margin_medium</item>
+        <item name="android:paddingLeft">@dimen/page_margin</item>
+        <item name="android:paddingRight">@dimen/page_margin</item>
+        <item name="android:textAppearance">?android:textAppearanceMedium</item>
+        <item name="android:lineSpacingMultiplier">1.1</item>
+    </style>
+
+</resources>
diff --git a/ui/lists/CustomChoiceList/src/com/example/android/customchoicelist/CheckableLinearLayout.java b/ui/lists/CustomChoiceList/src/com/example/android/customchoicelist/CheckableLinearLayout.java
new file mode 100644
index 0000000..97be8cb
--- /dev/null
+++ b/ui/lists/CustomChoiceList/src/com/example/android/customchoicelist/CheckableLinearLayout.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2013 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.customchoicelist;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.View;
+import android.widget.Checkable;
+import android.widget.LinearLayout;
+
+/**
+ * This is a simple wrapper for {@link LinearLayout} that implements the {@link Checkable}
+ * interface by keeping an internal 'checked' state flag.
+ * <p>
+ * This can be used as the root view for a custom list item layout for
+ * {@link android.widget.AbsListView} elements with a
+ * {@link android.widget.AbsListView#setChoiceMode(int) choiceMode} set.
+ */
+public class CheckableLinearLayout extends LinearLayout implements Checkable {
+    private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked};
+
+    private boolean mChecked = false;
+
+    public CheckableLinearLayout(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public boolean isChecked() {
+        return mChecked;
+    }
+
+    public void setChecked(boolean b) {
+        if (b != mChecked) {
+            mChecked = b;
+            refreshDrawableState();
+        }
+    }
+
+    public void toggle() {
+        setChecked(!mChecked);
+    }
+
+    @Override
+    public int[] onCreateDrawableState(int extraSpace) {
+        final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
+        if (isChecked()) {
+            mergeDrawableStates(drawableState, CHECKED_STATE_SET);
+        }
+        return drawableState;
+    }
+}
diff --git a/ui/lists/CustomChoiceList/src/com/example/android/customchoicelist/Cheeses.java b/ui/lists/CustomChoiceList/src/com/example/android/customchoicelist/Cheeses.java
new file mode 100644
index 0000000..871ae29
--- /dev/null
+++ b/ui/lists/CustomChoiceList/src/com/example/android/customchoicelist/Cheeses.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2013 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.customchoicelist;
+
+/**
+ * Dummy data.
+ */
+public class Cheeses {
+    public static final String[] CHEESES = {
+            "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi",
+            "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale",
+            "Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese",
+            "Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-Bilh", "Anthoriro", "Appenzell",
+            "Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "Aromes au Gene de Marc",
+            "Asadero", "Asiago", "Aubisque Pyrenees", "Autun", "Avaxtskyr", "Baby Swiss",
+            "Babybel", "Baguette Laonnaise", "Bakers", "Baladi", "Balaton", "Bandal", "Banon",
+            "Barry's Bay Cheddar", "Basing", "Basket Cheese", "Bath Cheese", "Bavarian Bergkase",
+            "Baylough", "Beaufort", "Beauvoorde", "Beenleigh Blue", "Beer Cheese", "Bel Paese",
+            "Bergader", "Bergere Bleue", "Berkswell", "Beyaz Peynir", "Bierkase", "Bishop Kennedy",
+            "Blarney", "Bleu d'Auvergne", "Bleu de Gex", "Bleu de Laqueuille",
+            "Bleu de Septmoncel", "Bleu Des Causses", "Blue", "Blue Castello", "Blue Rathgore",
+            "Blue Vein (Australian)", "Blue Vein Cheeses", "Bocconcini", "Bocconcini (Australian)",
+            "Boeren Leidenkaas", "Bonchester", "Bosworth", "Bougon", "Boule Du Roves",
+            "Boulette d'Avesnes", "Boursault", "Boursin", "Bouyssou", "Bra", "Braudostur",
+            "Breakfast Cheese", "Brebis du Lavort", "Brebis du Lochois", "Brebis du Puyfaucon",
+            "Bresse Bleu", "Brick", "Brie", "Brie de Meaux", "Brie de Melun", "Brillat-Savarin",
+            "Brin", "Brin d' Amour", "Brin d'Amour", "Brinza (Burduf Brinza)",
+            "Briquette de Brebis", "Briquette du Forez", "Broccio", "Broccio Demi-Affine",
+            "Brousse du Rove", "Bruder Basil", "Brusselae Kaas (Fromage de Bruxelles)", "Bryndza",
+            "Buchette d'Anjou", "Buffalo", "Burgos", "Butte", "Butterkase", "Button (Innes)",
+            "Buxton Blue", "Cabecou", "Caboc", "Cabrales", "Cachaille", "Caciocavallo", "Caciotta",
+            "Caerphilly", "Cairnsmore", "Calenzana", "Cambazola", "Camembert de Normandie",
+            "Canadian Cheddar", "Canestrato", "Cantal", "Caprice des Dieux", "Capricorn Goat",
+            "Capriole Banon", "Carre de l'Est", "Casciotta di Urbino", "Cashel Blue", "Castellano",
+            "Castelleno", "Castelmagno", "Castelo Branco", "Castigliano", "Cathelain",
+            "Celtic Promise", "Cendre d'Olivet", "Cerney", "Chabichou", "Chabichou du Poitou",
+            "Chabis de Gatine", "Chaource", "Charolais", "Chaumes", "Cheddar",
+            "Cheddar Clothbound", "Cheshire", "Chevres", "Chevrotin des Aravis", "Chontaleno",
+            "Civray", "Coeur de Camembert au Calvados", "Coeur de Chevre", "Colby", "Cold Pack",
+            "Comte", "Coolea", "Cooleney", "Coquetdale", "Corleggy", "Cornish Pepper",
+            "Cotherstone", "Cotija", "Cottage Cheese", "Cottage Cheese (Australian)",
+            "Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese",
+            "Cream Havarti", "Crema Agria", "Crema Mexicana", "Creme Fraiche", "Crescenza",
+            "Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley",
+            "Cuajada", "Curd", "Cure Nantais", "Curworthy", "Cwmtawe Pecorino",
+            "Cypress Grove Chevre", "Danablu (Danish Blue)", "Danbo", "Danish Fontina",
+            "Daralagjazsky", "Dauphin", "Delice des Fiouves", "Denhany Dorset Drum", "Derby",
+            "Dessertnyj Belyj", "Devon Blue", "Devon Garland", "Dolcelatte", "Doolin",
+            "Doppelrhamstufel", "Dorset Blue Vinney", "Double Gloucester", "Double Worcester",
+            "Dreux a la Feuille", "Dry Jack", "Duddleswell", "Dunbarra", "Dunlop", "Dunsyre Blue",
+            "Duroblando", "Durrus", "Dutch Mimolette (Commissiekaas)", "Edam", "Edelpilz",
+            "Emental Grand Cru", "Emlett", "Emmental", "Epoisses de Bourgogne", "Esbareich",
+            "Esrom", "Etorki", "Evansdale Farmhouse Brie", "Evora De L'Alentejo", "Exmoor Blue",
+            "Explorateur", "Feta", "Feta (Australian)", "Figue", "Filetta", "Fin-de-Siecle",
+            "Finlandia Swiss", "Finn", "Fiore Sardo", "Fleur du Maquis", "Flor de Guia",
+            "Flower Marie", "Folded", "Folded cheese with mint", "Fondant de Brebis",
+            "Fontainebleau", "Fontal", "Fontina Val d'Aosta", "Formaggio di capra", "Fougerus",
+            "Four Herb Gouda", "Fourme d' Ambert", "Fourme de Haute Loire", "Fourme de Montbrison",
+            "Fresh Jack", "Fresh Mozzarella", "Fresh Ricotta", "Fresh Truffles", "Fribourgeois",
+            "Friesekaas", "Friesian", "Friesla", "Frinault", "Fromage a Raclette", "Fromage Corse",
+            "Fromage de Montagne de Savoie", "Fromage Frais", "Fruit Cream Cheese",
+            "Frying Cheese", "Fynbo", "Gabriel", "Galette du Paludier", "Galette Lyonnaise",
+            "Galloway Goat's Milk Gems", "Gammelost", "Gaperon a l'Ail", "Garrotxa", "Gastanberra",
+            "Geitost", "Gippsland Blue", "Gjetost", "Gloucester", "Golden Cross", "Gorgonzola",
+            "Gornyaltajski", "Gospel Green", "Gouda", "Goutu", "Gowrie", "Grabetto", "Graddost",
+            "Grafton Village Cheddar", "Grana", "Grana Padano", "Grand Vatel",
+            "Grataron d' Areches", "Gratte-Paille", "Graviera", "Greuilh", "Greve",
+            "Gris de Lille", "Gruyere", "Gubbeen", "Guerbigny", "Halloumi",
+            "Halloumy (Australian)", "Haloumi-Style Cheese", "Harbourne Blue", "Havarti",
+            "Heidi Gruyere", "Hereford Hop", "Herrgardsost", "Herriot Farmhouse", "Herve",
+            "Hipi Iti", "Hubbardston Blue Cow", "Hushallsost", "Iberico", "Idaho Goatster",
+            "Idiazabal", "Il Boschetto al Tartufo", "Ile d'Yeu", "Isle of Mull", "Jarlsberg",
+            "Jermi Tortes", "Jibneh Arabieh", "Jindi Brie", "Jubilee Blue", "Juustoleipa",
+            "Kadchgall", "Kaseri", "Kashta", "Kefalotyri", "Kenafa", "Kernhem", "Kervella Affine",
+            "Kikorangi", "King Island Cape Wickham Brie", "King River Gold", "Klosterkaese",
+            "Knockalara", "Kugelkase", "L'Aveyronnais", "L'Ecir de l'Aubrac", "La Taupiniere",
+            "La Vache Qui Rit", "Laguiole", "Lairobell", "Lajta", "Lanark Blue", "Lancashire",
+            "Langres", "Lappi", "Laruns", "Lavistown", "Le Brin", "Le Fium Orbo", "Le Lacandou",
+            "Le Roule", "Leafield", "Lebbene", "Leerdammer", "Leicester", "Leyden", "Limburger",
+            "Lincolnshire Poacher", "Lingot Saint Bousquet d'Orb", "Liptauer", "Little Rydings",
+            "Livarot", "Llanboidy", "Llanglofan Farmhouse", "Loch Arthur Farmhouse",
+            "Loddiswell Avondale", "Longhorn", "Lou Palou", "Lou Pevre", "Lyonnais", "Maasdam",
+            "Macconais", "Mahoe Aged Gouda", "Mahon", "Malvern", "Mamirolle", "Manchego",
+            "Manouri", "Manur", "Marble Cheddar", "Marbled Cheeses", "Maredsous", "Margotin",
+            "Maribo", "Maroilles", "Mascares", "Mascarpone", "Mascarpone (Australian)",
+            "Mascarpone Torta", "Matocq", "Maytag Blue", "Meira", "Menallack Farmhouse",
+            "Menonita", "Meredith Blue", "Mesost", "Metton (Cancoillotte)", "Meyer Vintage Gouda",
+            "Mihalic Peynir", "Milleens", "Mimolette", "Mine-Gabhar", "Mini Baby Bells", "Mixte",
+            "Molbo", "Monastery Cheeses", "Mondseer", "Mont D'or Lyonnais", "Montasio",
+            "Monterey Jack", "Monterey Jack Dry", "Morbier", "Morbier Cru de Montagne",
+            "Mothais a la Feuille", "Mozzarella", "Mozzarella (Australian)",
+            "Mozzarella di Bufala", "Mozzarella Fresh, in water", "Mozzarella Rolls", "Munster",
+            "Murol", "Mycella", "Myzithra", "Naboulsi", "Nantais", "Neufchatel",
+            "Neufchatel (Australian)", "Niolo", "Nokkelost", "Northumberland", "Oaxaca",
+            "Olde York", "Olivet au Foin", "Olivet Bleu", "Olivet Cendre",
+            "Orkney Extra Mature Cheddar", "Orla", "Oschtjepka", "Ossau Fermier", "Ossau-Iraty",
+            "Oszczypek", "Oxford Blue", "P'tit Berrichon", "Palet de Babligny", "Paneer", "Panela",
+            "Pannerone", "Pant ys Gawn", "Parmesan (Parmigiano)", "Parmigiano Reggiano",
+            "Pas de l'Escalette", "Passendale", "Pasteurized Processed", "Pate de Fromage",
+            "Patefine Fort", "Pave d'Affinois", "Pave d'Auge", "Pave de Chirac", "Pave du Berry",
+            "Pecorino", "Pecorino in Walnut Leaves", "Pecorino Romano", "Peekskill Pyramid",
+            "Pelardon des Cevennes", "Pelardon des Corbieres", "Penamellera", "Penbryn",
+            "Pencarreg", "Perail de Brebis", "Petit Morin", "Petit Pardou", "Petit-Suisse",
+            "Picodon de Chevre", "Picos de Europa", "Piora", "Pithtviers au Foin",
+            "Plateau de Herve", "Plymouth Cheese", "Podhalanski", "Poivre d'Ane", "Polkolbin",
+            "Pont l'Eveque", "Port Nicholson", "Port-Salut", "Postel", "Pouligny-Saint-Pierre",
+            "Pourly", "Prastost", "Pressato", "Prince-Jean", "Processed Cheddar", "Provolone",
+            "Provolone (Australian)", "Pyengana Cheddar", "Pyramide", "Quark",
+            "Quark (Australian)", "Quartirolo Lombardo", "Quatre-Vents", "Quercy Petit",
+            "Queso Blanco", "Queso Blanco con Frutas --Pina y Mango", "Queso de Murcia",
+            "Queso del Montsec", "Queso del Tietar", "Queso Fresco", "Queso Fresco (Adobera)",
+            "Queso Iberico", "Queso Jalapeno", "Queso Majorero", "Queso Media Luna",
+            "Queso Para Frier", "Queso Quesadilla", "Rabacal", "Raclette", "Ragusano", "Raschera",
+            "Reblochon", "Red Leicester", "Regal de la Dombes", "Reggianito", "Remedou",
+            "Requeson", "Richelieu", "Ricotta", "Ricotta (Australian)", "Ricotta Salata", "Ridder",
+            "Rigotte", "Rocamadour", "Rollot", "Romano", "Romans Part Dieu", "Roncal", "Roquefort",
+            "Roule", "Rouleau De Beaulieu", "Royalp Tilsit", "Rubens", "Rustinu", "Saaland Pfarr",
+            "Saanenkaese", "Saga", "Sage Derby", "Sainte Maure", "Saint-Marcellin",
+            "Saint-Nectaire", "Saint-Paulin", "Salers", "Samso", "San Simon", "Sancerre",
+            "Sap Sago", "Sardo", "Sardo Egyptian", "Sbrinz", "Scamorza", "Schabzieger", "Schloss",
+            "Selles sur Cher", "Selva", "Serat", "Seriously Strong Cheddar", "Serra da Estrela",
+            "Sharpam", "Shelburne Cheddar", "Shropshire Blue", "Siraz", "Sirene", "Smoked Gouda",
+            "Somerset Brie", "Sonoma Jack", "Sottocenare al Tartufo", "Soumaintrain",
+            "Sourire Lozerien", "Spenwood", "Sraffordshire Organic", "St. Agur Blue Cheese",
+            "Stilton", "Stinking Bishop", "String", "Sussex Slipcote", "Sveciaost", "Swaledale",
+            "Sweet Style Swiss", "Swiss", "Syrian (Armenian String)", "Tala", "Taleggio", "Tamie",
+            "Tasmania Highland Chevre Log", "Taupiniere", "Teifi", "Telemea", "Testouri",
+            "Tete de Moine", "Tetilla", "Texas Goat Cheese", "Tibet", "Tillamook Cheddar",
+            "Tilsit", "Timboon Brie", "Toma", "Tomme Brulee", "Tomme d'Abondance",
+            "Tomme de Chevre", "Tomme de Romans", "Tomme de Savoie", "Tomme des Chouans", "Tommes",
+            "Torta del Casar", "Toscanello", "Touree de L'Aubier", "Tourmalet",
+            "Trappe (Veritable)", "Trois Cornes De Vendee", "Tronchon", "Trou du Cru", "Truffe",
+            "Tupi", "Turunmaa", "Tymsboro", "Tyn Grug", "Tyning", "Ubriaco", "Ulloa",
+            "Vacherin-Fribourgeois", "Valencay", "Vasterbottenost", "Venaco", "Vendomois",
+            "Vieux Corse", "Vignotte", "Vulscombe", "Waimata Farmhouse Blue",
+            "Washed Rind Cheese (Australian)", "Waterloo", "Weichkaese", "Wellington",
+            "Wensleydale", "White Stilton", "Whitestone Farmhouse", "Wigmore", "Woodside Cabecou",
+            "Xanadu", "Xynotyro", "Yarg Cornish", "Yarra Valley Pyramid", "Yorkshire Blue",
+            "Zamorano", "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano"
+    };
+}
diff --git a/ui/lists/CustomChoiceList/src/com/example/android/customchoicelist/MainActivity.java b/ui/lists/CustomChoiceList/src/com/example/android/customchoicelist/MainActivity.java
new file mode 100755
index 0000000..e27ff97
--- /dev/null
+++ b/ui/lists/CustomChoiceList/src/com/example/android/customchoicelist/MainActivity.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2013 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.customchoicelist;
+
+import android.app.ListActivity;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.TextView;
+
+/**
+ * This sample demonstrates how to create custom single- or multi-choice
+ * {@link android.widget.ListView} UIs. The most interesting bits are in
+ * the <code>res/layout/</code> directory of this sample.
+ */
+public class MainActivity extends ListActivity {
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+        setListAdapter(new MyAdapter());
+    }
+
+    /**
+     * A simple array adapter that creates a list of cheeses.
+     */
+    private class MyAdapter extends BaseAdapter {
+        @Override
+        public int getCount() {
+            return Cheeses.CHEESES.length;
+        }
+
+        @Override
+        public String getItem(int position) {
+            return Cheeses.CHEESES[position];
+        }
+
+        @Override
+        public long getItemId(int position) {
+            return Cheeses.CHEESES[position].hashCode();
+        }
+
+        @Override
+        public View getView(int position, View convertView, ViewGroup container) {
+            if (convertView == null) {
+                convertView = getLayoutInflater().inflate(R.layout.list_item, container, false);
+            }
+
+            ((TextView) convertView.findViewById(android.R.id.text1))
+                    .setText(getItem(position));
+            return convertView;
+        }
+    }
+}
diff --git a/ui/views/TextSwitcher/AndroidManifest.xml b/ui/views/TextSwitcher/AndroidManifest.xml
new file mode 100644
index 0000000..707bfe3
--- /dev/null
+++ b/ui/views/TextSwitcher/AndroidManifest.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 2013 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.view.textswitcher"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk
+        android:minSdkVersion="4"
+        android:targetSdkVersion="17" />
+
+    <application
+        android:allowBackup="true"
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <activity
+            android:name="com.example.android.ui.views.textswitcher.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/ui/views/TextSwitcher/res/drawable-hdpi/ic_launcher.png b/ui/views/TextSwitcher/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..641bab2
--- /dev/null
+++ b/ui/views/TextSwitcher/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/ui/views/TextSwitcher/res/drawable-mdpi/ic_launcher.png b/ui/views/TextSwitcher/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..e29c59f
--- /dev/null
+++ b/ui/views/TextSwitcher/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/ui/views/TextSwitcher/res/drawable-xhdpi/ic_launcher.png b/ui/views/TextSwitcher/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..d23193b
--- /dev/null
+++ b/ui/views/TextSwitcher/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/views/TextSwitcher/res/drawable-xxhdpi/ic_launcher.png b/ui/views/TextSwitcher/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..22bfd45
--- /dev/null
+++ b/ui/views/TextSwitcher/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/views/TextSwitcher/res/layout/activity_main.xml b/ui/views/TextSwitcher/res/layout/activity_main.xml
new file mode 100644
index 0000000..a5a7053
--- /dev/null
+++ b/ui/views/TextSwitcher/res/layout/activity_main.xml
@@ -0,0 +1,47 @@
+<!--
+  Copyright 2013 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"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/LinearLayout1"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_gravity="top|center_horizontal"
+    android:gravity="center_horizontal"
+    android:orientation="vertical"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    tools:context=".MainActivity" >
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/intro" />
+
+    <Button
+        android:id="@+id/button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/next" />
+
+    <TextSwitcher
+        android:id="@+id/switcher"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"/>
+
+</LinearLayout>
diff --git a/ui/views/TextSwitcher/res/values-sw600dp/dimens.xml b/ui/views/TextSwitcher/res/values-sw600dp/dimens.xml
new file mode 100644
index 0000000..686fe89
--- /dev/null
+++ b/ui/views/TextSwitcher/res/values-sw600dp/dimens.xml
@@ -0,0 +1,24 @@
+<!--
+  Copyright 2013 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>
+
+    <!--
+         Customize dimensions originally defined in res/values/dimens.xml (such as
+         screen margins) for sw600dp devices (e.g. 7" tablets) here.
+    -->
+
+</resources>
diff --git a/ui/views/TextSwitcher/res/values-sw720dp-land/dimens.xml b/ui/views/TextSwitcher/res/values-sw720dp-land/dimens.xml
new file mode 100644
index 0000000..560bd44
--- /dev/null
+++ b/ui/views/TextSwitcher/res/values-sw720dp-land/dimens.xml
@@ -0,0 +1,25 @@
+<!--
+  Copyright 2013 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>
+
+    <!--
+         Customize dimensions originally defined in res/values/dimens.xml (such as
+         screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
+    -->
+    <dimen name="activity_horizontal_margin">128dp</dimen>
+
+</resources>
diff --git a/ui/views/TextSwitcher/res/values-v11/styles.xml b/ui/views/TextSwitcher/res/values-v11/styles.xml
new file mode 100644
index 0000000..91f4523
--- /dev/null
+++ b/ui/views/TextSwitcher/res/values-v11/styles.xml
@@ -0,0 +1,27 @@
+<!--
+  Copyright 2013 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<resources>
+
+    <!--
+        Base application theme for API 11+. This theme completely replaces
+        AppBaseTheme from res/values/styles.xml on API 11+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+        <!-- API 11 theme customizations can go here. -->
+    </style>
+
+</resources>
diff --git a/ui/views/TextSwitcher/res/values-v14/styles.xml b/ui/views/TextSwitcher/res/values-v14/styles.xml
new file mode 100644
index 0000000..c2b6a6b
--- /dev/null
+++ b/ui/views/TextSwitcher/res/values-v14/styles.xml
@@ -0,0 +1,28 @@
+<!--
+  Copyright 2013 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<resources>
+
+    <!--
+        Base application theme for API 14+. This theme completely replaces
+        AppBaseTheme from BOTH res/values/styles.xml and
+        res/values-v11/styles.xml on API 14+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+        <!-- API 14 theme customizations can go here. -->
+    </style>
+
+</resources>
diff --git a/ui/views/TextSwitcher/res/values/dimens.xml b/ui/views/TextSwitcher/res/values/dimens.xml
new file mode 100644
index 0000000..3b1975a
--- /dev/null
+++ b/ui/views/TextSwitcher/res/values/dimens.xml
@@ -0,0 +1,23 @@
+<!--
+  Copyright 2013 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<resources>
+
+    <!-- Default screen margins, per the Android Design guidelines. -->
+    <dimen name="activity_horizontal_margin">16dp</dimen>
+    <dimen name="activity_vertical_margin">16dp</dimen>
+
+</resources>
diff --git a/ui/views/TextSwitcher/res/values/strings.xml b/ui/views/TextSwitcher/res/values/strings.xml
new file mode 100644
index 0000000..6b281e6
--- /dev/null
+++ b/ui/views/TextSwitcher/res/values/strings.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 2013 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">TextSwitcherSample</string>
+    <string name="intro">This sample illustrates the use of a <b>TextSwitcher</b> to display text.
+\n\n<b>Click the button</b> below to set new text in the TextSwitcher and observe the in and out
+ fade animations.</string>
+    <string name="next">Next</string>
+
+</resources>
diff --git a/ui/views/TextSwitcher/res/values/styles.xml b/ui/views/TextSwitcher/res/values/styles.xml
new file mode 100644
index 0000000..27efa47
--- /dev/null
+++ b/ui/views/TextSwitcher/res/values/styles.xml
@@ -0,0 +1,36 @@
+<!--
+  Copyright 2013 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<resources>
+
+    <!--
+        Base application theme, dependent on API level. This theme is replaced
+        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Light">
+        <!--
+            Theme customizations available in newer API levels can go in
+            res/values-vXX/styles.xml, while customizations related to
+            backward-compatibility can go here.
+        -->
+    </style>
+
+    <!-- Application theme. -->
+    <style name="AppTheme" parent="AppBaseTheme">
+        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+    </style>
+
+</resources>
diff --git a/ui/views/TextSwitcher/src/com/example/android/ui/views/textswitcher/MainActivity.java b/ui/views/TextSwitcher/src/com/example/android/ui/views/textswitcher/MainActivity.java
new file mode 100644
index 0000000..1beeb59
--- /dev/null
+++ b/ui/views/TextSwitcher/src/com/example/android/ui/views/textswitcher/MainActivity.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2013 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.ui.views.textswitcher;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Gravity;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.widget.Button;
+import android.widget.TextSwitcher;
+import android.widget.TextView;
+import android.widget.ViewSwitcher;
+import android.widget.ViewSwitcher.ViewFactory;
+
+import com.example.android.view.textswitcher.R;
+
+/**
+ * This sample shows the use of the {@link TextSwitcher} View with animations. A
+ * {@link TextSwitcher} is a special type of {@link ViewSwitcher} that animates
+ * the current text out and new text in when
+ * {@link TextSwitcher#setText(CharSequence)} is called.
+ */
+public class MainActivity extends Activity {
+    private TextSwitcher mSwitcher;
+    private int mCounter = 0;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+
+        // Get the TextSwitcher view from the layout
+        mSwitcher = (TextSwitcher) findViewById(R.id.switcher);
+
+        // BEGIN_INCLUDE(setup)
+        // Set the factory used to create TextViews to switch between.
+        mSwitcher.setFactory(mFactory);
+
+        /*
+         * Set the in and out animations. Using the fade_in/out animations
+         * provided by the framework.
+         */
+        Animation in = AnimationUtils.loadAnimation(this,
+                android.R.anim.fade_in);
+        Animation out = AnimationUtils.loadAnimation(this,
+                android.R.anim.fade_out);
+        mSwitcher.setInAnimation(in);
+        mSwitcher.setOutAnimation(out);
+        // END_INCLUDE(setup)
+
+        /*
+         * Setup the 'next' button. The counter is incremented when clicked and
+         * the new value is displayed in the TextSwitcher. The change of text is
+         * automatically animated using the in/out animations set above.
+         */
+        Button nextButton = (Button) findViewById(R.id.button);
+        nextButton.setOnClickListener(new View.OnClickListener() {
+
+            @Override
+            public void onClick(View v) {
+                mCounter++;
+                // BEGIN_INCLUDE(settext)
+                mSwitcher.setText(String.valueOf(mCounter));
+                // END_INCLUDE(settext)
+            }
+        });
+
+        // Set the initial text without an animation
+        mSwitcher.setCurrentText(String.valueOf(mCounter));
+
+    }
+
+    // BEGIN_INCLUDE(factory)
+    /**
+     * The {@link ViewFactory} used to create {@link TextView}s that the
+     * {@link TextSwitcher} will switch between.
+     */
+    private ViewSwitcher.ViewFactory mFactory = new ViewFactory() {
+
+        @Override
+        public View makeView() {
+
+            // Create a new TextView
+            TextView t = new TextView(MainActivity.this);
+            t.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
+            t.setTextAppearance(MainActivity.this, android.R.style.TextAppearance_Large);
+            return t;
+        }
+    };
+    // END_INCLUDE(factory)
+}