summaryrefslogtreecommitdiff
path: root/samples/demos
diff options
context:
space:
mode:
Diffstat (limited to 'samples/demos')
-rw-r--r--samples/demos/AndroidManifest.xml188
-rw-r--r--samples/demos/README.md13
-rw-r--r--samples/demos/libs/android-support-v4.jarbin0 -> 271754 bytes
-rw-r--r--samples/demos/pom.xml112
-rw-r--r--samples/demos/project.properties17
-rw-r--r--samples/demos/res/drawable-hdpi/bg_striped_img.pngbin0 -> 156 bytes
-rw-r--r--samples/demos/res/drawable-hdpi/bg_striped_split_img.pngbin0 -> 151 bytes
-rw-r--r--samples/demos/res/drawable-hdpi/ic_compose.pngbin0 -> 1390 bytes
-rw-r--r--samples/demos/res/drawable-hdpi/ic_compose_inverse.pngbin0 -> 647 bytes
-rw-r--r--samples/demos/res/drawable-hdpi/ic_launcher_settings.pngbin0 -> 7230 bytes
-rw-r--r--samples/demos/res/drawable-hdpi/ic_magnifying_glass.pngbin0 -> 5093 bytes
-rw-r--r--samples/demos/res/drawable-hdpi/ic_refresh.pngbin0 -> 683 bytes
-rw-r--r--samples/demos/res/drawable-hdpi/ic_refresh_inverse.pngbin0 -> 797 bytes
-rw-r--r--samples/demos/res/drawable-hdpi/ic_search.pngbin0 -> 641 bytes
-rw-r--r--samples/demos/res/drawable-hdpi/ic_search_inverse.pngbin0 -> 759 bytes
-rw-r--r--samples/demos/res/drawable-hdpi/ic_title_share_default.pngbin0 -> 641 bytes
-rw-r--r--samples/demos/res/drawable-hdpi/icon.pngbin0 -> 6996 bytes
-rw-r--r--samples/demos/res/drawable-ldpi/icon.pngbin0 -> 3003 bytes
-rw-r--r--samples/demos/res/drawable-mdpi/bg_striped_img.pngbin0 -> 141 bytes
-rw-r--r--samples/demos/res/drawable-mdpi/bg_striped_split_img.pngbin0 -> 136 bytes
-rw-r--r--samples/demos/res/drawable-mdpi/ic_compose.pngbin0 -> 1327 bytes
-rw-r--r--samples/demos/res/drawable-mdpi/ic_compose_inverse.pngbin0 -> 578 bytes
-rw-r--r--samples/demos/res/drawable-mdpi/ic_launcher_settings.pngbin0 -> 4122 bytes
-rw-r--r--samples/demos/res/drawable-mdpi/ic_magnifying_glass.pngbin0 -> 2631 bytes
-rw-r--r--samples/demos/res/drawable-mdpi/ic_refresh.pngbin0 -> 1392 bytes
-rw-r--r--samples/demos/res/drawable-mdpi/ic_refresh_inverse.pngbin0 -> 659 bytes
-rw-r--r--samples/demos/res/drawable-mdpi/ic_search.pngbin0 -> 1330 bytes
-rw-r--r--samples/demos/res/drawable-mdpi/ic_search_inverse.pngbin0 -> 616 bytes
-rw-r--r--samples/demos/res/drawable-mdpi/icon.pngbin0 -> 4248 bytes
-rw-r--r--samples/demos/res/drawable-xhdpi/bg_striped_img.pngbin0 -> 169 bytes
-rw-r--r--samples/demos/res/drawable-xhdpi/bg_striped_split_img.pngbin0 -> 164 bytes
-rw-r--r--samples/demos/res/drawable-xhdpi/ic_launcher_settings.pngbin0 -> 11183 bytes
-rw-r--r--samples/demos/res/drawable-xhdpi/icon.pngbin0 -> 10322 bytes
-rw-r--r--samples/demos/res/drawable/bg_striped.xml6
-rw-r--r--samples/demos/res/drawable/bg_striped_split.xml6
-rw-r--r--samples/demos/res/layout-large-land/feature_toggles.xml393
-rw-r--r--samples/demos/res/layout/action_modes.xml30
-rw-r--r--samples/demos/res/layout/collapsible_edittext.xml5
-rw-r--r--samples/demos/res/layout/context_menus.xml25
-rw-r--r--samples/demos/res/layout/custom_view.xml25
-rw-r--r--samples/demos/res/layout/feature_toggles.xml373
-rw-r--r--samples/demos/res/layout/iprogress.xml29
-rw-r--r--samples/demos/res/layout/list_navigation.xml17
-rw-r--r--samples/demos/res/layout/overlay.xml28
-rw-r--r--samples/demos/res/layout/preferences.xml8
-rw-r--r--samples/demos/res/layout/progress.xml21
-rw-r--r--samples/demos/res/layout/settings_action_provider.xml34
-rw-r--r--samples/demos/res/layout/tab_custom_view.xml9
-rw-r--r--samples/demos/res/layout/tab_navigation.xml17
-rw-r--r--samples/demos/res/layout/text.xml12
-rw-r--r--samples/demos/res/menu/settings_action_provider.xml28
-rw-r--r--samples/demos/res/menu/share_action_provider.xml29
-rw-r--r--samples/demos/res/raw/robot.pngbin0 -> 5634 bytes
-rw-r--r--samples/demos/res/values/arrays.xml22
-rw-r--r--samples/demos/res/values/colors.xml5
-rw-r--r--samples/demos/res/values/strings.xml121
-rw-r--r--samples/demos/res/values/themes.xml15
-rw-r--r--samples/demos/res/xml/preferences.xml82
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/ActionItems.java56
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/ActionModes.java102
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/ActionModesNoActionBar.java107
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/ActionProviders.java121
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/CollapsibleActionItem.java46
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/ContextMenus.java75
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/CustomNavigation.java51
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/Dialog.java29
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/FeatureToggles.java271
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/ForcedOverflowItem.java73
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/IndeterminateProgress.java49
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/ListNavigation.java37
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/Overlay.java245
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/Preference.java51
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/Progress.java65
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/SampleList.java175
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/ShareActionProviders.java129
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/Simple.java31
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionItems.java26
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionModes.java19
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/StaticAttachment.java94
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/Styled.java62
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/SubMenus.java57
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigation.java43
-rw-r--r--samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigationCollapsed.java15
83 files changed, 3699 insertions, 0 deletions
diff --git a/samples/demos/AndroidManifest.xml b/samples/demos/AndroidManifest.xml
new file mode 100644
index 0000000..0d489ed
--- /dev/null
+++ b/samples/demos/AndroidManifest.xml
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="90" android:versionName="4.1.0" package="com.actionbarsherlock.sample.demos">
+
+ <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
+
+ <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
+
+ <application android:icon="@drawable/icon" android:label="@string/application_name">
+
+ <activity android:label="@string/activity_name" android:name=".SampleList" android:theme="@style/Theme.Sherlock">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+
+
+ <activity android:label="@string/action_items" android:name=".ActionItems">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/action_modes" android:name=".ActionModes">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/action_modes_no_action_bar" android:name=".ActionModesNoActionBar">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/action_providers" android:name=".ActionProviders">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/collapsible" android:name=".CollapsibleActionItem">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/context_menus" android:name=".ContextMenus">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/custom_navigation" android:name=".CustomNavigation">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/dialog" android:name=".Dialog" android:theme="@style/Theme.Sherlock.Dialog">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/feature_toggles" android:name=".FeatureToggles">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/forced_overflow" android:name=".ForcedOverflowItem">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/iprogress" android:name=".IndeterminateProgress">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/list_navigation" android:name=".ListNavigation">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/overlay" android:name=".Overlay">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/preference" android:name=".Preference">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/progress" android:name=".Progress">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/simple" android:name=".Simple">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/split" android:name=".SplitActionItems" android:uiOptions="splitActionBarWhenNarrow">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/share_action_providers" android:name=".ShareActionProviders">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/split_action_modes" android:name=".SplitActionModes" android:uiOptions="splitActionBarWhenNarrow">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/static_attach" android:name=".StaticAttachment">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/styled" android:name=".Styled" android:theme="@style/Theme.Styled" android:uiOptions="splitActionBarWhenNarrow">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/submenus" android:name=".SubMenus">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/tab_navigation" android:name=".TabNavigation">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:label="@string/tab_navigation_collapsed" android:name=".TabNavigationCollapsed">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.actionbarsherlock.sample.demos.EXAMPLE"/>
+ </intent-filter>
+ </activity>
+
+ </application>
+</manifest>
diff --git a/samples/demos/README.md b/samples/demos/README.md
new file mode 100644
index 0000000..a0198bf
--- /dev/null
+++ b/samples/demos/README.md
@@ -0,0 +1,13 @@
+ActionBarSherlock Sample: Demos
+===============================
+
+See [actionbarsherlock.com/samples.html][1] for information on the sample
+contained in this folder.
+
+
+
+
+
+
+
+ [1]: http://actionbarsherlock.com/samples.html
diff --git a/samples/demos/libs/android-support-v4.jar b/samples/demos/libs/android-support-v4.jar
new file mode 100644
index 0000000..99e063b
--- /dev/null
+++ b/samples/demos/libs/android-support-v4.jar
Binary files differ
diff --git a/samples/demos/pom.xml b/samples/demos/pom.xml
new file mode 100644
index 0000000..c6a0146
--- /dev/null
+++ b/samples/demos/pom.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.actionbarsherlock</groupId>
+ <artifactId>sample-demos</artifactId>
+ <name>Sample: Demos</name>
+ <packaging>apk</packaging>
+
+ <parent>
+ <groupId>com.actionbarsherlock</groupId>
+ <artifactId>parent-sample</artifactId>
+ <version>4.1.0</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.google.android</groupId>
+ <artifactId>android</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.actionbarsherlock</groupId>
+ <artifactId>library</artifactId>
+ <version>${project.version}</version>
+ <type>apklib</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <finalName>${apk.prefix}-${project.artifactId}-${project.version}-unaligned</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>com.jayway.maven.plugins.android.generation2</groupId>
+ <artifactId>android-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>zipalign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jarsigner-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>../../checkstyle.xml</configLocation>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>checkstyle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>abs-release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.github.github</groupId>
+ <artifactId>downloads-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>deploy</phase>
+ <goals>
+ <goal>upload</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/samples/demos/project.properties b/samples/demos/project.properties
new file mode 100644
index 0000000..d29d6c7
--- /dev/null
+++ b/samples/demos/project.properties
@@ -0,0 +1,17 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-14
+android.library.reference.1=../../library
+
+
+
+
+
diff --git a/samples/demos/res/drawable-hdpi/bg_striped_img.png b/samples/demos/res/drawable-hdpi/bg_striped_img.png
new file mode 100644
index 0000000..ab8487a
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/bg_striped_img.png
Binary files differ
diff --git a/samples/demos/res/drawable-hdpi/bg_striped_split_img.png b/samples/demos/res/drawable-hdpi/bg_striped_split_img.png
new file mode 100644
index 0000000..4c780ea
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/bg_striped_split_img.png
Binary files differ
diff --git a/samples/demos/res/drawable-hdpi/ic_compose.png b/samples/demos/res/drawable-hdpi/ic_compose.png
new file mode 100644
index 0000000..cdb09e4
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/ic_compose.png
Binary files differ
diff --git a/samples/demos/res/drawable-hdpi/ic_compose_inverse.png b/samples/demos/res/drawable-hdpi/ic_compose_inverse.png
new file mode 100644
index 0000000..8a0c487
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/ic_compose_inverse.png
Binary files differ
diff --git a/samples/demos/res/drawable-hdpi/ic_launcher_settings.png b/samples/demos/res/drawable-hdpi/ic_launcher_settings.png
new file mode 100644
index 0000000..c02bd42
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/ic_launcher_settings.png
Binary files differ
diff --git a/samples/demos/res/drawable-hdpi/ic_magnifying_glass.png b/samples/demos/res/drawable-hdpi/ic_magnifying_glass.png
new file mode 100644
index 0000000..cdf3518
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/ic_magnifying_glass.png
Binary files differ
diff --git a/samples/demos/res/drawable-hdpi/ic_refresh.png b/samples/demos/res/drawable-hdpi/ic_refresh.png
new file mode 100644
index 0000000..08c32e0
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/ic_refresh.png
Binary files differ
diff --git a/samples/demos/res/drawable-hdpi/ic_refresh_inverse.png b/samples/demos/res/drawable-hdpi/ic_refresh_inverse.png
new file mode 100644
index 0000000..9ab1d38
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/ic_refresh_inverse.png
Binary files differ
diff --git a/samples/demos/res/drawable-hdpi/ic_search.png b/samples/demos/res/drawable-hdpi/ic_search.png
new file mode 100644
index 0000000..59de344
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/ic_search.png
Binary files differ
diff --git a/samples/demos/res/drawable-hdpi/ic_search_inverse.png b/samples/demos/res/drawable-hdpi/ic_search_inverse.png
new file mode 100644
index 0000000..eb090a6
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/ic_search_inverse.png
Binary files differ
diff --git a/samples/demos/res/drawable-hdpi/ic_title_share_default.png b/samples/demos/res/drawable-hdpi/ic_title_share_default.png
new file mode 100644
index 0000000..ee4b285
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/ic_title_share_default.png
Binary files differ
diff --git a/samples/demos/res/drawable-hdpi/icon.png b/samples/demos/res/drawable-hdpi/icon.png
new file mode 100644
index 0000000..723fbf0
--- /dev/null
+++ b/samples/demos/res/drawable-hdpi/icon.png
Binary files differ
diff --git a/samples/demos/res/drawable-ldpi/icon.png b/samples/demos/res/drawable-ldpi/icon.png
new file mode 100644
index 0000000..181f679
--- /dev/null
+++ b/samples/demos/res/drawable-ldpi/icon.png
Binary files differ
diff --git a/samples/demos/res/drawable-mdpi/bg_striped_img.png b/samples/demos/res/drawable-mdpi/bg_striped_img.png
new file mode 100644
index 0000000..06e3ebd
--- /dev/null
+++ b/samples/demos/res/drawable-mdpi/bg_striped_img.png
Binary files differ
diff --git a/samples/demos/res/drawable-mdpi/bg_striped_split_img.png b/samples/demos/res/drawable-mdpi/bg_striped_split_img.png
new file mode 100644
index 0000000..1308ade
--- /dev/null
+++ b/samples/demos/res/drawable-mdpi/bg_striped_split_img.png
Binary files differ
diff --git a/samples/demos/res/drawable-mdpi/ic_compose.png b/samples/demos/res/drawable-mdpi/ic_compose.png
new file mode 100644
index 0000000..15a4130
--- /dev/null
+++ b/samples/demos/res/drawable-mdpi/ic_compose.png
Binary files differ
diff --git a/samples/demos/res/drawable-mdpi/ic_compose_inverse.png b/samples/demos/res/drawable-mdpi/ic_compose_inverse.png
new file mode 100644
index 0000000..de58ce8
--- /dev/null
+++ b/samples/demos/res/drawable-mdpi/ic_compose_inverse.png
Binary files differ
diff --git a/samples/demos/res/drawable-mdpi/ic_launcher_settings.png b/samples/demos/res/drawable-mdpi/ic_launcher_settings.png
new file mode 100644
index 0000000..05cdd9a
--- /dev/null
+++ b/samples/demos/res/drawable-mdpi/ic_launcher_settings.png
Binary files differ
diff --git a/samples/demos/res/drawable-mdpi/ic_magnifying_glass.png b/samples/demos/res/drawable-mdpi/ic_magnifying_glass.png
new file mode 100644
index 0000000..53aa6d9
--- /dev/null
+++ b/samples/demos/res/drawable-mdpi/ic_magnifying_glass.png
Binary files differ
diff --git a/samples/demos/res/drawable-mdpi/ic_refresh.png b/samples/demos/res/drawable-mdpi/ic_refresh.png
new file mode 100644
index 0000000..55c43c3
--- /dev/null
+++ b/samples/demos/res/drawable-mdpi/ic_refresh.png
Binary files differ
diff --git a/samples/demos/res/drawable-mdpi/ic_refresh_inverse.png b/samples/demos/res/drawable-mdpi/ic_refresh_inverse.png
new file mode 100644
index 0000000..d5736ec
--- /dev/null
+++ b/samples/demos/res/drawable-mdpi/ic_refresh_inverse.png
Binary files differ
diff --git a/samples/demos/res/drawable-mdpi/ic_search.png b/samples/demos/res/drawable-mdpi/ic_search.png
new file mode 100644
index 0000000..75339d9
--- /dev/null
+++ b/samples/demos/res/drawable-mdpi/ic_search.png
Binary files differ
diff --git a/samples/demos/res/drawable-mdpi/ic_search_inverse.png b/samples/demos/res/drawable-mdpi/ic_search_inverse.png
new file mode 100644
index 0000000..b462c32
--- /dev/null
+++ b/samples/demos/res/drawable-mdpi/ic_search_inverse.png
Binary files differ
diff --git a/samples/demos/res/drawable-mdpi/icon.png b/samples/demos/res/drawable-mdpi/icon.png
new file mode 100644
index 0000000..79f50d8
--- /dev/null
+++ b/samples/demos/res/drawable-mdpi/icon.png
Binary files differ
diff --git a/samples/demos/res/drawable-xhdpi/bg_striped_img.png b/samples/demos/res/drawable-xhdpi/bg_striped_img.png
new file mode 100644
index 0000000..92f3fa1
--- /dev/null
+++ b/samples/demos/res/drawable-xhdpi/bg_striped_img.png
Binary files differ
diff --git a/samples/demos/res/drawable-xhdpi/bg_striped_split_img.png b/samples/demos/res/drawable-xhdpi/bg_striped_split_img.png
new file mode 100644
index 0000000..e31f4a6
--- /dev/null
+++ b/samples/demos/res/drawable-xhdpi/bg_striped_split_img.png
Binary files differ
diff --git a/samples/demos/res/drawable-xhdpi/ic_launcher_settings.png b/samples/demos/res/drawable-xhdpi/ic_launcher_settings.png
new file mode 100644
index 0000000..2b2907b
--- /dev/null
+++ b/samples/demos/res/drawable-xhdpi/ic_launcher_settings.png
Binary files differ
diff --git a/samples/demos/res/drawable-xhdpi/icon.png b/samples/demos/res/drawable-xhdpi/icon.png
new file mode 100644
index 0000000..34ca9a4
--- /dev/null
+++ b/samples/demos/res/drawable-xhdpi/icon.png
Binary files differ
diff --git a/samples/demos/res/drawable/bg_striped.xml b/samples/demos/res/drawable/bg_striped.xml
new file mode 100644
index 0000000..77e0aab
--- /dev/null
+++ b/samples/demos/res/drawable/bg_striped.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/bg_striped_img"
+ android:tileMode="repeat"
+ android:dither="true" /> \ No newline at end of file
diff --git a/samples/demos/res/drawable/bg_striped_split.xml b/samples/demos/res/drawable/bg_striped_split.xml
new file mode 100644
index 0000000..9b0e313
--- /dev/null
+++ b/samples/demos/res/drawable/bg_striped_split.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/bg_striped_split_img"
+ android:tileMode="repeat"
+ android:dither="true" /> \ No newline at end of file
diff --git a/samples/demos/res/layout-large-land/feature_toggles.xml b/samples/demos/res/layout-large-land/feature_toggles.xml
new file mode 100644
index 0000000..359f298
--- /dev/null
+++ b/samples/demos/res/layout-large-land/feature_toggles.xml
@@ -0,0 +1,393 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+ <ScrollView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/feature_toggles_content"
+ android:padding="15dp"
+ android:layout_marginBottom="20dp" />
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical"
+ android:padding="15dip">
+
+ <!-- ACTION BAR DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="ActionBar Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_actionbar_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_actionbar_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- NAVIGATION MODE -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Navigation Mode" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/navigation_standard"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Standard" />
+ <Button
+ android:id="@+id/navigation_list"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="List" />
+ <Button
+ android:id="@+id/navigation_tabs"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Tabs" />
+ </LinearLayout>
+
+ <!-- TAB DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Tab Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_tab_add"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Add" />
+ <Button
+ android:id="@+id/display_tab_select"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Select Random" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_tab_remove"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Remove" />
+ <Button
+ android:id="@+id/display_tab_remove_all"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Remove All" />
+ </LinearLayout>
+
+ <!-- TITLE DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Title Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_title_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_title_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- SUBTITLE DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Subtitle Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_subtitle_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_subtitle_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical"
+ android:padding="15dip">
+
+ <!-- ACTION ITEMS DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Action Items Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_items_add"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Add" />
+ <Button
+ android:id="@+id/display_items_clear"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Remove All" />
+ </LinearLayout>
+
+ <!-- CUSTOM VIEW DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Custom View Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_custom_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_custom_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- HOME DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Home Action Item Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_home_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_home_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- LOGO DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Logo Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_logo_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Use" />
+ <Button
+ android:id="@+id/display_logo_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Do Not Use" />
+ </LinearLayout>
+
+ <!-- HOME AS UP DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Home As Up Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_home_as_up_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_home_as_up_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- PROGESS DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Progress Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_progress_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_progress_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- INDETERMINATE PROGESS DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Indeterminate Progress Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_iprogress_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_iprogress_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+ </ScrollView>
+</LinearLayout>
diff --git a/samples/demos/res/layout/action_modes.xml b/samples/demos/res/layout/action_modes.xml
new file mode 100644
index 0000000..dd9b0c4
--- /dev/null
+++ b/samples/demos/res/layout/action_modes.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:padding="20dip">
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:orientation="horizontal">
+ <Button
+ android:id="@+id/start"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="10dp"
+ android:text="Start" />
+ <Button
+ android:id="@+id/cancel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Cancel" />
+ </LinearLayout>
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="20dp"
+ android:text="@string/action_modes_content"/>
+</LinearLayout> \ No newline at end of file
diff --git a/samples/demos/res/layout/collapsible_edittext.xml b/samples/demos/res/layout/collapsible_edittext.xml
new file mode 100644
index 0000000..d1bd064
--- /dev/null
+++ b/samples/demos/res/layout/collapsible_edittext.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<EditText xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:hint="Search"/>
diff --git a/samples/demos/res/layout/context_menus.xml b/samples/demos/res/layout/context_menus.xml
new file mode 100644
index 0000000..e5d796e
--- /dev/null
+++ b/samples/demos/res/layout/context_menus.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:padding="20dip">
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:orientation="horizontal">
+ <Button
+ android:id="@+id/show_context_menu"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="10dp"
+ android:text="Long-Press Me" />
+ </LinearLayout>
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="20dp"
+ android:text="@string/context_menus_content"/>
+</LinearLayout> \ No newline at end of file
diff --git a/samples/demos/res/layout/custom_view.xml b/samples/demos/res/layout/custom_view.xml
new file mode 100644
index 0000000..43a8a0c
--- /dev/null
+++ b/samples/demos/res/layout/custom_view.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ android:gravity="left|center_vertical"
+ android:orientation="horizontal"
+ >
+ <RadioGroup
+ android:id="@+id/radio_nav"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+ <RadioButton
+ android:text="Custom"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ />
+ <RadioButton
+ android:text="View!"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ />
+ </RadioGroup>
+</LinearLayout> \ No newline at end of file
diff --git a/samples/demos/res/layout/feature_toggles.xml b/samples/demos/res/layout/feature_toggles.xml
new file mode 100644
index 0000000..7d0f796
--- /dev/null
+++ b/samples/demos/res/layout/feature_toggles.xml
@@ -0,0 +1,373 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+ <ScrollView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="15dip">
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/feature_toggles_content"
+ android:layout_marginBottom="20dp" />
+
+ <!-- ACTION BAR DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="ActionBar Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_actionbar_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_actionbar_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- NAVIGATION MODE -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Navigation Mode" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/navigation_standard"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Standard" />
+ <Button
+ android:id="@+id/navigation_list"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="List" />
+ <Button
+ android:id="@+id/navigation_tabs"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Tabs" />
+ </LinearLayout>
+
+ <!-- TAB DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Tab Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_tab_add"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Add" />
+ <Button
+ android:id="@+id/display_tab_select"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Select Random" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_tab_remove"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Remove" />
+ <Button
+ android:id="@+id/display_tab_remove_all"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Remove All" />
+ </LinearLayout>
+
+ <!-- ACTION ITEMS DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Action Items Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_items_add"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Add" />
+ <Button
+ android:id="@+id/display_items_clear"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Remove All" />
+ </LinearLayout>
+
+ <!-- TITLE DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Title Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_title_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_title_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- SUBTITLE DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Subtitle Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_subtitle_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_subtitle_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- CUSTOM VIEW DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Custom View Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_custom_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_custom_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- HOME DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Home Action Item Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_home_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_home_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- LOGO DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Logo Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_logo_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Use" />
+ <Button
+ android:id="@+id/display_logo_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Do Not Use" />
+ </LinearLayout>
+
+ <!-- HOME AS UP DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Home As Up Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_home_as_up_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_home_as_up_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- PROGESS DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Progress Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_progress_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_progress_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+
+ <!-- INDETERMINATE PROGESS DISPLAY -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="2dip"
+ android:text="Indeterminate Progress Display" />
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_marginBottom="10dip">
+ <Button
+ android:id="@+id/display_iprogress_show"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Show" />
+ <Button
+ android:id="@+id/display_iprogress_hide"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="Hide" />
+ </LinearLayout>
+ </LinearLayout>
+ </ScrollView>
+</LinearLayout>
diff --git a/samples/demos/res/layout/iprogress.xml b/samples/demos/res/layout/iprogress.xml
new file mode 100644
index 0000000..5f1ca7d
--- /dev/null
+++ b/samples/demos/res/layout/iprogress.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:padding="20dip">
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal">
+ <Button
+ android:id="@+id/enable"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="10dp"
+ android:text="Enable" />
+ <Button
+ android:id="@+id/disable"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Disable" />
+ </LinearLayout>
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="20dp"
+ android:text="@string/iprogress_content" />
+</LinearLayout> \ No newline at end of file
diff --git a/samples/demos/res/layout/list_navigation.xml b/samples/demos/res/layout/list_navigation.xml
new file mode 100644
index 0000000..55254ae
--- /dev/null
+++ b/samples/demos/res/layout/list_navigation.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:padding="20dip">
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="20dp"
+ android:text="@string/list_navigation_content" />
+ <TextView
+ android:id="@+id/text"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" />
+</LinearLayout> \ No newline at end of file
diff --git a/samples/demos/res/layout/overlay.xml b/samples/demos/res/layout/overlay.xml
new file mode 100644
index 0000000..adc4565
--- /dev/null
+++ b/samples/demos/res/layout/overlay.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+ <ScrollView
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:paddingTop="?actionBarSize"
+ android:orientation="vertical">
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:layout_marginBottom="30dp"
+ android:text="@string/overlay_content" />
+ <TextView
+ android:id="@+id/bunch_of_text"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" />
+ </LinearLayout>
+ </ScrollView>
+</FrameLayout> \ No newline at end of file
diff --git a/samples/demos/res/layout/preferences.xml b/samples/demos/res/layout/preferences.xml
new file mode 100644
index 0000000..d2e1e83
--- /dev/null
+++ b/samples/demos/res/layout/preferences.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:drawSelectorOnTop="false"
+ android:scrollbarAlwaysDrawVerticalTrack="true"
+ /> \ No newline at end of file
diff --git a/samples/demos/res/layout/progress.xml b/samples/demos/res/layout/progress.xml
new file mode 100644
index 0000000..fe47c61
--- /dev/null
+++ b/samples/demos/res/layout/progress.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:gravity="center_horizontal"
+ android:padding="20dip">
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="20dp"
+ android:text="@string/progress_content" />
+ <Button
+ android:id="@+id/go"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingLeft="40dp"
+ android:paddingRight="40dp"
+ android:text="Go" />
+</LinearLayout> \ No newline at end of file
diff --git a/samples/demos/res/layout/settings_action_provider.xml b/samples/demos/res/layout/settings_action_provider.xml
new file mode 100644
index 0000000..969332a
--- /dev/null
+++ b/samples/demos/res/layout/settings_action_provider.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:focusable="true"
+ android:addStatesFromChildren="true"
+ android:background="?attr/actionBarItemBackground"
+ style="?attr/actionButtonStyle">
+
+ <ImageButton android:id="@+id/button"
+ android:background="@drawable/ic_launcher_settings"
+ android:layout_width="32dip"
+ android:layout_height="32dip"
+ android:layout_gravity="center"
+ android:scaleType="fitCenter"
+ android:adjustViewBounds="true" />
+
+</LinearLayout>
diff --git a/samples/demos/res/layout/tab_custom_view.xml b/samples/demos/res/layout/tab_custom_view.xml
new file mode 100644
index 0000000..a091411
--- /dev/null
+++ b/samples/demos/res/layout/tab_custom_view.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+ <ProgressBar
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:indeterminate="true"/>
+</LinearLayout> \ No newline at end of file
diff --git a/samples/demos/res/layout/tab_navigation.xml b/samples/demos/res/layout/tab_navigation.xml
new file mode 100644
index 0000000..7b7f989
--- /dev/null
+++ b/samples/demos/res/layout/tab_navigation.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:padding="20dip">
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="20dp"
+ android:text="@string/tab_navigation_content" />
+ <TextView
+ android:id="@+id/text"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" />
+</LinearLayout> \ No newline at end of file
diff --git a/samples/demos/res/layout/text.xml b/samples/demos/res/layout/text.xml
new file mode 100644
index 0000000..77dcd21
--- /dev/null
+++ b/samples/demos/res/layout/text.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:padding="20dip">
+ <TextView
+ android:id="@+id/text"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" />
+</LinearLayout> \ No newline at end of file
diff --git a/samples/demos/res/menu/settings_action_provider.xml b/samples/demos/res/menu/settings_action_provider.xml
new file mode 100644
index 0000000..0a9b0ce
--- /dev/null
+++ b/samples/demos/res/menu/settings_action_provider.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:id="@+id/menu_item_action_provider_action_bar"
+ android:showAsAction="ifRoom"
+ android:title="Settings"
+ android:actionProviderClass="com.actionbarsherlock.sample.demos.ActionProviders$SettingsActionProvider"/>
+
+ <item android:id="@+id/menu_item_action_provider_overflow"
+ android:showAsAction="never"
+ android:title="Settings"
+ android:actionProviderClass="com.actionbarsherlock.sample.demos.ActionProviders$SettingsActionProvider"/>
+
+</menu>
diff --git a/samples/demos/res/menu/share_action_provider.xml b/samples/demos/res/menu/share_action_provider.xml
new file mode 100644
index 0000000..6b05235
--- /dev/null
+++ b/samples/demos/res/menu/share_action_provider.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:id="@+id/menu_item_share_action_provider_action_bar"
+ android:showAsAction="always"
+ android:title="@string/action_bar_share_with"
+ android:actionProviderClass="com.actionbarsherlock.widget.ShareActionProvider" />
+
+ <!-- XXX: For now, ShareActionProviders must be displayed on the action bar -->
+ <!--item android:id="@+id/menu_item_share_action_provider_overflow"
+ android:showAsAction="never"
+ android:title="@string/action_bar_share_with"
+ android:actionProviderClass="com.actionbarsherlock.widget.ShareActionProvider" /-->
+
+</menu>
diff --git a/samples/demos/res/raw/robot.png b/samples/demos/res/raw/robot.png
new file mode 100644
index 0000000..8a9e698
--- /dev/null
+++ b/samples/demos/res/raw/robot.png
Binary files differ
diff --git a/samples/demos/res/values/arrays.xml b/samples/demos/res/values/arrays.xml
new file mode 100644
index 0000000..19eb537
--- /dev/null
+++ b/samples/demos/res/values/arrays.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string-array name="entries_list_preference">
+ <item>Alpha Option 01</item>
+ <item>Beta Option 02</item>
+ <item>Charlie Option 03</item>
+ </string-array>
+
+ <string-array name="entryvalues_list_preference">
+ <item>alpha</item>
+ <item>beta</item>
+ <item>charlie</item>
+ </string-array>
+
+ <string-array name="locations">
+ <item>Home</item>
+ <item>Email</item>
+ <item>Calendar</item>
+ <item>Browser</item>
+ <item>Clock</item>
+ </string-array>
+</resources>
diff --git a/samples/demos/res/values/colors.xml b/samples/demos/res/values/colors.xml
new file mode 100644
index 0000000..2e2ad74
--- /dev/null
+++ b/samples/demos/res/values/colors.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<resources>
+ <drawable name="ab_bg_black">#aa000000</drawable>
+</resources>
diff --git a/samples/demos/res/values/strings.xml b/samples/demos/res/values/strings.xml
new file mode 100644
index 0000000..610235a
--- /dev/null
+++ b/samples/demos/res/values/strings.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<resources>
+ <string name="application_name">ActionBarSherlock Demos</string>
+ <string name="activity_name">ABS: Demos</string>
+
+
+
+ <string name="action_items">Action Items</string>
+ <string name="action_items_content">The action bar creates a unified and persistant navigation experience for your application and action items are a great way to provide a clear indication of what the user can do.</string>
+
+ <string name="action_modes">Action Modes</string>
+ <string name="action_modes_content">Action modes are used to display contextual information based on some interaction made by the user (long press, checkbox selection, etc). Like the normal action bar they also support splitting the action items to the bottom of the screen on small devices.</string>
+
+ <string name="action_modes_no_action_bar">Action Modes (No Action Bar)</string>
+
+ <string name="share_action_providers">Share Action Providers</string>
+ <string name="share_action_providers_content">This activity demonstrates how to use an ActionProvider for adding functionality to the Action Bar. In particular this demo is adding a menu item with ShareActionProvider as its action provider. The ShareActionProvider is responsible for managing the UI for sharing actions.\n\nFor now, ShareActionProviders must be displayed on the action bar</string>
+
+ <string name="action_providers">Action Providers</string>
+ <string name="action_providers_content">This activity demonstrates how to implement an ActionProvider for adding functionality to the Action Bar. In particular this demo creates an ActionProvider for launching the system settings and adds a menu item with that provider.</string>
+
+ <string name="collapsible">Collapsible Action Items</string>
+ <string name="collapsible_content">This activity is a demonstration of how collapsible action items work. When you are concerned about the available room for items on small screens you should use this feature.</string>
+
+ <string name="context_menus">Context Menus</string>
+ <string name="context_menus_content">Since both ActionBarSherlock and Android use \'Menu\' and \'MenuItem\' class names you must take extra care when using context menus. It is still very much possible to use both in a single activity.</string>
+
+ <string name="custom_navigation">Custom Navigation</string>
+ <string name="custom_navigation_content">If you find that list and tab navigation are not suitable for your application you may replace it with a custom layout.</string>
+
+ <string name="dialog">Dialog</string>
+ <string name="dialog_content">This is a demonstration of how you can give an activity the look of a dialog.\n\nWhile there is a light version of this theme, it cannot be set programmatically without disabling the fancy transparent outer background. In order for this effect the theme must be set in the manifest.</string>
+
+ <string name="feature_toggles">Feature Toggles</string>
+ <string name="feature_toggles_content">Use these buttons to create various configurations with the action bar to see how it behaves.</string>
+
+ <string name="forced_overflow">Forced Overflow Item</string>
+ <string name="forced_overflow_content">If you choose, you can force the presence of the overflow menu as an action item. Google\'s own research indicates that the regular options menu is lost on most users and doing this will place it always on screen. You can use a theme ending in `ForceOverflow` or add the `absForceOverflow` attribute to a custom theme.\n\nNote: This will only work on the pre-ICS action bar.</string>
+
+ <string name="iprogress">Indeterminate Progress</string>
+ <string name="iprogress_content">The action bar includes a standard indeterminate progress bar. The methods for accessing it are prefixed with `support`. See the source for this demo for more information.</string>
+
+ <string name="list_navigation">List Navigation</string>
+ <string name="list_navigation_content">List navigation requires the use of a special layout for the spinner item. Failure to use it will result in your spinner text being the same color as the action bar background on pre-3.0. See the source code of this demo for more information.</string>
+
+ <string name="overlay">Overlay</string>
+ <string name="overlay_content">Overlay can be useful if you have a lot of scrolling content, especially if that content is images. Remember to lead your content with a margin so that it starts below the action bar when scrolled to the top.</string>
+
+ <string name="preference">Preference</string>
+ <string name="preference_content">You can use the `SherlockPreferenceActivity` base class to place the action bar on top of a normal `PreferenceActivity`.\n\nThis does not yet support the use of `PreferenceFragments`, however.</string>
+
+ <string name="progress">Progress</string>
+ <string name="progress_content">The action bar includes a standard progress bar. The methods for accessing it are prefixed with `support`. See the source for this demo for more information.</string>
+
+ <string name="simple">Simple</string>
+ <string name="simple_content">This is a simple showcase of how easy it is to add the action bar to your activities. Take a look at the source code, it\'s surprisingly simple!</string>
+
+ <string name="split">Split Action Items</string>
+ <string name="split_content">This activity is a demonstration of how split action items work. When you are concerned about the available room for items on small screens you should use this feature.</string>
+
+ <string name="split_action_modes">Split Action Modes</string>
+
+ <string name="static_attach">Static Attachment</string>
+ <string name="static_attach_content">This is a simple showcase of how easy it is to add the action bar to your activities without having to extend from a custom activity. Take a look at the source code, it\'s surprisingly simple!</string>
+
+ <string name="styled">Styled</string>
+ <string name="styled_content">This is a simple showcase of how to style the action bar to your liking. Be sure to remember that you need to consider both the custom and native action bar when styling. Looking at this activity\'s style is a good way to start.</string>
+
+ <string name="submenus">Sub-menus</string>
+ <string name="submenus_content">This activity is a demonstration of how sub-menus work when they are either an action item or an item in the overflow menu.</string>
+
+ <string name="tab_navigation">Tab Navigation</string>
+ <string name="tab_navigation_content">Tabs can be useful for switching between a limited number of items. You can also collapse the main body of the action bar on small devices so that only the tab bar is displayed. See the source for more information.</string>
+
+ <string name="tab_navigation_collapsed">Tab Navigation (Collapsed)</string>
+
+
+
+ <string name="action_bar_share_with">Share with...</string>
+
+
+
+ <string name="inline_preferences">In-line preferences</string>
+ <string name="dialog_based_preferences">Dialog-based preferences</string>
+ <string name="launch_preferences">Launch preferences</string>
+ <string name="preference_attributes">Preference attributes</string>
+
+ <string name="title_checkbox_preference">Checkbox preference</string>
+ <string name="summary_checkbox_preference">This is a checkbox</string>
+
+ <string name="title_edittext_preference">Edit text preference</string>
+ <string name="summary_edittext_preference">An example that uses an edit text dialog</string>
+ <string name="dialog_title_edittext_preference">Enter your favorite animal</string>
+
+ <string name="title_list_preference">List preference</string>
+ <string name="summary_list_preference">An example that uses a list dialog</string>
+ <string name="dialog_title_list_preference">Choose one</string>
+
+ <string name="title_intent_preference">Intent preference</string>
+ <string name="summary_intent_preference">Launches an Activity from an Intent</string>
+
+ <string name="title_my_preference">My preference</string>
+ <string name="summary_my_preference">This is a custom counter preference</string>
+
+ <string name="title_advanced_toggle_preference">Haunted preference</string>
+ <string name="summary_on_advanced_toggle_preference">I\'m on! :)</string>
+ <string name="summary_off_advanced_toggle_preference">I\'m off! :(</string>
+
+ <string name="title_parent_preference">Parent checkbox preference</string>
+ <string name="summary_parent_preference">This is visually a parent</string>
+ <string name="title_child_preference">Child checkbox preference</string>
+ <string name="summary_child_preference">This is visually a child</string>
+
+ <string name="example_preference_dependency">Example preference dependency</string>
+ <string name="title_wifi">WiFi</string>
+ <string name="title_wifi_settings">WiFi settings</string>
+
+ <string name="default_value_list_preference">beta</string>
+ <string name="default_value_edittext_preference">Default value</string>
+</resources>
diff --git a/samples/demos/res/values/themes.xml b/samples/demos/res/values/themes.xml
new file mode 100644
index 0000000..032bb48
--- /dev/null
+++ b/samples/demos/res/values/themes.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<resources>
+ <style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
+ <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
+ <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
+ </style>
+ <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
+ <item name="background">@drawable/bg_striped</item>
+ <item name="android:background">@drawable/bg_striped</item>
+
+ <item name="backgroundSplit">@drawable/bg_striped_split</item>
+ <item name="android:backgroundSplit">@drawable/bg_striped_split</item>
+ </style>
+</resources>
diff --git a/samples/demos/res/xml/preferences.xml b/samples/demos/res/xml/preferences.xml
new file mode 100644
index 0000000..98084f3
--- /dev/null
+++ b/samples/demos/res/xml/preferences.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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 is a primitive example showing the different types of preferences available. -->
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <PreferenceCategory
+ android:title="@string/inline_preferences">
+
+ <CheckBoxPreference
+ android:key="checkbox_preference"
+ android:title="@string/title_checkbox_preference"
+ android:summary="@string/summary_checkbox_preference" />
+
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:title="@string/dialog_based_preferences">
+
+ <EditTextPreference
+ android:key="edittext_preference"
+ android:title="@string/title_edittext_preference"
+ android:summary="@string/summary_edittext_preference"
+ android:dialogTitle="@string/dialog_title_edittext_preference" />
+
+ <ListPreference
+ android:key="list_preference"
+ android:title="@string/title_list_preference"
+ android:summary="@string/summary_list_preference"
+ android:entries="@array/entries_list_preference"
+ android:entryValues="@array/entryvalues_list_preference"
+ android:dialogTitle="@string/dialog_title_list_preference" />
+
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:title="@string/launch_preferences">
+
+ <PreferenceScreen
+ android:title="@string/title_intent_preference"
+ android:summary="@string/summary_intent_preference">
+
+ <intent android:action="android.intent.action.VIEW"
+ android:data="http://www.android.com" />
+
+ </PreferenceScreen>
+
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:title="@string/preference_attributes">
+
+ <CheckBoxPreference
+ android:key="parent_checkbox_preference"
+ android:title="@string/title_parent_preference"
+ android:summary="@string/summary_parent_preference" />
+
+ <!-- The visual style of a child is defined by this styled theme attribute. -->
+ <CheckBoxPreference
+ android:key="child_checkbox_preference"
+ android:dependency="parent_checkbox_preference"
+ android:layout="?android:attr/preferenceLayoutChild"
+ android:title="@string/title_child_preference"
+ android:summary="@string/summary_child_preference" />
+
+ </PreferenceCategory>
+
+</PreferenceScreen> \ No newline at end of file
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionItems.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionItems.java
new file mode 100644
index 0000000..593a232
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionItems.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.widget.TextView;
+
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+
+public class ActionItems extends SherlockActivity {
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ //Used to put dark icons on light action bar
+ boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light;
+
+ menu.add("Save")
+ .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Search")
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add("Refresh")
+ .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ return true;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.text);
+ setContent((TextView)findViewById(R.id.text));
+ }
+
+ protected void setContent(TextView view) {
+ view.setText(R.string.action_items_content);
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModes.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModes.java
new file mode 100644
index 0000000..58a01e7
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModes.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.Toast;
+
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.ActionMode;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+
+public class ActionModes extends SherlockActivity {
+ ActionMode mMode;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.action_modes);
+
+ ((Button)findViewById(R.id.start)).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mMode = startActionMode(new AnActionModeOfEpicProportions());
+ }
+ });
+ ((Button)findViewById(R.id.cancel)).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mMode != null) {
+ mMode.finish();
+ }
+ }
+ });
+ }
+
+ private final class AnActionModeOfEpicProportions implements ActionMode.Callback {
+ @Override
+ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+ //Used to put dark icons on light action bar
+ boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light;
+
+ menu.add("Save")
+ .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Search")
+ .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Refresh")
+ .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Save")
+ .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Search")
+ .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Refresh")
+ .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+ return false;
+ }
+
+ @Override
+ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+ Toast.makeText(ActionModes.this, "Got click: " + item, Toast.LENGTH_SHORT).show();
+ mode.finish();
+ return true;
+ }
+
+ @Override
+ public void onDestroyActionMode(ActionMode mode) {
+ }
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModesNoActionBar.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModesNoActionBar.java
new file mode 100644
index 0000000..23c7a3b
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModesNoActionBar.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.Toast;
+
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.ActionMode;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+import com.actionbarsherlock.view.Window;
+
+public class ActionModesNoActionBar extends SherlockActivity {
+ ActionMode mMode;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+
+ //You could also use Theme.Sherlock.NoActionBar or Theme.Sherlock.Light.NoActionBar
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.action_modes);
+
+ ((Button)findViewById(R.id.start)).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mMode = startActionMode(new AnActionModeOfEpicProportions());
+ }
+ });
+ ((Button)findViewById(R.id.cancel)).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mMode != null) {
+ mMode.finish();
+ }
+ }
+ });
+ }
+
+ private final class AnActionModeOfEpicProportions implements ActionMode.Callback {
+ @Override
+ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+ //Used to put dark icons on light action bar
+ boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light;
+
+ menu.add("Save")
+ .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Search")
+ .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Refresh")
+ .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Save")
+ .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Search")
+ .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Refresh")
+ .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+ return false;
+ }
+
+ @Override
+ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+ Toast.makeText(ActionModesNoActionBar.this, "Got click: " + item, Toast.LENGTH_SHORT).show();
+ mode.finish();
+ return true;
+ }
+
+ @Override
+ public void onDestroyActionMode(ActionMode mode) {
+ }
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionProviders.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionProviders.java
new file mode 100644
index 0000000..d7de2d8
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionProviders.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.actionbarsherlock.sample.demos;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.provider.Settings;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageButton;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.ActionProvider;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+
+/**
+ * This activity demonstrates how to implement an {@link android.view.ActionProvider}
+ * for adding functionality to the Action Bar. In particular this demo creates an
+ * ActionProvider for launching the system settings and adds a menu item with that
+ * provider.
+ */
+public class ActionProviders extends SherlockActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.text);
+ ((TextView)findViewById(R.id.text)).setText(R.string.action_providers_content);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ getSupportMenuInflater().inflate(R.menu.settings_action_provider, menu);
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // If this callback does not handle the item click, onPerformDefaultAction
+ // of the ActionProvider is invoked. Hence, the provider encapsulates the
+ // complete functionality of the menu item.
+ Toast.makeText(this, "Handling in onOptionsItemSelected avoided",
+ Toast.LENGTH_SHORT).show();
+ return false;
+ }
+
+ public static class SettingsActionProvider extends ActionProvider {
+
+ /** An intent for launching the system settings. */
+ private static final Intent sSettingsIntent = new Intent(Settings.ACTION_SETTINGS);
+
+ /** Context for accessing resources. */
+ private final Context mContext;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param context Context for accessing resources.
+ */
+ public SettingsActionProvider(Context context) {
+ super(context);
+ mContext = context;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public View onCreateActionView() {
+ // Inflate the action view to be shown on the action bar.
+ LayoutInflater layoutInflater = LayoutInflater.from(mContext);
+ View view = layoutInflater.inflate(R.layout.settings_action_provider, null);
+ ImageButton button = (ImageButton) view.findViewById(R.id.button);
+ // Attach a click listener for launching the system settings.
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mContext.startActivity(sSettingsIntent);
+ }
+ });
+ return view;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onPerformDefaultAction() {
+ // This is called if the host menu item placed in the overflow menu of the
+ // action bar is clicked and the host activity did not handle the click.
+ mContext.startActivity(sSettingsIntent);
+ return true;
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/CollapsibleActionItem.java b/samples/demos/src/com/actionbarsherlock/sample/demos/CollapsibleActionItem.java
new file mode 100644
index 0000000..116545e
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/CollapsibleActionItem.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2012 Scott Kennedy
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.widget.TextView;
+
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+
+public class CollapsibleActionItem extends SherlockActivity {
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ //Used to put dark icons on light action bar
+ boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light;
+
+ menu.add("Search")
+ .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search)
+ .setActionView(R.layout.collapsible_edittext)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
+
+ return true;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.text);
+ ((TextView)findViewById(R.id.text)).setText(R.string.collapsible_content);
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ContextMenus.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ContextMenus.java
new file mode 100644
index 0000000..3f08bfe
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/ContextMenus.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.view.ContextMenu;
+import android.view.View;
+import android.widget.Toast;
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+
+public class ContextMenus extends SherlockActivity {
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ //Used to put dark icons on light action bar
+ boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light;
+
+ menu.add("Save")
+ .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Search")
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add("Refresh")
+ .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ //This uses the imported MenuItem from ActionBarSherlock
+ Toast.makeText(this, "Got click: " + item.toString(), Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
+ menu.add("One");
+ menu.add("Two");
+ menu.add("Three");
+ menu.add("Four");
+ }
+
+ @Override
+ public boolean onContextItemSelected(android.view.MenuItem item) {
+ //Note how this callback is using the fully-qualified class name
+ Toast.makeText(this, "Got click: " + item.toString(), Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.context_menus);
+ registerForContextMenu(findViewById(R.id.show_context_menu));
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/CustomNavigation.java b/samples/demos/src/com/actionbarsherlock/sample/demos/CustomNavigation.java
new file mode 100644
index 0000000..f9696fc
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/CustomNavigation.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.RadioGroup;
+import android.widget.Toast;
+import android.widget.RadioGroup.OnCheckedChangeListener;
+import android.widget.TextView;
+
+import com.actionbarsherlock.app.SherlockActivity;
+
+public class CustomNavigation extends SherlockActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.text);
+ ((TextView)findViewById(R.id.text)).setText(R.string.custom_navigation_content);
+
+ //Inflate the custom view
+ View customNav = LayoutInflater.from(this).inflate(R.layout.custom_view, null);
+
+ //Bind to its state change
+ ((RadioGroup)customNav.findViewById(R.id.radio_nav)).setOnCheckedChangeListener(new OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
+ Toast.makeText(CustomNavigation.this, "Navigation selection changed.", Toast.LENGTH_SHORT).show();
+ }
+ });
+
+ //Attach to the action bar
+ getSupportActionBar().setCustomView(customNav);
+ getSupportActionBar().setDisplayShowCustomEnabled(true);
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Dialog.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Dialog.java
new file mode 100644
index 0000000..a9dbaeb
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/Dialog.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.widget.TextView;
+import com.actionbarsherlock.app.SherlockActivity;
+
+public class Dialog extends SherlockActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.text);
+ ((TextView)findViewById(R.id.text)).setText(R.string.dialog_content);
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/FeatureToggles.java b/samples/demos/src/com/actionbarsherlock/sample/demos/FeatureToggles.java
new file mode 100644
index 0000000..c9b99b9
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/FeatureToggles.java
@@ -0,0 +1,271 @@
+package com.actionbarsherlock.sample.demos;
+
+import java.util.Random;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v4.app.FragmentTransaction;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.ActionBar.Tab;
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+import com.actionbarsherlock.view.Window;
+
+public class FeatureToggles extends SherlockActivity implements ActionBar.TabListener {
+ private static final Random RANDOM = new Random();
+
+ private int items = 0;
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ for (int i = 0; i < items; i++) {
+ menu.add("Text")
+ .setIcon(R.drawable.ic_title_share_default)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+ }
+
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ requestWindowFeature(Window.FEATURE_PROGRESS);
+ requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.feature_toggles);
+ setSupportProgressBarIndeterminateVisibility(false);
+ setSupportProgressBarVisibility(false);
+
+ getSupportActionBar().setCustomView(R.layout.custom_view);
+ getSupportActionBar().setDisplayShowCustomEnabled(false);
+
+ Context context = getSupportActionBar().getThemedContext();
+ ArrayAdapter<CharSequence> listAdapter = ArrayAdapter.createFromResource(context, R.array.locations, R.layout.sherlock_spinner_item);
+ listAdapter.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
+
+ getSupportActionBar().setListNavigationCallbacks(listAdapter, null);
+
+ findViewById(R.id.display_progress_show).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setSupportProgressBarVisibility(true);
+ setSupportProgressBarIndeterminateVisibility(false);
+ setSupportProgress(RANDOM.nextInt(8000) + 10);
+ }
+ });
+ findViewById(R.id.display_progress_hide).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setSupportProgressBarVisibility(false);
+ }
+ });
+ findViewById(R.id.display_iprogress_show).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //Hack to hide the regular progress bar
+ setSupportProgress(Window.PROGRESS_END);
+ setSupportProgressBarIndeterminateVisibility(true);
+ }
+ });
+ findViewById(R.id.display_iprogress_hide).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setSupportProgressBarIndeterminateVisibility(false);
+ }
+ });
+
+ findViewById(R.id.display_items_clear).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ items = 0;
+ invalidateOptionsMenu();
+ }
+ });
+ findViewById(R.id.display_items_add).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ items += 1;
+ invalidateOptionsMenu();
+ }
+ });
+
+ findViewById(R.id.display_subtitle_show).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setSubtitle("The quick brown fox jumps over the lazy dog.");
+ }
+ });
+ findViewById(R.id.display_subtitle_hide).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setSubtitle(null);
+ }
+ });
+
+ findViewById(R.id.display_title_show).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setDisplayShowTitleEnabled(true);
+ }
+ });
+ findViewById(R.id.display_title_hide).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setDisplayShowTitleEnabled(false);
+ }
+ });
+
+ findViewById(R.id.display_custom_show).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setDisplayShowCustomEnabled(true);
+ }
+ });
+ findViewById(R.id.display_custom_hide).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setDisplayShowCustomEnabled(false);
+ }
+ });
+
+ findViewById(R.id.navigation_standard).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+ }
+ });
+ findViewById(R.id.navigation_list).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
+ }
+ });
+ findViewById(R.id.navigation_tabs).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+ }
+ });
+
+ findViewById(R.id.display_home_as_up_show).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ }
+ });
+ findViewById(R.id.display_home_as_up_hide).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(false);
+ }
+ });
+
+ findViewById(R.id.display_logo_show).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setDisplayUseLogoEnabled(true);
+ }
+ });
+ findViewById(R.id.display_logo_hide).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setDisplayUseLogoEnabled(false);
+ }
+ });
+
+ findViewById(R.id.display_home_show).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setDisplayShowHomeEnabled(true);
+ }
+ });
+ findViewById(R.id.display_home_hide).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().setDisplayShowHomeEnabled(false);
+ }
+ });
+
+ findViewById(R.id.display_actionbar_show).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().show();
+ }
+ });
+ findViewById(R.id.display_actionbar_hide).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().hide();
+ }
+ });
+
+ Button tabAdd = (Button)findViewById(R.id.display_tab_add);
+ tabAdd.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ ActionBar.Tab newTab = getSupportActionBar().newTab();
+
+ if (RANDOM.nextBoolean()) {
+ newTab.setCustomView(R.layout.tab_custom_view);
+ } else {
+ boolean icon = RANDOM.nextBoolean();
+ if (icon) {
+ newTab.setIcon(R.drawable.ic_title_share_default);
+ }
+ if (!icon || RANDOM.nextBoolean()) {
+ newTab.setText("Text!");
+ }
+ }
+ newTab.setTabListener(FeatureToggles.this);
+ getSupportActionBar().addTab(newTab);
+ }
+ });
+ //Add some tabs
+ tabAdd.performClick();
+ tabAdd.performClick();
+ tabAdd.performClick();
+
+ findViewById(R.id.display_tab_select).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (getSupportActionBar().getTabCount() > 0) {
+ getSupportActionBar().selectTab(
+ getSupportActionBar().getTabAt(
+ RANDOM.nextInt(getSupportActionBar().getTabCount())
+ )
+ );
+ }
+ }
+ });
+ findViewById(R.id.display_tab_remove).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (getSupportActionBar().getTabCount() > 0) {
+ getSupportActionBar().removeTabAt(getSupportActionBar().getTabCount() - 1);
+ }
+ }
+ });
+ findViewById(R.id.display_tab_remove_all).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ getSupportActionBar().removeAllTabs();
+ }
+ });
+ }
+
+ @Override
+ public void onTabSelected(Tab tab, FragmentTransaction transaction) {}
+
+ @Override
+ public void onTabUnselected(Tab tab, FragmentTransaction transaction) {}
+
+ @Override
+ public void onTabReselected(Tab tab, FragmentTransaction transaction) {}
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ForcedOverflowItem.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ForcedOverflowItem.java
new file mode 100644
index 0000000..3c8e3f1
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/ForcedOverflowItem.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.widget.TextView;
+
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+
+public class ForcedOverflowItem extends SherlockActivity {
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ //Used to put dark icons on light action bar
+ boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light;
+
+ menu.add("Save")
+ .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Search")
+ .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Refresh")
+ .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Save")
+ .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Search")
+ .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ menu.add("Refresh")
+ .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ return true;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ //Used for theme switching in samples
+ int theme = R.style.Theme_Sherlock_ForceOverflow;
+ if (SampleList.THEME == R.style.Theme_Sherlock_Light) {
+ theme = R.style.Theme_Sherlock_Light_ForceOverflow;
+ } else if (SampleList.THEME == R.style.Theme_Sherlock_Light_DarkActionBar) {
+ theme = R.style.Theme_Sherlock_Light_DarkActionBar_ForceOverflow;
+ }
+ setTheme(theme);
+
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.text);
+ ((TextView)findViewById(R.id.text)).setText(R.string.forced_overflow_content);
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/IndeterminateProgress.java b/samples/demos/src/com/actionbarsherlock/sample/demos/IndeterminateProgress.java
new file mode 100644
index 0000000..5d10d28
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/IndeterminateProgress.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.view.View;
+
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Window;
+
+public class IndeterminateProgress extends SherlockActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+
+ //This has to be called before setContentView and you must use the
+ //class in com.actionbarsherlock.view and NOT android.view
+ requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
+
+ setContentView(R.layout.iprogress);
+
+ findViewById(R.id.enable).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ setSupportProgressBarIndeterminateVisibility(true);
+ }
+ });
+ findViewById(R.id.disable).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ setSupportProgressBarIndeterminateVisibility(false);
+ }
+ });
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ListNavigation.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ListNavigation.java
new file mode 100644
index 0000000..e529de3
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/ListNavigation.java
@@ -0,0 +1,37 @@
+package com.actionbarsherlock.sample.demos;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.SherlockActivity;
+
+public class ListNavigation extends SherlockActivity implements ActionBar.OnNavigationListener {
+ private TextView mSelected;
+ private String[] mLocations;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.list_navigation);
+ mSelected = (TextView)findViewById(R.id.text);
+
+ mLocations = getResources().getStringArray(R.array.locations);
+
+ Context context = getSupportActionBar().getThemedContext();
+ ArrayAdapter<CharSequence> list = ArrayAdapter.createFromResource(context, R.array.locations, R.layout.sherlock_spinner_item);
+ list.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
+
+ getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
+ getSupportActionBar().setListNavigationCallbacks(list, this);
+ }
+
+ @Override
+ public boolean onNavigationItemSelected(int itemPosition, long itemId) {
+ mSelected.setText("Selected: " + mLocations[itemPosition]);
+ return true;
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Overlay.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Overlay.java
new file mode 100644
index 0000000..4bb37ea
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/Overlay.java
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.widget.TextView;
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Window;
+
+public class Overlay extends SherlockActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.overlay);
+
+ //Load partially transparent black background
+ getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_bg_black));
+
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < 3; i++) {
+ for (String dialog : DIALOGUE) {
+ builder.append(dialog).append("\n\n");
+ }
+ }
+
+ TextView bunchOfText = (TextView)findViewById(R.id.bunch_of_text);
+ bunchOfText.setText(builder.toString());
+ }
+
+ public static final String[] DIALOGUE = new String[] {
+ "So shaken as we are, so wan with care," +
+ "Find we a time for frighted peace to pant," +
+ "And breathe short-winded accents of new broils" +
+ "To be commenced in strands afar remote." +
+ "No more the thirsty entrance of this soil" +
+ "Shall daub her lips with her own children's blood;" +
+ "Nor more shall trenching war channel her fields," +
+ "Nor bruise her flowerets with the armed hoofs" +
+ "Of hostile paces: those opposed eyes," +
+ "Which, like the meteors of a troubled heaven," +
+ "All of one nature, of one substance bred," +
+ "Did lately meet in the intestine shock" +
+ "And furious close of civil butchery" +
+ "Shall now, in mutual well-beseeming ranks," +
+ "March all one way and be no more opposed" +
+ "Against acquaintance, kindred and allies:" +
+ "The edge of war, like an ill-sheathed knife," +
+ "No more shall cut his master. Therefore, friends," +
+ "As far as to the sepulchre of Christ," +
+ "Whose soldier now, under whose blessed cross" +
+ "We are impressed and engaged to fight," +
+ "Forthwith a power of English shall we levy;" +
+ "Whose arms were moulded in their mothers' womb" +
+ "To chase these pagans in those holy fields" +
+ "Over whose acres walk'd those blessed feet" +
+ "Which fourteen hundred years ago were nail'd" +
+ "For our advantage on the bitter cross." +
+ "But this our purpose now is twelve month old," +
+ "And bootless 'tis to tell you we will go:" +
+ "Therefore we meet not now. Then let me hear" +
+ "Of you, my gentle cousin Westmoreland," +
+ "What yesternight our council did decree" +
+ "In forwarding this dear expedience.",
+
+ "Hear him but reason in divinity," +
+ "And all-admiring with an inward wish" +
+ "You would desire the king were made a prelate:" +
+ "Hear him debate of commonwealth affairs," +
+ "You would say it hath been all in all his study:" +
+ "List his discourse of war, and you shall hear" +
+ "A fearful battle render'd you in music:" +
+ "Turn him to any cause of policy," +
+ "The Gordian knot of it he will unloose," +
+ "Familiar as his garter: that, when he speaks," +
+ "The air, a charter'd libertine, is still," +
+ "And the mute wonder lurketh in men's ears," +
+ "To steal his sweet and honey'd sentences;" +
+ "So that the art and practic part of life" +
+ "Must be the mistress to this theoric:" +
+ "Which is a wonder how his grace should glean it," +
+ "Since his addiction was to courses vain," +
+ "His companies unletter'd, rude and shallow," +
+ "His hours fill'd up with riots, banquets, sports," +
+ "And never noted in him any study," +
+ "Any retirement, any sequestration" +
+ "From open haunts and popularity.",
+
+ "I come no more to make you laugh: things now," +
+ "That bear a weighty and a serious brow," +
+ "Sad, high, and working, full of state and woe," +
+ "Such noble scenes as draw the eye to flow," +
+ "We now present. Those that can pity, here" +
+ "May, if they think it well, let fall a tear;" +
+ "The subject will deserve it. Such as give" +
+ "Their money out of hope they may believe," +
+ "May here find truth too. Those that come to see" +
+ "Only a show or two, and so agree" +
+ "The play may pass, if they be still and willing," +
+ "I'll undertake may see away their shilling" +
+ "Richly in two short hours. Only they" +
+ "That come to hear a merry bawdy play," +
+ "A noise of targets, or to see a fellow" +
+ "In a long motley coat guarded with yellow," +
+ "Will be deceived; for, gentle hearers, know," +
+ "To rank our chosen truth with such a show" +
+ "As fool and fight is, beside forfeiting" +
+ "Our own brains, and the opinion that we bring," +
+ "To make that only true we now intend," +
+ "Will leave us never an understanding friend." +
+ "Therefore, for goodness' sake, and as you are known" +
+ "The first and happiest hearers of the town," +
+ "Be sad, as we would make ye: think ye see" +
+ "The very persons of our noble story" +
+ "As they were living; think you see them great," +
+ "And follow'd with the general throng and sweat" +
+ "Of thousand friends; then in a moment, see" +
+ "How soon this mightiness meets misery:" +
+ "And, if you can be merry then, I'll say" +
+ "A man may weep upon his wedding-day.",
+
+ "First, heaven be the record to my speech!" +
+ "In the devotion of a subject's love," +
+ "Tendering the precious safety of my prince," +
+ "And free from other misbegotten hate," +
+ "Come I appellant to this princely presence." +
+ "Now, Thomas Mowbray, do I turn to thee," +
+ "And mark my greeting well; for what I speak" +
+ "My body shall make good upon this earth," +
+ "Or my divine soul answer it in heaven." +
+ "Thou art a traitor and a miscreant," +
+ "Too good to be so and too bad to live," +
+ "Since the more fair and crystal is the sky," +
+ "The uglier seem the clouds that in it fly." +
+ "Once more, the more to aggravate the note," +
+ "With a foul traitor's name stuff I thy throat;" +
+ "And wish, so please my sovereign, ere I move," +
+ "What my tongue speaks my right drawn sword may prove.",
+
+ "Now is the winter of our discontent" +
+ "Made glorious summer by this sun of York;" +
+ "And all the clouds that lour'd upon our house" +
+ "In the deep bosom of the ocean buried." +
+ "Now are our brows bound with victorious wreaths;" +
+ "Our bruised arms hung up for monuments;" +
+ "Our stern alarums changed to merry meetings," +
+ "Our dreadful marches to delightful measures." +
+ "Grim-visaged war hath smooth'd his wrinkled front;" +
+ "And now, instead of mounting barded steeds" +
+ "To fright the souls of fearful adversaries," +
+ "He capers nimbly in a lady's chamber" +
+ "To the lascivious pleasing of a lute." +
+ "But I, that am not shaped for sportive tricks," +
+ "Nor made to court an amorous looking-glass;" +
+ "I, that am rudely stamp'd, and want love's majesty" +
+ "To strut before a wanton ambling nymph;" +
+ "I, that am curtail'd of this fair proportion," +
+ "Cheated of feature by dissembling nature," +
+ "Deformed, unfinish'd, sent before my time" +
+ "Into this breathing world, scarce half made up," +
+ "And that so lamely and unfashionable" +
+ "That dogs bark at me as I halt by them;" +
+ "Why, I, in this weak piping time of peace," +
+ "Have no delight to pass away the time," +
+ "Unless to spy my shadow in the sun" +
+ "And descant on mine own deformity:" +
+ "And therefore, since I cannot prove a lover," +
+ "To entertain these fair well-spoken days," +
+ "I am determined to prove a villain" +
+ "And hate the idle pleasures of these days." +
+ "Plots have I laid, inductions dangerous," +
+ "By drunken prophecies, libels and dreams," +
+ "To set my brother Clarence and the king" +
+ "In deadly hate the one against the other:" +
+ "And if King Edward be as true and just" +
+ "As I am subtle, false and treacherous," +
+ "This day should Clarence closely be mew'd up," +
+ "About a prophecy, which says that 'G'" +
+ "Of Edward's heirs the murderer shall be." +
+ "Dive, thoughts, down to my soul: here" +
+ "Clarence comes.",
+
+ "To bait fish withal: if it will feed nothing else," +
+ "it will feed my revenge. He hath disgraced me, and" +
+ "hindered me half a million; laughed at my losses," +
+ "mocked at my gains, scorned my nation, thwarted my" +
+ "bargains, cooled my friends, heated mine" +
+ "enemies; and what's his reason? I am a Jew. Hath" +
+ "not a Jew eyes? hath not a Jew hands, organs," +
+ "dimensions, senses, affections, passions? fed with" +
+ "the same food, hurt with the same weapons, subject" +
+ "to the same diseases, healed by the same means," +
+ "warmed and cooled by the same winter and summer, as" +
+ "a Christian is? If you prick us, do we not bleed?" +
+ "if you tickle us, do we not laugh? if you poison" +
+ "us, do we not die? and if you wrong us, shall we not" +
+ "revenge? If we are like you in the rest, we will" +
+ "resemble you in that. If a Jew wrong a Christian," +
+ "what is his humility? Revenge. If a Christian" +
+ "wrong a Jew, what should his sufferance be by" +
+ "Christian example? Why, revenge. The villany you" +
+ "teach me, I will execute, and it shall go hard but I" +
+ "will better the instruction.",
+
+ "Virtue! a fig! 'tis in ourselves that we are thus" +
+ "or thus. Our bodies are our gardens, to the which" +
+ "our wills are gardeners: so that if we will plant" +
+ "nettles, or sow lettuce, set hyssop and weed up" +
+ "thyme, supply it with one gender of herbs, or" +
+ "distract it with many, either to have it sterile" +
+ "with idleness, or manured with industry, why, the" +
+ "power and corrigible authority of this lies in our" +
+ "wills. If the balance of our lives had not one" +
+ "scale of reason to poise another of sensuality, the" +
+ "blood and baseness of our natures would conduct us" +
+ "to most preposterous conclusions: but we have" +
+ "reason to cool our raging motions, our carnal" +
+ "stings, our unbitted lusts, whereof I take this that" +
+ "you call love to be a sect or scion.",
+
+ "Blow, winds, and crack your cheeks! rage! blow!" +
+ "You cataracts and hurricanoes, spout" +
+ "Till you have drench'd our steeples, drown'd the cocks!" +
+ "You sulphurous and thought-executing fires," +
+ "Vaunt-couriers to oak-cleaving thunderbolts," +
+ "Singe my white head! And thou, all-shaking thunder," +
+ "Smite flat the thick rotundity o' the world!" +
+ "Crack nature's moulds, an germens spill at once," +
+ "That make ingrateful man!"
+ };
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Preference.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Preference.java
new file mode 100644
index 0000000..27cfc7d
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/Preference.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import com.actionbarsherlock.app.SherlockPreferenceActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+
+public class Preference extends SherlockPreferenceActivity {
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ //Used to put dark icons on light action bar
+ boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light;
+
+ menu.add("Save")
+ .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add("Search")
+ .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add("Refresh")
+ .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+
+ addPreferencesFromResource(R.xml.preferences);
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Progress.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Progress.java
new file mode 100644
index 0000000..f6b4b88
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/Progress.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.view.View;
+
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Window;
+
+public class Progress extends SherlockActivity {
+ Handler mHandler = new Handler();
+ Runnable mProgressRunner = new Runnable() {
+ @Override
+ public void run() {
+ mProgress += 2;
+
+ //Normalize our progress along the progress bar's scale
+ int progress = (Window.PROGRESS_END - Window.PROGRESS_START) / 100 * mProgress;
+ setSupportProgress(progress);
+
+ if (mProgress < 100) {
+ mHandler.postDelayed(mProgressRunner, 50);
+ }
+ }
+ };
+
+ private int mProgress = 100;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+
+ //This has to be called before setContentView and you must use the
+ //class in com.actionbarsherlock.view and NOT android.view
+ requestWindowFeature(Window.FEATURE_PROGRESS);
+
+ setContentView(R.layout.progress);
+
+ findViewById(R.id.go).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ if (mProgress == 100) {
+ mProgress = 0;
+ mProgressRunner.run();
+ }
+ }
+ });
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/SampleList.java b/samples/demos/src/com/actionbarsherlock/sample/demos/SampleList.java
new file mode 100644
index 0000000..38ef4c0
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/SampleList.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.actionbarsherlock.sample.demos;
+
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.SimpleAdapter;
+import android.widget.Toast;
+
+import com.actionbarsherlock.app.SherlockListActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+import com.actionbarsherlock.view.SubMenu;
+
+public class SampleList extends SherlockListActivity {
+ public static int THEME = R.style.Theme_Sherlock;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Intent intent = getIntent();
+ String path = intent.getStringExtra("com.example.android.apis.Path");
+
+ if (path == null) {
+ path = "";
+ }
+
+ setListAdapter(new SimpleAdapter(this, getData(path),
+ android.R.layout.simple_list_item_1, new String[] { "title" },
+ new int[] { android.R.id.text1 }));
+ getListView().setTextFilterEnabled(true);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ SubMenu sub = menu.addSubMenu("Theme");
+ sub.add(0, R.style.Theme_Sherlock, 0, "Default");
+ sub.add(0, R.style.Theme_Sherlock_Light, 0, "Light");
+ sub.add(0, R.style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)");
+ sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home || item.getItemId() == 0) {
+ return false;
+ }
+ THEME = item.getItemId();
+ Toast.makeText(this, "Theme changed to \"" + item.getTitle() + "\"", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
+ protected List<Map<String, Object>> getData(String prefix) {
+ List<Map<String, Object>> myData = new ArrayList<Map<String, Object>>();
+
+ Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
+ mainIntent.addCategory("com.actionbarsherlock.sample.demos.EXAMPLE");
+
+ PackageManager pm = getPackageManager();
+ List<ResolveInfo> list = pm.queryIntentActivities(mainIntent, 0);
+
+ if (null == list)
+ return myData;
+
+ String[] prefixPath;
+ String prefixWithSlash = prefix;
+
+ if (prefix.equals("")) {
+ prefixPath = null;
+ } else {
+ prefixPath = prefix.split("/");
+ prefixWithSlash = prefix + "/";
+ }
+
+ int len = list.size();
+
+ Map<String, Boolean> entries = new HashMap<String, Boolean>();
+
+ for (int i = 0; i < len; i++) {
+ ResolveInfo info = list.get(i);
+ CharSequence labelSeq = info.loadLabel(pm);
+ String label = labelSeq != null
+ ? labelSeq.toString()
+ : info.activityInfo.name;
+
+ if (prefixWithSlash.length() == 0 || label.startsWith(prefixWithSlash)) {
+
+ String[] labelPath = label.split("/");
+
+ String nextLabel = prefixPath == null ? labelPath[0] : labelPath[prefixPath.length];
+
+ if ((prefixPath != null ? prefixPath.length : 0) == labelPath.length - 1) {
+ addItem(myData, nextLabel, activityIntent(
+ info.activityInfo.applicationInfo.packageName,
+ info.activityInfo.name));
+ } else {
+ if (entries.get(nextLabel) == null) {
+ addItem(myData, nextLabel, browseIntent(prefix.equals("") ? nextLabel : prefix + "/" + nextLabel));
+ entries.put(nextLabel, true);
+ }
+ }
+ }
+ }
+
+ Collections.sort(myData, sDisplayNameComparator);
+
+ return myData;
+ }
+
+ private final static Comparator<Map<String, Object>> sDisplayNameComparator =
+ new Comparator<Map<String, Object>>() {
+ private final Collator collator = Collator.getInstance();
+
+ public int compare(Map<String, Object> map1, Map<String, Object> map2) {
+ return collator.compare(map1.get("title"), map2.get("title"));
+ }
+ };
+
+ protected Intent activityIntent(String pkg, String componentName) {
+ Intent result = new Intent();
+ result.setClassName(pkg, componentName);
+ return result;
+ }
+
+ protected Intent browseIntent(String path) {
+ Intent result = new Intent();
+ result.setClass(this, SampleList.class);
+ result.putExtra("com.example.android.apis.Path", path);
+ return result;
+ }
+
+ protected void addItem(List<Map<String, Object>> data, String name, Intent intent) {
+ Map<String, Object> temp = new HashMap<String, Object>();
+ temp.put("title", name);
+ temp.put("intent", intent);
+ data.add(temp);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position);
+
+ Intent intent = (Intent) map.get("intent");
+ startActivity(intent);
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ShareActionProviders.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ShareActionProviders.java
new file mode 100644
index 0000000..5b7ece2
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/ShareActionProviders.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.actionbarsherlock.sample.demos;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.widget.TextView;
+
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+import com.actionbarsherlock.widget.ShareActionProvider;
+
+/**
+ * This activity demonstrates how to use an {@link android.view.ActionProvider}
+ * for adding functionality to the Action Bar. In particular this demo is adding
+ * a menu item with ShareActionProvider as its action provider. The
+ * ShareActionProvider is responsible for managing the UI for sharing actions.
+ */
+public class ShareActionProviders extends SherlockActivity {
+
+ private static final String SHARED_FILE_NAME = "shared.png";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.text);
+ ((TextView)findViewById(R.id.text)).setText(R.string.share_action_providers_content);
+ copyPrivateRawResuorceToPubliclyAccessibleFile();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate your menu.
+ getSupportMenuInflater().inflate(R.menu.share_action_provider, menu);
+
+ // Set file with share history to the provider and set the share intent.
+ MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar);
+ ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider();
+ actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
+ // Note that you can set/change the intent any time,
+ // say when the user has selected an image.
+ actionProvider.setShareIntent(createShareIntent());
+
+ //XXX: For now, ShareActionProviders must be displayed on the action bar
+ // Set file with share history to the provider and set the share intent.
+ //MenuItem overflowItem = menu.findItem(R.id.menu_item_share_action_provider_overflow);
+ //ShareActionProvider overflowProvider =
+ // (ShareActionProvider) overflowItem.getActionProvider();
+ //overflowProvider.setShareHistoryFileName(
+ // ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
+ // Note that you can set/change the intent any time,
+ // say when the user has selected an image.
+ //overflowProvider.setShareIntent(createShareIntent());
+
+ return true;
+ }
+
+ /**
+ * Creates a sharing {@link Intent}.
+ *
+ * @return The sharing intent.
+ */
+ private Intent createShareIntent() {
+ Intent shareIntent = new Intent(Intent.ACTION_SEND);
+ shareIntent.setType("image/*");
+ Uri uri = Uri.fromFile(getFileStreamPath("shared.png"));
+ shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
+ return shareIntent;
+ }
+
+ /**
+ * Copies a private raw resource content to a publicly readable
+ * file such that the latter can be shared with other applications.
+ */
+ private void copyPrivateRawResuorceToPubliclyAccessibleFile() {
+ InputStream inputStream = null;
+ FileOutputStream outputStream = null;
+ try {
+ inputStream = getResources().openRawResource(R.raw.robot);
+ outputStream = openFileOutput(SHARED_FILE_NAME,
+ Context.MODE_WORLD_READABLE | Context.MODE_APPEND);
+ byte[] buffer = new byte[1024];
+ int length = 0;
+ try {
+ while ((length = inputStream.read(buffer)) > 0){
+ outputStream.write(buffer, 0, length);
+ }
+ } catch (IOException ioe) {
+ /* ignore */
+ }
+ } catch (FileNotFoundException fnfe) {
+ /* ignore */
+ } finally {
+ try {
+ inputStream.close();
+ } catch (IOException ioe) {
+ /* ignore */
+ }
+ try {
+ outputStream.close();
+ } catch (IOException ioe) {
+ /* ignore */
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Simple.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Simple.java
new file mode 100644
index 0000000..a5eb843
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/Simple.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.widget.TextView;
+
+import com.actionbarsherlock.app.SherlockActivity;
+
+public class Simple extends SherlockActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.text);
+ ((TextView)findViewById(R.id.text)).setText(R.string.simple_content);
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionItems.java b/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionItems.java
new file mode 100644
index 0000000..d155870
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionItems.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.widget.TextView;
+
+//We're the same! Manifest and content text changes only.
+public class SplitActionItems extends ActionItems {
+ @Override
+ public void setContent(TextView view) {
+ view.setText(R.string.split_content);
+ }
+} \ No newline at end of file
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionModes.java b/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionModes.java
new file mode 100644
index 0000000..e1d7850
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionModes.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+//We're the same! Manifest changes only.
+public class SplitActionModes extends ActionModes {}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/StaticAttachment.java b/samples/demos/src/com/actionbarsherlock/sample/demos/StaticAttachment.java
new file mode 100644
index 0000000..b48bf85
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/StaticAttachment.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import com.actionbarsherlock.ActionBarSherlock;
+import com.actionbarsherlock.ActionBarSherlock.OnCreateOptionsMenuListener;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+import android.app.Activity;
+import android.content.pm.ActivityInfo;
+import android.os.Bundle;
+import android.widget.TextView;
+
+public class StaticAttachment extends Activity implements OnCreateOptionsMenuListener {
+ ActionBarSherlock mSherlock = ActionBarSherlock.wrap(this);
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+
+ /*
+ * Most interactions with what would otherwise be the system UI should
+ * now be done through this instance. Content, title, action bar, and
+ * menu inflation can all be done.
+ *
+ * All of the base activities use this class to provide the normal
+ * action bar functionality so everything that they can do is possible
+ * using this static attachment method.
+ *
+ * Calling something like setContentView or getActionBar on this
+ * instance is required in order to properly set up the wrapped layout
+ * and dispatch menu events (if they are needed).
+ */
+ mSherlock.setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
+ mSherlock.setContentView(R.layout.text);
+
+ ((TextView)findViewById(R.id.text)).setText(R.string.static_attach_content);
+ }
+
+ /*
+ * In order to use action items properly with static attachment you
+ * need to dispatch create, prepare, and selected events for the
+ * native type to the ActionBarSherlock instance. If for some reason
+ * you need to use static attachment you should probably create a
+ * common base activity that does this for all three methods.
+ */
+ @Override
+ public boolean onCreateOptionsMenu(android.view.Menu menu) {
+ return mSherlock.dispatchCreateOptionsMenu(menu);
+ }
+
+ /*
+ * In order to receive these events you need to implement an interface
+ * from ActionBarSherlock so it knows to dispatch to this callback.
+ * There are three possible interface you can implement, one for each
+ * menu event.
+ *
+ * Remember, there are no superclass implementations of these methods so
+ * you must return a value with meaning.
+ */
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ //Used to put dark icons on light action bar
+ boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light;
+
+ menu.add("Save")
+ .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add("Search")
+ .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add("Refresh")
+ .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ return true;
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Styled.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Styled.java
new file mode 100644
index 0000000..4655e20
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/Styled.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.graphics.Shader.TileMode;
+import android.graphics.drawable.BitmapDrawable;
+import android.os.Build;
+import android.os.Bundle;
+import android.widget.TextView;
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+
+public class Styled extends SherlockActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.text);
+ ((TextView)findViewById(R.id.text)).setText(R.string.styled_content);
+
+ //This is a workaround for http://b.android.com/15340 from http://stackoverflow.com/a/5852198/132047
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ BitmapDrawable bg = (BitmapDrawable)getResources().getDrawable(R.drawable.bg_striped);
+ bg.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT);
+ getSupportActionBar().setBackgroundDrawable(bg);
+
+ BitmapDrawable bgSplit = (BitmapDrawable)getResources().getDrawable(R.drawable.bg_striped_split_img);
+ bgSplit.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT);
+ getSupportActionBar().setSplitBackgroundDrawable(bgSplit);
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ menu.add("Save")
+ .setIcon(R.drawable.ic_compose)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add("Search")
+ .setIcon(R.drawable.ic_search)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add("Refresh")
+ .setIcon(R.drawable.ic_refresh)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ return super.onCreateOptionsMenu(menu);
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/SubMenus.java b/samples/demos/src/com/actionbarsherlock/sample/demos/SubMenus.java
new file mode 100644
index 0000000..33e65a5
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/SubMenus.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 Jake Wharton
+ *
+ * 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.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.widget.TextView;
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+import com.actionbarsherlock.view.SubMenu;
+
+public class SubMenus extends SherlockActivity {
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+
+ SubMenu subMenu1 = menu.addSubMenu("Action Item");
+ subMenu1.add("Sample");
+ subMenu1.add("Menu");
+ subMenu1.add("Items");
+
+ MenuItem subMenu1Item = subMenu1.getItem();
+ subMenu1Item.setIcon(R.drawable.ic_title_share_default);
+ subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ SubMenu subMenu2 = menu.addSubMenu("Overflow Item");
+ subMenu2.add("These");
+ subMenu2.add("Are");
+ subMenu2.add("Sample");
+ subMenu2.add("Items");
+
+ MenuItem subMenu2Item = subMenu2.getItem();
+ subMenu2Item.setIcon(R.drawable.ic_compose);
+
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.text);
+ ((TextView)findViewById(R.id.text)).setText(R.string.submenus_content);
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigation.java b/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigation.java
new file mode 100644
index 0000000..19bc031
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigation.java
@@ -0,0 +1,43 @@
+package com.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentTransaction;
+import android.widget.TextView;
+
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.ActionBar.Tab;
+import com.actionbarsherlock.app.SherlockActivity;
+
+public class TabNavigation extends SherlockActivity implements ActionBar.TabListener {
+ private TextView mSelected;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ setTheme(SampleList.THEME); //Used for theme switching in samples
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.tab_navigation);
+ mSelected = (TextView)findViewById(R.id.text);
+
+ getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+ for (int i = 1; i <= 3; i++) {
+ ActionBar.Tab tab = getSupportActionBar().newTab();
+ tab.setText("Tab " + i);
+ tab.setTabListener(this);
+ getSupportActionBar().addTab(tab);
+ }
+ }
+
+ @Override
+ public void onTabReselected(Tab tab, FragmentTransaction transaction) {
+ }
+
+ @Override
+ public void onTabSelected(Tab tab, FragmentTransaction transaction) {
+ mSelected.setText("Selected: " + tab.getText());
+ }
+
+ @Override
+ public void onTabUnselected(Tab tab, FragmentTransaction transaction) {
+ }
+}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigationCollapsed.java b/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigationCollapsed.java
new file mode 100644
index 0000000..033d2f5
--- /dev/null
+++ b/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigationCollapsed.java
@@ -0,0 +1,15 @@
+package com.actionbarsherlock.sample.demos;
+
+import android.os.Bundle;
+
+public class TabNavigationCollapsed extends TabNavigation {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ //The following two options trigger the collapsing of the main action bar view.
+ //See the parent activity for the rest of the implementation
+ getSupportActionBar().setDisplayShowHomeEnabled(false);
+ getSupportActionBar().setDisplayShowTitleEnabled(false);
+ }
+}