diff --git a/.gitignore b/.gitignore index 4f9aae456..b2d90e3dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,17 @@ +.idea/workspace.xml +out/ *~ -.DS_Store .metadata *.class -org.eclipse.ltk.core.refactoring.prefs gen local.properties /release /dev lp-translations/ translations/strings.xml -.idea -*.iml coverage.em astrid/src-combined -antbuild -greendroid/GDCatalog/.project api/bin astrid/bin diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 000000000..98f19714a --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +astrid \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 000000000..e035e2a3a --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,34 @@ + + + + + + diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 000000000..3572571ad --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 000000000..e206d70d8 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 000000000..5bec54801 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,15 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..3b312839b --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/CWAC_SackOfViewsAdapter.xml b/.idea/libraries/CWAC_SackOfViewsAdapter.xml new file mode 100644 index 000000000..18a0d1835 --- /dev/null +++ b/.idea/libraries/CWAC_SackOfViewsAdapter.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/android_support_v41.xml b/.idea/libraries/android_support_v41.xml new file mode 100644 index 000000000..eaba40aa8 --- /dev/null +++ b/.idea/libraries/android_support_v41.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/commons_codec.xml b/.idea/libraries/commons_codec.xml new file mode 100644 index 000000000..1fa955d41 --- /dev/null +++ b/.idea/libraries/commons_codec.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/crittercism.xml b/.idea/libraries/crittercism.xml new file mode 100644 index 000000000..7adc26c0e --- /dev/null +++ b/.idea/libraries/crittercism.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/findbugs_annotations.xml b/.idea/libraries/findbugs_annotations.xml new file mode 100644 index 000000000..925fee97b --- /dev/null +++ b/.idea/libraries/findbugs_annotations.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/framework.xml b/.idea/libraries/framework.xml new file mode 100644 index 000000000..cad4e90ce --- /dev/null +++ b/.idea/libraries/framework.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/gcm.xml b/.idea/libraries/gcm.xml new file mode 100644 index 000000000..a12ddc69e --- /dev/null +++ b/.idea/libraries/gcm.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/google_api_client.xml b/.idea/libraries/google_api_client.xml new file mode 100644 index 000000000..8d4beb3f8 --- /dev/null +++ b/.idea/libraries/google_api_client.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/google_api_services_tasks.xml b/.idea/libraries/google_api_services_tasks.xml new file mode 100644 index 000000000..66d5bd867 --- /dev/null +++ b/.idea/libraries/google_api_services_tasks.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/google_http_client.xml b/.idea/libraries/google_http_client.xml new file mode 100644 index 000000000..c55365a4d --- /dev/null +++ b/.idea/libraries/google_http_client.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/google_oauth_client.xml b/.idea/libraries/google_oauth_client.xml new file mode 100644 index 000000000..7636b144c --- /dev/null +++ b/.idea/libraries/google_oauth_client.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/googleloginclient_helper.xml b/.idea/libraries/googleloginclient_helper.xml new file mode 100644 index 000000000..6b0abd554 --- /dev/null +++ b/.idea/libraries/googleloginclient_helper.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/gson.xml b/.idea/libraries/gson.xml new file mode 100644 index 000000000..a625b9dbc --- /dev/null +++ b/.idea/libraries/gson.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/guava.xml b/.idea/libraries/guava.xml new file mode 100644 index 000000000..b559e33c8 --- /dev/null +++ b/.idea/libraries/guava.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/httpmime.xml b/.idea/libraries/httpmime.xml new file mode 100644 index 000000000..f4c9c06d1 --- /dev/null +++ b/.idea/libraries/httpmime.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/jackson_core_asl.xml b/.idea/libraries/jackson_core_asl.xml new file mode 100644 index 000000000..6f91d5b8b --- /dev/null +++ b/.idea/libraries/jackson_core_asl.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/jchronic.xml b/.idea/libraries/jchronic.xml new file mode 100644 index 000000000..dbcf84966 --- /dev/null +++ b/.idea/libraries/jchronic.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/jsr305.xml b/.idea/libraries/jsr305.xml new file mode 100644 index 000000000..6c0616f63 --- /dev/null +++ b/.idea/libraries/jsr305.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/locale_platform.xml b/.idea/libraries/locale_platform.xml new file mode 100644 index 000000000..85ca8bcd6 --- /dev/null +++ b/.idea/libraries/locale_platform.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/rfc2445_4Mar2011.xml b/.idea/libraries/rfc2445_4Mar2011.xml new file mode 100644 index 000000000..0848b95b8 --- /dev/null +++ b/.idea/libraries/rfc2445_4Mar2011.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..10a3aff90 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..1eccb6c79 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/.idea/runConfigurations/Astrid.xml b/.idea/runConfigurations/Astrid.xml new file mode 100644 index 000000000..fd781ecec --- /dev/null +++ b/.idea/runConfigurations/Astrid.xml @@ -0,0 +1,20 @@ + + + + + \ No newline at end of file diff --git a/.idea/scopes/Astrid.xml b/.idea/scopes/Astrid.xml new file mode 100644 index 000000000..d6058e323 --- /dev/null +++ b/.idea/scopes/Astrid.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 000000000..922003b84 --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..9d32e507a --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/OVERVIEW b/OVERVIEW deleted file mode 100644 index 033568b67..000000000 --- a/OVERVIEW +++ /dev/null @@ -1,30 +0,0 @@ -Astrid Project Overview ----------------------------- -Last Updated: Oct 8, 2010 by Tim - -A brief guide of the Astrid project. - -================= -Files and Folders -================= - -art/ - original art resources -astrid/ - astrid Android project - antlib/ - libraries for ant - assets/ - folder for raw assets - common-src/ - todoroo-commons source folder - gen/ - auto-generated source folder - libs/ - external jars - plugin-src/ - plugin source folder - res/ - android resources - src/ - astrid source folder - src-legacy/ - astrid v2 source folder -bin/ - utility shell scripts -docs/ - astrid project documents -LICENSE - license under which source is released -OVERVIEW - this file -README.md - github project readme -samples/ - astrid plugin code samples -tests/ - unit test project -translations/ - gettext .po and .pot files - diff --git a/README.md b/README.md index e2fd86c0a..fa9e81df7 100644 --- a/README.md +++ b/README.md @@ -1,95 +1,4 @@ -[Astrid](http://www.astrid.com/) - Task Management Done Right -================================ -Astrid strives to be a simple and effective organization tool for Google Android phones. It comes with features like reminders, tagging, widgets, and integration with online synchronization services. - -Interested in using Astrid? Search "astrid" in Android Market. Look for the smiling pink squid! - -If you would like to help out with the Astrid project, you're in the right place. - Getting Started With Development --------------- -1. Create your own fork of Astrid by clicking on Github's *Fork* button above (you may have to log in first - [github help](http://help.github.com/forking/)). - -2. Install the following: - • *[git](http://git.or.cz/)* - • *[Eclipse](http://eclipse.org)* (preferred: Eclipse IDE for Java Developers) - • *[Android SDK](http://developer.android.com/sdk/index.html)* (Recommended SDK Platform: Android 4.0 Google APIs) - • *[ADT Plugin for Eclipse](http://developer.android.com/sdk/eclipse-adt.html)* - -3. Use **git** to clone your forked repositories - -`git clone git@github.com:yourgithubid/astrid.git` - -(see Github's instructions if you need help). Follow the [Github Line Ending Help](http://help.github.com/dealing-with-lineendings/) - -4. Open up **eclipse** and import the *astrid*, *astridApi*, *astrid-tests*, *facebook*, and *GreenDroid* projects. - -5. In Eclipse preferences -> Android build settings, set the SDK location (you installed it in step 2). At this point, there should be no compilation errors. If there are, you might have to **refresh** and **clean** the projects a few times from within **eclipse** - -*from Eclipse: project-menu -> clean -> select projects -> check "start a build immediately" if "automatic build" is not enabled* - -6. Launch the *astrid* project as an **Android Application**, or the *astrid-tests* project as an **Android JUnit Test Suite**. - -7. Join the [Astrid Power-Users List](http://groups.google.com/group/astrid-power). - -8. Check out the [Product Roadmap](http://wiki.github.com/todoroo/astrid/) and [Issues](http://github.com/todoroo/astrid/issues), and look for something you'd want to tackle. - -9. Read the following contributor and debugging workflow and help make Astrid better! - -10. Sign a [Contributors License Agreement](https://github.com/downloads/todoroo/astrid/Contributors%20Licensing%20Agreement.pdf) and send it to tim AT astrid.com - -Testing on a device - Debugging ---------------- -How to debug/test on a USB device: (JoshuaGross Jan 14, 2011) - -1. Plug in your device and make sure you can see it by running `adb devices` - -2. If you cannot see the device, or want to restart debugging, do: - -`adb kill-server` - -`adb usb` - -`adb devices` (make sure your device is listed) - -`adb uninstall com.todoroo.astrid.tests` (you should see "Failure" if this was uninstalled already) - -`adb uninstall com.todoroo.astrid` (you should see "Failure" if this was uninstalled already) - -3. If you have not already, set up Run configurations in Eclipse; either under the "Run" or "Debug" menus. To test the application, set up "Android Application". To run JUnit tests, set up "Android JUnit Tests". Settings should autofill for you, you should be able to open a new configuration and run it. If you run it in debug mode, see #2 above for getting adb to work in case it is finicky. - -4. When running unit tests: make sure to *close all JUnit windows* before running tests. JUnit/Eclipse/Android work together in a very, very janky way. You may get incorrect results if you do not close the window out before running tests. You have been warned. - -5. Make sure to commit changes both to the "astrid" project while developing. - -Contributors workflow ---------------- - -**Setup:** - -`git clone git@github.com:your-github-id/astrid.git` (your-github-id should obviously be replaced) - -`git remote add upstream git@github.com:todoroo/astrid.git` - -**Working on new features/fixes:** - -`git checkout -b my-new-features upstream/master` - -work, work, work! - -`git commit` (a separate commit for each bug fix, feature change, style or copy edit please!) - -`git fetch upstream` - -`git rebase -i upstream/master` (i like to rebase -i to verify what i'm committing and squish small commits) - -`git push origin HEAD` - -then go to github and submit a pull request! - -For further information, read [Tim's Collaborator Guide](http://www.betaful.com/2011/04/git-for-ongoing-collaboration/). - -Contact -------- -For general support requests, use [Astrid's feedback page](http://astrid.com/feedback). For development questions, contact [timsu](http://github.com/timsu) via e-mail. +Requires [Android Studio](http://developer.android.com/sdk/installing/studio.html) diff --git a/actionbarsherlock/library/.classpath b/actionbarsherlock/library/.classpath deleted file mode 100644 index a4763d1ee..000000000 --- a/actionbarsherlock/library/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/actionbarsherlock/library/.project b/actionbarsherlock/library/.project deleted file mode 100644 index be2b2c053..000000000 --- a/actionbarsherlock/library/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - actionbarsherlock - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/actionbarsherlock/library/ActionBarSherlock.iml b/actionbarsherlock/library/ActionBarSherlock.iml new file mode 100644 index 000000000..5074408f2 --- /dev/null +++ b/actionbarsherlock/library/ActionBarSherlock.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/actionbarsherlock/library/build.xml b/actionbarsherlock/library/build.xml deleted file mode 100644 index 0c95b7582..000000000 --- a/actionbarsherlock/library/build.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/README.md b/actionbarsherlock/samples/README.md deleted file mode 100755 index 2c461e84f..000000000 --- a/actionbarsherlock/samples/README.md +++ /dev/null @@ -1,13 +0,0 @@ -ActionBarSherlock Samples -========================= - -See [actionbarsherlock.com/samples.html][1] for information on the samples -contained in this folder as well as a list of open source implementations. - - - - - - - - [1]: http://actionbarsherlock.com/samples.html diff --git a/actionbarsherlock/samples/demos/AndroidManifest.xml b/actionbarsherlock/samples/demos/AndroidManifest.xml deleted file mode 100755 index 56f660e35..000000000 --- a/actionbarsherlock/samples/demos/AndroidManifest.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/demos/README.md b/actionbarsherlock/samples/demos/README.md deleted file mode 100755 index a0198bf59..000000000 --- a/actionbarsherlock/samples/demos/README.md +++ /dev/null @@ -1,13 +0,0 @@ -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/actionbarsherlock/samples/demos/libs/android-support-v4.jar b/actionbarsherlock/samples/demos/libs/android-support-v4.jar deleted file mode 100755 index 99e063b33..000000000 Binary files a/actionbarsherlock/samples/demos/libs/android-support-v4.jar and /dev/null differ diff --git a/actionbarsherlock/samples/demos/pom.xml b/actionbarsherlock/samples/demos/pom.xml deleted file mode 100755 index 0f5cec3ed..000000000 --- a/actionbarsherlock/samples/demos/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - 4.0.0 - - sample-demos - Sample: Demos - apk - - - com.actionbarsherlock - parent-sample - 4.2.0 - ../pom.xml - - - - - com.google.android - android - provided - - - - com.actionbarsherlock - actionbarsherlock - ${project.version} - apklib - - - - - src - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - true - - - - org.apache.maven.plugins - maven-javadoc-plugin - - true - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - ../../checkstyle.xml - - - - verify - - checkstyle - - - - - - - diff --git a/actionbarsherlock/samples/demos/project.properties b/actionbarsherlock/samples/demos/project.properties deleted file mode 100755 index d29d6c7e1..000000000 --- a/actionbarsherlock/samples/demos/project.properties +++ /dev/null @@ -1,17 +0,0 @@ -# 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/actionbarsherlock/samples/demos/res/drawable-hdpi/bg_striped_img.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/bg_striped_img.png deleted file mode 100755 index ab8487a50..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/bg_striped_img.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-hdpi/bg_striped_split_img.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/bg_striped_split_img.png deleted file mode 100755 index 4c780ea28..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/bg_striped_split_img.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_compose.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_compose.png deleted file mode 100755 index cdb09e4c6..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_compose.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_compose_inverse.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_compose_inverse.png deleted file mode 100755 index 8a0c4876e..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_compose_inverse.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_launcher_settings.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_launcher_settings.png deleted file mode 100755 index c02bd424f..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_launcher_settings.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_magnifying_glass.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_magnifying_glass.png deleted file mode 100755 index cdf35185e..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_magnifying_glass.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_refresh.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_refresh.png deleted file mode 100755 index 08c32e09e..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_refresh.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_refresh_inverse.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_refresh_inverse.png deleted file mode 100755 index 9ab1d3834..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_refresh_inverse.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_search.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_search.png deleted file mode 100755 index 59de344e7..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_search.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_search_inverse.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_search_inverse.png deleted file mode 100755 index eb090a6e0..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_search_inverse.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_title_share_default.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_title_share_default.png deleted file mode 100755 index ee4b285f7..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/ic_title_share_default.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-hdpi/icon.png b/actionbarsherlock/samples/demos/res/drawable-hdpi/icon.png deleted file mode 100755 index 723fbf062..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-ldpi/icon.png b/actionbarsherlock/samples/demos/res/drawable-ldpi/icon.png deleted file mode 100755 index 181f679f5..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-ldpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-mdpi/bg_striped_img.png b/actionbarsherlock/samples/demos/res/drawable-mdpi/bg_striped_img.png deleted file mode 100755 index 06e3ebd77..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-mdpi/bg_striped_img.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-mdpi/bg_striped_split_img.png b/actionbarsherlock/samples/demos/res/drawable-mdpi/bg_striped_split_img.png deleted file mode 100755 index 1308ade7f..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-mdpi/bg_striped_split_img.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_compose.png b/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_compose.png deleted file mode 100755 index 15a413053..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_compose.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_compose_inverse.png b/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_compose_inverse.png deleted file mode 100755 index de58ce832..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_compose_inverse.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_launcher_settings.png b/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_launcher_settings.png deleted file mode 100755 index 05cdd9aa9..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_launcher_settings.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_magnifying_glass.png b/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_magnifying_glass.png deleted file mode 100755 index 53aa6d9fc..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_magnifying_glass.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_refresh.png b/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_refresh.png deleted file mode 100755 index 55c43c327..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_refresh.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_refresh_inverse.png b/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_refresh_inverse.png deleted file mode 100755 index d5736ec30..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_refresh_inverse.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_search.png b/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_search.png deleted file mode 100755 index 75339d906..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_search.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_search_inverse.png b/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_search_inverse.png deleted file mode 100755 index b462c32c8..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-mdpi/ic_search_inverse.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-mdpi/icon.png b/actionbarsherlock/samples/demos/res/drawable-mdpi/icon.png deleted file mode 100755 index 79f50d84c..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-xhdpi/bg_striped_img.png b/actionbarsherlock/samples/demos/res/drawable-xhdpi/bg_striped_img.png deleted file mode 100755 index 92f3fa114..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-xhdpi/bg_striped_img.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-xhdpi/bg_striped_split_img.png b/actionbarsherlock/samples/demos/res/drawable-xhdpi/bg_striped_split_img.png deleted file mode 100755 index e31f4a667..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-xhdpi/bg_striped_split_img.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-xhdpi/ic_launcher_settings.png b/actionbarsherlock/samples/demos/res/drawable-xhdpi/ic_launcher_settings.png deleted file mode 100755 index 2b2907b60..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-xhdpi/ic_launcher_settings.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable-xhdpi/icon.png b/actionbarsherlock/samples/demos/res/drawable-xhdpi/icon.png deleted file mode 100755 index 34ca9a489..000000000 Binary files a/actionbarsherlock/samples/demos/res/drawable-xhdpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/demos/res/drawable/bg_striped.xml b/actionbarsherlock/samples/demos/res/drawable/bg_striped.xml deleted file mode 100755 index 77e0aab22..000000000 --- a/actionbarsherlock/samples/demos/res/drawable/bg_striped.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - \ No newline at end of file diff --git a/actionbarsherlock/samples/demos/res/drawable/bg_striped_split.xml b/actionbarsherlock/samples/demos/res/drawable/bg_striped_split.xml deleted file mode 100755 index 9b0e31354..000000000 --- a/actionbarsherlock/samples/demos/res/drawable/bg_striped_split.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - \ No newline at end of file diff --git a/actionbarsherlock/samples/demos/res/layout-large-land/feature_toggles.xml b/actionbarsherlock/samples/demos/res/layout-large-land/feature_toggles.xml deleted file mode 100755 index 359f2981e..000000000 --- a/actionbarsherlock/samples/demos/res/layout-large-land/feature_toggles.xml +++ /dev/null @@ -1,393 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/fragment_dialog.xml b/actionbarsherlock/samples/fragments/res/layout/fragment_dialog.xml deleted file mode 100755 index f9dec5990..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/fragment_dialog.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/fragment_dialog_or_activity.xml b/actionbarsherlock/samples/fragments/res/layout/fragment_dialog_or_activity.xml deleted file mode 100755 index 295f01787..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/fragment_dialog_or_activity.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/fragment_hide_show_support.xml b/actionbarsherlock/samples/fragments/res/layout/fragment_hide_show_support.xml deleted file mode 100755 index 45001bd8a..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/fragment_hide_show_support.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/fragment_pager_list.xml b/actionbarsherlock/samples/fragments/res/layout/fragment_pager_list.xml deleted file mode 100755 index c817ae58e..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/fragment_pager_list.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/fragment_retain_instance.xml b/actionbarsherlock/samples/fragments/res/layout/fragment_retain_instance.xml deleted file mode 100755 index 0dc39853f..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/fragment_retain_instance.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/fragment_stack.xml b/actionbarsherlock/samples/fragments/res/layout/fragment_stack.xml deleted file mode 100755 index 1d12496ac..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/fragment_stack.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/fragment_tabs.xml b/actionbarsherlock/samples/fragments/res/layout/fragment_tabs.xml deleted file mode 100755 index 0fb142cbc..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/fragment_tabs.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/fragment_tabs_pager.xml b/actionbarsherlock/samples/fragments/res/layout/fragment_tabs_pager.xml deleted file mode 100755 index c36cf3c30..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/fragment_tabs_pager.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/hello_world.xml b/actionbarsherlock/samples/fragments/res/layout/hello_world.xml deleted file mode 100755 index 3d90a3351..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/hello_world.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/labeled_text_edit.xml b/actionbarsherlock/samples/fragments/res/layout/labeled_text_edit.xml deleted file mode 100755 index 27568afbb..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/labeled_text_edit.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/list_item_icon_text.xml b/actionbarsherlock/samples/fragments/res/layout/list_item_icon_text.xml deleted file mode 100755 index c3825b719..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/list_item_icon_text.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/receive_result.xml b/actionbarsherlock/samples/fragments/res/layout/receive_result.xml deleted file mode 100755 index 5deb2ac4a..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/receive_result.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/send_result.xml b/actionbarsherlock/samples/fragments/res/layout/send_result.xml deleted file mode 100755 index bdd927c60..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/send_result.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/layout/simple_list_item_checkable_1.xml b/actionbarsherlock/samples/fragments/res/layout/simple_list_item_checkable_1.xml deleted file mode 100755 index d122b5c23..000000000 --- a/actionbarsherlock/samples/fragments/res/layout/simple_list_item_checkable_1.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/menu/shortcuts.xml b/actionbarsherlock/samples/fragments/res/menu/shortcuts.xml deleted file mode 100755 index b5e938a5a..000000000 --- a/actionbarsherlock/samples/fragments/res/menu/shortcuts.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/values/attrs.xml b/actionbarsherlock/samples/fragments/res/values/attrs.xml deleted file mode 100755 index 0459aa5d2..000000000 --- a/actionbarsherlock/samples/fragments/res/values/attrs.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - diff --git a/actionbarsherlock/samples/fragments/res/values/colors.xml b/actionbarsherlock/samples/fragments/res/values/colors.xml deleted file mode 100755 index a52502efa..000000000 --- a/actionbarsherlock/samples/fragments/res/values/colors.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - #7f00 - #770000ff - #7700ff00 - #77ffff00 - diff --git a/actionbarsherlock/samples/fragments/res/values/strings.xml b/actionbarsherlock/samples/fragments/res/values/strings.xml deleted file mode 100755 index 858d10084..000000000 --- a/actionbarsherlock/samples/fragments/res/values/strings.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - ActionBarSherlock Fragments - ABS: Fragments - - Hello, World! - - Lorem ipsum dolor sit aie consectetur adipiscing\nPlloaso mako nuto - siwuf cakso dodtos anr koop. - - OK - Cancel - - Initial text. - - Pick a result to send, or BACK to cancel. - Corky - Violet - Press the button to get an activity result, which will be displayed here: - Get Result - - Alert Dialog - - Arguments - Demonstrates a fragment that takes arguments - as a Bundle at runtime (on the right) or from attributes in a layout (on the left). - From Attributes - Landscape Only - - Custom Animation - - Hide and Show - - Context Menu - Fragment populating a context - menu; long press the button to see. - Long press me - - Dialog - Show - - Dialog or Activity - Demonstrates the same fragment - being shown as a dialog and embedded inside of an activity. - Fragment embedded inside - of the activity: - - Layout - - List Array - - Menu - Build menus from two fragments, allowing - you to hide them to remove them.. - Show fragment 1 menu - Show fragment 2 menu - - Retain Instance - Current progress of retained fragment; - restarts if fragment is re-created. - Restart - - Receive Result - - Stack - New fragment - - Tabs - - Tabs and Pager - - Pager - First - Last - - State Pager - - diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/CheckableFrameLayout.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/CheckableFrameLayout.java deleted file mode 100755 index cb6b7a4df..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/CheckableFrameLayout.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.fragments; - -import android.content.Context; -import android.graphics.drawable.ColorDrawable; -import android.util.AttributeSet; -import android.widget.Checkable; -import android.widget.FrameLayout; - -public class CheckableFrameLayout extends FrameLayout implements Checkable { - private boolean mChecked; - - public CheckableFrameLayout(Context context) { - super(context); - } - - public CheckableFrameLayout(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public void setChecked(boolean checked) { - mChecked = checked; - setBackgroundDrawable(checked ? new ColorDrawable(0xff0000a0) : null); - } - - public boolean isChecked() { - return mChecked; - } - - public void toggle() { - setChecked(!mChecked); - } - -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/Cheeses.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/Cheeses.java deleted file mode 100755 index cc288bc11..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/Cheeses.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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.fragments; - -public class Cheeses { - - public static final String[] sCheeseStrings = { - "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi", - "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", - "Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese", - "Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-Bilh", "Anthoriro", "Appenzell", - "Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "Aromes au Gene de Marc", - "Asadero", "Asiago", "Aubisque Pyrenees", "Autun", "Avaxtskyr", "Baby Swiss", - "Babybel", "Baguette Laonnaise", "Bakers", "Baladi", "Balaton", "Bandal", "Banon", - "Barry's Bay Cheddar", "Basing", "Basket Cheese", "Bath Cheese", "Bavarian Bergkase", - "Baylough", "Beaufort", "Beauvoorde", "Beenleigh Blue", "Beer Cheese", "Bel Paese", - "Bergader", "Bergere Bleue", "Berkswell", "Beyaz Peynir", "Bierkase", "Bishop Kennedy", - "Blarney", "Bleu d'Auvergne", "Bleu de Gex", "Bleu de Laqueuille", - "Bleu de Septmoncel", "Bleu Des Causses", "Blue", "Blue Castello", "Blue Rathgore", - "Blue Vein (Australian)", "Blue Vein Cheeses", "Bocconcini", "Bocconcini (Australian)", - "Boeren Leidenkaas", "Bonchester", "Bosworth", "Bougon", "Boule Du Roves", - "Boulette d'Avesnes", "Boursault", "Boursin", "Bouyssou", "Bra", "Braudostur", - "Breakfast Cheese", "Brebis du Lavort", "Brebis du Lochois", "Brebis du Puyfaucon", - "Bresse Bleu", "Brick", "Brie", "Brie de Meaux", "Brie de Melun", "Brillat-Savarin", - "Brin", "Brin d' Amour", "Brin d'Amour", "Brinza (Burduf Brinza)", - "Briquette de Brebis", "Briquette du Forez", "Broccio", "Broccio Demi-Affine", - "Brousse du Rove", "Bruder Basil", "Brusselae Kaas (Fromage de Bruxelles)", "Bryndza", - "Buchette d'Anjou", "Buffalo", "Burgos", "Butte", "Butterkase", "Button (Innes)", - "Buxton Blue", "Cabecou", "Caboc", "Cabrales", "Cachaille", "Caciocavallo", "Caciotta", - "Caerphilly", "Cairnsmore", "Calenzana", "Cambazola", "Camembert de Normandie", - "Canadian Cheddar", "Canestrato", "Cantal", "Caprice des Dieux", "Capricorn Goat", - "Capriole Banon", "Carre de l'Est", "Casciotta di Urbino", "Cashel Blue", "Castellano", - "Castelleno", "Castelmagno", "Castelo Branco", "Castigliano", "Cathelain", - "Celtic Promise", "Cendre d'Olivet", "Cerney", "Chabichou", "Chabichou du Poitou", - "Chabis de Gatine", "Chaource", "Charolais", "Chaumes", "Cheddar", - "Cheddar Clothbound", "Cheshire", "Chevres", "Chevrotin des Aravis", "Chontaleno", - "Civray", "Coeur de Camembert au Calvados", "Coeur de Chevre", "Colby", "Cold Pack", - "Comte", "Coolea", "Cooleney", "Coquetdale", "Corleggy", "Cornish Pepper", - "Cotherstone", "Cotija", "Cottage Cheese", "Cottage Cheese (Australian)", - "Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese", - "Cream Havarti", "Crema Agria", "Crema Mexicana", "Creme Fraiche", "Crescenza", - "Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley", - "Cuajada", "Curd", "Cure Nantais", "Curworthy", "Cwmtawe Pecorino", - "Cypress Grove Chevre", "Danablu (Danish Blue)", "Danbo", "Danish Fontina", - "Daralagjazsky", "Dauphin", "Delice des Fiouves", "Denhany Dorset Drum", "Derby", - "Dessertnyj Belyj", "Devon Blue", "Devon Garland", "Dolcelatte", "Doolin", - "Doppelrhamstufel", "Dorset Blue Vinney", "Double Gloucester", "Double Worcester", - "Dreux a la Feuille", "Dry Jack", "Duddleswell", "Dunbarra", "Dunlop", "Dunsyre Blue", - "Duroblando", "Durrus", "Dutch Mimolette (Commissiekaas)", "Edam", "Edelpilz", - "Emental Grand Cru", "Emlett", "Emmental", "Epoisses de Bourgogne", "Esbareich", - "Esrom", "Etorki", "Evansdale Farmhouse Brie", "Evora De L'Alentejo", "Exmoor Blue", - "Explorateur", "Feta", "Feta (Australian)", "Figue", "Filetta", "Fin-de-Siecle", - "Finlandia Swiss", "Finn", "Fiore Sardo", "Fleur du Maquis", "Flor de Guia", - "Flower Marie", "Folded", "Folded cheese with mint", "Fondant de Brebis", - "Fontainebleau", "Fontal", "Fontina Val d'Aosta", "Formaggio di capra", "Fougerus", - "Four Herb Gouda", "Fourme d' Ambert", "Fourme de Haute Loire", "Fourme de Montbrison", - "Fresh Jack", "Fresh Mozzarella", "Fresh Ricotta", "Fresh Truffles", "Fribourgeois", - "Friesekaas", "Friesian", "Friesla", "Frinault", "Fromage a Raclette", "Fromage Corse", - "Fromage de Montagne de Savoie", "Fromage Frais", "Fruit Cream Cheese", - "Frying Cheese", "Fynbo", "Gabriel", "Galette du Paludier", "Galette Lyonnaise", - "Galloway Goat's Milk Gems", "Gammelost", "Gaperon a l'Ail", "Garrotxa", "Gastanberra", - "Geitost", "Gippsland Blue", "Gjetost", "Gloucester", "Golden Cross", "Gorgonzola", - "Gornyaltajski", "Gospel Green", "Gouda", "Goutu", "Gowrie", "Grabetto", "Graddost", - "Grafton Village Cheddar", "Grana", "Grana Padano", "Grand Vatel", - "Grataron d' Areches", "Gratte-Paille", "Graviera", "Greuilh", "Greve", - "Gris de Lille", "Gruyere", "Gubbeen", "Guerbigny", "Halloumi", - "Halloumy (Australian)", "Haloumi-Style Cheese", "Harbourne Blue", "Havarti", - "Heidi Gruyere", "Hereford Hop", "Herrgardsost", "Herriot Farmhouse", "Herve", - "Hipi Iti", "Hubbardston Blue Cow", "Hushallsost", "Iberico", "Idaho Goatster", - "Idiazabal", "Il Boschetto al Tartufo", "Ile d'Yeu", "Isle of Mull", "Jarlsberg", - "Jermi Tortes", "Jibneh Arabieh", "Jindi Brie", "Jubilee Blue", "Juustoleipa", - "Kadchgall", "Kaseri", "Kashta", "Kefalotyri", "Kenafa", "Kernhem", "Kervella Affine", - "Kikorangi", "King Island Cape Wickham Brie", "King River Gold", "Klosterkaese", - "Knockalara", "Kugelkase", "L'Aveyronnais", "L'Ecir de l'Aubrac", "La Taupiniere", - "La Vache Qui Rit", "Laguiole", "Lairobell", "Lajta", "Lanark Blue", "Lancashire", - "Langres", "Lappi", "Laruns", "Lavistown", "Le Brin", "Le Fium Orbo", "Le Lacandou", - "Le Roule", "Leafield", "Lebbene", "Leerdammer", "Leicester", "Leyden", "Limburger", - "Lincolnshire Poacher", "Lingot Saint Bousquet d'Orb", "Liptauer", "Little Rydings", - "Livarot", "Llanboidy", "Llanglofan Farmhouse", "Loch Arthur Farmhouse", - "Loddiswell Avondale", "Longhorn", "Lou Palou", "Lou Pevre", "Lyonnais", "Maasdam", - "Macconais", "Mahoe Aged Gouda", "Mahon", "Malvern", "Mamirolle", "Manchego", - "Manouri", "Manur", "Marble Cheddar", "Marbled Cheeses", "Maredsous", "Margotin", - "Maribo", "Maroilles", "Mascares", "Mascarpone", "Mascarpone (Australian)", - "Mascarpone Torta", "Matocq", "Maytag Blue", "Meira", "Menallack Farmhouse", - "Menonita", "Meredith Blue", "Mesost", "Metton (Cancoillotte)", "Meyer Vintage Gouda", - "Mihalic Peynir", "Milleens", "Mimolette", "Mine-Gabhar", "Mini Baby Bells", "Mixte", - "Molbo", "Monastery Cheeses", "Mondseer", "Mont D'or Lyonnais", "Montasio", - "Monterey Jack", "Monterey Jack Dry", "Morbier", "Morbier Cru de Montagne", - "Mothais a la Feuille", "Mozzarella", "Mozzarella (Australian)", - "Mozzarella di Bufala", "Mozzarella Fresh, in water", "Mozzarella Rolls", "Munster", - "Murol", "Mycella", "Myzithra", "Naboulsi", "Nantais", "Neufchatel", - "Neufchatel (Australian)", "Niolo", "Nokkelost", "Northumberland", "Oaxaca", - "Olde York", "Olivet au Foin", "Olivet Bleu", "Olivet Cendre", - "Orkney Extra Mature Cheddar", "Orla", "Oschtjepka", "Ossau Fermier", "Ossau-Iraty", - "Oszczypek", "Oxford Blue", "P'tit Berrichon", "Palet de Babligny", "Paneer", "Panela", - "Pannerone", "Pant ys Gawn", "Parmesan (Parmigiano)", "Parmigiano Reggiano", - "Pas de l'Escalette", "Passendale", "Pasteurized Processed", "Pate de Fromage", - "Patefine Fort", "Pave d'Affinois", "Pave d'Auge", "Pave de Chirac", "Pave du Berry", - "Pecorino", "Pecorino in Walnut Leaves", "Pecorino Romano", "Peekskill Pyramid", - "Pelardon des Cevennes", "Pelardon des Corbieres", "Penamellera", "Penbryn", - "Pencarreg", "Perail de Brebis", "Petit Morin", "Petit Pardou", "Petit-Suisse", - "Picodon de Chevre", "Picos de Europa", "Piora", "Pithtviers au Foin", - "Plateau de Herve", "Plymouth Cheese", "Podhalanski", "Poivre d'Ane", "Polkolbin", - "Pont l'Eveque", "Port Nicholson", "Port-Salut", "Postel", "Pouligny-Saint-Pierre", - "Pourly", "Prastost", "Pressato", "Prince-Jean", "Processed Cheddar", "Provolone", - "Provolone (Australian)", "Pyengana Cheddar", "Pyramide", "Quark", - "Quark (Australian)", "Quartirolo Lombardo", "Quatre-Vents", "Quercy Petit", - "Queso Blanco", "Queso Blanco con Frutas --Pina y Mango", "Queso de Murcia", - "Queso del Montsec", "Queso del Tietar", "Queso Fresco", "Queso Fresco (Adobera)", - "Queso Iberico", "Queso Jalapeno", "Queso Majorero", "Queso Media Luna", - "Queso Para Frier", "Queso Quesadilla", "Rabacal", "Raclette", "Ragusano", "Raschera", - "Reblochon", "Red Leicester", "Regal de la Dombes", "Reggianito", "Remedou", - "Requeson", "Richelieu", "Ricotta", "Ricotta (Australian)", "Ricotta Salata", "Ridder", - "Rigotte", "Rocamadour", "Rollot", "Romano", "Romans Part Dieu", "Roncal", "Roquefort", - "Roule", "Rouleau De Beaulieu", "Royalp Tilsit", "Rubens", "Rustinu", "Saaland Pfarr", - "Saanenkaese", "Saga", "Sage Derby", "Sainte Maure", "Saint-Marcellin", - "Saint-Nectaire", "Saint-Paulin", "Salers", "Samso", "San Simon", "Sancerre", - "Sap Sago", "Sardo", "Sardo Egyptian", "Sbrinz", "Scamorza", "Schabzieger", "Schloss", - "Selles sur Cher", "Selva", "Serat", "Seriously Strong Cheddar", "Serra da Estrela", - "Sharpam", "Shelburne Cheddar", "Shropshire Blue", "Siraz", "Sirene", "Smoked Gouda", - "Somerset Brie", "Sonoma Jack", "Sottocenare al Tartufo", "Soumaintrain", - "Sourire Lozerien", "Spenwood", "Sraffordshire Organic", "St. Agur Blue Cheese", - "Stilton", "Stinking Bishop", "String", "Sussex Slipcote", "Sveciaost", "Swaledale", - "Sweet Style Swiss", "Swiss", "Syrian (Armenian String)", "Tala", "Taleggio", "Tamie", - "Tasmania Highland Chevre Log", "Taupiniere", "Teifi", "Telemea", "Testouri", - "Tete de Moine", "Tetilla", "Texas Goat Cheese", "Tibet", "Tillamook Cheddar", - "Tilsit", "Timboon Brie", "Toma", "Tomme Brulee", "Tomme d'Abondance", - "Tomme de Chevre", "Tomme de Romans", "Tomme de Savoie", "Tomme des Chouans", "Tommes", - "Torta del Casar", "Toscanello", "Touree de L'Aubier", "Tourmalet", - "Trappe (Veritable)", "Trois Cornes De Vendee", "Tronchon", "Trou du Cru", "Truffe", - "Tupi", "Turunmaa", "Tymsboro", "Tyn Grug", "Tyning", "Ubriaco", "Ulloa", - "Vacherin-Fribourgeois", "Valencay", "Vasterbottenost", "Venaco", "Vendomois", - "Vieux Corse", "Vignotte", "Vulscombe", "Waimata Farmhouse Blue", - "Washed Rind Cheese (Australian)", "Waterloo", "Weichkaese", "Wellington", - "Wensleydale", "White Stilton", "Whitestone Farmhouse", "Wigmore", "Woodside Cabecou", - "Xanadu", "Xynotyro", "Yarg Cornish", "Yarra Valley Pyramid", "Yorkshire Blue", - "Zamorano", "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano" - }; - -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentAlertDialogSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentAlertDialogSupport.java deleted file mode 100755 index 6c6abefd7..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentAlertDialogSupport.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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.fragments; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.content.DialogInterface; -import android.os.Bundle; -import android.support.v4.app.DialogFragment; -import android.util.Log; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.Button; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockDialogFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -/** - * Demonstrates how to show an AlertDialog that is managed by a Fragment. - */ -public class FragmentAlertDialogSupport extends SherlockFragmentActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_dialog); - - View tv = findViewById(R.id.text); - ((TextView)tv).setText("Example of displaying an alert dialog with a DialogFragment"); - - // Watch for button clicks. - Button button = (Button)findViewById(R.id.show); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - showDialog(); - } - }); - } - - - void showDialog() { - DialogFragment newFragment = MyAlertDialogFragment.newInstance( - R.string.alert_dialog_two_buttons_title); - newFragment.show(getSupportFragmentManager(), "dialog"); - } - - public void doPositiveClick() { - // Do stuff here. - Log.i("FragmentAlertDialog", "Positive click!"); - } - - public void doNegativeClick() { - // Do stuff here. - Log.i("FragmentAlertDialog", "Negative click!"); - } - - - - public static class MyAlertDialogFragment extends SherlockDialogFragment { - - public static MyAlertDialogFragment newInstance(int title) { - MyAlertDialogFragment frag = new MyAlertDialogFragment(); - Bundle args = new Bundle(); - args.putInt("title", title); - frag.setArguments(args); - return frag; - } - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - int title = getArguments().getInt("title"); - - return new AlertDialog.Builder(getActivity()) - .setIcon(R.drawable.alert_dialog_icon) - .setTitle(title) - .setPositiveButton(R.string.alert_dialog_ok, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int whichButton) { - ((FragmentAlertDialogSupport)getActivity()).doPositiveClick(); - } - } - ) - .setNegativeButton(R.string.alert_dialog_cancel, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int whichButton) { - ((FragmentAlertDialogSupport)getActivity()).doNegativeClick(); - } - } - ) - .create(); - } - } - -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentArgumentsSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentArgumentsSupport.java deleted file mode 100755 index 3310e0b57..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentArgumentsSupport.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.fragments; - -import android.app.Activity; -import android.content.res.TypedArray; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -/** - * Demonstrates a fragment that can be configured through both Bundle arguments - * and layout attributes. - */ -public class FragmentArgumentsSupport extends SherlockFragmentActivity { - - @Override protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_arguments_support); - - if (savedInstanceState == null) { - // First-time init; create fragment to embed in activity. - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - Fragment newFragment = MyFragment.newInstance("From Arguments"); - ft.add(R.id.created, newFragment); - ft.commit(); - } - } - - - - public static class MyFragment extends SherlockFragment { - CharSequence mLabel; - - /** - * Create a new instance of MyFragment that will be initialized - * with the given arguments. - */ - static MyFragment newInstance(CharSequence label) { - MyFragment f = new MyFragment(); - Bundle b = new Bundle(); - b.putCharSequence("label", label); - f.setArguments(b); - return f; - } - - /** - * Parse attributes during inflation from a view hierarchy into the - * arguments we handle. - */ - @Override public void onInflate(Activity activity, AttributeSet attrs, - Bundle savedInstanceState) { - super.onInflate(activity, attrs, savedInstanceState); - - TypedArray a = activity.obtainStyledAttributes(attrs, - R.styleable.FragmentArguments); - mLabel = a.getText(R.styleable.FragmentArguments_android_label); - a.recycle(); - } - - /** - * During creation, if arguments have been supplied to the fragment - * then parse those out. - */ - @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - Bundle args = getArguments(); - if (args != null) { - CharSequence label = args.getCharSequence("label"); - if (label != null) { - mLabel = label; - } - } - } - - /** - * Create the view for this fragment, using the arguments given to it. - */ - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.hello_world, container, false); - View tv = v.findViewById(R.id.text); - ((TextView)tv).setText(mLabel != null ? mLabel : "(no label)"); - tv.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.gallery_thumb)); - return v; - } - } - -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentContextMenuSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentContextMenuSupport.java deleted file mode 100755 index a01e8bd95..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentContextMenuSupport.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.fragments; - -import android.os.Bundle; -import android.util.Log; -import android.view.ContextMenu; -import android.view.ContextMenu.ContextMenuInfo; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import com.actionbarsherlock.app.SherlockFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -/** - * Demonstration of displaying a context menu from a fragment. - */ -public class FragmentContextMenuSupport extends SherlockFragmentActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - - // Create the list fragment and add it as our sole content. - ContextMenuFragment content = new ContextMenuFragment(); - getSupportFragmentManager().beginTransaction().add( - android.R.id.content, content).commit(); - } - - public static class ContextMenuFragment extends SherlockFragment { - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View root = inflater.inflate(R.layout.fragment_context_menu, container, false); - registerForContextMenu(root.findViewById(R.id.long_press)); - return root; - } - - @Override - public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { - super.onCreateContextMenu(menu, v, menuInfo); - menu.add(Menu.NONE, R.id.a_item, Menu.NONE, "Menu A"); - menu.add(Menu.NONE, R.id.b_item, Menu.NONE, "Menu B"); - } - - @Override - public boolean onContextItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.a_item: - Log.i("ContextMenu", "Item 1a was chosen"); - return true; - case R.id.b_item: - Log.i("ContextMenu", "Item 1b was chosen"); - return true; - } - return super.onContextItemSelected(item); - } - } -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentCustomAnimationSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentCustomAnimationSupport.java deleted file mode 100755 index 125103a5e..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentCustomAnimationSupport.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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.fragments; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -public class FragmentCustomAnimationSupport extends SherlockFragmentActivity { - int mStackLevel = 1; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_stack); - - // Watch for button clicks. - Button button = (Button)findViewById(R.id.new_fragment); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - addFragmentToStack(); - } - }); - - if (savedInstanceState == null) { - // Do first time initialization -- add initial fragment. - Fragment newFragment = CountingFragment.newInstance(mStackLevel); - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - ft.add(R.id.simple_fragment, newFragment).commit(); - } else { - mStackLevel = savedInstanceState.getInt("level"); - } - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putInt("level", mStackLevel); - } - - - void addFragmentToStack() { - mStackLevel++; - - // Instantiate a new fragment. - Fragment newFragment = CountingFragment.newInstance(mStackLevel); - - // Add the fragment to the activity, pushing this transaction - // on to the back stack. - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - ft.setCustomAnimations(R.anim.fragment_slide_left_enter, - R.anim.fragment_slide_left_exit, - R.anim.fragment_slide_right_enter, - R.anim.fragment_slide_right_exit); - ft.replace(R.id.simple_fragment, newFragment); - ft.addToBackStack(null); - ft.commit(); - } - - - - public static class CountingFragment extends SherlockFragment { - int mNum; - - /** - * Create a new instance of CountingFragment, providing "num" - * as an argument. - */ - static CountingFragment newInstance(int num) { - CountingFragment f = new CountingFragment(); - - // Supply num input as an argument. - Bundle args = new Bundle(); - args.putInt("num", num); - f.setArguments(args); - - return f; - } - - /** - * When creating, retrieve this instance's number from its arguments. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mNum = getArguments() != null ? getArguments().getInt("num") : 1; - } - - /** - * The Fragment's UI is just a simple text view showing its - * instance number. - */ - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.hello_world, container, false); - View tv = v.findViewById(R.id.text); - ((TextView)tv).setText("Fragment #" + mNum); - tv.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.gallery_thumb)); - return v; - } - } - -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentDialogOrActivitySupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentDialogOrActivitySupport.java deleted file mode 100755 index 718fc2085..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentDialogOrActivitySupport.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2010 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.fragments; - -import android.os.Bundle; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentTransaction; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockDialogFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -public class FragmentDialogOrActivitySupport extends SherlockFragmentActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_dialog_or_activity); - - if (savedInstanceState == null) { - // First-time init; create fragment to embed in activity. - - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - DialogFragment newFragment = MyDialogFragment.newInstance(); - ft.add(R.id.embedded, newFragment); - ft.commit(); - - } - - // Watch for button clicks. - Button button = (Button)findViewById(R.id.show_dialog); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - showDialog(); - } - }); - } - - - void showDialog() { - // Create the fragment and show it as a dialog. - DialogFragment newFragment = MyDialogFragment.newInstance(); - newFragment.show(getSupportFragmentManager(), "dialog"); - } - - - - public static class MyDialogFragment extends SherlockDialogFragment { - static MyDialogFragment newInstance() { - return new MyDialogFragment(); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.hello_world, container, false); - View tv = v.findViewById(R.id.text); - ((TextView)tv).setText("This is an instance of MyDialogFragment"); - return v; - } - } - -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentDialogSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentDialogSupport.java deleted file mode 100755 index ef9837b37..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentDialogSupport.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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.fragments; - -import android.os.Bundle; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockDialogFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -public class FragmentDialogSupport extends SherlockFragmentActivity { - int mStackLevel = 0; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_dialog); - - View tv = findViewById(R.id.text); - ((TextView)tv).setText("Example of displaying dialogs with a DialogFragment. " - + "Press the show button below to see the first dialog; pressing " - + "successive show buttons will display other dialog styles as a " - + "stack, with dismissing or back going to the previous dialog."); - - // Watch for button clicks. - Button button = (Button)findViewById(R.id.show); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - showDialog(); - } - }); - - if (savedInstanceState != null) { - mStackLevel = savedInstanceState.getInt("level"); - } - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putInt("level", mStackLevel); - } - - - void showDialog() { - mStackLevel++; - - // DialogFragment.show() will take care of adding the fragment - // in a transaction. We also want to remove any currently showing - // dialog, so make our own transaction and take care of that here. - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog"); - if (prev != null) { - ft.remove(prev); - } - ft.addToBackStack(null); - - // Create and show the dialog. - DialogFragment newFragment = MyDialogFragment.newInstance(mStackLevel); - newFragment.show(ft, "dialog"); - } - - - static String getNameForNum(int num) { - switch ((num-1)%6) { - case 1: return "STYLE_NO_TITLE"; - case 2: return "STYLE_NO_FRAME"; - case 3: return "STYLE_NO_INPUT (this window can't receive input, so " - + "you will need to press the bottom show button)"; - case 4: return "STYLE_NORMAL with dark fullscreen theme"; - case 5: return "STYLE_NORMAL with light theme"; - case 6: return "STYLE_NO_TITLE with light theme"; - case 7: return "STYLE_NO_FRAME with light theme"; - case 8: return "STYLE_NORMAL with light fullscreen theme"; - } - return "STYLE_NORMAL"; - } - - - public static class MyDialogFragment extends SherlockDialogFragment { - int mNum; - - /** - * Create a new instance of MyDialogFragment, providing "num" - * as an argument. - */ - static MyDialogFragment newInstance(int num) { - MyDialogFragment f = new MyDialogFragment(); - - // Supply num input as an argument. - Bundle args = new Bundle(); - args.putInt("num", num); - f.setArguments(args); - - return f; - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mNum = getArguments().getInt("num"); - - // Pick a style based on the num. - int style = DialogFragment.STYLE_NORMAL, theme = 0; - switch ((mNum-1)%6) { - case 1: style = DialogFragment.STYLE_NO_TITLE; break; - case 2: style = DialogFragment.STYLE_NO_FRAME; break; - case 3: style = DialogFragment.STYLE_NO_INPUT; break; - case 4: style = DialogFragment.STYLE_NORMAL; break; - case 5: style = DialogFragment.STYLE_NO_TITLE; break; - case 6: style = DialogFragment.STYLE_NO_FRAME; break; - case 7: style = DialogFragment.STYLE_NORMAL; break; - } - switch ((mNum-1)%6) { - case 2: theme = android.R.style.Theme_Panel; break; - case 4: theme = android.R.style.Theme; break; - case 5: theme = android.R.style.Theme_Light; break; - case 6: theme = android.R.style.Theme_Light_Panel; break; - case 7: theme = android.R.style.Theme_Light; break; - } - setStyle(style, theme); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.fragment_dialog, container, false); - View tv = v.findViewById(R.id.text); - ((TextView)tv).setText("Dialog #" + mNum + ": using style " - + getNameForNum(mNum)); - - // Watch for button clicks. - Button button = (Button)v.findViewById(R.id.show); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - // When button is clicked, call up to owning activity. - ((FragmentDialogSupport)getActivity()).showDialog(); - } - }); - - return v; - } - } - -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentHideShowSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentHideShowSupport.java deleted file mode 100755 index 41ce40772..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentHideShowSupport.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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.fragments; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -/** - * Demonstration of hiding and showing fragments. - */ -public class FragmentHideShowSupport extends SherlockFragmentActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_hide_show_support); - - // The content view embeds two fragments; now retrieve them and attach - // their "hide" button. - FragmentManager fm = getSupportFragmentManager(); - addShowHideListener(R.id.frag1hide, fm.findFragmentById(R.id.fragment1)); - addShowHideListener(R.id.frag2hide, fm.findFragmentById(R.id.fragment2)); - } - - void addShowHideListener(int buttonId, final Fragment fragment) { - final Button button = (Button)findViewById(buttonId); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - ft.setCustomAnimations(android.R.anim.fade_in, - android.R.anim.fade_out); - if (fragment.isHidden()) { - ft.show(fragment); - button.setText("Hide"); - } else { - ft.hide(fragment); - button.setText("Show"); - } - ft.commit(); - } - }); - } - - public static class FirstFragment extends SherlockFragment { - TextView mTextView; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.labeled_text_edit, container, false); - View tv = v.findViewById(R.id.msg); - ((TextView)tv).setText("The fragment saves and restores this text."); - - // Retrieve the text editor, and restore the last saved state if needed. - mTextView = (TextView)v.findViewById(R.id.saved); - if (savedInstanceState != null) { - mTextView.setText(savedInstanceState.getCharSequence("text")); - } - return v; - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - - // Remember the current text, to restore if we later restart. - outState.putCharSequence("text", mTextView.getText()); - } - } - - public static class SecondFragment extends Fragment { - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.labeled_text_edit, container, false); - View tv = v.findViewById(R.id.msg); - ((TextView)tv).setText("The TextView saves and restores this text."); - - // Retrieve the text editor and tell it to save and restore its state. - // Note that you will often set this in the layout XML, but since - // we are sharing our layout with the other fragment we will customize - // it here. - ((TextView)v.findViewById(R.id.saved)).setSaveEnabled(true); - return v; - } - } -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentLayoutSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentLayoutSupport.java deleted file mode 100755 index e3f6a926f..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentLayoutSupport.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (C) 2010 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.fragments; - -import android.content.Intent; -import android.content.res.Configuration; -import android.os.Bundle; -import android.support.v4.app.FragmentTransaction; -import android.util.TypedValue; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.ListView; -import android.widget.ScrollView; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.actionbarsherlock.app.SherlockListFragment; - -/** - * Demonstration of using fragments to implement different activity layouts. - * This sample provides a different layout (and activity flow) when run in - * landscape. - */ -public class FragmentLayoutSupport extends SherlockFragmentActivity { - - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - - setContentView(R.layout.fragment_layout_support); - } - - - /** - * This is a secondary activity, to show what the user has selected - * when the screen is not large enough to show it all in one activity. - */ - - public static class DetailsActivity extends SherlockFragmentActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - - if (getResources().getConfiguration().orientation - == Configuration.ORIENTATION_LANDSCAPE) { - // If the screen is now in landscape mode, we can show the - // dialog in-line with the list so we don't need this activity. - finish(); - return; - } - - if (savedInstanceState == null) { - // During initial setup, plug in the details fragment. - DetailsFragment details = new DetailsFragment(); - details.setArguments(getIntent().getExtras()); - getSupportFragmentManager().beginTransaction().add( - android.R.id.content, details).commit(); - } - } - } - - - /** - * This is the "top-level" fragment, showing a list of items that the - * user can pick. Upon picking an item, it takes care of displaying the - * data to the user as appropriate based on the currrent UI layout. - */ - - public static class TitlesFragment extends SherlockListFragment { - boolean mDualPane; - int mCurCheckPosition = 0; - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - - // Populate list with our static array of titles. - setListAdapter(new ArrayAdapter(getActivity(), - R.layout.simple_list_item_checkable_1, - android.R.id.text1, Shakespeare.TITLES)); - - // Check to see if we have a frame in which to embed the details - // fragment directly in the containing UI. - View detailsFrame = getActivity().findViewById(R.id.details); - mDualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE; - - if (savedInstanceState != null) { - // Restore last state for checked position. - mCurCheckPosition = savedInstanceState.getInt("curChoice", 0); - } - - if (mDualPane) { - // In dual-pane mode, the list view highlights the selected item. - getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); - // Make sure our UI is in the correct state. - showDetails(mCurCheckPosition); - } - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putInt("curChoice", mCurCheckPosition); - } - - @Override - public void onListItemClick(ListView l, View v, int position, long id) { - showDetails(position); - } - - /** - * Helper function to show the details of a selected item, either by - * displaying a fragment in-place in the current UI, or starting a - * whole new activity in which it is displayed. - */ - void showDetails(int index) { - mCurCheckPosition = index; - - if (mDualPane) { - // We can display everything in-place with fragments, so update - // the list to highlight the selected item and show the data. - getListView().setItemChecked(index, true); - - // Check what fragment is currently shown, replace if needed. - DetailsFragment details = (DetailsFragment) - getFragmentManager().findFragmentById(R.id.details); - if (details == null || details.getShownIndex() != index) { - // Make new fragment to show this selection. - details = DetailsFragment.newInstance(index); - - // Execute a transaction, replacing any existing fragment - // with this one inside the frame. - FragmentTransaction ft = getFragmentManager().beginTransaction(); - ft.replace(R.id.details, details); - ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); - ft.commit(); - } - - } else { - // Otherwise we need to launch a new activity to display - // the dialog fragment with selected text. - Intent intent = new Intent(); - intent.setClass(getActivity(), DetailsActivity.class); - intent.putExtra("index", index); - startActivity(intent); - } - } - } - - - /** - * This is the secondary fragment, displaying the details of a particular - * item. - */ - - public static class DetailsFragment extends SherlockFragment { - /** - * Create a new instance of DetailsFragment, initialized to - * show the text at 'index'. - */ - public static DetailsFragment newInstance(int index) { - DetailsFragment f = new DetailsFragment(); - - // Supply index input as an argument. - Bundle args = new Bundle(); - args.putInt("index", index); - f.setArguments(args); - - return f; - } - - public int getShownIndex() { - return getArguments().getInt("index", 0); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - if (container == null) { - // We have different layouts, and in one of them this - // fragment's containing frame doesn't exist. The fragment - // may still be created from its saved state, but there is - // no reason to try to create its view hierarchy because it - // won't be displayed. Note this is not needed -- we could - // just run the code below, where we would create and return - // the view hierarchy; it would just never be used. - return null; - } - - ScrollView scroller = new ScrollView(getActivity()); - TextView text = new TextView(getActivity()); - int padding = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, - 4, getActivity().getResources().getDisplayMetrics()); - text.setPadding(padding, padding, padding, padding); - scroller.addView(text); - text.setText(Shakespeare.DIALOGUE[getShownIndex()]); - return scroller; - } - } - -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentListArraySupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentListArraySupport.java deleted file mode 100755 index 9462375c0..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentListArraySupport.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2010 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.fragments; - -import android.os.Bundle; -import android.util.Log; -import android.view.View; -import android.widget.ArrayAdapter; -import android.widget.ListView; -import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.actionbarsherlock.app.SherlockListFragment; - -/** - * Demonstration of using ListFragment to show a list of items - * from a canned array. - */ -public class FragmentListArraySupport extends SherlockFragmentActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - - // Create the list fragment and add it as our sole content. - if (getSupportFragmentManager().findFragmentById(android.R.id.content) == null) { - ArrayListFragment list = new ArrayListFragment(); - getSupportFragmentManager().beginTransaction().add(android.R.id.content, list).commit(); - } - } - - public static class ArrayListFragment extends SherlockListFragment { - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - setListAdapter(new ArrayAdapter(getActivity(), - android.R.layout.simple_list_item_1, Shakespeare.TITLES)); - } - - @Override - public void onListItemClick(ListView l, View v, int position, long id) { - Log.i("FragmentList", "Item clicked: " + id); - } - } -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentMenuSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentMenuSupport.java deleted file mode 100755 index 58c818d37..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentMenuSupport.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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.fragments; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.CheckBox; -import com.actionbarsherlock.app.SherlockFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuInflater; -import com.actionbarsherlock.view.MenuItem; - -/** - * Demonstrates how fragments can participate in the options menu. - */ -public class FragmentMenuSupport extends SherlockFragmentActivity { - Fragment mFragment1; - Fragment mFragment2; - CheckBox mCheckBox1; - CheckBox mCheckBox2; - - // Update fragment visibility when check boxes are changed. - final OnClickListener mClickListener = new OnClickListener() { - public void onClick(View v) { - updateFragmentVisibility(); - } - }; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_menu); - - // Make sure the two menu fragments are created. - FragmentManager fm = getSupportFragmentManager(); - FragmentTransaction ft = fm.beginTransaction(); - mFragment1 = fm.findFragmentByTag("f1"); - if (mFragment1 == null) { - mFragment1 = new MenuFragment(); - ft.add(mFragment1, "f1"); - } - mFragment2 = fm.findFragmentByTag("f2"); - if (mFragment2 == null) { - mFragment2 = new Menu2Fragment(); - ft.add(mFragment2, "f2"); - } - ft.commit(); - - // Watch check box clicks. - mCheckBox1 = (CheckBox)findViewById(R.id.menu1); - mCheckBox1.setOnClickListener(mClickListener); - mCheckBox2 = (CheckBox)findViewById(R.id.menu2); - mCheckBox2.setOnClickListener(mClickListener); - - // Make sure fragments start out with correct visibility. - updateFragmentVisibility(); - } - - @Override - protected void onRestoreInstanceState(Bundle savedInstanceState) { - super.onRestoreInstanceState(savedInstanceState); - // Make sure fragments are updated after check box view state is restored. - updateFragmentVisibility(); - } - - // Update fragment visibility based on current check box state. - void updateFragmentVisibility() { - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - if (mCheckBox1.isChecked()) ft.show(mFragment1); - else ft.hide(mFragment1); - if (mCheckBox2.isChecked()) ft.show(mFragment2); - else ft.hide(mFragment2); - ft.commit(); - } - - /** - * A fragment that displays a menu. This fragment happens to not - * have a UI (it does not implement onCreateView), but it could also - * have one if it wanted. - */ - public static class MenuFragment extends SherlockFragment { - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - } - - @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - menu.add("Menu 1a").setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - menu.add("Menu 1b").setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - } - } - - /** - * Second fragment with a menu. - */ - public static class Menu2Fragment extends SherlockFragment { - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - } - - @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - menu.add("Menu 2").setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - } - } -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentPagerSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentPagerSupport.java deleted file mode 100755 index a531b1587..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentPagerSupport.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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.fragments; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.view.ViewPager; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.ListView; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.actionbarsherlock.app.SherlockListFragment; - - -public class FragmentPagerSupport extends SherlockFragmentActivity { - static final int NUM_ITEMS = 10; - - MyAdapter mAdapter; - - ViewPager mPager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_pager); - - mAdapter = new MyAdapter(getSupportFragmentManager()); - - mPager = (ViewPager)findViewById(R.id.pager); - mPager.setAdapter(mAdapter); - - // Watch for button clicks. - Button button = (Button)findViewById(R.id.goto_first); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - mPager.setCurrentItem(0); - } - }); - button = (Button)findViewById(R.id.goto_last); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - mPager.setCurrentItem(NUM_ITEMS-1); - } - }); - } - - public static class MyAdapter extends FragmentPagerAdapter { - public MyAdapter(FragmentManager fm) { - super(fm); - } - - @Override - public int getCount() { - return NUM_ITEMS; - } - - @Override - public Fragment getItem(int position) { - return ArrayListFragment.newInstance(position); - } - } - - public static class ArrayListFragment extends SherlockListFragment { - int mNum; - - /** - * Create a new instance of CountingFragment, providing "num" - * as an argument. - */ - static ArrayListFragment newInstance(int num) { - ArrayListFragment f = new ArrayListFragment(); - - // Supply num input as an argument. - Bundle args = new Bundle(); - args.putInt("num", num); - f.setArguments(args); - - return f; - } - - /** - * When creating, retrieve this instance's number from its arguments. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mNum = getArguments() != null ? getArguments().getInt("num") : 1; - } - - /** - * The Fragment's UI is just a simple text view showing its - * instance number. - */ - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.fragment_pager_list, container, false); - View tv = v.findViewById(R.id.text); - ((TextView)tv).setText("Fragment #" + mNum); - return v; - } - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - setListAdapter(new ArrayAdapter(getActivity(), - android.R.layout.simple_list_item_1, Cheeses.sCheeseStrings)); - } - - @Override - public void onListItemClick(ListView l, View v, int position, long id) { - Log.i("FragmentList", "Item clicked: " + id); - } - } -} - diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentReceiveResultSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentReceiveResultSupport.java deleted file mode 100755 index fda6d1cc0..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentReceiveResultSupport.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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.fragments; - -import android.content.Intent; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; -import android.text.Editable; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.FrameLayout; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -public class FragmentReceiveResultSupport extends SherlockFragmentActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( - ViewGroup.LayoutParams.FILL_PARENT, - ViewGroup.LayoutParams.FILL_PARENT); - FrameLayout frame = new FrameLayout(this); - frame.setId(R.id.simple_fragment); - setContentView(frame, lp); - - if (savedInstanceState == null) { - // Do first time initialization -- add fragment. - Fragment newFragment = new ReceiveResultFragment(); - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - ft.add(R.id.simple_fragment, newFragment).commit(); - } - } - - public static class ReceiveResultFragment extends SherlockFragment { - // Definition of the one requestCode we use for receiving resuls. - static final private int GET_CODE = 0; - - private TextView mResults; - - private OnClickListener mGetListener = new OnClickListener() { - public void onClick(View v) { - // Start the activity whose result we want to retrieve. The - // result will come back with request code GET_CODE. - Intent intent = new Intent(getActivity(), SendResult.class); - startActivityForResult(intent, GET_CODE); - } - }; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.receive_result, container, false); - - // Retrieve the TextView widget that will display results. - mResults = (TextView)v.findViewById(R.id.results); - - // This allows us to later extend the text buffer. - mResults.setText(mResults.getText(), TextView.BufferType.EDITABLE); - - // Watch for button clicks. - Button getButton = (Button)v.findViewById(R.id.get); - getButton.setOnClickListener(mGetListener); - - return v; - } - - /** - * This method is called when the sending activity has finished, with the - * result it supplied. - */ - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - // You can use the requestCode to select between multiple child - // activities you may have started. Here there is only one thing - // we launch. - if (requestCode == GET_CODE) { - - // We will be adding to our text. - Editable text = (Editable)mResults.getText(); - - // This is a standard resultCode that is sent back if the - // activity doesn't supply an explicit result. It will also - // be returned if the activity failed to launch. - if (resultCode == RESULT_CANCELED) { - text.append("(cancelled)"); - - // Our protocol with the sending activity is that it will send - // text in 'data' as its result. - } else { - text.append("(okay "); - text.append(Integer.toString(resultCode)); - text.append(") "); - if (data != null) { - text.append(data.getAction()); - } - } - - text.append("\n"); - } - } - } -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentRetainInstanceSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentRetainInstanceSupport.java deleted file mode 100755 index a6f5a7368..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentRetainInstanceSupport.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * 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.fragments; - -import android.os.Bundle; -import android.support.v4.app.FragmentManager; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.ProgressBar; -import com.actionbarsherlock.app.SherlockFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -/** - * This example shows how you can use a Fragment to easily propagate state - * (such as threads) across activity instances when an activity needs to be - * restarted due to, for example, a configuration change. This is a lot - * easier than using the raw Activity.onRetainNonConfiguratinInstance() API. - */ -public class FragmentRetainInstanceSupport extends SherlockFragmentActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - - // First time init, create the UI. - if (savedInstanceState == null) { - getSupportFragmentManager().beginTransaction().add(android.R.id.content, - new UiFragment()).commit(); - } - } - - /** - * This is a fragment showing UI that will be updated from work done - * in the retained fragment. - */ - public static class UiFragment extends SherlockFragment { - RetainedFragment mWorkFragment; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.fragment_retain_instance, container, false); - - // Watch for button clicks. - Button button = (Button)v.findViewById(R.id.restart); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - mWorkFragment.restart(); - } - }); - - return v; - } - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - - FragmentManager fm = getFragmentManager(); - - // Check to see if we have retained the worker fragment. - mWorkFragment = (RetainedFragment)fm.findFragmentByTag("work"); - - // If not retained (or first time running), we need to create it. - if (mWorkFragment == null) { - mWorkFragment = new RetainedFragment(); - // Tell it who it is working with. - mWorkFragment.setTargetFragment(this, 0); - fm.beginTransaction().add(mWorkFragment, "work").commit(); - } - } - - } - - /** - * This is the Fragment implementation that will be retained across - * activity instances. It represents some ongoing work, here a thread - * we have that sits around incrementing a progress indicator. - */ - public static class RetainedFragment extends SherlockFragment { - ProgressBar mProgressBar; - int mPosition; - boolean mReady = false; - boolean mQuiting = false; - - /** - * This is the thread that will do our work. It sits in a loop running - * the progress up until it has reached the top, then stops and waits. - */ - final Thread mThread = new Thread() { - @Override - public void run() { - // We'll figure the real value out later. - int max = 10000; - - // This thread runs almost forever. - while (true) { - - // Update our shared state with the UI. - synchronized (this) { - // Our thread is stopped if the UI is not ready - // or it has completed its work. - while (!mReady || mPosition >= max) { - if (mQuiting) { - return; - } - try { - wait(); - } catch (InterruptedException e) { - } - } - - // Now update the progress. Note it is important that - // we touch the progress bar with the lock held, so it - // doesn't disappear on us. - mPosition++; - max = mProgressBar.getMax(); - mProgressBar.setProgress(mPosition); - } - - // Normally we would be doing some work, but put a kludge - // here to pretend like we are. - synchronized (this) { - try { - wait(50); - } catch (InterruptedException e) { - } - } - } - } - }; - - /** - * Fragment initialization. We way we want to be retained and - * start our thread. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // Tell the framework to try to keep this fragment around - // during a configuration change. - setRetainInstance(true); - - // Start up the worker thread. - mThread.start(); - } - - /** - * This is called when the Fragment's Activity is ready to go, after - * its content view has been installed; it is called both after - * the initial fragment creation and after the fragment is re-attached - * to a new activity. - */ - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - - // Retrieve the progress bar from the target's view hierarchy. - mProgressBar = (ProgressBar)getTargetFragment().getView().findViewById( - R.id.progress_horizontal); - - // We are ready for our thread to go. - synchronized (mThread) { - mReady = true; - mThread.notify(); - } - } - - /** - * This is called when the fragment is going away. It is NOT called - * when the fragment is being propagated between activity instances. - */ - @Override - public void onDestroy() { - // Make the thread go away. - synchronized (mThread) { - mReady = false; - mQuiting = true; - mThread.notify(); - } - - super.onDestroy(); - } - - /** - * This is called right before the fragment is detached from its - * current activity instance. - */ - @Override - public void onDetach() { - // This fragment is being detached from its activity. We need - // to make sure its thread is not going to touch any activity - // state after returning from this function. - synchronized (mThread) { - mProgressBar = null; - mReady = false; - mThread.notify(); - } - - super.onDetach(); - } - - /** - * API for our UI to restart the progress thread. - */ - public void restart() { - synchronized (mThread) { - mPosition = 0; - mThread.notify(); - } - } - } -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentStackSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentStackSupport.java deleted file mode 100755 index 9e044a6c7..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentStackSupport.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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.fragments; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -public class FragmentStackSupport extends SherlockFragmentActivity { - int mStackLevel = 1; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_stack); - - // Watch for button clicks. - Button button = (Button)findViewById(R.id.new_fragment); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - addFragmentToStack(); - } - }); - - if (savedInstanceState == null) { - // Do first time initialization -- add initial fragment. - Fragment newFragment = CountingFragment.newInstance(mStackLevel); - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - ft.add(R.id.simple_fragment, newFragment).commit(); - } else { - mStackLevel = savedInstanceState.getInt("level"); - } - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putInt("level", mStackLevel); - } - - - void addFragmentToStack() { - mStackLevel++; - - // Instantiate a new fragment. - Fragment newFragment = CountingFragment.newInstance(mStackLevel); - - // Add the fragment to the activity, pushing this transaction - // on to the back stack. - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - ft.replace(R.id.simple_fragment, newFragment); - ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); - ft.addToBackStack(null); - ft.commit(); - } - - - - public static class CountingFragment extends SherlockFragment { - int mNum; - - /** - * Create a new instance of CountingFragment, providing "num" - * as an argument. - */ - static CountingFragment newInstance(int num) { - CountingFragment f = new CountingFragment(); - - // Supply num input as an argument. - Bundle args = new Bundle(); - args.putInt("num", num); - f.setArguments(args); - - return f; - } - - /** - * When creating, retrieve this instance's number from its arguments. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mNum = getArguments() != null ? getArguments().getInt("num") : 1; - } - - /** - * The Fragment's UI is just a simple text view showing its - * instance number. - */ - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.hello_world, container, false); - View tv = v.findViewById(R.id.text); - ((TextView)tv).setText("Fragment #" + mNum); - tv.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.gallery_thumb)); - return v; - } - } - -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentStatePagerSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentStatePagerSupport.java deleted file mode 100755 index 433c7e37c..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentStatePagerSupport.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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.fragments; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentStatePagerAdapter; -import android.support.v4.view.ViewPager; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.ListView; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.actionbarsherlock.app.SherlockListFragment; - - -public class FragmentStatePagerSupport extends SherlockFragmentActivity { - static final int NUM_ITEMS = 10; - - MyAdapter mAdapter; - - ViewPager mPager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_pager); - - mAdapter = new MyAdapter(getSupportFragmentManager()); - - mPager = (ViewPager)findViewById(R.id.pager); - mPager.setAdapter(mAdapter); - - // Watch for button clicks. - Button button = (Button)findViewById(R.id.goto_first); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - mPager.setCurrentItem(0); - } - }); - button = (Button)findViewById(R.id.goto_last); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - mPager.setCurrentItem(NUM_ITEMS-1); - } - }); - } - - public static class MyAdapter extends FragmentStatePagerAdapter { - public MyAdapter(FragmentManager fm) { - super(fm); - } - - @Override - public int getCount() { - return NUM_ITEMS; - } - - @Override - public Fragment getItem(int position) { - return ArrayListFragment.newInstance(position); - } - } - - public static class ArrayListFragment extends SherlockListFragment { - int mNum; - - /** - * Create a new instance of CountingFragment, providing "num" - * as an argument. - */ - static ArrayListFragment newInstance(int num) { - ArrayListFragment f = new ArrayListFragment(); - - // Supply num input as an argument. - Bundle args = new Bundle(); - args.putInt("num", num); - f.setArguments(args); - - return f; - } - - /** - * When creating, retrieve this instance's number from its arguments. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mNum = getArguments() != null ? getArguments().getInt("num") : 1; - } - - /** - * The Fragment's UI is just a simple text view showing its - * instance number. - */ - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.fragment_pager_list, container, false); - View tv = v.findViewById(R.id.text); - ((TextView)tv).setText("Fragment #" + mNum); - return v; - } - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - setListAdapter(new ArrayAdapter(getActivity(), - android.R.layout.simple_list_item_1, Cheeses.sCheeseStrings)); - } - - @Override - public void onListItemClick(ListView l, View v, int position, long id) { - Log.i("FragmentList", "Item clicked: " + id); - } - } -} - diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentTabs.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentTabs.java deleted file mode 100755 index e6dbd9489..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentTabs.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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.fragments; - - -import java.util.HashMap; -import android.content.Context; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentTransaction; -import android.view.View; -import android.widget.TabHost; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -/** - * This demonstrates how you can implement switching between the tabs of a - * TabHost through fragments. It uses a trick (see the code below) to allow - * the tabs to switch between fragments instead of simple views. - */ -public class FragmentTabs extends SherlockFragmentActivity { - TabHost mTabHost; - TabManager mTabManager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - - setContentView(R.layout.fragment_tabs); - mTabHost = (TabHost)findViewById(android.R.id.tabhost); - mTabHost.setup(); - - mTabManager = new TabManager(this, mTabHost, R.id.realtabcontent); - - mTabManager.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"), - FragmentStackSupport.CountingFragment.class, null); - mTabManager.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"), - LoaderCursorSupport.CursorLoaderListFragment.class, null); - mTabManager.addTab(mTabHost.newTabSpec("custom").setIndicator("Custom"), - LoaderCustomSupport.AppListFragment.class, null); - mTabManager.addTab(mTabHost.newTabSpec("throttle").setIndicator("Throttle"), - LoaderThrottleSupport.ThrottledLoaderListFragment.class, null); - - if (savedInstanceState != null) { - mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); - } - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putString("tab", mTabHost.getCurrentTabTag()); - } - - /** - * This is a helper class that implements a generic mechanism for - * associating fragments with the tabs in a tab host. It relies on a - * trick. Normally a tab host has a simple API for supplying a View or - * Intent that each tab will show. This is not sufficient for switching - * between fragments. So instead we make the content part of the tab host - * 0dp high (it is not shown) and the TabManager supplies its own dummy - * view to show as the tab content. It listens to changes in tabs, and takes - * care of switch to the correct fragment shown in a separate content area - * whenever the selected tab changes. - */ - public static class TabManager implements TabHost.OnTabChangeListener { - private final FragmentActivity mActivity; - private final TabHost mTabHost; - private final int mContainerId; - private final HashMap mTabs = new HashMap(); - TabInfo mLastTab; - - static final class TabInfo { - private final String tag; - private final Class clss; - private final Bundle args; - private Fragment fragment; - - TabInfo(String _tag, Class _class, Bundle _args) { - tag = _tag; - clss = _class; - args = _args; - } - } - - static class DummyTabFactory implements TabHost.TabContentFactory { - private final Context mContext; - - public DummyTabFactory(Context context) { - mContext = context; - } - - @Override - public View createTabContent(String tag) { - View v = new View(mContext); - v.setMinimumWidth(0); - v.setMinimumHeight(0); - return v; - } - } - - public TabManager(FragmentActivity activity, TabHost tabHost, int containerId) { - mActivity = activity; - mTabHost = tabHost; - mContainerId = containerId; - mTabHost.setOnTabChangedListener(this); - } - - public void addTab(TabHost.TabSpec tabSpec, Class clss, Bundle args) { - tabSpec.setContent(new DummyTabFactory(mActivity)); - String tag = tabSpec.getTag(); - - TabInfo info = new TabInfo(tag, clss, args); - - // Check to see if we already have a fragment for this tab, probably - // from a previously saved state. If so, deactivate it, because our - // initial state is that a tab isn't shown. - info.fragment = mActivity.getSupportFragmentManager().findFragmentByTag(tag); - if (info.fragment != null && !info.fragment.isDetached()) { - FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction(); - ft.detach(info.fragment); - ft.commit(); - } - - mTabs.put(tag, info); - mTabHost.addTab(tabSpec); - } - - @Override - public void onTabChanged(String tabId) { - TabInfo newTab = mTabs.get(tabId); - if (mLastTab != newTab) { - FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction(); - if (mLastTab != null) { - if (mLastTab.fragment != null) { - ft.detach(mLastTab.fragment); - } - } - if (newTab != null) { - if (newTab.fragment == null) { - newTab.fragment = Fragment.instantiate(mActivity, - newTab.clss.getName(), newTab.args); - ft.add(mContainerId, newTab.fragment, newTab.tag); - } else { - ft.attach(newTab.fragment); - } - } - - mLastTab = newTab; - ft.commit(); - mActivity.getSupportFragmentManager().executePendingTransactions(); - } - } - } -} - diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentTabsPager.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentTabsPager.java deleted file mode 100755 index d50092f8a..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/FragmentTabsPager.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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.fragments; - -import java.util.ArrayList; -import android.content.Context; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.view.ViewPager; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TabHost; -import android.widget.TabWidget; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -/** - * Demonstrates combining a TabHost with a ViewPager to implement a tab UI - * that switches between tabs and also allows the user to perform horizontal - * flicks to move between the tabs. - */ -public class FragmentTabsPager extends SherlockFragmentActivity { - TabHost mTabHost; - ViewPager mViewPager; - TabsAdapter mTabsAdapter; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - - setContentView(R.layout.fragment_tabs_pager); - mTabHost = (TabHost)findViewById(android.R.id.tabhost); - mTabHost.setup(); - - mViewPager = (ViewPager)findViewById(R.id.pager); - - mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager); - - mTabsAdapter.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"), - FragmentStackSupport.CountingFragment.class, null); - mTabsAdapter.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"), - LoaderCursorSupport.CursorLoaderListFragment.class, null); - mTabsAdapter.addTab(mTabHost.newTabSpec("custom").setIndicator("Custom"), - LoaderCustomSupport.AppListFragment.class, null); - mTabsAdapter.addTab(mTabHost.newTabSpec("throttle").setIndicator("Throttle"), - LoaderThrottleSupport.ThrottledLoaderListFragment.class, null); - - if (savedInstanceState != null) { - mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); - } - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putString("tab", mTabHost.getCurrentTabTag()); - } - - /** - * This is a helper class that implements the management of tabs and all - * details of connecting a ViewPager with associated TabHost. It relies on a - * trick. Normally a tab host has a simple API for supplying a View or - * Intent that each tab will show. This is not sufficient for switching - * between pages. So instead we make the content part of the tab host - * 0dp high (it is not shown) and the TabsAdapter supplies its own dummy - * view to show as the tab content. It listens to changes in tabs, and takes - * care of switch to the correct paged in the ViewPager whenever the selected - * tab changes. - */ - public static class TabsAdapter extends FragmentPagerAdapter - implements TabHost.OnTabChangeListener, ViewPager.OnPageChangeListener { - private final Context mContext; - private final TabHost mTabHost; - private final ViewPager mViewPager; - private final ArrayList mTabs = new ArrayList(); - - static final class TabInfo { - private final String tag; - private final Class clss; - private final Bundle args; - - TabInfo(String _tag, Class _class, Bundle _args) { - tag = _tag; - clss = _class; - args = _args; - } - } - - static class DummyTabFactory implements TabHost.TabContentFactory { - private final Context mContext; - - public DummyTabFactory(Context context) { - mContext = context; - } - - @Override - public View createTabContent(String tag) { - View v = new View(mContext); - v.setMinimumWidth(0); - v.setMinimumHeight(0); - return v; - } - } - - public TabsAdapter(FragmentActivity activity, TabHost tabHost, ViewPager pager) { - super(activity.getSupportFragmentManager()); - mContext = activity; - mTabHost = tabHost; - mViewPager = pager; - mTabHost.setOnTabChangedListener(this); - mViewPager.setAdapter(this); - mViewPager.setOnPageChangeListener(this); - } - - public void addTab(TabHost.TabSpec tabSpec, Class clss, Bundle args) { - tabSpec.setContent(new DummyTabFactory(mContext)); - String tag = tabSpec.getTag(); - - TabInfo info = new TabInfo(tag, clss, args); - mTabs.add(info); - mTabHost.addTab(tabSpec); - notifyDataSetChanged(); - } - - @Override - public int getCount() { - return mTabs.size(); - } - - @Override - public Fragment getItem(int position) { - TabInfo info = mTabs.get(position); - return Fragment.instantiate(mContext, info.clss.getName(), info.args); - } - - @Override - public void onTabChanged(String tabId) { - int position = mTabHost.getCurrentTab(); - mViewPager.setCurrentItem(position); - } - - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - } - - @Override - public void onPageSelected(int position) { - // Unfortunately when TabHost changes the current tab, it kindly - // also takes care of putting focus on it when not in touch mode. - // The jerk. - // This hack tries to prevent this from pulling focus out of our - // ViewPager. - TabWidget widget = mTabHost.getTabWidget(); - int oldFocusability = widget.getDescendantFocusability(); - widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); - mTabHost.setCurrentTab(position); - widget.setDescendantFocusability(oldFocusability); - } - - @Override - public void onPageScrollStateChanged(int state) { - } - } -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/LoaderCursorSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/LoaderCursorSupport.java deleted file mode 100755 index e465a2ba7..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/LoaderCursorSupport.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (C) 2010 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.fragments; - -import android.database.Cursor; -import android.net.Uri; -import android.os.Bundle; -import android.provider.Contacts.People; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.LoaderManager; -import android.support.v4.content.CursorLoader; -import android.support.v4.content.Loader; -import android.support.v4.widget.SearchViewCompat; -import android.support.v4.widget.SearchViewCompat.OnQueryTextListenerCompat; -import android.support.v4.widget.SimpleCursorAdapter; -import android.text.TextUtils; -import android.util.Log; -import android.view.View; -import android.widget.ListView; -import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.actionbarsherlock.app.SherlockListFragment; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuInflater; -import com.actionbarsherlock.view.MenuItem; - -/** - * Demonstration of the use of a CursorLoader to load and display contacts - * data in a fragment. - */ -@SuppressWarnings("all") -public class LoaderCursorSupport extends SherlockFragmentActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - FragmentManager fm = getSupportFragmentManager(); - - // Create the list fragment and add it as our sole content. - if (fm.findFragmentById(android.R.id.content) == null) { - CursorLoaderListFragment list = new CursorLoaderListFragment(); - fm.beginTransaction().add(android.R.id.content, list).commit(); - } - } - - - public static class CursorLoaderListFragment extends SherlockListFragment - implements LoaderManager.LoaderCallbacks { - - // This is the Adapter being used to display the list's data. - SimpleCursorAdapter mAdapter; - - // If non-null, this is the current filter the user has provided. - String mCurFilter; - - @Override public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - - // Give some text to display if there is no data. In a real - // application this would come from a resource. - setEmptyText("No phone numbers"); - - // We have a menu item to show in action bar. - setHasOptionsMenu(true); - - // Create an empty adapter we will use to display the loaded data. - mAdapter = new SimpleCursorAdapter(getActivity(), - android.R.layout.simple_list_item_1, null, - new String[] { People.DISPLAY_NAME }, - new int[] { android.R.id.text1}, 0); - setListAdapter(mAdapter); - - // Start out with a progress indicator. - setListShown(false); - - // Prepare the loader. Either re-connect with an existing one, - // or start a new one. - getLoaderManager().initLoader(0, null, this); - } - - @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - // Place an action bar item for searching. - MenuItem item = menu.add("Search"); - item.setIcon(android.R.drawable.ic_menu_search); - item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); - View searchView = SearchViewCompat.newSearchView(getActivity()); - if (searchView != null) { - SearchViewCompat.setOnQueryTextListener(searchView, - new OnQueryTextListenerCompat() { - @Override - public boolean onQueryTextChange(String newText) { - // Called when the action bar search text has changed. Update - // the search filter, and restart the loader to do a new query - // with this filter. - mCurFilter = !TextUtils.isEmpty(newText) ? newText : null; - getLoaderManager().restartLoader(0, null, CursorLoaderListFragment.this); - return true; - } - }); - item.setActionView(searchView); - } - } - - @Override public void onListItemClick(ListView l, View v, int position, long id) { - // Insert desired behavior here. - Log.i("FragmentComplexList", "Item clicked: " + id); - } - - // These are the Contacts rows that we will retrieve. - static final String[] CONTACTS_SUMMARY_PROJECTION = new String[] { - People._ID, - People.DISPLAY_NAME, - }; - - public Loader onCreateLoader(int id, Bundle args) { - // This is called when a new Loader needs to be created. This - // sample only has one Loader, so we don't care about the ID. - // First, pick the base URI to use depending on whether we are - // currently filtering. - Uri baseUri; - if (mCurFilter != null) { - baseUri = Uri.withAppendedPath(People.CONTENT_FILTER_URI, Uri.encode(mCurFilter)); - } else { - baseUri = People.CONTENT_URI; - } - - // Now create and return a CursorLoader that will take care of - // creating a Cursor for the data being displayed. - String select = "((" + People.DISPLAY_NAME + " NOTNULL) AND (" - + People.DISPLAY_NAME + " != '' ))"; - return new CursorLoader(getActivity(), baseUri, - CONTACTS_SUMMARY_PROJECTION, select, null, - People.DISPLAY_NAME + " COLLATE LOCALIZED ASC"); - } - - public void onLoadFinished(Loader loader, Cursor data) { - // Swap the new cursor in. (The framework will take care of closing the - // old cursor once we return.) - mAdapter.swapCursor(data); - - // The list should now be shown. - if (isResumed()) { - setListShown(true); - } else { - setListShownNoAnimation(true); - } - } - - public void onLoaderReset(Loader loader) { - // This is called when the last Cursor provided to onLoadFinished() - // above is about to be closed. We need to make sure we are no - // longer using it. - mAdapter.swapCursor(null); - } - } - -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/LoaderCustomSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/LoaderCustomSupport.java deleted file mode 100755 index e1852cd7e..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/LoaderCustomSupport.java +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright (C) 2010 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.fragments; - -import java.io.File; -import java.text.Collator; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.pm.ActivityInfo; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; -import android.content.res.Configuration; -import android.content.res.Resources; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.LoaderManager; -import android.support.v4.content.AsyncTaskLoader; -import android.support.v4.content.IntentCompat; -import android.support.v4.content.Loader; -import android.support.v4.content.pm.ActivityInfoCompat; -import android.support.v4.widget.SearchViewCompat; -import android.support.v4.widget.SearchViewCompat.OnQueryTextListenerCompat; -import android.text.TextUtils; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.ImageView; -import android.widget.ListView; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.actionbarsherlock.app.SherlockListFragment; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuInflater; -import com.actionbarsherlock.view.MenuItem; - -/** - * Demonstration of the implementation of a custom Loader. - */ -public class LoaderCustomSupport extends SherlockFragmentActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - FragmentManager fm = getSupportFragmentManager(); - - // Create the list fragment and add it as our sole content. - if (fm.findFragmentById(android.R.id.content) == null) { - AppListFragment list = new AppListFragment(); - fm.beginTransaction().add(android.R.id.content, list).commit(); - } - } - - - /** - * This class holds the per-item data in our Loader. - */ - public static class AppEntry { - public AppEntry(AppListLoader loader, ApplicationInfo info) { - mLoader = loader; - mInfo = info; - mApkFile = new File(info.sourceDir); - } - - public ApplicationInfo getApplicationInfo() { - return mInfo; - } - - public String getLabel() { - return mLabel; - } - - public Drawable getIcon() { - if (mIcon == null) { - if (mApkFile.exists()) { - mIcon = mInfo.loadIcon(mLoader.mPm); - return mIcon; - } else { - mMounted = false; - } - } else if (!mMounted) { - // If the app wasn't mounted but is now mounted, reload - // its icon. - if (mApkFile.exists()) { - mMounted = true; - mIcon = mInfo.loadIcon(mLoader.mPm); - return mIcon; - } - } else { - return mIcon; - } - - return mLoader.getContext().getResources().getDrawable( - android.R.drawable.sym_def_app_icon); - } - - @Override public String toString() { - return mLabel; - } - - void loadLabel(Context context) { - if (mLabel == null || !mMounted) { - if (!mApkFile.exists()) { - mMounted = false; - mLabel = mInfo.packageName; - } else { - mMounted = true; - CharSequence label = mInfo.loadLabel(context.getPackageManager()); - mLabel = label != null ? label.toString() : mInfo.packageName; - } - } - } - - private final AppListLoader mLoader; - private final ApplicationInfo mInfo; - private final File mApkFile; - private String mLabel; - private Drawable mIcon; - private boolean mMounted; - } - - /** - * Perform alphabetical comparison of application entry objects. - */ - public static final Comparator ALPHA_COMPARATOR = new Comparator() { - private final Collator sCollator = Collator.getInstance(); - @Override - public int compare(AppEntry object1, AppEntry object2) { - return sCollator.compare(object1.getLabel(), object2.getLabel()); - } - }; - - /** - * Helper for determining if the configuration has changed in an interesting - * way so we need to rebuild the app list. - */ - public static class InterestingConfigChanges { - final Configuration mLastConfiguration = new Configuration(); - int mLastDensity; - - boolean applyNewConfig(Resources res) { - int configChanges = mLastConfiguration.updateFrom(res.getConfiguration()); - boolean densityChanged = mLastDensity != res.getDisplayMetrics().densityDpi; - if (densityChanged || (configChanges&(ActivityInfo.CONFIG_LOCALE - |ActivityInfoCompat.CONFIG_UI_MODE|ActivityInfo.CONFIG_SCREEN_LAYOUT)) != 0) { - mLastDensity = res.getDisplayMetrics().densityDpi; - return true; - } - return false; - } - } - - /** - * Helper class to look for interesting changes to the installed apps - * so that the loader can be updated. - */ - public static class PackageIntentReceiver extends BroadcastReceiver { - final AppListLoader mLoader; - - public PackageIntentReceiver(AppListLoader loader) { - mLoader = loader; - IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED); - filter.addAction(Intent.ACTION_PACKAGE_REMOVED); - filter.addAction(Intent.ACTION_PACKAGE_CHANGED); - filter.addDataScheme("package"); - mLoader.getContext().registerReceiver(this, filter); - // Register for events related to sdcard installation. - IntentFilter sdFilter = new IntentFilter(); - sdFilter.addAction(IntentCompat.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE); - sdFilter.addAction(IntentCompat.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE); - mLoader.getContext().registerReceiver(this, sdFilter); - } - - @Override public void onReceive(Context context, Intent intent) { - // Tell the loader about the change. - mLoader.onContentChanged(); - } - } - - /** - * A custom Loader that loads all of the installed applications. - */ - public static class AppListLoader extends AsyncTaskLoader> { - final InterestingConfigChanges mLastConfig = new InterestingConfigChanges(); - final PackageManager mPm; - - List mApps; - PackageIntentReceiver mPackageObserver; - - public AppListLoader(Context context) { - super(context); - - // Retrieve the package manager for later use; note we don't - // use 'context' directly but instead the save global application - // context returned by getContext(). - mPm = getContext().getPackageManager(); - } - - /** - * This is where the bulk of our work is done. This function is - * called in a background thread and should generate a new set of - * data to be published by the loader. - */ - @Override public List loadInBackground() { - // Retrieve all known applications. - List apps = mPm.getInstalledApplications( - PackageManager.GET_UNINSTALLED_PACKAGES | - PackageManager.GET_DISABLED_COMPONENTS); - if (apps == null) { - apps = new ArrayList(); - } - - final Context context = getContext(); - - // Create corresponding array of entries and load their labels. - List entries = new ArrayList(apps.size()); - for (int i=0; i apps) { - if (isReset()) { - // An async query came in while the loader is stopped. We - // don't need the result. - if (apps != null) { - onReleaseResources(apps); - } - } - List oldApps = apps; - mApps = apps; - - if (isStarted()) { - // If the Loader is currently started, we can immediately - // deliver its results. - super.deliverResult(apps); - } - - // At this point we can release the resources associated with - // 'oldApps' if needed; now that the new result is delivered we - // know that it is no longer in use. - if (oldApps != null) { - onReleaseResources(oldApps); - } - } - - /** - * Handles a request to start the Loader. - */ - @Override protected void onStartLoading() { - if (mApps != null) { - // If we currently have a result available, deliver it - // immediately. - deliverResult(mApps); - } - - // Start watching for changes in the app data. - if (mPackageObserver == null) { - mPackageObserver = new PackageIntentReceiver(this); - } - - // Has something interesting in the configuration changed since we - // last built the app list? - boolean configChange = mLastConfig.applyNewConfig(getContext().getResources()); - - if (takeContentChanged() || mApps == null || configChange) { - // If the data has changed since the last time it was loaded - // or is not currently available, start a load. - forceLoad(); - } - } - - /** - * Handles a request to stop the Loader. - */ - @Override protected void onStopLoading() { - // Attempt to cancel the current load task if possible. - cancelLoad(); - } - - /** - * Handles a request to cancel a load. - */ - @Override public void onCanceled(List apps) { - super.onCanceled(apps); - - // At this point we can release the resources associated with 'apps' - // if needed. - onReleaseResources(apps); - } - - /** - * Handles a request to completely reset the Loader. - */ - @Override protected void onReset() { - super.onReset(); - - // Ensure the loader is stopped - onStopLoading(); - - // At this point we can release the resources associated with 'apps' - // if needed. - if (mApps != null) { - onReleaseResources(mApps); - mApps = null; - } - - // Stop monitoring for changes. - if (mPackageObserver != null) { - getContext().unregisterReceiver(mPackageObserver); - mPackageObserver = null; - } - } - - /** - * Helper function to take care of releasing resources associated - * with an actively loaded data set. - */ - protected void onReleaseResources(List apps) { - // For a simple List<> there is nothing to do. For something - // like a Cursor, we would close it here. - } - } - - - - public static class AppListAdapter extends ArrayAdapter { - private final LayoutInflater mInflater; - - public AppListAdapter(Context context) { - super(context, android.R.layout.simple_list_item_2); - mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - } - - public void setData(List data) { - clear(); - if (data != null) { - for (AppEntry appEntry : data) { - add(appEntry); - } - } - } - - /** - * Populate new items in the list. - */ - @Override public View getView(int position, View convertView, ViewGroup parent) { - View view; - - if (convertView == null) { - view = mInflater.inflate(R.layout.list_item_icon_text, parent, false); - } else { - view = convertView; - } - - AppEntry item = getItem(position); - ((ImageView)view.findViewById(R.id.icon)).setImageDrawable(item.getIcon()); - ((TextView)view.findViewById(R.id.text)).setText(item.getLabel()); - - return view; - } - } - - public static class AppListFragment extends SherlockListFragment - implements LoaderManager.LoaderCallbacks> { - - // This is the Adapter being used to display the list's data. - AppListAdapter mAdapter; - - // If non-null, this is the current filter the user has provided. - String mCurFilter; - - OnQueryTextListenerCompat mOnQueryTextListenerCompat; - - @Override public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - - // Give some text to display if there is no data. In a real - // application this would come from a resource. - setEmptyText("No applications"); - - // We have a menu item to show in action bar. - setHasOptionsMenu(true); - - // Create an empty adapter we will use to display the loaded data. - mAdapter = new AppListAdapter(getActivity()); - setListAdapter(mAdapter); - - // Start out with a progress indicator. - setListShown(false); - - // Prepare the loader. Either re-connect with an existing one, - // or start a new one. - getLoaderManager().initLoader(0, null, this); - } - - @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - // Place an action bar item for searching. - MenuItem item = menu.add("Search"); - item.setIcon(android.R.drawable.ic_menu_search); - item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - View searchView = SearchViewCompat.newSearchView(getActivity()); - if (searchView != null) { - SearchViewCompat.setOnQueryTextListener(searchView, - new OnQueryTextListenerCompat() { - @Override - public boolean onQueryTextChange(String newText) { - // Called when the action bar search text has changed. Since this - // is a simple array adapter, we can just have it do the filtering. - mCurFilter = !TextUtils.isEmpty(newText) ? newText : null; - mAdapter.getFilter().filter(mCurFilter); - return true; - } - }); - item.setActionView(searchView); - } - } - - @Override public void onListItemClick(ListView l, View v, int position, long id) { - // Insert desired behavior here. - Log.i("LoaderCustom", "Item clicked: " + id); - } - - @Override public Loader> onCreateLoader(int id, Bundle args) { - // This is called when a new Loader needs to be created. This - // sample only has one Loader with no arguments, so it is simple. - return new AppListLoader(getActivity()); - } - - @Override public void onLoadFinished(Loader> loader, List data) { - // Set the new data in the adapter. - mAdapter.setData(data); - - // The list should now be shown. - if (isResumed()) { - setListShown(true); - } else { - setListShownNoAnimation(true); - } - } - - @Override public void onLoaderReset(Loader> loader) { - // Clear the data in the adapter. - mAdapter.setData(null); - } - } - -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/LoaderThrottleSupport.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/LoaderThrottleSupport.java deleted file mode 100755 index 85dbd8704..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/LoaderThrottleSupport.java +++ /dev/null @@ -1,510 +0,0 @@ -/* - * 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.fragments; - - -import java.util.HashMap; -import android.content.ContentProvider; -import android.content.ContentResolver; -import android.content.ContentUris; -import android.content.ContentValues; -import android.content.Context; -import android.content.UriMatcher; -import android.database.Cursor; -import android.database.SQLException; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; -import android.database.sqlite.SQLiteQueryBuilder; -import android.net.Uri; -import android.os.AsyncTask; -import android.os.Bundle; -import android.provider.BaseColumns; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.LoaderManager; -import android.support.v4.content.CursorLoader; -import android.support.v4.content.Loader; -import android.support.v4.database.DatabaseUtilsCompat; -import android.support.v4.widget.SimpleCursorAdapter; -import android.text.TextUtils; -import android.util.Log; -import android.view.View; -import android.widget.ListView; -import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.actionbarsherlock.app.SherlockListFragment; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuInflater; -import com.actionbarsherlock.view.MenuItem; - -/** - * Demonstration of bottom to top implementation of a content provider holding - * structured data through displaying it in the UI, using throttling to reduce - * the number of queries done when its data changes. - */ -public class LoaderThrottleSupport extends SherlockFragmentActivity { - // Debugging. - static final String TAG = "LoaderThrottle"; - - /** - * The authority we use to get to our sample provider. - */ - public static final String AUTHORITY = "com.example.android.apis.supportv4.app.LoaderThrottle"; - - /** - * Definition of the contract for the main table of our provider. - */ - public static final class MainTable implements BaseColumns { - - // This class cannot be instantiated - private MainTable() {} - - /** - * The table name offered by this provider - */ - public static final String TABLE_NAME = "main"; - - /** - * The content:// style URL for this table - */ - public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/main"); - - /** - * The content URI base for a single row of data. Callers must - * append a numeric row id to this Uri to retrieve a row - */ - public static final Uri CONTENT_ID_URI_BASE - = Uri.parse("content://" + AUTHORITY + "/main/"); - - /** - * The MIME type of {@link #CONTENT_URI}. - */ - public static final String CONTENT_TYPE - = "vnd.android.cursor.dir/vnd.example.api-demos-throttle"; - - /** - * The MIME type of a {@link #CONTENT_URI} sub-directory of a single row. - */ - public static final String CONTENT_ITEM_TYPE - = "vnd.android.cursor.item/vnd.example.api-demos-throttle"; - /** - * The default sort order for this table - */ - public static final String DEFAULT_SORT_ORDER = "data COLLATE LOCALIZED ASC"; - - /** - * Column name for the single column holding our data. - *

Type: TEXT

- */ - public static final String COLUMN_NAME_DATA = "data"; - } - - /** - * This class helps open, create, and upgrade the database file. - */ - static class DatabaseHelper extends SQLiteOpenHelper { - - private static final String DATABASE_NAME = "loader_throttle.db"; - private static final int DATABASE_VERSION = 2; - - DatabaseHelper(Context context) { - - // calls the super constructor, requesting the default cursor factory. - super(context, DATABASE_NAME, null, DATABASE_VERSION); - } - - /** - * - * Creates the underlying database with table name and column names taken from the - * NotePad class. - */ - @Override - public void onCreate(SQLiteDatabase db) { - db.execSQL("CREATE TABLE " + MainTable.TABLE_NAME + " (" - + MainTable._ID + " INTEGER PRIMARY KEY," - + MainTable.COLUMN_NAME_DATA + " TEXT" - + ");"); - } - - /** - * - * Demonstrates that the provider must consider what happens when the - * underlying datastore is changed. In this sample, the database is upgraded the database - * by destroying the existing data. - * A real application should upgrade the database in place. - */ - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - - // Logs that the database is being upgraded - Log.w(TAG, "Upgrading database from version " + oldVersion + " to " - + newVersion + ", which will destroy all old data"); - - // Kills the table and existing data - db.execSQL("DROP TABLE IF EXISTS notes"); - - // Recreates the database with a new version - onCreate(db); - } - } - - /** - * A very simple implementation of a content provider. - */ - public static class SimpleProvider extends ContentProvider { - // A projection map used to select columns from the database - private final HashMap mNotesProjectionMap; - // Uri matcher to decode incoming URIs. - private final UriMatcher mUriMatcher; - - // The incoming URI matches the main table URI pattern - private static final int MAIN = 1; - // The incoming URI matches the main table row ID URI pattern - private static final int MAIN_ID = 2; - - // Handle to a new DatabaseHelper. - private DatabaseHelper mOpenHelper; - - /** - * Global provider initialization. - */ - public SimpleProvider() { - // Create and initialize URI matcher. - mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); - mUriMatcher.addURI(AUTHORITY, MainTable.TABLE_NAME, MAIN); - mUriMatcher.addURI(AUTHORITY, MainTable.TABLE_NAME + "/#", MAIN_ID); - - // Create and initialize projection map for all columns. This is - // simply an identity mapping. - mNotesProjectionMap = new HashMap(); - mNotesProjectionMap.put(MainTable._ID, MainTable._ID); - mNotesProjectionMap.put(MainTable.COLUMN_NAME_DATA, MainTable.COLUMN_NAME_DATA); - } - - /** - * Perform provider creation. - */ - @Override - public boolean onCreate() { - mOpenHelper = new DatabaseHelper(getContext()); - // Assumes that any failures will be reported by a thrown exception. - return true; - } - - /** - * Handle incoming queries. - */ - @Override - public Cursor query(Uri uri, String[] projection, String selection, - String[] selectionArgs, String sortOrder) { - - // Constructs a new query builder and sets its table name - SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); - qb.setTables(MainTable.TABLE_NAME); - - switch (mUriMatcher.match(uri)) { - case MAIN: - // If the incoming URI is for main table. - qb.setProjectionMap(mNotesProjectionMap); - break; - - case MAIN_ID: - // The incoming URI is for a single row. - qb.setProjectionMap(mNotesProjectionMap); - qb.appendWhere(MainTable._ID + "=?"); - selectionArgs = DatabaseUtilsCompat.appendSelectionArgs(selectionArgs, - new String[] { uri.getLastPathSegment() }); - break; - - default: - throw new IllegalArgumentException("Unknown URI " + uri); - } - - - if (TextUtils.isEmpty(sortOrder)) { - sortOrder = MainTable.DEFAULT_SORT_ORDER; - } - - SQLiteDatabase db = mOpenHelper.getReadableDatabase(); - - Cursor c = qb.query(db, projection, selection, selectionArgs, - null /* no group */, null /* no filter */, sortOrder); - - c.setNotificationUri(getContext().getContentResolver(), uri); - return c; - } - - /** - * Return the MIME type for an known URI in the provider. - */ - @Override - public String getType(Uri uri) { - switch (mUriMatcher.match(uri)) { - case MAIN: - return MainTable.CONTENT_TYPE; - case MAIN_ID: - return MainTable.CONTENT_ITEM_TYPE; - default: - throw new IllegalArgumentException("Unknown URI " + uri); - } - } - - /** - * Handler inserting new data. - */ - @Override - public Uri insert(Uri uri, ContentValues initialValues) { - if (mUriMatcher.match(uri) != MAIN) { - // Can only insert into to main URI. - throw new IllegalArgumentException("Unknown URI " + uri); - } - - ContentValues values; - - if (initialValues != null) { - values = new ContentValues(initialValues); - } else { - values = new ContentValues(); - } - - if (values.containsKey(MainTable.COLUMN_NAME_DATA) == false) { - values.put(MainTable.COLUMN_NAME_DATA, ""); - } - - SQLiteDatabase db = mOpenHelper.getWritableDatabase(); - - long rowId = db.insert(MainTable.TABLE_NAME, null, values); - - // If the insert succeeded, the row ID exists. - if (rowId > 0) { - Uri noteUri = ContentUris.withAppendedId(MainTable.CONTENT_ID_URI_BASE, rowId); - getContext().getContentResolver().notifyChange(noteUri, null); - return noteUri; - } - - throw new SQLException("Failed to insert row into " + uri); - } - - /** - * Handle deleting data. - */ - @Override - public int delete(Uri uri, String where, String[] whereArgs) { - SQLiteDatabase db = mOpenHelper.getWritableDatabase(); - String finalWhere; - - int count; - - switch (mUriMatcher.match(uri)) { - case MAIN: - // If URI is main table, delete uses incoming where clause and args. - count = db.delete(MainTable.TABLE_NAME, where, whereArgs); - break; - - // If the incoming URI matches a single note ID, does the delete based on the - // incoming data, but modifies the where clause to restrict it to the - // particular note ID. - case MAIN_ID: - // If URI is for a particular row ID, delete is based on incoming - // data but modified to restrict to the given ID. - finalWhere = DatabaseUtilsCompat.concatenateWhere( - MainTable._ID + " = " + ContentUris.parseId(uri), where); - count = db.delete(MainTable.TABLE_NAME, finalWhere, whereArgs); - break; - - default: - throw new IllegalArgumentException("Unknown URI " + uri); - } - - getContext().getContentResolver().notifyChange(uri, null); - - return count; - } - - /** - * Handle updating data. - */ - @Override - public int update(Uri uri, ContentValues values, String where, String[] whereArgs) { - SQLiteDatabase db = mOpenHelper.getWritableDatabase(); - int count; - String finalWhere; - - switch (mUriMatcher.match(uri)) { - case MAIN: - // If URI is main table, update uses incoming where clause and args. - count = db.update(MainTable.TABLE_NAME, values, where, whereArgs); - break; - - case MAIN_ID: - // If URI is for a particular row ID, update is based on incoming - // data but modified to restrict to the given ID. - finalWhere = DatabaseUtilsCompat.concatenateWhere( - MainTable._ID + " = " + ContentUris.parseId(uri), where); - count = db.update(MainTable.TABLE_NAME, values, finalWhere, whereArgs); - break; - - default: - throw new IllegalArgumentException("Unknown URI " + uri); - } - - getContext().getContentResolver().notifyChange(uri, null); - - return count; - } - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - FragmentManager fm = getSupportFragmentManager(); - - // Create the list fragment and add it as our sole content. - if (fm.findFragmentById(android.R.id.content) == null) { - ThrottledLoaderListFragment list = new ThrottledLoaderListFragment(); - fm.beginTransaction().add(android.R.id.content, list).commit(); - } - } - - public static class ThrottledLoaderListFragment extends SherlockListFragment - implements LoaderManager.LoaderCallbacks { - - // Menu identifiers - static final int POPULATE_ID = Menu.FIRST; - static final int CLEAR_ID = Menu.FIRST+1; - - // This is the Adapter being used to display the list's data. - SimpleCursorAdapter mAdapter; - - // If non-null, this is the current filter the user has provided. - String mCurFilter; - - // Task we have running to populate the database. - AsyncTask mPopulatingTask; - - @Override public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - - setEmptyText("No data. Select 'Populate' to fill with data from Z to A at a rate of 4 per second."); - setHasOptionsMenu(true); - - // Create an empty adapter we will use to display the loaded data. - mAdapter = new SimpleCursorAdapter(getActivity(), - android.R.layout.simple_list_item_1, null, - new String[] { MainTable.COLUMN_NAME_DATA }, - new int[] { android.R.id.text1 }, 0); - setListAdapter(mAdapter); - - // Start out with a progress indicator. - setListShown(false); - - // Prepare the loader. Either re-connect with an existing one, - // or start a new one. - getLoaderManager().initLoader(0, null, this); - } - - @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - MenuItem populateItem = menu.add(Menu.NONE, POPULATE_ID, 0, "Populate"); - populateItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - MenuItem clearItem = menu.add(Menu.NONE, CLEAR_ID, 0, "Clear"); - clearItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - final ContentResolver cr = getActivity().getContentResolver(); - - switch (item.getItemId()) { - case POPULATE_ID: - if (mPopulatingTask != null) { - mPopulatingTask.cancel(false); - } - mPopulatingTask = new AsyncTask() { - @Override protected Void doInBackground(Void... params) { - for (char c='Z'; c>='A'; c--) { - if (isCancelled()) { - break; - } - StringBuilder builder = new StringBuilder("Data "); - builder.append(c); - ContentValues values = new ContentValues(); - values.put(MainTable.COLUMN_NAME_DATA, builder.toString()); - cr.insert(MainTable.CONTENT_URI, values); - // Wait a bit between each insert. - try { - Thread.sleep(250); - } catch (InterruptedException e) { - } - } - return null; - } - }; - mPopulatingTask.execute((Void[]) null); - return true; - - case CLEAR_ID: - if (mPopulatingTask != null) { - mPopulatingTask.cancel(false); - mPopulatingTask = null; - } - AsyncTask task = new AsyncTask() { - @Override protected Void doInBackground(Void... params) { - cr.delete(MainTable.CONTENT_URI, null, null); - return null; - } - }; - task.execute((Void[])null); - return true; - - default: - return super.onOptionsItemSelected(item); - } - } - - @Override public void onListItemClick(ListView l, View v, int position, long id) { - // Insert desired behavior here. - Log.i(TAG, "Item clicked: " + id); - } - - // These are the rows that we will retrieve. - static final String[] PROJECTION = new String[] { - MainTable._ID, - MainTable.COLUMN_NAME_DATA, - }; - - public Loader onCreateLoader(int id, Bundle args) { - CursorLoader cl = new CursorLoader(getActivity(), MainTable.CONTENT_URI, - PROJECTION, null, null, null); - cl.setUpdateThrottle(2000); // update at most every 2 seconds. - return cl; - } - - public void onLoadFinished(Loader loader, Cursor data) { - mAdapter.swapCursor(data); - - // The list should now be shown. - if (isResumed()) { - setListShown(true); - } else { - setListShownNoAnimation(true); - } - } - - public void onLoaderReset(Loader loader) { - mAdapter.swapCursor(null); - } - } -} - diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/SampleList.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/SampleList.java deleted file mode 100755 index 5ec19f19f..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/SampleList.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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.fragments; - -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> getData(String prefix) { - List> myData = new ArrayList>(); - - Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); - mainIntent.addCategory("com.actionbarsherlock.sample.fragments.EXAMPLE"); - - PackageManager pm = getPackageManager(); - List 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 entries = new HashMap(); - - 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> sDisplayNameComparator = - new Comparator>() { - private final Collator collator = Collator.getInstance(); - - public int compare(Map map1, Map 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> data, String name, Intent intent) { - Map temp = new HashMap(); - 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 map = (Map)l.getItemAtPosition(position); - - Intent intent = (Intent) map.get("intent"); - startActivity(intent); - } -} diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/SendResult.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/SendResult.java deleted file mode 100755 index fa1c28aaa..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/SendResult.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2007 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.fragments; - -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.Button; -import com.actionbarsherlock.app.SherlockActivity; - - -/** - * Example of receiving a result from another activity. - */ -public class SendResult extends SherlockActivity -{ - /** - * Initialization of the Activity after it is first created. Must at least - * call {@link android.app.Activity#setContentView setContentView()} to - * describe what is to be displayed in the screen. - */ - @Override - protected void onCreate(Bundle savedInstanceState) - { - setTheme(SampleList.THEME); //Used for theme switching in samples - // Be sure to call the super class. - super.onCreate(savedInstanceState); - - // See assets/res/any/layout/hello_world.xml for this - // view layout definition, which is being set here as - // the content of our screen. - setContentView(R.layout.send_result); - - // Watch for button clicks. - Button button = (Button)findViewById(R.id.corky); - button.setOnClickListener(mCorkyListener); - button = (Button)findViewById(R.id.violet); - button.setOnClickListener(mVioletListener); - } - - private OnClickListener mCorkyListener = new OnClickListener() - { - public void onClick(View v) - { - // To send a result, simply call setResult() before your - // activity is finished. - setResult(RESULT_OK, (new Intent()).setAction("Corky!")); - finish(); - } - }; - - private OnClickListener mVioletListener = new OnClickListener() - { - public void onClick(View v) - { - // To send a result, simply call setResult() before your - // activity is finished. - setResult(RESULT_OK, (new Intent()).setAction("Violet!")); - finish(); - } - }; -} - diff --git a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/Shakespeare.java b/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/Shakespeare.java deleted file mode 100755 index 66e243fa3..000000000 --- a/actionbarsherlock/samples/fragments/src/com/actionbarsherlock/sample/fragments/Shakespeare.java +++ /dev/null @@ -1,223 +0,0 @@ -package com.actionbarsherlock.sample.fragments; - -public final class Shakespeare { - /** - * Our data, part 1. - */ - public static final String[] TITLES = - { - "Henry IV (1)", - "Henry V", - "Henry VIII", - "Richard II", - "Richard III", - "Merchant of Venice", - "Othello", - "King Lear" - }; - - /** - * Our data, part 2. - */ - public static final String[] DIALOGUE = - { - "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/actionbarsherlock/samples/known-bugs/AndroidManifest.xml b/actionbarsherlock/samples/known-bugs/AndroidManifest.xml deleted file mode 100755 index 110a7cb08..000000000 --- a/actionbarsherlock/samples/known-bugs/AndroidManifest.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/known-bugs/README.md b/actionbarsherlock/samples/known-bugs/README.md deleted file mode 100755 index aa19bef0b..000000000 --- a/actionbarsherlock/samples/known-bugs/README.md +++ /dev/null @@ -1,11 +0,0 @@ -ActionBarSherlock Sample: Known Bugs -==================================== - -This sample demonstrates the known bugs at the time of release. By having this -included and revisioned with the library we allow for easier verification of -regressions and fixes. - -If you want to submit a new bug to the library it would be extremely helpful -if you filed a separate pull request which adds a test case. Doing so will -ensure we can reproduce your bug properly and ensure that a proper fix gets -implemented. \ No newline at end of file diff --git a/actionbarsherlock/samples/known-bugs/libs/android-support-v4.jar b/actionbarsherlock/samples/known-bugs/libs/android-support-v4.jar deleted file mode 100755 index 99e063b33..000000000 Binary files a/actionbarsherlock/samples/known-bugs/libs/android-support-v4.jar and /dev/null differ diff --git a/actionbarsherlock/samples/known-bugs/pom.xml b/actionbarsherlock/samples/known-bugs/pom.xml deleted file mode 100755 index fb142d0d5..000000000 --- a/actionbarsherlock/samples/known-bugs/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - 4.0.0 - - sample-known-bugs - Sample: Known Bugs - apk - - - com.actionbarsherlock - parent-sample - 4.2.0 - ../pom.xml - - - - - com.google.android - android - provided - - - - com.actionbarsherlock - actionbarsherlock - ${project.version} - apklib - - - - - src - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - true - - - - org.apache.maven.plugins - maven-javadoc-plugin - - true - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - ../../checkstyle.xml - - - - verify - - checkstyle - - - - - - - diff --git a/actionbarsherlock/samples/known-bugs/project.properties b/actionbarsherlock/samples/known-bugs/project.properties deleted file mode 100755 index d29d6c7e1..000000000 --- a/actionbarsherlock/samples/known-bugs/project.properties +++ /dev/null @@ -1,17 +0,0 @@ -# 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/actionbarsherlock/samples/known-bugs/res/anim/issue331_refresh.xml b/actionbarsherlock/samples/known-bugs/res/anim/issue331_refresh.xml deleted file mode 100755 index 30de199a7..000000000 --- a/actionbarsherlock/samples/known-bugs/res/anim/issue331_refresh.xml +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file diff --git a/actionbarsherlock/samples/known-bugs/res/drawable-hdpi/ic_refresh.png b/actionbarsherlock/samples/known-bugs/res/drawable-hdpi/ic_refresh.png deleted file mode 100755 index 08c32e09e..000000000 Binary files a/actionbarsherlock/samples/known-bugs/res/drawable-hdpi/ic_refresh.png and /dev/null differ diff --git a/actionbarsherlock/samples/known-bugs/res/drawable-hdpi/icon.png b/actionbarsherlock/samples/known-bugs/res/drawable-hdpi/icon.png deleted file mode 100755 index 723fbf062..000000000 Binary files a/actionbarsherlock/samples/known-bugs/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/known-bugs/res/drawable-ldpi/icon.png b/actionbarsherlock/samples/known-bugs/res/drawable-ldpi/icon.png deleted file mode 100755 index 181f679f5..000000000 Binary files a/actionbarsherlock/samples/known-bugs/res/drawable-ldpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/known-bugs/res/drawable-mdpi/ic_refresh.png b/actionbarsherlock/samples/known-bugs/res/drawable-mdpi/ic_refresh.png deleted file mode 100755 index 55c43c327..000000000 Binary files a/actionbarsherlock/samples/known-bugs/res/drawable-mdpi/ic_refresh.png and /dev/null differ diff --git a/actionbarsherlock/samples/known-bugs/res/drawable-mdpi/icon.png b/actionbarsherlock/samples/known-bugs/res/drawable-mdpi/icon.png deleted file mode 100755 index 79f50d84c..000000000 Binary files a/actionbarsherlock/samples/known-bugs/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/known-bugs/res/drawable-xhdpi/icon.png b/actionbarsherlock/samples/known-bugs/res/drawable-xhdpi/icon.png deleted file mode 100755 index 34ca9a489..000000000 Binary files a/actionbarsherlock/samples/known-bugs/res/drawable-xhdpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/known-bugs/res/layout/issue240.xml b/actionbarsherlock/samples/known-bugs/res/layout/issue240.xml deleted file mode 100755 index ba63ee4a5..000000000 --- a/actionbarsherlock/samples/known-bugs/res/layout/issue240.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - diff --git a/actionbarsherlock/samples/known-bugs/res/layout/issue272_fragment_pager.xml b/actionbarsherlock/samples/known-bugs/res/layout/issue272_fragment_pager.xml deleted file mode 100755 index 32f7c8fac..000000000 --- a/actionbarsherlock/samples/known-bugs/res/layout/issue272_fragment_pager.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/known-bugs/res/layout/issue272_fragment_pager_list.xml b/actionbarsherlock/samples/known-bugs/res/layout/issue272_fragment_pager_list.xml deleted file mode 100755 index 363174fd1..000000000 --- a/actionbarsherlock/samples/known-bugs/res/layout/issue272_fragment_pager_list.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/known-bugs/res/layout/issue331_action_view.xml b/actionbarsherlock/samples/known-bugs/res/layout/issue331_action_view.xml deleted file mode 100755 index e77ec088b..000000000 --- a/actionbarsherlock/samples/known-bugs/res/layout/issue331_action_view.xml +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/actionbarsherlock/samples/known-bugs/res/values/issue379.xml b/actionbarsherlock/samples/known-bugs/res/values/issue379.xml deleted file mode 100755 index 363708898..000000000 --- a/actionbarsherlock/samples/known-bugs/res/values/issue379.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - \ No newline at end of file diff --git a/actionbarsherlock/samples/known-bugs/res/values/strings.xml b/actionbarsherlock/samples/known-bugs/res/values/strings.xml deleted file mode 100755 index 4dc424951..000000000 --- a/actionbarsherlock/samples/known-bugs/res/values/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - ActionBarSherlock Known Bugs - ABS: Bugs - diff --git a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue240.java b/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue240.java deleted file mode 100755 index 6c214b905..000000000 --- a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue240.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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.knownbugs; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentStatePagerAdapter; -import android.support.v4.app.FragmentTransaction; -import android.support.v4.view.ViewPager; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; -import com.actionbarsherlock.app.ActionBar; -import com.actionbarsherlock.app.SherlockFragment; -import com.actionbarsherlock.app.SherlockFragmentActivity; - -import static android.support.v4.view.ViewPager.OnPageChangeListener; -import static android.view.Gravity.CENTER; -import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; -import static com.actionbarsherlock.app.ActionBar.NAVIGATION_MODE_TABS; -import static com.actionbarsherlock.app.ActionBar.TabListener; - -public class Issue240 extends SherlockFragmentActivity implements OnPageChangeListener, TabListener { - private static final int COUNT = 10; - - ViewPager mPager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.issue240); - - mPager = (ViewPager)findViewById(R.id.pager); - mPager.setAdapter(new MyAdapter(getSupportFragmentManager())); - mPager.setOnPageChangeListener(this); - - ActionBar ab = getSupportActionBar(); - ab.setNavigationMode(NAVIGATION_MODE_TABS); - for (int i = 1; i <= COUNT; i++) { - ab.addTab(ab.newTab().setText("Tab " + i).setTabListener(this)); - } - } - - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - } - - @Override - public void onPageSelected(int position) { - getSupportActionBar().setSelectedNavigationItem(position); - } - - @Override - public void onPageScrollStateChanged(int state) { - } - - @Override - public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { - mPager.setCurrentItem(tab.getPosition()); - } - - @Override - public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) { - } - - @Override - public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { - } - - public static class MyAdapter extends FragmentStatePagerAdapter { - public MyAdapter(FragmentManager fm) { - super(fm); - } - - @Override - public int getCount() { - return COUNT; - } - - @Override - public Fragment getItem(int position) { - return BoringFragment.newInstance(position + 1); - } - } - - public static class BoringFragment extends SherlockFragment { - int mNum; - - /** - * Create a new instance of CountingFragment, providing "num" - * as an argument. - */ - static BoringFragment newInstance(int num) { - BoringFragment f = new BoringFragment(); - - // Supply num input as an argument. - Bundle args = new Bundle(); - args.putInt("num", num); - f.setArguments(args); - - return f; - } - - /** - * When creating, retrieve this instance's number from its arguments. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mNum = getArguments() != null ? getArguments().getInt("num") : 1; - } - - /** - * The Fragment's UI is just a simple text view showing its - * instance number. - */ - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - TextView tv = new TextView(getActivity()); - tv.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)); - tv.setText("Fragment #" + mNum); - tv.setGravity(CENTER); - return tv; - } - - } -} - diff --git a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue272.java b/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue272.java deleted file mode 100755 index d4f16e5b5..000000000 --- a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue272.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * 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.knownbugs; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentStatePagerAdapter; -import android.support.v4.view.ViewPager; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.ListView; -import android.widget.TextView; -import android.widget.Toast; -import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.actionbarsherlock.app.SherlockListFragment; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuInflater; -import com.actionbarsherlock.view.MenuItem; - -public class Issue272 extends SherlockFragmentActivity { - static final int NUM_ITEMS = 10; - - MyAdapter mAdapter; - - ViewPager mPager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.issue272_fragment_pager); - - mAdapter = new MyAdapter(getSupportFragmentManager()); - - mPager = (ViewPager) findViewById(R.id.pager); - mPager.setAdapter(mAdapter); - - // Watch for button clicks. - Button button = (Button) findViewById(R.id.goto_first); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - mPager.setCurrentItem(0); - } - }); - button = (Button) findViewById(R.id.goto_last); - button.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - mPager.setCurrentItem(NUM_ITEMS - 1); - } - }); - } - - public static class MyAdapter extends FragmentStatePagerAdapter { - public MyAdapter(FragmentManager fm) { - super(fm); - } - - @Override - public int getCount() { - return NUM_ITEMS; - } - - @Override - public Fragment getItem(int position) { - return ArrayListFragment.newInstance(position); - } - } - - public static class ArrayListFragment extends SherlockListFragment { - int mNum; - - /** - * Create a new instance of CountingFragment, providing "num" - * as an argument. - */ - static ArrayListFragment newInstance(int num) { - ArrayListFragment f = new ArrayListFragment(); - - // Supply num input as an argument. - Bundle args = new Bundle(); - args.putInt("num", num); - f.setArguments(args); - - return f; - } - - /** - * When creating, retrieve this instance's number from its arguments. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mNum = getArguments() != null ? getArguments().getInt("num") : 1; - // tell the hosting activity we have options menu - setHasOptionsMenu(true); - } - - /** - * The Fragment's UI is just a simple text view showing its - * instance number. - */ - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.issue272_fragment_pager_list, container, false); - View tv = v.findViewById(R.id.text); - ((TextView) tv).setText("Fragment #" + mNum); - return v; - } - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - setListAdapter(new ArrayAdapter(getActivity(), - android.R.layout.simple_list_item_1, sCheeseStrings)); - } - - @Override - public void onListItemClick(ListView l, View v, int position, long id) { - Log.i("FragmentList", "Item clicked: " + id); - } - - // create our fragment's options menu - - @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - - menu.add("Refresh") - .setIcon(R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - menu.add("Save") - .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - Toast.makeText(getActivity(), item.getTitle() + " action for page " + mNum, Toast.LENGTH_SHORT).show(); - return true; - } - - - } - - public static final String[] sCheeseStrings = { - "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi", - "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", - "Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese", - "Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-Bilh", "Anthoriro", "Appenzell", - "Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "Aromes au Gene de Marc", - "Asadero", "Asiago", "Aubisque Pyrenees", "Autun", "Avaxtskyr", "Baby Swiss", - "Babybel", "Baguette Laonnaise", "Bakers", "Baladi", "Balaton", "Bandal", "Banon", - "Barry's Bay Cheddar", "Basing", "Basket Cheese", "Bath Cheese", "Bavarian Bergkase", - "Baylough", "Beaufort", "Beauvoorde", "Beenleigh Blue", "Beer Cheese", "Bel Paese", - "Bergader", "Bergere Bleue", "Berkswell", "Beyaz Peynir", "Bierkase", "Bishop Kennedy", - "Blarney", "Bleu d'Auvergne", "Bleu de Gex", "Bleu de Laqueuille", - "Bleu de Septmoncel", "Bleu Des Causses", "Blue", "Blue Castello", "Blue Rathgore", - "Blue Vein (Australian)", "Blue Vein Cheeses", "Bocconcini", "Bocconcini (Australian)", - "Boeren Leidenkaas", "Bonchester", "Bosworth", "Bougon", "Boule Du Roves", - "Boulette d'Avesnes", "Boursault", "Boursin", "Bouyssou", "Bra", "Braudostur", - "Breakfast Cheese", "Brebis du Lavort", "Brebis du Lochois", "Brebis du Puyfaucon", - "Bresse Bleu", "Brick", "Brie", "Brie de Meaux", "Brie de Melun", "Brillat-Savarin", - "Brin", "Brin d' Amour", "Brin d'Amour", "Brinza (Burduf Brinza)", - "Briquette de Brebis", "Briquette du Forez", "Broccio", "Broccio Demi-Affine", - "Brousse du Rove", "Bruder Basil", "Brusselae Kaas (Fromage de Bruxelles)", "Bryndza", - "Buchette d'Anjou", "Buffalo", "Burgos", "Butte", "Butterkase", "Button (Innes)", - "Buxton Blue", "Cabecou", "Caboc", "Cabrales", "Cachaille", "Caciocavallo", "Caciotta", - "Caerphilly", "Cairnsmore", "Calenzana", "Cambazola", "Camembert de Normandie", - "Canadian Cheddar", "Canestrato", "Cantal", "Caprice des Dieux", "Capricorn Goat", - "Capriole Banon", "Carre de l'Est", "Casciotta di Urbino", "Cashel Blue", "Castellano", - "Castelleno", "Castelmagno", "Castelo Branco", "Castigliano", "Cathelain", - "Celtic Promise", "Cendre d'Olivet", "Cerney", "Chabichou", "Chabichou du Poitou", - "Chabis de Gatine", "Chaource", "Charolais", "Chaumes", "Cheddar", - "Cheddar Clothbound", "Cheshire", "Chevres", "Chevrotin des Aravis", "Chontaleno", - "Civray", "Coeur de Camembert au Calvados", "Coeur de Chevre", "Colby", "Cold Pack", - "Comte", "Coolea", "Cooleney", "Coquetdale", "Corleggy", "Cornish Pepper", - "Cotherstone", "Cotija", "Cottage Cheese", "Cottage Cheese (Australian)", - "Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese", - "Cream Havarti", "Crema Agria", "Crema Mexicana", "Creme Fraiche", "Crescenza", - "Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley", - "Cuajada", "Curd", "Cure Nantais", "Curworthy", "Cwmtawe Pecorino", - "Cypress Grove Chevre", "Danablu (Danish Blue)", "Danbo", "Danish Fontina", - "Daralagjazsky", "Dauphin", "Delice des Fiouves", "Denhany Dorset Drum", "Derby", - "Dessertnyj Belyj", "Devon Blue", "Devon Garland", "Dolcelatte", "Doolin", - "Doppelrhamstufel", "Dorset Blue Vinney", "Double Gloucester", "Double Worcester", - "Dreux a la Feuille", "Dry Jack", "Duddleswell", "Dunbarra", "Dunlop", "Dunsyre Blue", - "Duroblando", "Durrus", "Dutch Mimolette (Commissiekaas)", "Edam", "Edelpilz", - "Emental Grand Cru", "Emlett", "Emmental", "Epoisses de Bourgogne", "Esbareich", - "Esrom", "Etorki", "Evansdale Farmhouse Brie", "Evora De L'Alentejo", "Exmoor Blue", - "Explorateur", "Feta", "Feta (Australian)", "Figue", "Filetta", "Fin-de-Siecle", - "Finlandia Swiss", "Finn", "Fiore Sardo", "Fleur du Maquis", "Flor de Guia", - "Flower Marie", "Folded", "Folded cheese with mint", "Fondant de Brebis", - "Fontainebleau", "Fontal", "Fontina Val d'Aosta", "Formaggio di capra", "Fougerus", - "Four Herb Gouda", "Fourme d' Ambert", "Fourme de Haute Loire", "Fourme de Montbrison", - "Fresh Jack", "Fresh Mozzarella", "Fresh Ricotta", "Fresh Truffles", "Fribourgeois", - "Friesekaas", "Friesian", "Friesla", "Frinault", "Fromage a Raclette", "Fromage Corse", - "Fromage de Montagne de Savoie", "Fromage Frais", "Fruit Cream Cheese", - "Frying Cheese", "Fynbo", "Gabriel", "Galette du Paludier", "Galette Lyonnaise", - "Galloway Goat's Milk Gems", "Gammelost", "Gaperon a l'Ail", "Garrotxa", "Gastanberra", - "Geitost", "Gippsland Blue", "Gjetost", "Gloucester", "Golden Cross", "Gorgonzola", - "Gornyaltajski", "Gospel Green", "Gouda", "Goutu", "Gowrie", "Grabetto", "Graddost", - "Grafton Village Cheddar", "Grana", "Grana Padano", "Grand Vatel", - "Grataron d' Areches", "Gratte-Paille", "Graviera", "Greuilh", "Greve", - "Gris de Lille", "Gruyere", "Gubbeen", "Guerbigny", "Halloumi", - "Halloumy (Australian)", "Haloumi-Style Cheese", "Harbourne Blue", "Havarti", - "Heidi Gruyere", "Hereford Hop", "Herrgardsost", "Herriot Farmhouse", "Herve", - "Hipi Iti", "Hubbardston Blue Cow", "Hushallsost", "Iberico", "Idaho Goatster", - "Idiazabal", "Il Boschetto al Tartufo", "Ile d'Yeu", "Isle of Mull", "Jarlsberg", - "Jermi Tortes", "Jibneh Arabieh", "Jindi Brie", "Jubilee Blue", "Juustoleipa", - "Kadchgall", "Kaseri", "Kashta", "Kefalotyri", "Kenafa", "Kernhem", "Kervella Affine", - "Kikorangi", "King Island Cape Wickham Brie", "King River Gold", "Klosterkaese", - "Knockalara", "Kugelkase", "L'Aveyronnais", "L'Ecir de l'Aubrac", "La Taupiniere", - "La Vache Qui Rit", "Laguiole", "Lairobell", "Lajta", "Lanark Blue", "Lancashire", - "Langres", "Lappi", "Laruns", "Lavistown", "Le Brin", "Le Fium Orbo", "Le Lacandou", - "Le Roule", "Leafield", "Lebbene", "Leerdammer", "Leicester", "Leyden", "Limburger", - "Lincolnshire Poacher", "Lingot Saint Bousquet d'Orb", "Liptauer", "Little Rydings", - "Livarot", "Llanboidy", "Llanglofan Farmhouse", "Loch Arthur Farmhouse", - "Loddiswell Avondale", "Longhorn", "Lou Palou", "Lou Pevre", "Lyonnais", "Maasdam", - "Macconais", "Mahoe Aged Gouda", "Mahon", "Malvern", "Mamirolle", "Manchego", - "Manouri", "Manur", "Marble Cheddar", "Marbled Cheeses", "Maredsous", "Margotin", - "Maribo", "Maroilles", "Mascares", "Mascarpone", "Mascarpone (Australian)", - "Mascarpone Torta", "Matocq", "Maytag Blue", "Meira", "Menallack Farmhouse", - "Menonita", "Meredith Blue", "Mesost", "Metton (Cancoillotte)", "Meyer Vintage Gouda", - "Mihalic Peynir", "Milleens", "Mimolette", "Mine-Gabhar", "Mini Baby Bells", "Mixte", - "Molbo", "Monastery Cheeses", "Mondseer", "Mont D'or Lyonnais", "Montasio", - "Monterey Jack", "Monterey Jack Dry", "Morbier", "Morbier Cru de Montagne", - "Mothais a la Feuille", "Mozzarella", "Mozzarella (Australian)", - "Mozzarella di Bufala", "Mozzarella Fresh, in water", "Mozzarella Rolls", "Munster", - "Murol", "Mycella", "Myzithra", "Naboulsi", "Nantais", "Neufchatel", - "Neufchatel (Australian)", "Niolo", "Nokkelost", "Northumberland", "Oaxaca", - "Olde York", "Olivet au Foin", "Olivet Bleu", "Olivet Cendre", - "Orkney Extra Mature Cheddar", "Orla", "Oschtjepka", "Ossau Fermier", "Ossau-Iraty", - "Oszczypek", "Oxford Blue", "P'tit Berrichon", "Palet de Babligny", "Paneer", "Panela", - "Pannerone", "Pant ys Gawn", "Parmesan (Parmigiano)", "Parmigiano Reggiano", - "Pas de l'Escalette", "Passendale", "Pasteurized Processed", "Pate de Fromage", - "Patefine Fort", "Pave d'Affinois", "Pave d'Auge", "Pave de Chirac", "Pave du Berry", - "Pecorino", "Pecorino in Walnut Leaves", "Pecorino Romano", "Peekskill Pyramid", - "Pelardon des Cevennes", "Pelardon des Corbieres", "Penamellera", "Penbryn", - "Pencarreg", "Perail de Brebis", "Petit Morin", "Petit Pardou", "Petit-Suisse", - "Picodon de Chevre", "Picos de Europa", "Piora", "Pithtviers au Foin", - "Plateau de Herve", "Plymouth Cheese", "Podhalanski", "Poivre d'Ane", "Polkolbin", - "Pont l'Eveque", "Port Nicholson", "Port-Salut", "Postel", "Pouligny-Saint-Pierre", - "Pourly", "Prastost", "Pressato", "Prince-Jean", "Processed Cheddar", "Provolone", - "Provolone (Australian)", "Pyengana Cheddar", "Pyramide", "Quark", - "Quark (Australian)", "Quartirolo Lombardo", "Quatre-Vents", "Quercy Petit", - "Queso Blanco", "Queso Blanco con Frutas --Pina y Mango", "Queso de Murcia", - "Queso del Montsec", "Queso del Tietar", "Queso Fresco", "Queso Fresco (Adobera)", - "Queso Iberico", "Queso Jalapeno", "Queso Majorero", "Queso Media Luna", - "Queso Para Frier", "Queso Quesadilla", "Rabacal", "Raclette", "Ragusano", "Raschera", - "Reblochon", "Red Leicester", "Regal de la Dombes", "Reggianito", "Remedou", - "Requeson", "Richelieu", "Ricotta", "Ricotta (Australian)", "Ricotta Salata", "Ridder", - "Rigotte", "Rocamadour", "Rollot", "Romano", "Romans Part Dieu", "Roncal", "Roquefort", - "Roule", "Rouleau De Beaulieu", "Royalp Tilsit", "Rubens", "Rustinu", "Saaland Pfarr", - "Saanenkaese", "Saga", "Sage Derby", "Sainte Maure", "Saint-Marcellin", - "Saint-Nectaire", "Saint-Paulin", "Salers", "Samso", "San Simon", "Sancerre", - "Sap Sago", "Sardo", "Sardo Egyptian", "Sbrinz", "Scamorza", "Schabzieger", "Schloss", - "Selles sur Cher", "Selva", "Serat", "Seriously Strong Cheddar", "Serra da Estrela", - "Sharpam", "Shelburne Cheddar", "Shropshire Blue", "Siraz", "Sirene", "Smoked Gouda", - "Somerset Brie", "Sonoma Jack", "Sottocenare al Tartufo", "Soumaintrain", - "Sourire Lozerien", "Spenwood", "Sraffordshire Organic", "St. Agur Blue Cheese", - "Stilton", "Stinking Bishop", "String", "Sussex Slipcote", "Sveciaost", "Swaledale", - "Sweet Style Swiss", "Swiss", "Syrian (Armenian String)", "Tala", "Taleggio", "Tamie", - "Tasmania Highland Chevre Log", "Taupiniere", "Teifi", "Telemea", "Testouri", - "Tete de Moine", "Tetilla", "Texas Goat Cheese", "Tibet", "Tillamook Cheddar", - "Tilsit", "Timboon Brie", "Toma", "Tomme Brulee", "Tomme d'Abondance", - "Tomme de Chevre", "Tomme de Romans", "Tomme de Savoie", "Tomme des Chouans", "Tommes", - "Torta del Casar", "Toscanello", "Touree de L'Aubier", "Tourmalet", - "Trappe (Veritable)", "Trois Cornes De Vendee", "Tronchon", "Trou du Cru", "Truffe", - "Tupi", "Turunmaa", "Tymsboro", "Tyn Grug", "Tyning", "Ubriaco", "Ulloa", - "Vacherin-Fribourgeois", "Valencay", "Vasterbottenost", "Venaco", "Vendomois", - "Vieux Corse", "Vignotte", "Vulscombe", "Waimata Farmhouse Blue", - "Washed Rind Cheese (Australian)", "Waterloo", "Weichkaese", "Wellington", - "Wensleydale", "White Stilton", "Whitestone Farmhouse", "Wigmore", "Woodside Cabecou", - "Xanadu", "Xynotyro", "Yarg Cornish", "Yarra Valley Pyramid", "Yorkshire Blue", - "Zamorano", "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano" - }; -} - diff --git a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue331.java b/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue331.java deleted file mode 100755 index 259d9b10a..000000000 --- a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue331.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.actionbarsherlock.sample.knownbugs; - -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.animation.Animation; -import android.view.animation.AnimationUtils; -import android.widget.Button; -import android.widget.ImageView; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; - -import static android.view.View.OnClickListener; - -public class Issue331 extends SherlockActivity { - boolean mShow = true; - - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - Button b = new Button(this); - b.setText("Click action item and then this button twice on pre-ICS"); - b.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - mShow = !mShow; - invalidateOptionsMenu(); - } - }); - setContentView(b); - } - - public boolean onCreateOptionsMenu(Menu menu) { - if (mShow) { - menu.add("Refresh").setIcon(R.drawable.ic_refresh).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - } - return mShow; - } - - public boolean onOptionsItemSelected(MenuItem item) { - ImageView iv = (ImageView) LayoutInflater.from(this).inflate(R.layout.issue331_action_view, null); - Animation r = AnimationUtils.loadAnimation(this, R.anim.issue331_refresh); - r.setRepeatCount(Animation.INFINITE); - iv.startAnimation(r); - item.setActionView(iv); - return true; - } -} diff --git a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue379.java b/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue379.java deleted file mode 100755 index 954764cb2..000000000 --- a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue379.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.knownbugs; - -import android.os.Bundle; -import android.support.v4.app.FragmentTransaction; -import android.widget.TextView; -import com.actionbarsherlock.app.ActionBar; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; - -import static com.actionbarsherlock.app.ActionBar.NAVIGATION_MODE_TABS; -import static com.actionbarsherlock.view.MenuItem.SHOW_AS_ACTION_ALWAYS; -import static com.actionbarsherlock.view.MenuItem.SHOW_AS_ACTION_WITH_TEXT; - -public class Issue379 extends SherlockActivity implements ActionBar.TabListener { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - ActionBar ab = getSupportActionBar(); - ab.setNavigationMode(NAVIGATION_MODE_TABS); - ab.addTab(ab.newTab().setTabListener(this).setText("Test")); - - TextView tv = new TextView(this); - tv.setText("ColorDrawable ignores bounds on pre-HC. Make sure you see three colors."); - setContentView(tv); - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - menu.add("Test").setShowAsAction(SHOW_AS_ACTION_ALWAYS | SHOW_AS_ACTION_WITH_TEXT); - return true; - } - - @Override - public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { - } - - @Override - public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) { - } - - @Override - public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { - } -} diff --git a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue435.java b/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue435.java deleted file mode 100755 index 6b26565ed..000000000 --- a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/Issue435.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.actionbarsherlock.sample.knownbugs; - -import android.graphics.drawable.GradientDrawable; -import android.os.Bundle; -import android.support.v4.app.FragmentTransaction; -import android.view.View; -import android.widget.Button; -import android.widget.LinearLayout; -import android.widget.TextView; -import com.actionbarsherlock.app.ActionBar; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.ActionMode; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; - -import static android.graphics.drawable.GradientDrawable.Orientation.TOP_BOTTOM; - -public class Issue435 extends SherlockActivity implements View.OnClickListener, ActionBar.TabListener { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - LinearLayout layout = new LinearLayout(this); - layout.setOrientation(LinearLayout.VERTICAL); - - TextView t = new TextView(this); - t.setText("Must be on a portrait device where the tabs are stacked. Stacked background will disappear when action mode is triggered."); - layout.addView(t); - - Button b = new Button(this); - b.setText("Start ActionMode"); - b.setOnClickListener(this); - layout.addView(b); - - setContentView(layout); - - ActionBar ab = getSupportActionBar(); - ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); - ab.addTab(ab.newTab().setText("One").setTabListener(this)); - ab.addTab(ab.newTab().setText("One").setTabListener(this)); - ab.addTab(ab.newTab().setText("One").setTabListener(this)); - - ab.setBackgroundDrawable(new GradientDrawable(TOP_BOTTOM, new int[] { 0xFF004400, 0xFF002200 })); - ab.setStackedBackgroundDrawable(new GradientDrawable(TOP_BOTTOM, new int[] { 0xFF440000, 0xFF220000 })); - } - - @Override public void onClick(View v) { - ActionMode am = startActionMode(new SuperSweetActionModeOfScience()); - am.setTitle("Hello, Broken?"); - } - - @Override - public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { - /* Empty */ - } - - @Override - public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) { - /* Empty */ - } - - @Override - public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { - /* Empty */ - } - - private static final class SuperSweetActionModeOfScience implements ActionMode.Callback { - @Override - public boolean onCreateActionMode(ActionMode mode, Menu menu) { - return true; - } - - @Override - public boolean onPrepareActionMode(ActionMode mode, Menu menu) { - return false; - } - - @Override - public boolean onActionItemClicked(ActionMode mode, MenuItem item) { - return false; - } - - @Override - public void onDestroyActionMode(ActionMode mode) { - /* Empty */ - } - } -} diff --git a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/SampleList.java b/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/SampleList.java deleted file mode 100755 index 4289a0273..000000000 --- a/actionbarsherlock/samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/SampleList.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2012 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.knownbugs; - -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.os.Bundle; -import android.support.v4.app.FragmentTransaction; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; -import android.widget.ListView; -import android.widget.TextView; -import com.actionbarsherlock.app.ActionBar; -import com.actionbarsherlock.app.SherlockListActivity; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static android.content.Intent.ACTION_MAIN; -import static com.actionbarsherlock.app.ActionBar.NAVIGATION_MODE_TABS; -import static java.util.Locale.ENGLISH; - -public class SampleList extends SherlockListActivity implements ActionBar.TabListener { - private final IntentAdapter mAdapter = new IntentAdapter(); - private String mCategory = "OPEN"; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - final ActionBar actionBar = getSupportActionBar(); - actionBar.setNavigationMode(NAVIGATION_MODE_TABS); - actionBar.addTab(actionBar.newTab().setText("Open").setTabListener(this)); - actionBar.addTab(actionBar.newTab().setText("Closed").setTabListener(this)); - - setListAdapter(mAdapter); - } - - @Override - @SuppressWarnings("unchecked") - protected void onListItemClick(ListView l, View v, int position, long id) { - startActivity(mAdapter.getItem(position)); - } - - @Override - public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { - mCategory = tab.getText().toString().toUpperCase(ENGLISH); - mAdapter.refresh(); - } - - @Override - public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) { - /* Empty */ - } - - @Override - public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { - /* Empty */ - } - - private class IntentAdapter extends BaseAdapter { - private final List mNames; - private final Map mIntents; - - IntentAdapter() { - mNames = new ArrayList(); - mIntents = new HashMap(); - } - - void refresh() { - mNames.clear(); - mIntents.clear(); - - final Intent mainIntent = new Intent(ACTION_MAIN, null); - mainIntent.addCategory("com.actionbarsherlock.sample.knownbugs." + mCategory); - - PackageManager pm = getPackageManager(); - final List matches = pm.queryIntentActivities(mainIntent, 0); - for (ResolveInfo match : matches) { - Intent intent = new Intent(); - intent.setClassName(match.activityInfo.packageName, match.activityInfo.name); - final CharSequence name = match.loadLabel(pm); - mNames.add(name); - mIntents.put(name, intent); - } - - notifyDataSetChanged(); - } - - @Override - public int getCount() { - return mNames.size(); - } - - @Override - public Intent getItem(int position) { - return mIntents.get(mNames.get(position)); - } - - @Override - public long getItemId(int position) { - return position; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - TextView tv = (TextView)convertView; - if (convertView == null) { - tv = (TextView) LayoutInflater.from(SampleList.this).inflate(android.R.layout.simple_list_item_1, parent, false); - } - tv.setText(mNames.get(position)); - return tv; - } - } -} diff --git a/actionbarsherlock/samples/pom.xml b/actionbarsherlock/samples/pom.xml deleted file mode 100755 index 8cf5dcc21..000000000 --- a/actionbarsherlock/samples/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - 4.0.0 - - parent-sample - Sample (Parent) - pom - - - com.actionbarsherlock - parent - 4.2.0 - ../pom.xml - - - - demos - fragments - known-bugs - roboguice - styled - - diff --git a/actionbarsherlock/samples/roboguice/AndroidManifest.xml b/actionbarsherlock/samples/roboguice/AndroidManifest.xml deleted file mode 100755 index 00a97fe08..000000000 --- a/actionbarsherlock/samples/roboguice/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/actionbarsherlock/samples/roboguice/README.md b/actionbarsherlock/samples/roboguice/README.md deleted file mode 100755 index ec09b5f27..000000000 --- a/actionbarsherlock/samples/roboguice/README.md +++ /dev/null @@ -1,16 +0,0 @@ -ActionBarSherlock Sample: RoboGuice -=================================== - -See [actionbarsherlock.com/samples.html][1] for information on the sample -contained in this folder. - -This sample uses the [roboguice-sherlock][2] plugin from Roberto Tyley. - - - - - - - - [1]: http://actionbarsherlock.com/samples.html - [2]: https://github.com/rtyley/roboguice-sherlock diff --git a/actionbarsherlock/samples/roboguice/libs/android-support-v4.jar b/actionbarsherlock/samples/roboguice/libs/android-support-v4.jar deleted file mode 100755 index 99e063b33..000000000 Binary files a/actionbarsherlock/samples/roboguice/libs/android-support-v4.jar and /dev/null differ diff --git a/actionbarsherlock/samples/roboguice/libs/guice-3.0-no_aop.jar b/actionbarsherlock/samples/roboguice/libs/guice-3.0-no_aop.jar deleted file mode 100755 index ef3a55b0c..000000000 Binary files a/actionbarsherlock/samples/roboguice/libs/guice-3.0-no_aop.jar and /dev/null differ diff --git a/actionbarsherlock/samples/roboguice/libs/javax.inject-1.jar b/actionbarsherlock/samples/roboguice/libs/javax.inject-1.jar deleted file mode 100755 index b2a9d0bf7..000000000 Binary files a/actionbarsherlock/samples/roboguice/libs/javax.inject-1.jar and /dev/null differ diff --git a/actionbarsherlock/samples/roboguice/libs/roboguice-2.0b4.jar b/actionbarsherlock/samples/roboguice/libs/roboguice-2.0b4.jar deleted file mode 100755 index 4704414f2..000000000 Binary files a/actionbarsherlock/samples/roboguice/libs/roboguice-2.0b4.jar and /dev/null differ diff --git a/actionbarsherlock/samples/roboguice/libs/roboguice-sherlock-1.0.jar b/actionbarsherlock/samples/roboguice/libs/roboguice-sherlock-1.0.jar deleted file mode 100755 index 604b007f1..000000000 Binary files a/actionbarsherlock/samples/roboguice/libs/roboguice-sherlock-1.0.jar and /dev/null differ diff --git a/actionbarsherlock/samples/roboguice/pom.xml b/actionbarsherlock/samples/roboguice/pom.xml deleted file mode 100755 index 4503b7f50..000000000 --- a/actionbarsherlock/samples/roboguice/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - 4.0.0 - - sample-roboguice - Sample: RoboGuice - apk - - - com.actionbarsherlock - parent-sample - 4.2.0 - ../pom.xml - - - - - com.google.android - android - provided - - - - com.actionbarsherlock - actionbarsherlock - ${project.version} - apklib - - - com.github.rtyley - roboguice-sherlock - - - - - src - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - true - - - - org.apache.maven.plugins - maven-javadoc-plugin - - true - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - ../../checkstyle.xml - - - - verify - - checkstyle - - - - - - - diff --git a/actionbarsherlock/samples/roboguice/project.properties b/actionbarsherlock/samples/roboguice/project.properties deleted file mode 100755 index 602c3af0e..000000000 --- a/actionbarsherlock/samples/roboguice/project.properties +++ /dev/null @@ -1,15 +0,0 @@ -# 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/actionbarsherlock/samples/roboguice/res/anim/expletive_animation.xml b/actionbarsherlock/samples/roboguice/res/anim/expletive_animation.xml deleted file mode 100755 index 9d11d8db3..000000000 --- a/actionbarsherlock/samples/roboguice/res/anim/expletive_animation.xml +++ /dev/null @@ -1,9 +0,0 @@ - - diff --git a/actionbarsherlock/samples/roboguice/res/drawable-hdpi/icon.png b/actionbarsherlock/samples/roboguice/res/drawable-hdpi/icon.png deleted file mode 100755 index 723fbf062..000000000 Binary files a/actionbarsherlock/samples/roboguice/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/roboguice/res/drawable-ldpi/icon.png b/actionbarsherlock/samples/roboguice/res/drawable-ldpi/icon.png deleted file mode 100755 index 181f679f5..000000000 Binary files a/actionbarsherlock/samples/roboguice/res/drawable-ldpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/roboguice/res/drawable-mdpi/icon.png b/actionbarsherlock/samples/roboguice/res/drawable-mdpi/icon.png deleted file mode 100755 index 79f50d84c..000000000 Binary files a/actionbarsherlock/samples/roboguice/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/roboguice/res/drawable-xhdpi/icon.png b/actionbarsherlock/samples/roboguice/res/drawable-xhdpi/icon.png deleted file mode 100755 index 34ca9a489..000000000 Binary files a/actionbarsherlock/samples/roboguice/res/drawable-xhdpi/icon.png and /dev/null differ diff --git a/actionbarsherlock/samples/roboguice/res/layout/fight_evil.xml b/actionbarsherlock/samples/roboguice/res/layout/fight_evil.xml deleted file mode 100755 index a44ecce67..000000000 --- a/actionbarsherlock/samples/roboguice/res/layout/fight_evil.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - diff --git a/actionbarsherlock/samples/roboguice/res/layout/main.xml b/actionbarsherlock/samples/roboguice/res/layout/main.xml deleted file mode 100755 index c608c7abd..000000000 --- a/actionbarsherlock/samples/roboguice/res/layout/main.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - -