diff --git a/external/JakeWharton-ActionBarSherlock/.gitignore b/external/JakeWharton-ActionBarSherlock/.gitignore new file mode 100644 index 00000000..fb211339 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/.gitignore @@ -0,0 +1,19 @@ +#Android generated +bin +gen + +#Eclipse +.project +.classpath +.settings + +#IntelliJ IDEA +.idea +*.iml + +#Maven +target +release.properties +pom.xml.* + +website/_site diff --git a/external/JakeWharton-ActionBarSherlock/CHANGELOG.md b/external/JakeWharton-ActionBarSherlock/CHANGELOG.md new file mode 100644 index 00000000..5fd4fe28 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/CHANGELOG.md @@ -0,0 +1,279 @@ +Change Log +=============================================================================== + +Version 3.3.0 *(2011-10-11)* +---------------------------- + + * Tabs are now displayed below the action bar on all medium-screen devices and + portrait large-screen devices. + * Fix: Dialog fragments no longer throw an `IllegalStateException` when being + used as a regular fragment (i.e., not as a popup). See + [StackOverflow](http://stackoverflow.com/questions/5637894/dialogfragments-with-devices-api-level-11/7560686#7560686) + for more information. + * Fix: Popping a fragment off of the back stack now properly assigns its parent + activity. + * Fix: An activity result no longer causes a `NullPointerException` when the + target fragment no longer exists. + * Fix: Action item dividers are now properly initially hidden when their + associated action items are as well. + + +Version 3.2.3 *(2011-09-16)* +---------------------------- + + * Fix: Fragments in a `ViewPager` that contributed items to the options menu + were caught in a race condition causing inconsistent results when a new page + was selected. This regression was introduced in version 3.2.2. + + +Version 3.2.2 *(2011-09-15)* +---------------------------- + + * Fix: Side-effects related to using `FragmentMapActivity` due to how it was + referencing resources from the main library. + * Fix: Fragments adjacent to the currently selected fragment in a `ViewPager` + no longer receive context menu events. + * Fix: Eliminate exception when inflating context menus on 3.0+ when using + `getMenuInflater()`. + * Fix: `ViewPager` now determines whether or not an activity menu invalidation + is required independently of whether or not fragments were created or + destroyed. This should fix an edge case where an activity with a `ViewPager` + containing only two fragments would not get its menu properly invalidated. + + +Version 3.2.1 *(2011-09-12)* +---------------------------- + + * Fix: Action mode API incorrectly using the native `Menu` and `MenuItem` + classes causing an easy pitfall for `ClassCastExceptions`. + * Fix: Large action bar backgrounds increasing the size beyond that alloted in + the theme. + + +Version 3.2.0 *(2011-09-05)* +---------------------------- + + * Added support for `MapView` and the Google APIs through the use of + `FragmentMapActivity`. If you are using a map within a fragment you must + ensure it is always attached to an activity which extends from this new base + class. + + Since supporting maps requires compiling against the Google APIs, this + functionality is implemented in the form of a plugin which is to be used + alongside the normal library. You can choose to add it as an additional + library project or by including it as a `.jar`. Maven users may simply + include the additional dependency (artifactId: `plugin-maps`). + * Fix: Fragments adjacent to the currently selected fragment in a `ViewPager` + no longer contribute to the activity menu. + * `ActionBar.Tab` has been changed from an interface to an abstract class to + mirror its native counterpart. + + +Version 3.1.3 *(2011-08-14)* +---------------------------- + + * Renamed all resources to be prefixed with `abs__` to avoid conflicts when + including in your project. + * Fix: Action bar background being set on two views causing artifacts to remain + on screen when the action bar was hidden. + * Fix: Incorrect sub-menu item being selected by default when the sub-menu was + triggered from the native options menu on pre-3.0. + * Fix: `MenuItem.setVisible` now properly updates the associated action item and + native menu item visible state. + * Fix: Adding items to a menu now honors its ordering and category. + * Fix: Fragment options item selected callback now uses the proper version of + `MenuItem`. + + +Version 3.1.2 *(2011-08-07)* +---------------------------- + + * Fix: `MenuItem.getMenuInfo()` was throwing runtime exception. Will now just + return `null`. + * Fix: Dragging over a `WebView` contained in a `ViewPager` would not register. + * Fix: Inflation of context menu incorrectly being handled by the custom menu + inflater for the library. + + +Version 3.1.1 *(2011-07-31)* +---------------------------- + + * Fix: `MenuItem.getSubMenu` now returns a support instance rather than a + native instance. + * Fix: Fragment methods `onAttach` and `onInflate` incorrectly regressed to use + `Activity` instead of a `FragmentActivity` in their method signatures. + * Fix: Retained fragments not being re-attached on pre-3.0 when attached to + `android.R.id.content` upon activity recreation. + * Fix: `onPrepareOptionsMenu` not dispatched to fragments. This still will only + occur if the activity method returns true (which is the default). + * Fix: `Menu.findItem` not returning `null` when the item was not found on + Android 3.0+. + + +Version 3.1.0 *(2011-07-22)* +---------------------------- + +Due to shortcomings in the Android theming system, a small change must be made +in how this library handles themes. If you were using a custom style for +`actionBarStyle` you must now specify its attributes in the root of the theme +and prefix them with 'ab'. + +You can see an example of this in the `SherlockCustom` theme in +`samples/demos/res/values/styles.xml`. + + * Library now uses the `r3` version of the compatibility library for its base. + * `actionBarStyle` is no longer a valid theme attribute (see note above). + * Added the demo project included with the new compatibility library under + `samples/demos/` and merged in the old 'featuredemo'. + * Dividers are now shown on pre-3.0 devices between all action items. + * `Window.FEATURE_ACTION_BAR_OVERLAY` is now honored on pre-3.0 devices. + * Inflation of XML menu resources will now honor `android:actionLayout` and + `android:actionViewClass` attributes. + * Buttons for displaying the determinate and indeterminate progress bars have + been added to the feature toggle demo. + * Added support for indeterminate progress bar. Due to the `final` modifier on + the native type, you must use `setIndeterminateProgressBarVisibility(Boolean)` + and pass `Boolean.TRUE` or `Boolean.FALSE`. + * Fix: `MenuBuilder#removeItem(int)` and `MenuBuilder#findItem(int)` throwing + `IndexOutOfBoundsException`s when the item was not found. + * Fix: Theme attributes for home item data (e.g., icon, logo) will not be + overwritten by the special `MenuItem` instance for home. + * Fix: Native strings can now be specified for an XML menu `` in + `android:title` and `android:titleCondensed`. + * `Window.FEATURE_ENABLE_ACTION_BAR_WATSON_TEXT` is now + `Window.FEATURE_ACTION_BAR_ITEM_TEXT`. + * `Widget.Sherlock.Spinner.DropDown.ActionBar` and + `Widget.Sherlock.Light.Spinner.DropDown.ActionBar` styles are now + `Widget.Sherlock.Spinner` and `Widget.Sherlock.Light.Spinner`, respectively. + * `Widget.Sherlock.ActionBarView_TabXXX` styles are now + `Widget.Sherlock.ActionBar.TabXXX`. + + +Version 3.0.3 *(2011-07-17)* +---------------------------- + +This version is a hotfix for incompatibilities introduced with the SDKs for +3.1 r2 and 3.2 r1. Due to unavoidable changes in the underlying SDK, the library +must now be compiled against API level 13. + + * `actionModeStyle` and `actionModePopupWindowStyle` are no longer valid theme + attributes. + + +Version 3.0.2 *(2011-06-23)* +---------------------------- + + * Sub-menus for action items are now shown in a list dialog. + * Moved certain classes to the `com.actionbarsherlock.internal` package which + were not meant for public consumption. Despite being given `public` scope in + this new package, these classes should **NOT** be used under any circumstances + as their API can be considered highly volatile and is subject to change often + and without warning. + + +Version 3.0.1 *(2011-06-08)* +---------------------------- + + * Fix: `onOptionsItemSelected()` not being called in fragments if the activity + version returns `false`. + * Fix: `onCreateOptionsMenu()` not being called in fragments on Android 3.0+. + * New: Enable action item text display on pre-Android 3.0 by calling + `requestWindowFeature` with `Window.FEATURE_ENABLE_ACTION_BAR_WATSON_TEXT`. + * Fix: `setCustomView()` no longer automatically enables the custom view on + pre-3.0. You must call `setDisplayShowCustomEnabled()` in order to display + the view. + + +Version 3.0.0 *(2011-06-05)* +---------------------------- + +The API has been rewritten to mimic that of the native action bar. As a result, +usage now only requires changing a few imports to use the support versions +of classes and calling `getSupportActionBar()`. See the README for more info. + +The rewrite necessitated tight interaction with the +[compatibility library](http://android-developers.blogspot.com/2011/03/fragments-for-all.html) +to the point where its sources are now included. You are no longer required to +have the standalone `.jar` file. + +Also included is a default custom action bar for use by default on pre-3.0 +devices. This custom implementation is based off of Johan Nilsson's +[Android-ActionBar](https://github.com/johannilsson/android-actionbar) and the +[work that I have done](https://github.com/johannilsson/android-actionbar/pull/25) +on it. + +More details are available at http://actionbarsherlock.com + + +Version 2.1.1 *(2011-03-21)* +---------------------------- + +**No changes to library code.** + + * Moved library to the root of the repository. + * Added `samples/dependencies.py` script to automatically download the needed + dependencies for the sample projects. + + +Version 2.1.0 *(2011-03-21)* +---------------------------- + +**WARNING**: The +[Android Compatibility Library (v4)](http://android-developers.blogspot.com/2011/03/fragments-for-all.html) +is now required. + + * Added `ActionBarSherlock.Activity`, `ActionBarSherlock.FragmentActivity`, + and `ActionBarSherlock.ListActivity` for extension by implementing + activities, the latter of which is deprecated. This affords a much tighter + integration and allows for the use of other new features listed below. + * New API method: `layout(Fragment)` will use the fragment argument as the + content to the activity. + * New API method: `menu(int)` allows for the inflation of menu XMLs from a + resource. For the non-native implementation, the XML can be inflated to a + custom Menu which can then be applied appropriately to the third-party + action bar. Sub-menus are also supported. Third-party action bar handlers + should implement `ActionBarSherlock.HasMenu` for this functionality. *This + feature requires that activities extend from one of the provided activity + base classes.* + * New API method: `homeAsUp(boolean)`. This mimics the native method + `setDisplayHomeAsUpEnalbed` on the native action bar. Third-party action bar + handlers should implement `ActionBarSherlock.HasHomeAsUp` for this + functionality. + * New API method: `useLogo(boolean)` will trigger the action bar to hide the + application icon/home button and title and show a larger logo representing + the application. Third-party action bar handlers should implement + `ActionBarSherlock.HasLogo` for this functionality. + * New API method: `listNavigation(SpinnerAdapter, OnNavigationListener)`. Tells + the action bar to use drop-down style navigation with the specified list of + items and callback listener. Third-party action bar handlers should + implement `ActionBarSherlock.HasListNavigation` for this functionality. + * Javadocs are now available at + [jakewharton.github.com/ActionBarSherlock](http://jakewharton.github.com/ActionBarSherlock/). + * A standalone JAR is now available via the + [GitHub downloads page](https://github.com/JakeWharton/ActionBarSherlock/downloads) + or in my + [personal maven repository](http://r.jakewharton.com/maven/) + as `com.jakewharton:android-actionbarsherlock:2.1.0`. + + +Version 2.0.1 *(2011-03-11)* +---------------------------- + + * Use `Class.forName()` for detection of native action bar. This provides + compatability all the way back to Android 1.5. + + +Version 2.0.0 *(2011-03-09)* +---------------------------- +Complete rewrite! + + * New and better API. + * More sane logic and attachment to activity. + * Extensible via generics. Implement any ActionBar or roll your own with + minimal effort. + * Now a library project for easy inclusion in applications. + + +Version 1.0.0 *(2011-03-07)* +---------------------------- +Initial release. diff --git a/external/JakeWharton-ActionBarSherlock/LICENSE.txt b/external/JakeWharton-ActionBarSherlock/LICENSE.txt new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/external/JakeWharton-ActionBarSherlock/README.md b/external/JakeWharton-ActionBarSherlock/README.md new file mode 100644 index 00000000..75a94a00 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/README.md @@ -0,0 +1,55 @@ +Action Bar Sherlock +=================== + +ActionBarSherlock is an extension of the [compatibility library][1] designed +to facilitate the use of the action bar design pattern across all versions of +Android through a single API. + +The class will automatically use the [native ActionBar][2] implementation on +Android 3.0 or later. For previous versions which do not include ActionBar, a +custom action bar implementation will automatically be wrapped around the +layout. Support for this goes all the way back to Android 1.6. + +Try out the sample applications on the Android Market: [Feature Demos][4], +[Shakespeare][5], and [Styled Action Bar][6]. + +**See http://actionbarsherlock.com for more information.** + +![Example Image][3] + + + +Developed By +============ + +* Jake Wharton - + + + +License +======= + + Copyright 2011 Jake Wharton + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + + + + [1]: http://android-developers.blogspot.com/2011/03/fragments-for-all.html + [2]: http://developer.android.com/guide/topics/ui/actionbar.html + [3]: http://actionbarsherlock.com/static/feature.png + [4]: https://market.android.com/details?id=com.actionbarsherlock.sample.demos + [5]: https://market.android.com/details?id=com.actionbarsherlock.sample.shakespeare + [6]: https://market.android.com/details?id=com.actionbarsherlock.sample.styledactionbar diff --git a/external/JakeWharton-ActionBarSherlock/library/.classpath b/external/JakeWharton-ActionBarSherlock/library/.classpath new file mode 100644 index 00000000..a4763d1e --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/.project b/external/JakeWharton-ActionBarSherlock/library/.project new file mode 100644 index 00000000..c513f6fd --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/.project @@ -0,0 +1,33 @@ + + + com_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/external/JakeWharton-ActionBarSherlock/library/.settings/org.eclipse.jdt.core.prefs b/external/JakeWharton-ActionBarSherlock/library/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..df27f3ee --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Tue Nov 01 09:28:45 CET 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/external/JakeWharton-ActionBarSherlock/library/AndroidManifest.xml b/external/JakeWharton-ActionBarSherlock/library/AndroidManifest.xml new file mode 100644 index 00000000..83e3d30d --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/AndroidManifest.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/README.md b/external/JakeWharton-ActionBarSherlock/library/README.md new file mode 100644 index 00000000..4b22e6fe --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/README.md @@ -0,0 +1,15 @@ +ActionBarSherlock Library +========================= + +This folder contains the main library which should be linked against as an +Android library project in your application. + +For more information see the "Including In Your Project" section of the +[download page][1]. + + + + + + + [1]: http://actionbarsherlock.com/download.html diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$LayoutParams.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$LayoutParams.class new file mode 100644 index 00000000..38ac5024 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$LayoutParams.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$OnMenuVisibilityListener.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$OnMenuVisibilityListener.class new file mode 100644 index 00000000..106c6710 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$OnMenuVisibilityListener.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$OnNavigationListener.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$OnNavigationListener.class new file mode 100644 index 00000000..2465687a Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$OnNavigationListener.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$Tab.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$Tab.class new file mode 100644 index 00000000..29f068a3 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$Tab.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$TabListener.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$TabListener.class new file mode 100644 index 00000000..ec759be1 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar$TabListener.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar.class new file mode 100644 index 00000000..92af3459 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ActionBar.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackRecord$Op.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackRecord$Op.class new file mode 100644 index 00000000..f2b956eb Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackRecord$Op.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackRecord.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackRecord.class new file mode 100644 index 00000000..3977712d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackRecord.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackState$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackState$1.class new file mode 100644 index 00000000..597cc3bc Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackState$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackState.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackState.class new file mode 100644 index 00000000..514e97fe Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/BackStackState.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/DialogFragment.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/DialogFragment.class new file mode 100644 index 00000000..ad38a4d3 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/DialogFragment.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment$InstantiationException.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment$InstantiationException.class new file mode 100644 index 00000000..52a2f24d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment$InstantiationException.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment$SavedState$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment$SavedState$1.class new file mode 100644 index 00000000..681b097b Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment$SavedState$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment$SavedState.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment$SavedState.class new file mode 100644 index 00000000..0a5c7892 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment$SavedState.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment.class new file mode 100644 index 00000000..4be715be Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/Fragment.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$1.class new file mode 100644 index 00000000..52b78e66 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$2.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$2.class new file mode 100644 index 00000000..385aa868 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$2.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$3.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$3.class new file mode 100644 index 00000000..8bda7763 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$3.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$FragmentTag.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$FragmentTag.class new file mode 100644 index 00000000..b990bb0d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$FragmentTag.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$HoneycombInvalidateOptionsMenu.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$HoneycombInvalidateOptionsMenu.class new file mode 100644 index 00000000..88c3135a Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$HoneycombInvalidateOptionsMenu.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$NonConfigurationInstances.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$NonConfigurationInstances.class new file mode 100644 index 00000000..36b241f5 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$NonConfigurationInstances.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$OverridePendingTransition.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$OverridePendingTransition.class new file mode 100644 index 00000000..1d3c90a0 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity$OverridePendingTransition.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity.class new file mode 100644 index 00000000..c360c9e8 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentActivity.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManager$BackStackEntry.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManager$BackStackEntry.class new file mode 100644 index 00000000..c062291c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManager$BackStackEntry.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManager$OnBackStackChangedListener.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManager$OnBackStackChangedListener.class new file mode 100644 index 00000000..9485a1ab Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManager$OnBackStackChangedListener.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManager.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManager.class new file mode 100644 index 00000000..a836c0e6 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManager.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$1.class new file mode 100644 index 00000000..c397bf4c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$2.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$2.class new file mode 100644 index 00000000..b51bb622 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$2.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$3.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$3.class new file mode 100644 index 00000000..91fea8a4 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$3.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$4.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$4.class new file mode 100644 index 00000000..5f095ba4 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$4.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$5.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$5.class new file mode 100644 index 00000000..88ac3ad1 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl$5.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl.class new file mode 100644 index 00000000..3701ef3f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerState$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerState$1.class new file mode 100644 index 00000000..2d09bff6 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerState$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerState.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerState.class new file mode 100644 index 00000000..7e18f4f6 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentManagerState.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentPagerAdapter.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentPagerAdapter.class new file mode 100644 index 00000000..d88d08a5 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentPagerAdapter.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentState$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentState$1.class new file mode 100644 index 00000000..25f3a680 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentState$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentState.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentState.class new file mode 100644 index 00000000..742e25b8 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentState.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentStatePagerAdapter.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentStatePagerAdapter.class new file mode 100644 index 00000000..c87a5a8d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentStatePagerAdapter.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentTransaction.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentTransaction.class new file mode 100644 index 00000000..35b28926 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/FragmentTransaction.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/HCSparseArray.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/HCSparseArray.class new file mode 100644 index 00000000..17f7dda8 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/HCSparseArray.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ListFragment$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ListFragment$1.class new file mode 100644 index 00000000..52f16c74 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ListFragment$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ListFragment$2.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ListFragment$2.class new file mode 100644 index 00000000..3248fbd2 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ListFragment$2.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ListFragment.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ListFragment.class new file mode 100644 index 00000000..69600217 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/ListFragment.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManager$LoaderCallbacks.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManager$LoaderCallbacks.class new file mode 100644 index 00000000..6b2567c6 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManager$LoaderCallbacks.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManager.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManager.class new file mode 100644 index 00000000..57cf523b Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManager.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManagerImpl$LoaderInfo.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManagerImpl$LoaderInfo.class new file mode 100644 index 00000000..0a494874 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManagerImpl$LoaderInfo.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManagerImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManagerImpl.class new file mode 100644 index 00000000..b5bea027 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/LoaderManagerImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/NoSaveStateFrameLayout.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/NoSaveStateFrameLayout.class new file mode 100644 index 00000000..d62e1f0d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/NoSaveStateFrameLayout.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/SuperNotCalledException.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/SuperNotCalledException.class new file mode 100644 index 00000000..d19de7e3 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/SuperNotCalledException.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/SupportActivity$InternalCallbacks.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/SupportActivity$InternalCallbacks.class new file mode 100644 index 00000000..8ad19857 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/SupportActivity$InternalCallbacks.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/SupportActivity.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/SupportActivity.class new file mode 100644 index 00000000..eb372f51 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/app/SupportActivity.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/AsyncTaskLoader$LoadTask.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/AsyncTaskLoader$LoadTask.class new file mode 100644 index 00000000..4002e2e7 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/AsyncTaskLoader$LoadTask.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/AsyncTaskLoader.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/AsyncTaskLoader.class new file mode 100644 index 00000000..4abe8fca Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/AsyncTaskLoader.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/CursorLoader.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/CursorLoader.class new file mode 100644 index 00000000..d43a16f5 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/CursorLoader.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/Loader$ForceLoadContentObserver.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/Loader$ForceLoadContentObserver.class new file mode 100644 index 00000000..91eb74e4 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/Loader$ForceLoadContentObserver.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/Loader$OnLoadCompleteListener.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/Loader$OnLoadCompleteListener.class new file mode 100644 index 00000000..be35be3a Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/Loader$OnLoadCompleteListener.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/Loader.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/Loader.class new file mode 100644 index 00000000..747aad03 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/content/Loader.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompat$CompatCreator.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompat$CompatCreator.class new file mode 100644 index 00000000..826fc72c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompat$CompatCreator.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompat.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompat.class new file mode 100644 index 00000000..4ec17250 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompat.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompatCreatorCallbacks.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompatCreatorCallbacks.class new file mode 100644 index 00000000..ce10a0a0 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompatCreatorCallbacks.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompatCreatorHoneycombMR2.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompatCreatorHoneycombMR2.class new file mode 100644 index 00000000..2ffdddae Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompatCreatorHoneycombMR2.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompatCreatorHoneycombMR2Stub.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompatCreatorHoneycombMR2Stub.class new file mode 100644 index 00000000..d6e1485d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/os/ParcelableCompatCreatorHoneycombMR2Stub.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/DebugUtils.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/DebugUtils.class new file mode 100644 index 00000000..dd0c34dd Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/DebugUtils.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/LogWriter.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/LogWriter.class new file mode 100644 index 00000000..94faa708 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/LogWriter.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/LruCache.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/LruCache.class new file mode 100644 index 00000000..de713ba8 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/LruCache.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/TimeUtils.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/TimeUtils.class new file mode 100644 index 00000000..a89e77b1 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/util/TimeUtils.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ActionMode$Callback.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ActionMode$Callback.class new file mode 100644 index 00000000..576b4d81 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ActionMode$Callback.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ActionMode.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ActionMode.class new file mode 100644 index 00000000..a3cc3014 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ActionMode.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/Menu.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/Menu.class new file mode 100644 index 00000000..b00f5f4e Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/Menu.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuInflater$ActionBarMenuState.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuInflater$ActionBarMenuState.class new file mode 100644 index 00000000..a48c3510 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuInflater$ActionBarMenuState.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuInflater$InflatedOnMenuItemClickListener.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuInflater$InflatedOnMenuItemClickListener.class new file mode 100644 index 00000000..85491c3c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuInflater$InflatedOnMenuItemClickListener.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuInflater.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuInflater.class new file mode 100644 index 00000000..b340d68f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuInflater.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuItem$OnMenuItemClickListener.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuItem$OnMenuItemClickListener.class new file mode 100644 index 00000000..a43d6306 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuItem$OnMenuItemClickListener.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuItem.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuItem.class new file mode 100644 index 00000000..996d4ee3 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MenuItem.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat$BaseMotionEventVersionImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat$BaseMotionEventVersionImpl.class new file mode 100644 index 00000000..6774024b Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat$BaseMotionEventVersionImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat$EclairMotionEventVersionImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat$EclairMotionEventVersionImpl.class new file mode 100644 index 00000000..5a2624df Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat$EclairMotionEventVersionImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat$MotionEventVersionImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat$MotionEventVersionImpl.class new file mode 100644 index 00000000..173f1258 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat$MotionEventVersionImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat.class new file mode 100644 index 00000000..5db33841 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompat.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompatEclair.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompatEclair.class new file mode 100644 index 00000000..21a8f5a7 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/MotionEventCompatEclair.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/PagerAdapter$DataSetObserver.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/PagerAdapter$DataSetObserver.class new file mode 100644 index 00000000..47e863e1 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/PagerAdapter$DataSetObserver.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/PagerAdapter.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/PagerAdapter.class new file mode 100644 index 00000000..03a7edd1 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/PagerAdapter.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/SubMenu.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/SubMenu.class new file mode 100644 index 00000000..0f5757d7 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/SubMenu.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat$BaseVelocityTrackerVersionImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat$BaseVelocityTrackerVersionImpl.class new file mode 100644 index 00000000..87b10772 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat$BaseVelocityTrackerVersionImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat$HoneycombVelocityTrackerVersionImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat$HoneycombVelocityTrackerVersionImpl.class new file mode 100644 index 00000000..44516a8e Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat$HoneycombVelocityTrackerVersionImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat$VelocityTrackerVersionImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat$VelocityTrackerVersionImpl.class new file mode 100644 index 00000000..6d9c700a Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat$VelocityTrackerVersionImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat.class new file mode 100644 index 00000000..9f8f3d29 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompat.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompatHoneycomb.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompatHoneycomb.class new file mode 100644 index 00000000..8bddfbbf Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/VelocityTrackerCompatHoneycomb.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat$BaseViewConfigurationVersionImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat$BaseViewConfigurationVersionImpl.class new file mode 100644 index 00000000..eadf554d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat$BaseViewConfigurationVersionImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat$FroyoViewConfigurationVersionImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat$FroyoViewConfigurationVersionImpl.class new file mode 100644 index 00000000..5e97dd5f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat$FroyoViewConfigurationVersionImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat$ViewConfigurationVersionImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat$ViewConfigurationVersionImpl.class new file mode 100644 index 00000000..71dd24c0 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat$ViewConfigurationVersionImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat.class new file mode 100644 index 00000000..117b8643 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompat.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompatFroyo.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompatFroyo.class new file mode 100644 index 00000000..7af6b459 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewConfigurationCompatFroyo.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$DataSetObserver.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$DataSetObserver.class new file mode 100644 index 00000000..7ed9fb4a Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$DataSetObserver.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$ItemInfo.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$ItemInfo.class new file mode 100644 index 00000000..051c1153 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$ItemInfo.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$OnPageChangeListener.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$OnPageChangeListener.class new file mode 100644 index 00000000..e5b99377 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$OnPageChangeListener.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$SavedState$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$SavedState$1.class new file mode 100644 index 00000000..54676d0b Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$SavedState$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$SavedState.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$SavedState.class new file mode 100644 index 00000000..b0d4faef Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$SavedState.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$SimpleOnPageChangeListener.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$SimpleOnPageChangeListener.class new file mode 100644 index 00000000..688762e2 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager$SimpleOnPageChangeListener.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager.class new file mode 100644 index 00000000..8a785e53 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/ViewPager.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/Window.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/Window.class new file mode 100644 index 00000000..a10f4e94 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/view/Window.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorAdapter$ChangeObserver.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorAdapter$ChangeObserver.class new file mode 100644 index 00000000..934714ee Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorAdapter$ChangeObserver.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorAdapter$MyDataSetObserver.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorAdapter$MyDataSetObserver.class new file mode 100644 index 00000000..95ad2657 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorAdapter$MyDataSetObserver.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorAdapter.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorAdapter.class new file mode 100644 index 00000000..0cf4dc41 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorAdapter.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorFilter$CursorFilterClient.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorFilter$CursorFilterClient.class new file mode 100644 index 00000000..981f7e1f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorFilter$CursorFilterClient.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorFilter.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorFilter.class new file mode 100644 index 00000000..d57d2ce7 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/CursorFilter.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/ResourceCursorAdapter.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/ResourceCursorAdapter.class new file mode 100644 index 00000000..533023f4 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/ResourceCursorAdapter.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/SimpleCursorAdapter$CursorToStringConverter.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/SimpleCursorAdapter$CursorToStringConverter.class new file mode 100644 index 00000000..d2a80115 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/SimpleCursorAdapter$CursorToStringConverter.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/SimpleCursorAdapter$ViewBinder.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/SimpleCursorAdapter$ViewBinder.class new file mode 100644 index 00000000..e2516ae3 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/SimpleCursorAdapter$ViewBinder.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/SimpleCursorAdapter.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/SimpleCursorAdapter.class new file mode 100644 index 00000000..8229913c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/android/support/v4/widget/SimpleCursorAdapter.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$attr.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$attr.class new file mode 100644 index 00000000..ba86c9df Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$attr.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$color.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$color.class new file mode 100644 index 00000000..bd4ef402 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$color.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$drawable.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$drawable.class new file mode 100644 index 00000000..3a0a03e9 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$drawable.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$id.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$id.class new file mode 100644 index 00000000..35be7e2d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$id.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$integer.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$integer.class new file mode 100644 index 00000000..5c923d90 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$integer.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$layout.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$layout.class new file mode 100644 index 00000000..854f001a Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$layout.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$string.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$string.class new file mode 100644 index 00000000..7421b93b Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$string.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$style.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$style.class new file mode 100644 index 00000000..8654d6cd Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$style.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$styleable.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$styleable.class new file mode 100644 index 00000000..7821cece Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R$styleable.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R.class new file mode 100644 index 00000000..3ba6bf1b Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/R.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarImpl.class new file mode 100644 index 00000000..f051263d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$1.class new file mode 100644 index 00000000..6fb70845 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$2.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$2.class new file mode 100644 index 00000000..c93b8394 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$2.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$3.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$3.class new file mode 100644 index 00000000..eb696156 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$3.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$ActionModeWrapper.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$ActionModeWrapper.class new file mode 100644 index 00000000..22b3973b Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$ActionModeWrapper.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$TabImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$TabImpl.class new file mode 100644 index 00000000..fb1d9850 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl$TabImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl.class new file mode 100644 index 00000000..91967609 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper$Impl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper.class new file mode 100644 index 00000000..1a5fd154 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/app/ActionBarWrapper.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/ActionMenuItem$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/ActionMenuItem$1.class new file mode 100644 index 00000000..56661eec Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/ActionMenuItem$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/ActionMenuItem.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/ActionMenuItem.class new file mode 100644 index 00000000..909156f5 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/ActionMenuItem.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/ActionMenuItemView.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/ActionMenuItemView.class new file mode 100644 index 00000000..e196a9a7 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/ActionMenuItemView.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuBuilder$Callback.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuBuilder$Callback.class new file mode 100644 index 00000000..16625645 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuBuilder$Callback.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuBuilder.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuBuilder.class new file mode 100644 index 00000000..0608b217 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuBuilder.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuInflaterWrapper.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuInflaterWrapper.class new file mode 100644 index 00000000..63d60934 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuInflaterWrapper.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$1.class new file mode 100644 index 00000000..f9057600 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$2.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$2.class new file mode 100644 index 00000000..431e5e5b Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$2.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$3.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$3.class new file mode 100644 index 00000000..7c87b7fd Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$3.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$NativeMenuItemView.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$NativeMenuItemView.class new file mode 100644 index 00000000..921acb8f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl$NativeMenuItemView.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl.class new file mode 100644 index 00000000..abee7757 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemWrapper$HoneycombMenuItem.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemWrapper$HoneycombMenuItem.class new file mode 100644 index 00000000..a80651cc Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemWrapper$HoneycombMenuItem.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.class new file mode 100644 index 00000000..5923c47c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuView$ItemView.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuView$ItemView.class new file mode 100644 index 00000000..04602bbe Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuView$ItemView.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuView.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuView.class new file mode 100644 index 00000000..a42593fe Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuView.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuWrapper.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuWrapper.class new file mode 100644 index 00000000..74af99bf Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/MenuWrapper.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/SubMenuBuilder.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/SubMenuBuilder.class new file mode 100644 index 00000000..d5dbf340 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/SubMenuBuilder.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/SubMenuWrapper.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/SubMenuWrapper.class new file mode 100644 index 00000000..2d31cb25 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/view/menu/SubMenuWrapper.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarContainer.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarContainer.class new file mode 100644 index 00000000..16921268 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarContainer.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$1.class new file mode 100644 index 00000000..518fdec9 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$2.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$2.class new file mode 100644 index 00000000..f1798416 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$2.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$TabImpl$1.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$TabImpl$1.class new file mode 100644 index 00000000..e8f2ce2f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$TabImpl$1.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$TabImpl.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$TabImpl.class new file mode 100644 index 00000000..32cc3752 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView$TabImpl.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView.class new file mode 100644 index 00000000..f4dac869 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ActionBarView.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ScrollingTextView.class b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ScrollingTextView.class new file mode 100644 index 00000000..ac0c4253 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/classes/com/actionbarsherlock/internal/widget/ScrollingTextView.class differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/com_actionbarsherlock.jar b/external/JakeWharton-ActionBarSherlock/library/bin/com_actionbarsherlock.jar new file mode 100644 index 00000000..760887c0 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/com_actionbarsherlock.jar differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_dark.9.png new file mode 100644 index 00000000..26816ae4 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_light.9.png new file mode 100644 index 00000000..db78cc21 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_focused_holo.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_focused_holo.png new file mode 100644 index 00000000..abcc8eb1 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_focused_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_normal_holo.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_normal_holo.png new file mode 100644 index 00000000..f0df90d8 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_normal_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_pressed_holo.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_pressed_holo.png new file mode 100644 index 00000000..e689d42c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_pressed_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_dark.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_dark.png new file mode 100644 index 00000000..f54eb187 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_dark.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_light.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_light.png new file mode 100644 index 00000000..96d88873 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_light.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_focused_holo.9.png new file mode 100644 index 00000000..1820612c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_longpressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_longpressed_holo.9.png new file mode 100644 index 00000000..28ef2237 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_longpressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_dark.9.png new file mode 100644 index 00000000..80509cdf Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_light.9.png new file mode 100644 index 00000000..e4f4e44a Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_dark.9.png new file mode 100644 index 00000000..cb128962 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_light.9.png new file mode 100644 index 00000000..233da8e3 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_dark.9.png new file mode 100644 index 00000000..ed820cbb Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_light.9.png new file mode 100644 index 00000000..8d42e32d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_dark.9.png new file mode 100644 index 00000000..fc08574c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_light.9.png new file mode 100644 index 00000000..f6cef0e8 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_dark.9.png new file mode 100644 index 00000000..ed84951e Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_light.9.png new file mode 100644 index 00000000..b17ba12f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_dark.9.png new file mode 100644 index 00000000..5305fa27 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_light.9.png new file mode 100644 index 00000000..db9795b9 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_focused_holo.9.png new file mode 100644 index 00000000..e32e685f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_holo.9.png new file mode 100644 index 00000000..ec10b59b Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_focused_holo.9.png new file mode 100644 index 00000000..6eea722c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_holo.9.png new file mode 100644 index 00000000..86a18383 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_focused_holo.9.png new file mode 100644 index 00000000..4206afbc Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_holo.9.png new file mode 100644 index 00000000..2ffb0bbc Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_focused_holo.9.png new file mode 100644 index 00000000..dd8a7493 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_holo.9.png new file mode 100644 index 00000000..199464b6 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_dark.9.png new file mode 100644 index 00000000..d152cdf6 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_light.9.png new file mode 100644 index 00000000..fb30a707 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_focused_holo.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_focused_holo.png new file mode 100644 index 00000000..9e590b1d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_focused_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_normal_holo.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_normal_holo.png new file mode 100644 index 00000000..9c802531 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_normal_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_pressed_holo.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_pressed_holo.png new file mode 100644 index 00000000..62362941 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_pressed_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_dark.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_dark.png new file mode 100644 index 00000000..56720f33 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_dark.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_light.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_light.png new file mode 100644 index 00000000..3df7657e Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_light.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_focused_holo.9.png new file mode 100644 index 00000000..2287f398 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_longpressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_longpressed_holo.9.png new file mode 100644 index 00000000..a39c79f7 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_longpressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_dark.9.png new file mode 100644 index 00000000..bf0175fe Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_light.9.png new file mode 100644 index 00000000..7608d866 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_dark.9.png new file mode 100644 index 00000000..9428f21a Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_light.9.png new file mode 100644 index 00000000..80cd8e61 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_dark.9.png new file mode 100644 index 00000000..ff88f7b2 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_light.9.png new file mode 100644 index 00000000..9e758667 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_dark.9.png new file mode 100644 index 00000000..03fa2282 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_light.9.png new file mode 100644 index 00000000..a9493923 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_dark.9.png new file mode 100644 index 00000000..6b21ce0f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_light.9.png new file mode 100644 index 00000000..4f093152 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_dark.9.png new file mode 100644 index 00000000..c6114510 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_light.9.png new file mode 100644 index 00000000..da9eceef Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_focused_holo.9.png new file mode 100644 index 00000000..e75d6c8c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_holo.9.png new file mode 100644 index 00000000..5856dc5f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_focused_holo.9.png new file mode 100644 index 00000000..e26b4f95 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_holo.9.png new file mode 100644 index 00000000..e58bbc63 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_focused_holo.9.png new file mode 100644 index 00000000..32575002 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_holo.9.png new file mode 100644 index 00000000..e18ac5dd Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_focused_holo.9.png new file mode 100644 index 00000000..524f8cf9 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_holo.9.png new file mode 100644 index 00000000..a5aacad7 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-nodpi-v11/abs__action_item_divider.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-nodpi-v11/abs__action_item_divider.9.png new file mode 100644 index 00000000..f4b21f8f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-nodpi-v11/abs__action_item_divider.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-nodpi/abs__action_item_divider.9.png b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-nodpi/abs__action_item_divider.9.png new file mode 100644 index 00000000..cac34343 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/bin/res/drawable-nodpi/abs__action_item_divider.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/checkstyle.xml b/external/JakeWharton-ActionBarSherlock/library/checkstyle.xml new file mode 100644 index 00000000..87be4031 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/checkstyle.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/default.properties b/external/JakeWharton-ActionBarSherlock/library/default.properties new file mode 100644 index 00000000..3ac5a46b --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/default.properties @@ -0,0 +1,3 @@ +android.library=true +# Project target. +target=android-13 diff --git a/external/JakeWharton-ActionBarSherlock/library/gen/com/actionbarsherlock/R.java b/external/JakeWharton-ActionBarSherlock/library/gen/com/actionbarsherlock/R.java new file mode 100644 index 00000000..52876783 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/gen/com/actionbarsherlock/R.java @@ -0,0 +1,940 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package com.actionbarsherlock; + +public final class R { + public static final class attr { + /**

May be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". +

May be a color value, in the form of "#rgb", "#argb", +"#rrggbb", or "#aarrggbb". + */ + public static int abBackground=0x7f01001e; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int abCustomNavigationLayout=0x7f01001f; + /**

Must be one or more (separated by '|') of the following constant values.

+ ++++ + + + + + +
ConstantValueDescription
useLogo0x1
showHome0x2
homeAsUp0x4
showTitle0x8
showCustom0x10
+ */ + public static int abDisplayOptions=0x7f010016; + /**

May be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". +

May be a color value, in the form of "#rgb", "#argb", +"#rrggbb", or "#aarrggbb". + */ + public static int abDivider=0x7f01001d; + /**

May be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". +

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). + */ + public static int abHeight=0x7f010020; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int abHomeAsUpIndicator=0x7f010021; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int abHomeLayout=0x7f010022; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int abIcon=0x7f01001b; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int abIndeterminateProgressStyle=0x7f010024; + /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static int abItemPadding=0x7f010026; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int abLogo=0x7f01001c; + /**

Must be one of the following constant values.

+ ++++ + + + +
ConstantValueDescription
normal0
listMode1
tabMode2
+ */ + public static int abNavigationMode=0x7f010015; + /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static int abProgressBarPadding=0x7f010025; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int abProgressBarStyle=0x7f010023; + /**

Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static int abSubtitle=0x7f010018; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int abSubtitleTextStyle=0x7f01001a; + /**

Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static int abTitle=0x7f010017; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int abTitleTextStyle=0x7f010019; + /** attr name="actionBarStyle" format="reference" / +

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. +

May be one of the following constant values.

+ ++++ + +
ConstantValueDescription
wrap_content0
+ */ + public static int actionBarSize=0x7f010007; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionBarTabBarStyle=0x7f010003; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionBarTabStyle=0x7f010002; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionBarTabTextStyle=0x7f010004; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionButtonStyle=0x7f010001; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionDropDownStyle=0x7f010000; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionHomeButtonStyle=0x7f010006; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionMenuTextAppearance=0x7f010008; + /**

May be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". +

May be a color value, in the form of "#rgb", "#argb", +"#rrggbb", or "#aarrggbb". + */ + public static int actionMenuTextColor=0x7f010009; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionModeBackground=0x7f01000b; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionModeCloseButtonStyle=0x7f01000a; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionModeCloseDrawable=0x7f01000c; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionOverflowButtonStyle=0x7f010005; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int actionSpinnerItemStyle=0x7f010012; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int dropDownListViewStyle=0x7f01000f; + /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static int dropdownListPreferredItemHeight=0x7f010011; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int homeAsUpIndicator=0x7f01000d; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int popupMenuStyle=0x7f010010; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static int selectableItemBackground=0x7f01000e; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static int windowActionBar=0x7f010013; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static int windowActionModeOverlay=0x7f010014; + } + public static final class color { + public static int abs__item_bg=0x7f050001; + public static int abs__item_focused=0x7f050000; + public static int abs__tab_text_color_dark=0x7f050002; + public static int abs__tab_text_color_light=0x7f050003; + } + public static final class drawable { + public static int abs__action_item_divider=0x7f020000; + public static int abs__cab_background_holo_dark=0x7f020001; + public static int abs__cab_background_holo_light=0x7f020002; + public static int abs__cab_ic_close_focused_holo=0x7f020003; + public static int abs__cab_ic_close_holo=0x7f020004; + public static int abs__cab_ic_close_normal_holo=0x7f020005; + public static int abs__cab_ic_close_pressed_holo=0x7f020006; + public static int abs__ic_ab_back_holo_dark=0x7f020007; + public static int abs__ic_ab_back_holo_light=0x7f020008; + public static int abs__item_background_holo_dark=0x7f020009; + public static int abs__item_background_holo_light=0x7f02000a; + public static int abs__list_focused_holo=0x7f02000b; + public static int abs__list_longpressed_holo=0x7f02000c; + public static int abs__list_pressed_holo_dark=0x7f02000d; + public static int abs__list_pressed_holo_light=0x7f02000e; + public static int abs__list_selector_background_transition_holo_dark=0x7f02000f; + public static int abs__list_selector_background_transition_holo_light=0x7f020010; + public static int abs__list_selector_disabled_holo_dark=0x7f020011; + public static int abs__list_selector_disabled_holo_light=0x7f020012; + public static int abs__spinner_background_holo_dark=0x7f020013; + public static int abs__spinner_background_holo_light=0x7f020014; + public static int abs__spinner_default_holo_dark=0x7f020015; + public static int abs__spinner_default_holo_light=0x7f020016; + public static int abs__spinner_disabled_holo_dark=0x7f020017; + public static int abs__spinner_disabled_holo_light=0x7f020018; + public static int abs__spinner_focused_holo_dark=0x7f020019; + public static int abs__spinner_focused_holo_light=0x7f02001a; + public static int abs__spinner_pressed_holo_dark=0x7f02001b; + public static int abs__spinner_pressed_holo_light=0x7f02001c; + public static int abs__tab_indicator_holo=0x7f02001d; + public static int abs__tab_selected_focused_holo=0x7f02001e; + public static int abs__tab_selected_holo=0x7f02001f; + public static int abs__tab_selected_pressed_focused_holo=0x7f020020; + public static int abs__tab_selected_pressed_holo=0x7f020021; + public static int abs__tab_unselected_focused_holo=0x7f020022; + public static int abs__tab_unselected_holo=0x7f020023; + public static int abs__tab_unselected_pressed_focused_holo=0x7f020024; + public static int abs__tab_unselected_pressed_holo=0x7f020025; + } + public static final class id { + public static int abs__action_bar=0x7f04001a; + public static int abs__action_bar_container=0x7f040019; + public static int abs__action_bar_subtitle=0x7f040018; + public static int abs__action_bar_title=0x7f040017; + public static int abs__actions=0x7f04000c; + public static int abs__content=0x7f04001b; + public static int abs__custom=0x7f04000f; + public static int abs__home=0x7f04000b; + public static int abs__home_wrapper=0x7f040009; + public static int abs__iprogress=0x7f04000d; + public static int abs__item_custom=0x7f040013; + public static int abs__item_icon=0x7f040011; + public static int abs__item_text=0x7f040012; + public static int abs__nav_list=0x7f04000e; + public static int abs__nav_tabs=0x7f040010; + public static int abs__tab=0x7f040015; + public static int abs__tab_custom=0x7f040016; + public static int abs__tab_icon=0x7f040014; + public static int abs__up=0x7f04000a; + public static int homeAsUp=0x7f040006; + public static int listMode=0x7f040002; + public static int normal=0x7f040001; + public static int showCustom=0x7f040008; + public static int showHome=0x7f040005; + public static int showTitle=0x7f040007; + public static int tabMode=0x7f040003; + public static int useLogo=0x7f040004; + public static int wrap_content=0x7f040000; + } + public static final class integer { + public static int abs__max_action_buttons=0x7f060000; + } + public static final class layout { + public static int abs__action_bar=0x7f030000; + public static int abs__action_bar_home=0x7f030001; + public static int abs__action_bar_inline=0x7f030002; + public static int abs__action_bar_item_layout=0x7f030003; + public static int abs__action_bar_tab_layout=0x7f030004; + public static int abs__action_bar_title_item=0x7f030005; + public static int abs__screen_action_bar=0x7f030006; + public static int abs__screen_action_bar_inline=0x7f030007; + public static int abs__screen_action_bar_inline_overlay=0x7f030008; + public static int abs__screen_action_bar_overlay=0x7f030009; + public static int abs__screen_simple=0x7f03000a; + public static int abs__simple_spinner_item=0x7f03000b; + } + public static final class string { + public static int abs__tab_under_ab_tag=0x7f070000; + } + public static final class style { + public static int Internal_Widget_Sherlock_ActionBar=0x7f08001c; + public static int Internal_Widget_Sherlock_Light_ActionBar=0x7f08001d; + public static int TextAppearance_Widget_Subtitle=0x7f08001b; + public static int TextAppearance_Widget_Title=0x7f08001a; + public static int Theme_Sherlock=0x7f080000; + public static int Theme_Sherlock_Light=0x7f08000d; + public static int Widget_Sherlock_ActionBar_TabBar=0x7f080001; + public static int Widget_Sherlock_ActionBar_TabText=0x7f080003; + public static int Widget_Sherlock_ActionBar_TabView=0x7f080002; + public static int Widget_Sherlock_ActionButton=0x7f080004; + public static int Widget_Sherlock_ActionButton_CloseMode=0x7f080006; + public static int Widget_Sherlock_ActionButton_Home=0x7f080007; + public static int Widget_Sherlock_ActionButton_Overflow=0x7f080008; + public static int Widget_Sherlock_Light_ActionBar_TabBar=0x7f08000e; + public static int Widget_Sherlock_Light_ActionBar_TabText=0x7f080010; + public static int Widget_Sherlock_Light_ActionBar_TabView=0x7f08000f; + public static int Widget_Sherlock_Light_ActionButton=0x7f080011; + public static int Widget_Sherlock_Light_ActionButton_CloseMode=0x7f080016; + public static int Widget_Sherlock_Light_ActionButton_Home=0x7f080012; + public static int Widget_Sherlock_Light_ActionButton_Overflow=0x7f080013; + public static int Widget_Sherlock_Light_ListPopupWindow=0x7f080018; + public static int Widget_Sherlock_Light_ListView_DropDown=0x7f080017; + public static int Widget_Sherlock_Light_PopupMenu=0x7f080019; + public static int Widget_Sherlock_Light_Spinner=0x7f080015; + public static int Widget_Sherlock_Light_TextView_SpinnerItem_ActionBar=0x7f080014; + public static int Widget_Sherlock_ListPopupWindow=0x7f08000a; + public static int Widget_Sherlock_ListView_DropDown=0x7f08000b; + public static int Widget_Sherlock_PopupMenu=0x7f08000c; + public static int Widget_Sherlock_Spinner=0x7f080005; + public static int Widget_Sherlock_TextView_SpinnerItem_ActionBar=0x7f080009; + } + public static final class styleable { + /** Attributes that can be used with a SherlockTheme. +

Includes the following attributes:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeDescription
{@link #SherlockTheme_abBackground com.actionbarsherlock:abBackground}
{@link #SherlockTheme_abCustomNavigationLayout com.actionbarsherlock:abCustomNavigationLayout}
{@link #SherlockTheme_abDisplayOptions com.actionbarsherlock:abDisplayOptions}
{@link #SherlockTheme_abDivider com.actionbarsherlock:abDivider}
{@link #SherlockTheme_abHeight com.actionbarsherlock:abHeight}
{@link #SherlockTheme_abHomeAsUpIndicator com.actionbarsherlock:abHomeAsUpIndicator}
{@link #SherlockTheme_abHomeLayout com.actionbarsherlock:abHomeLayout}
{@link #SherlockTheme_abIcon com.actionbarsherlock:abIcon}
{@link #SherlockTheme_abIndeterminateProgressStyle com.actionbarsherlock:abIndeterminateProgressStyle}
{@link #SherlockTheme_abItemPadding com.actionbarsherlock:abItemPadding}
{@link #SherlockTheme_abLogo com.actionbarsherlock:abLogo}
{@link #SherlockTheme_abNavigationMode com.actionbarsherlock:abNavigationMode}
{@link #SherlockTheme_abProgressBarPadding com.actionbarsherlock:abProgressBarPadding}
{@link #SherlockTheme_abProgressBarStyle com.actionbarsherlock:abProgressBarStyle}
{@link #SherlockTheme_abSubtitle com.actionbarsherlock:abSubtitle}
{@link #SherlockTheme_abSubtitleTextStyle com.actionbarsherlock:abSubtitleTextStyle}
{@link #SherlockTheme_abTitle com.actionbarsherlock:abTitle}
{@link #SherlockTheme_abTitleTextStyle com.actionbarsherlock:abTitleTextStyle}
{@link #SherlockTheme_actionBarSize com.actionbarsherlock:actionBarSize}attr name="actionBarStyle" format="reference" /
{@link #SherlockTheme_actionBarTabBarStyle com.actionbarsherlock:actionBarTabBarStyle}
{@link #SherlockTheme_actionBarTabStyle com.actionbarsherlock:actionBarTabStyle}
{@link #SherlockTheme_actionBarTabTextStyle com.actionbarsherlock:actionBarTabTextStyle}
{@link #SherlockTheme_actionButtonStyle com.actionbarsherlock:actionButtonStyle}
{@link #SherlockTheme_actionDropDownStyle com.actionbarsherlock:actionDropDownStyle}
{@link #SherlockTheme_actionHomeButtonStyle com.actionbarsherlock:actionHomeButtonStyle}
{@link #SherlockTheme_actionMenuTextAppearance com.actionbarsherlock:actionMenuTextAppearance}
{@link #SherlockTheme_actionMenuTextColor com.actionbarsherlock:actionMenuTextColor}
{@link #SherlockTheme_actionModeBackground com.actionbarsherlock:actionModeBackground}
{@link #SherlockTheme_actionModeCloseButtonStyle com.actionbarsherlock:actionModeCloseButtonStyle}
{@link #SherlockTheme_actionModeCloseDrawable com.actionbarsherlock:actionModeCloseDrawable}
{@link #SherlockTheme_actionOverflowButtonStyle com.actionbarsherlock:actionOverflowButtonStyle}
{@link #SherlockTheme_actionSpinnerItemStyle com.actionbarsherlock:actionSpinnerItemStyle}
{@link #SherlockTheme_dropDownListViewStyle com.actionbarsherlock:dropDownListViewStyle}
{@link #SherlockTheme_dropdownListPreferredItemHeight com.actionbarsherlock:dropdownListPreferredItemHeight}
{@link #SherlockTheme_homeAsUpIndicator com.actionbarsherlock:homeAsUpIndicator}
{@link #SherlockTheme_popupMenuStyle com.actionbarsherlock:popupMenuStyle}
{@link #SherlockTheme_selectableItemBackground com.actionbarsherlock:selectableItemBackground}
{@link #SherlockTheme_windowActionBar com.actionbarsherlock:windowActionBar}
{@link #SherlockTheme_windowActionModeOverlay com.actionbarsherlock:windowActionModeOverlay}
+ @see #SherlockTheme_abBackground + @see #SherlockTheme_abCustomNavigationLayout + @see #SherlockTheme_abDisplayOptions + @see #SherlockTheme_abDivider + @see #SherlockTheme_abHeight + @see #SherlockTheme_abHomeAsUpIndicator + @see #SherlockTheme_abHomeLayout + @see #SherlockTheme_abIcon + @see #SherlockTheme_abIndeterminateProgressStyle + @see #SherlockTheme_abItemPadding + @see #SherlockTheme_abLogo + @see #SherlockTheme_abNavigationMode + @see #SherlockTheme_abProgressBarPadding + @see #SherlockTheme_abProgressBarStyle + @see #SherlockTheme_abSubtitle + @see #SherlockTheme_abSubtitleTextStyle + @see #SherlockTheme_abTitle + @see #SherlockTheme_abTitleTextStyle + @see #SherlockTheme_actionBarSize + @see #SherlockTheme_actionBarTabBarStyle + @see #SherlockTheme_actionBarTabStyle + @see #SherlockTheme_actionBarTabTextStyle + @see #SherlockTheme_actionButtonStyle + @see #SherlockTheme_actionDropDownStyle + @see #SherlockTheme_actionHomeButtonStyle + @see #SherlockTheme_actionMenuTextAppearance + @see #SherlockTheme_actionMenuTextColor + @see #SherlockTheme_actionModeBackground + @see #SherlockTheme_actionModeCloseButtonStyle + @see #SherlockTheme_actionModeCloseDrawable + @see #SherlockTheme_actionOverflowButtonStyle + @see #SherlockTheme_actionSpinnerItemStyle + @see #SherlockTheme_dropDownListViewStyle + @see #SherlockTheme_dropdownListPreferredItemHeight + @see #SherlockTheme_homeAsUpIndicator + @see #SherlockTheme_popupMenuStyle + @see #SherlockTheme_selectableItemBackground + @see #SherlockTheme_windowActionBar + @see #SherlockTheme_windowActionModeOverlay + */ + public static final int[] SherlockTheme = { + 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, + 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, + 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, + 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, + 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, + 0x7f010014, 0x7f010015, 0x7f010016, 0x7f010017, + 0x7f010018, 0x7f010019, 0x7f01001a, 0x7f01001b, + 0x7f01001c, 0x7f01001d, 0x7f01001e, 0x7f01001f, + 0x7f010020, 0x7f010021, 0x7f010022, 0x7f010023, + 0x7f010024, 0x7f010025, 0x7f010026 + }; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abBackground} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

May be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". +

May be a color value, in the form of "#rgb", "#argb", +"#rrggbb", or "#aarrggbb". + @attr name android:abBackground + */ + public static final int SherlockTheme_abBackground = 30; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abCustomNavigationLayout} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:abCustomNavigationLayout + */ + public static final int SherlockTheme_abCustomNavigationLayout = 31; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abDisplayOptions} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be one or more (separated by '|') of the following constant values.

+ ++++ + + + + + +
ConstantValueDescription
useLogo0x1
showHome0x2
homeAsUp0x4
showTitle0x8
showCustom0x10
+ @attr name android:abDisplayOptions + */ + public static final int SherlockTheme_abDisplayOptions = 22; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abDivider} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

May be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". +

May be a color value, in the form of "#rgb", "#argb", +"#rrggbb", or "#aarrggbb". + @attr name android:abDivider + */ + public static final int SherlockTheme_abDivider = 29; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abHeight} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

May be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". +

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). + @attr name android:abHeight + */ + public static final int SherlockTheme_abHeight = 32; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abHomeAsUpIndicator} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:abHomeAsUpIndicator + */ + public static final int SherlockTheme_abHomeAsUpIndicator = 33; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abHomeLayout} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:abHomeLayout + */ + public static final int SherlockTheme_abHomeLayout = 34; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abIcon} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:abIcon + */ + public static final int SherlockTheme_abIcon = 27; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abIndeterminateProgressStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:abIndeterminateProgressStyle + */ + public static final int SherlockTheme_abIndeterminateProgressStyle = 36; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abItemPadding} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:abItemPadding + */ + public static final int SherlockTheme_abItemPadding = 38; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abLogo} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:abLogo + */ + public static final int SherlockTheme_abLogo = 28; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abNavigationMode} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be one of the following constant values.

+ ++++ + + + +
ConstantValueDescription
normal0
listMode1
tabMode2
+ @attr name android:abNavigationMode + */ + public static final int SherlockTheme_abNavigationMode = 21; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abProgressBarPadding} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:abProgressBarPadding + */ + public static final int SherlockTheme_abProgressBarPadding = 37; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abProgressBarStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:abProgressBarStyle + */ + public static final int SherlockTheme_abProgressBarStyle = 35; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abSubtitle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:abSubtitle + */ + public static final int SherlockTheme_abSubtitle = 24; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abSubtitleTextStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:abSubtitleTextStyle + */ + public static final int SherlockTheme_abSubtitleTextStyle = 26; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abTitle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:abTitle + */ + public static final int SherlockTheme_abTitle = 23; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#abTitleTextStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:abTitleTextStyle + */ + public static final int SherlockTheme_abTitleTextStyle = 25; + /** +

+ @attr description + attr name="actionBarStyle" format="reference" / + + +

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. +

May be one of the following constant values.

+ ++++ + +
ConstantValueDescription
wrap_content0
+

This is a private symbol. + @attr name android:actionBarSize + */ + public static final int SherlockTheme_actionBarSize = 7; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionBarTabBarStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionBarTabBarStyle + */ + public static final int SherlockTheme_actionBarTabBarStyle = 3; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionBarTabStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionBarTabStyle + */ + public static final int SherlockTheme_actionBarTabStyle = 2; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionBarTabTextStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionBarTabTextStyle + */ + public static final int SherlockTheme_actionBarTabTextStyle = 4; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionButtonStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionButtonStyle + */ + public static final int SherlockTheme_actionButtonStyle = 1; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionDropDownStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionDropDownStyle + */ + public static final int SherlockTheme_actionDropDownStyle = 0; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionHomeButtonStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionHomeButtonStyle + */ + public static final int SherlockTheme_actionHomeButtonStyle = 6; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionMenuTextAppearance} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionMenuTextAppearance + */ + public static final int SherlockTheme_actionMenuTextAppearance = 8; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionMenuTextColor} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

May be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". +

May be a color value, in the form of "#rgb", "#argb", +"#rrggbb", or "#aarrggbb". + @attr name android:actionMenuTextColor + */ + public static final int SherlockTheme_actionMenuTextColor = 9; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionModeBackground} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionModeBackground + */ + public static final int SherlockTheme_actionModeBackground = 11; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionModeCloseButtonStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionModeCloseButtonStyle + */ + public static final int SherlockTheme_actionModeCloseButtonStyle = 10; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionModeCloseDrawable} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionModeCloseDrawable + */ + public static final int SherlockTheme_actionModeCloseDrawable = 12; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionOverflowButtonStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionOverflowButtonStyle + */ + public static final int SherlockTheme_actionOverflowButtonStyle = 5; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#actionSpinnerItemStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:actionSpinnerItemStyle + */ + public static final int SherlockTheme_actionSpinnerItemStyle = 18; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#dropDownListViewStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:dropDownListViewStyle + */ + public static final int SherlockTheme_dropDownListViewStyle = 15; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#dropdownListPreferredItemHeight} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:dropdownListPreferredItemHeight + */ + public static final int SherlockTheme_dropdownListPreferredItemHeight = 17; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#homeAsUpIndicator} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:homeAsUpIndicator + */ + public static final int SherlockTheme_homeAsUpIndicator = 13; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#popupMenuStyle} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:popupMenuStyle + */ + public static final int SherlockTheme_popupMenuStyle = 16; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#selectableItemBackground} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:selectableItemBackground + */ + public static final int SherlockTheme_selectableItemBackground = 14; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#windowActionBar} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:windowActionBar + */ + public static final int SherlockTheme_windowActionBar = 19; + /** +

This symbol is the offset where the {@link com.actionbarsherlock.R.attr#windowActionModeOverlay} + attribute's value can be found in the {@link #SherlockTheme} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:windowActionModeOverlay + */ + public static final int SherlockTheme_windowActionModeOverlay = 20; + }; +} diff --git a/external/JakeWharton-ActionBarSherlock/library/pom.xml b/external/JakeWharton-ActionBarSherlock/library/pom.xml new file mode 100644 index 00000000..83c1ed2e --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + com.actionbarsherlock + library + ActionBarSherlock + apklib + + + com.actionbarsherlock + parent + 3.3.0 + ../pom.xml + + + + + android + android + provided + + + + + src + + + + com.jayway.maven.plugins.android.generation2 + maven-android-plugin + true + + + + org.apache.maven.plugins + maven-javadoc-plugin + + true + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + ${project.basedir}/checkstyle.xml + + + + verify + + checkstyle + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + package + + attach-artifact + + + + + jar + ${project.build.directory}/${project.build.finalName}.jar + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/project.properties b/external/JakeWharton-ActionBarSherlock/library/project.properties new file mode 100644 index 00000000..05e464d6 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/project.properties @@ -0,0 +1,12 @@ +# 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. + +android.library=true +# Project target. +target=android-13 diff --git a/external/JakeWharton-ActionBarSherlock/library/res/color/abs__item_bg.xml b/external/JakeWharton-ActionBarSherlock/library/res/color/abs__item_bg.xml new file mode 100644 index 00000000..1a5e2ed2 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/color/abs__item_bg.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/color/abs__tab_text_color_dark.xml b/external/JakeWharton-ActionBarSherlock/library/res/color/abs__tab_text_color_dark.xml new file mode 100644 index 00000000..ef120df8 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/color/abs__tab_text_color_dark.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/res/color/abs__tab_text_color_light.xml b/external/JakeWharton-ActionBarSherlock/library/res/color/abs__tab_text_color_light.xml new file mode 100644 index 00000000..4174d184 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/color/abs__tab_text_color_light.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_background_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_background_holo_dark.9.png new file mode 100644 index 00000000..1a916b3f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_background_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_background_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_background_holo_light.9.png new file mode 100644 index 00000000..e8c9c608 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_background_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_ic_close_focused_holo.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_ic_close_focused_holo.png new file mode 100644 index 00000000..9d7f9320 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_ic_close_focused_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_ic_close_normal_holo.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_ic_close_normal_holo.png new file mode 100644 index 00000000..641507df Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_ic_close_normal_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_ic_close_pressed_holo.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_ic_close_pressed_holo.png new file mode 100644 index 00000000..ebb0fc82 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__cab_ic_close_pressed_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__ic_ab_back_holo_dark.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__ic_ab_back_holo_dark.png new file mode 100644 index 00000000..7855cda9 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__ic_ab_back_holo_dark.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__ic_ab_back_holo_light.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__ic_ab_back_holo_light.png new file mode 100644 index 00000000..c0627734 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__ic_ab_back_holo_light.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_focused_holo.9.png new file mode 100644 index 00000000..e354629a Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_longpressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_longpressed_holo.9.png new file mode 100644 index 00000000..367c7d9e Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_longpressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_pressed_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_pressed_holo_dark.9.png new file mode 100644 index 00000000..9eae8f41 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_pressed_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_pressed_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_pressed_holo_light.9.png new file mode 100644 index 00000000..a9131fcb Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_pressed_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_selector_disabled_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_selector_disabled_holo_dark.9.png new file mode 100644 index 00000000..f6fd30dc Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_selector_disabled_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_selector_disabled_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_selector_disabled_holo_light.9.png new file mode 100644 index 00000000..ca8e9a27 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__list_selector_disabled_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_default_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_default_holo_dark.9.png new file mode 100644 index 00000000..ac36c068 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_default_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_default_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_default_holo_light.9.png new file mode 100644 index 00000000..68215998 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_default_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_disabled_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_disabled_holo_dark.9.png new file mode 100644 index 00000000..adde6941 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_disabled_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_disabled_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_disabled_holo_light.9.png new file mode 100644 index 00000000..fdb4bdff Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_disabled_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_focused_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_focused_holo_dark.9.png new file mode 100644 index 00000000..d40d165b Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_focused_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_focused_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_focused_holo_light.9.png new file mode 100644 index 00000000..096b977f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_focused_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_pressed_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_pressed_holo_dark.9.png new file mode 100644 index 00000000..3b260170 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_pressed_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_pressed_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_pressed_holo_light.9.png new file mode 100644 index 00000000..33b661b0 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_pressed_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_focused_holo.9.png new file mode 100644 index 00000000..1ba35d55 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_holo.9.png new file mode 100644 index 00000000..ef913cc8 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_pressed_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_pressed_focused_holo.9.png new file mode 100644 index 00000000..d7e96880 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_pressed_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_pressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_pressed_holo.9.png new file mode 100644 index 00000000..b8b1fcfe Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_pressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_focused_holo.9.png new file mode 100644 index 00000000..256e8e73 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_holo.9.png new file mode 100644 index 00000000..eaa306ae Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_pressed_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_pressed_focused_holo.9.png new file mode 100644 index 00000000..d17b8202 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_pressed_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_pressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_pressed_holo.9.png new file mode 100644 index 00000000..a344994f Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_pressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_background_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_background_holo_dark.9.png new file mode 100644 index 00000000..38f44ce1 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_background_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_background_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_background_holo_light.9.png new file mode 100644 index 00000000..2a4deea4 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_background_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_ic_close_focused_holo.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_ic_close_focused_holo.png new file mode 100644 index 00000000..59149e4a Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_ic_close_focused_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_ic_close_normal_holo.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_ic_close_normal_holo.png new file mode 100644 index 00000000..b3788853 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_ic_close_normal_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_ic_close_pressed_holo.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_ic_close_pressed_holo.png new file mode 100644 index 00000000..29b04078 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__cab_ic_close_pressed_holo.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__ic_ab_back_holo_dark.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__ic_ab_back_holo_dark.png new file mode 100644 index 00000000..ae3e6bfb Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__ic_ab_back_holo_dark.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__ic_ab_back_holo_light.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__ic_ab_back_holo_light.png new file mode 100644 index 00000000..c61e3fa8 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__ic_ab_back_holo_light.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_focused_holo.9.png new file mode 100644 index 00000000..e2449ddd Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_longpressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_longpressed_holo.9.png new file mode 100644 index 00000000..3483891c Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_longpressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_pressed_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_pressed_holo_dark.9.png new file mode 100644 index 00000000..e3344b62 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_pressed_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_pressed_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_pressed_holo_light.9.png new file mode 100644 index 00000000..23659786 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_pressed_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_selector_disabled_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_selector_disabled_holo_dark.9.png new file mode 100644 index 00000000..92da2f0d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_selector_disabled_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_selector_disabled_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_selector_disabled_holo_light.9.png new file mode 100644 index 00000000..42cb6463 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__list_selector_disabled_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_default_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_default_holo_dark.9.png new file mode 100644 index 00000000..99b16056 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_default_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_default_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_default_holo_light.9.png new file mode 100644 index 00000000..c820e40a Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_default_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_disabled_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_disabled_holo_dark.9.png new file mode 100644 index 00000000..95d7c86e Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_disabled_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_disabled_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_disabled_holo_light.9.png new file mode 100644 index 00000000..2dba2704 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_disabled_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_focused_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_focused_holo_dark.9.png new file mode 100644 index 00000000..2e2fadd8 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_focused_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_focused_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_focused_holo_light.9.png new file mode 100644 index 00000000..5bbbf639 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_focused_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_pressed_holo_dark.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_pressed_holo_dark.9.png new file mode 100644 index 00000000..083194a6 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_pressed_holo_dark.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_pressed_holo_light.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_pressed_holo_light.9.png new file mode 100644 index 00000000..29cbc462 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_pressed_holo_light.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_focused_holo.9.png new file mode 100644 index 00000000..9a33cd2d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_holo.9.png new file mode 100644 index 00000000..e029e577 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_pressed_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_pressed_focused_holo.9.png new file mode 100644 index 00000000..285116e3 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_pressed_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_pressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_pressed_holo.9.png new file mode 100644 index 00000000..dadefa75 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_pressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_focused_holo.9.png new file mode 100644 index 00000000..032a9921 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_holo.9.png new file mode 100644 index 00000000..848f3f13 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_pressed_focused_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_pressed_focused_holo.9.png new file mode 100644 index 00000000..38451358 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_pressed_focused_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_pressed_holo.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_pressed_holo.9.png new file mode 100644 index 00000000..23fd8c9b Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_pressed_holo.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-nodpi-v11/abs__action_item_divider.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-nodpi-v11/abs__action_item_divider.9.png new file mode 100644 index 00000000..c30f607d Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-nodpi-v11/abs__action_item_divider.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable-nodpi/abs__action_item_divider.9.png b/external/JakeWharton-ActionBarSherlock/library/res/drawable-nodpi/abs__action_item_divider.9.png new file mode 100644 index 00000000..62332880 Binary files /dev/null and b/external/JakeWharton-ActionBarSherlock/library/res/drawable-nodpi/abs__action_item_divider.9.png differ diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__cab_ic_close_holo.xml b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__cab_ic_close_holo.xml new file mode 100644 index 00000000..0da7e237 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__cab_ic_close_holo.xml @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__item_background_holo_dark.xml b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__item_background_holo_dark.xml new file mode 100644 index 00000000..b7b97b5a --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__item_background_holo_dark.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__item_background_holo_light.xml b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__item_background_holo_light.xml new file mode 100644 index 00000000..fdcac1d8 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__item_background_holo_light.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__list_selector_background_transition_holo_dark.xml b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__list_selector_background_transition_holo_dark.xml new file mode 100644 index 00000000..b2ce4f0f --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__list_selector_background_transition_holo_dark.xml @@ -0,0 +1,20 @@ + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__list_selector_background_transition_holo_light.xml b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__list_selector_background_transition_holo_light.xml new file mode 100644 index 00000000..d7e31b1d --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__list_selector_background_transition_holo_light.xml @@ -0,0 +1,20 @@ + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__spinner_background_holo_dark.xml b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__spinner_background_holo_dark.xml new file mode 100644 index 00000000..8d350040 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__spinner_background_holo_dark.xml @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__spinner_background_holo_light.xml b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__spinner_background_holo_light.xml new file mode 100644 index 00000000..0770f109 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__spinner_background_holo_light.xml @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__tab_indicator_holo.xml b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__tab_indicator_holo.xml new file mode 100644 index 00000000..542a5cee --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/drawable/abs__tab_indicator_holo.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout-large-land/abs__action_bar.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout-large-land/abs__action_bar.xml new file mode 100644 index 00000000..a9641546 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout-large-land/abs__action_bar.xml @@ -0,0 +1,20 @@ + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout-large-land/abs__screen_action_bar.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout-large-land/abs__screen_action_bar.xml new file mode 100644 index 00000000..794f5283 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout-large-land/abs__screen_action_bar.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout-large-land/abs__screen_action_bar_overlay.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout-large-land/abs__screen_action_bar_overlay.xml new file mode 100644 index 00000000..66a63f9d --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout-large-land/abs__screen_action_bar_overlay.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout-xlarge/abs__action_bar.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout-xlarge/abs__action_bar.xml new file mode 100644 index 00000000..a9641546 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout-xlarge/abs__action_bar.xml @@ -0,0 +1,20 @@ + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout-xlarge/abs__screen_action_bar.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout-xlarge/abs__screen_action_bar.xml new file mode 100644 index 00000000..794f5283 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout-xlarge/abs__screen_action_bar.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout-xlarge/abs__screen_action_bar_overlay.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout-xlarge/abs__screen_action_bar_overlay.xml new file mode 100644 index 00000000..66a63f9d --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout-xlarge/abs__screen_action_bar_overlay.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar.xml new file mode 100644 index 00000000..44f7dff2 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_home.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_home.xml new file mode 100644 index 00000000..3f846fbc --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_home.xml @@ -0,0 +1,37 @@ + + + + + + \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_inline.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_inline.xml new file mode 100644 index 00000000..2762c8bd --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_inline.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_item_layout.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_item_layout.xml new file mode 100644 index 00000000..85d86617 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_item_layout.xml @@ -0,0 +1,52 @@ + + + + + + + \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_tab_layout.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_tab_layout.xml new file mode 100644 index 00000000..8af6662e --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_tab_layout.xml @@ -0,0 +1,53 @@ + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_title_item.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_title_item.xml new file mode 100644 index 00000000..1d37ef58 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__action_bar_title_item.xml @@ -0,0 +1,44 @@ + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar.xml new file mode 100644 index 00000000..d3a5fb79 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar_inline.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar_inline.xml new file mode 100644 index 00000000..16c05d11 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar_inline.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar_inline_overlay.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar_inline_overlay.xml new file mode 100644 index 00000000..a8243dd4 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar_inline_overlay.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar_overlay.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar_overlay.xml new file mode 100644 index 00000000..a9c3cc7a --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_action_bar_overlay.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_simple.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_simple.xml new file mode 100644 index 00000000..0687578f --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__screen_simple.xml @@ -0,0 +1,43 @@ + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__simple_spinner_item.xml b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__simple_spinner_item.xml new file mode 100644 index 00000000..9be5ea8d --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/layout/abs__simple_spinner_item.xml @@ -0,0 +1,26 @@ + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/values-land/abs__constants.xml b/external/JakeWharton-ActionBarSherlock/library/res/values-land/abs__constants.xml new file mode 100644 index 00000000..c9028db7 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/values-land/abs__constants.xml @@ -0,0 +1,5 @@ + + + + 4 + \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/res/values-v11/abs__styles.xml b/external/JakeWharton-ActionBarSherlock/library/res/values-v11/abs__styles.xml new file mode 100644 index 00000000..5c0dd103 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/values-v11/abs__styles.xml @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/values-v13/abs__styles.xml b/external/JakeWharton-ActionBarSherlock/library/res/values-v13/abs__styles.xml new file mode 100644 index 00000000..4112a4aa --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/values-v13/abs__styles.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/values/abs__attrs.xml b/external/JakeWharton-ActionBarSherlock/library/res/values/abs__attrs.xml new file mode 100644 index 00000000..0e51e5ad --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/values/abs__attrs.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/res/values/abs__constants.xml b/external/JakeWharton-ActionBarSherlock/library/res/values/abs__constants.xml new file mode 100644 index 00000000..ddcb58b9 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/values/abs__constants.xml @@ -0,0 +1,7 @@ + + + + #FF6899FF + 3 + tabUnderAb + \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/res/values/abs__styles.xml b/external/JakeWharton-ActionBarSherlock/library/res/values/abs__styles.xml new file mode 100644 index 00000000..a1fee779 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/res/values/abs__styles.xml @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/ActionBar.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/ActionBar.java new file mode 100644 index 00000000..e4a72d03 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/ActionBar.java @@ -0,0 +1,807 @@ +/* + * Copyright 2011 Jake Wharton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.support.v4.app; + +import android.app.Activity; +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.support.v4.view.ActionMode; +import android.util.AttributeSet; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewGroup.MarginLayoutParams; +import android.widget.SpinnerAdapter; + +/** + * This is the public interface to the contextual ActionBar. The ActionBar acts + * as a replacement for the title bar in Activities. It provides facilities for + * creating toolbar actions as well as methods of navigating around an + * application. + */ +public abstract class ActionBar { + /** Parent activity. */ + protected final SupportActivity mActivity; + /** Parent context. */ + protected final Context mContext; + + + protected ActionBar(T activity) { + mActivity = activity; + mContext = activity; + } + + /** + * Return the actual public action bar instance. This will either return + * itself or null depending on the state of the underlying action bar. + * + * @return Action bar instance. + */ + protected abstract ActionBar getPublicInstance(); + + // ------------------------------------------------------------------------ + // ACTION MODE SUPPORT + // ------------------------------------------------------------------------ + + protected abstract ActionMode startActionMode(ActionMode.Callback callback); + + // ------------------------------------------------------------------------ + // ACTION BAR SUPPORT + // ------------------------------------------------------------------------ + + /** + * Per-child layout information associated with action bar custom views. + */ + public static class LayoutParams extends MarginLayoutParams { + /** + * Gravity for the view associated with these LayoutParams. + * + * @see android.view.Gravity + */ + public int gravity = -1; + + public LayoutParams() { + this(-1); + } + public LayoutParams(Context c, AttributeSet attrs) { + super(c, attrs); + } + public LayoutParams(int width, int height) { + super(width, height); + } + public LayoutParams(int width, int height, int gravity) { + this(width, height); + this.gravity = gravity; + } + public LayoutParams(int gravity) { + this(0, 0, gravity); + } + public LayoutParams(LayoutParams source) { + super(source); + this.gravity = source.gravity; + } + public LayoutParams(ViewGroup.LayoutParams source) { + super(source); + } + } + + /** + * Listener for receiving events when action bar menus are shown or hidden. + */ + public interface OnMenuVisibilityListener { + /** + * Called when an action bar menu is shown or hidden. Applications may + * want to use this to tune auto-hiding behavior for the action bar or + * pause/resume video playback, gameplay, or other activity within the + * main content area. + * + * @param isVisible True if an action bar menu is now visible, false if + * no action bar menus are visible. + */ + void onMenuVisibilityChanged(boolean isVisible); + } + + /** + * Listener interface for ActionBar navigation events. + */ + public interface OnNavigationListener { + /** + * This method is called whenever a navigation item in your action bar + * is selected. + * + * @param itemPosition Position of the item clicked. + * @param itemId ID of the item clicked. + * @return True if the event was handled, false otherwise. + */ + boolean onNavigationItemSelected(int itemPosition, long itemId); + } + + /** + *

A tab in the action bar.

+ * + *

Tabs manage the hiding and showing of + * {@link android.support.v4.app.Fragment}.

+ */ + public static abstract class Tab { + /** + * An invalid position for a tab. + * + * @see #getPosition() + */ + public static int INVALID_POSITION = android.app.ActionBar.Tab.INVALID_POSITION; + + + /** + * Retrieve a previously set custom view for this tab. + * + * @return The custom view set by {@link #setCustomView(View)}. + */ + public abstract View getCustomView(); + + /** + * Return the icon associated with this tab. + * + * @return The tab's icon + */ + public abstract Drawable getIcon(); + + /** + * Return the current position of this tab in the action bar. + * + * @return Current position, or {@link #INVALID_POSITION} if this tab is + * not currently in the action bar. + */ + public abstract int getPosition(); + + /** + * Return the current tab listener. + * + * @return Tab listener. + */ + public abstract ActionBar.TabListener getTabListener(); + + /** + * @return This Tab's tag object. + */ + public abstract Object getTag(); + + /** + * Return the text of this tab. + * + * @return The tab's text + */ + public abstract CharSequence getText(); + + /** + * Select this tab. Only valid if the tab has been added to the action + * bar. + */ + public abstract void select(); + + /** + * Set a custom view to be used for this tab. This overrides values set + * by {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. + * + * @param layoutResId A layout resource to inflate and use as a custom + * tab view + * @return The current instance for call chaining + */ + public abstract ActionBar.Tab setCustomView(int layoutResId); + + /** + * Set a custom view to be used for this tab. This overrides values set + * by {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. + * + * @param view Custom view to be used as a tab. + * @return The current instance for call chaining + */ + public abstract ActionBar.Tab setCustomView(View view); + + /** + * Set the icon displayed on this tab. + * + * @param icon The drawable to use as an icon + * @return The current instance for call chaining + */ + public abstract ActionBar.Tab setIcon(Drawable icon); + + /** + * Set the icon displayed on this tab. + * + * @param resId Resource ID referring to the drawable to use as an icon + * @return The current instance for call chaining + */ + public abstract ActionBar.Tab setIcon(int resId); + + /** + * Set the {@link ActionBar.TabListener} that will handle switching to + * and from this tab. All tabs must have a TabListener set before being + * added to the ActionBar. + * + * @param listener Listener to handle tab selection events + * @return The current instance for call chaining + */ + public abstract ActionBar.Tab setTabListener(ActionBar.TabListener listener); + + /** + * Give this Tab an arbitrary object to hold for later use. + * + * @param obj Object to store + * @return The current instance for call chaining + */ + public abstract ActionBar.Tab setTag(Object obj); + + /** + * Set the text displayed on this tab. Text may be truncated if there is + * not room to display the entire string. + * + * @param resId A resource ID referring to the text that should be displayed + * @return The current instance for call chaining + */ + public abstract ActionBar.Tab setText(int resId); + + /** + * Set the text displayed on this tab. Text may be truncated if there is + * not room to display the entire string. + * + * @param text The text to display + * @return The current instance for call chaining + */ + public abstract ActionBar.Tab setText(CharSequence text); + } + + /** + * Callback interface invoked when a tab is focused, unfocused, added, or + * removed. + */ + public interface TabListener { + /** + * Called when a tab that is already selected is chosen again by the + * user. Some applications may use this action to return to the top + * level of a category. + * + * @param tab The tab that was reselected. + * @param ft Unused, always {@code null}. Begin your own transaction by + * calling {@link FragmentActivity#getSupportFragmentManager()}. + */ + void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft); + + /** + * Called when a tab enters the selected state. + * + * @param tab The tab that was selected + * @param ft Unused, always {@code null}. Begin your own transaction by + * calling {@link FragmentActivity#getSupportFragmentManager()}. + */ + void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft); + + /** + * Called when a tab exits the selected state. + * + * @param tab The tab that was unselected + * @param ft Unused, always {@code null}. Begin your own transaction by + * calling {@link FragmentActivity#getSupportFragmentManager()}. + */ + void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft); + } + + + + /** + * Display the 'home' element such that it appears as an 'up' affordance. + * e.g. show an arrow to the left indicating the action that will be taken. + * Set this flag if selecting the 'home' button in the action bar to return + * up by a single level in your UI rather than back to the top level or + * front page. + * + * @see #setDisplayOptions(int) + * @see #setDisplayOptions(int, int) + */ + public static final int DISPLAY_HOME_AS_UP = android.app.ActionBar.DISPLAY_HOME_AS_UP; + + /** + * Show the custom view if one has been set. + * + * @see #setCustomView(int) + * @see #setCustomView(View) + * @see #setCustomView(View, LayoutParams) + * @see #setDisplayOptions(int) + * @see #setDisplayOptions(int, int) + */ + public static final int DISPLAY_SHOW_CUSTOM = android.app.ActionBar.DISPLAY_SHOW_CUSTOM; + + /** + * Show 'home' elements in this action bar, leaving more space for other + * navigation elements. This includes logo and icon. + * + * @see #setDisplayOptions(int) + * @see #setDisplayOptions(int, int) + */ + public static final int DISPLAY_SHOW_HOME = android.app.ActionBar.DISPLAY_SHOW_HOME; + + /** + * Show the activity title and subtitle, if present. + * + * @see #setTitle(CharSequence) + * @see #setTitle(int) + * @see #setSubtitle(CharSequence) + * @see #setSubtitle(int) + * @see #setDisplayOptions(int) + * @see #setDisplayOptions(int, int) + */ + public static final int DISPLAY_SHOW_TITLE = android.app.ActionBar.DISPLAY_SHOW_TITLE; + + /** + * Use logo instead of icon if available. This flag will cause appropriate + * navigation modes to use a wider logo in place of the standard icon. + * + * @see #setDisplayOptions(int) + * @see #setDisplayOptions(int, int) + */ + public static final int DISPLAY_USE_LOGO = android.app.ActionBar.DISPLAY_USE_LOGO; + + /** + * List navigation mode. Instead of static title text this mode presents a + * list menu for navigation within the activity. e.g. this might be + * presented to the user as a dropdown list. + */ + public static final int NAVIGATION_MODE_LIST = android.app.ActionBar.NAVIGATION_MODE_LIST; + + /** + * Standard navigation mode. Consists of either a logo or icon and title + * text with an optional subtitle. Clicking any of these elements will + * dispatch onOptionsItemSelected to the host Activity with a MenuItem with + * item ID android.R.id.home. + */ + public static final int NAVIGATION_MODE_STANDARD = android.app.ActionBar.NAVIGATION_MODE_STANDARD; + + /** + * Tab navigation mode. Instead of static title text this mode presents a + * series of tabs for navigation within the activity. + */ + public static final int NAVIGATION_MODE_TABS = android.app.ActionBar.NAVIGATION_MODE_TABS; + + + + /** + * Add a listener that will respond to menu visibility change events. + * + * @param listener The new listener to add + */ + public abstract void addOnMenuVisibilityListener(ActionBar.OnMenuVisibilityListener listener); + + /** + * Add a tab for use in tabbed navigation mode. The tab will be added at the + * end of the list. If this is the first tab to be added it will become the + * selected tab. + * + * @param tab Tab to add + */ + public abstract void addTab(ActionBar.Tab tab); + + /** + * Add a tab for use in tabbed navigation mode. The tab will be added at the + * end of the list. + * + * @param tab Tab to add + * @param setSelected True if the added tab should become the selected tab. + */ + public abstract void addTab(ActionBar.Tab tab, boolean setSelected); + + /** + * Add a tab for use in tabbed navigation mode. The tab will be inserted at + * {@code position}. If this is the first tab to be added it will become the + * selected tab. + * + * @param tab The tab to add + * @param position The new position of the tab + */ + public abstract void addTab(ActionBar.Tab tab, int position); + + /** + * Add a tab for use in tabbed navigation mode. The tab will be insterted at + * {@code position}. + * + * @param tab The tab to add + * @param position The new position of the tab + * @param setSelected True if the added tab should become the selected tab. + */ + public abstract void addTab(ActionBar.Tab tab, int position, boolean setSelected); + + /** + * @return The current custom view. + */ + public abstract View getCustomView(); + + /** + * @return The current set of display options. + */ + public abstract int getDisplayOptions(); + + /** + * Retrieve the current height of the ActionBar. + * + * @return The ActionBar's height + */ + public abstract int getHeight(); + + /** + * Get the number of navigation items present in the current navigation + * mode. + * + * @return Number of navigation items. + */ + public abstract int getNavigationItemCount(); + + /** + * Returns the current navigation mode. The result will be one of: + *
    + *
  • {@link #NAVIGATION_MODE_STANDARD}
  • + *
  • {@link #NAVIGATION_MODE_LIST}
  • + *
  • {@link #NAVIGATION_MODE_TABS}
  • + *
+ * + * @return The current navigation mode. + * @see #setNavigationMode(int) + */ + public abstract int getNavigationMode(); + + /** + * Get the position of the selected navigation item in list or tabbed + * navigation modes. + * + * @return Position of the selected item. + */ + public abstract int getSelectedNavigationIndex(); + + /** + * Returns the currently selected tab if in tabbed navigation mode and there + * is at least one tab present. + * + * @return The currently selected tab or null. + */ + public abstract ActionBar.Tab getSelectedTab(); + + /** + * Returns the current ActionBar subtitle in standard mode. Returns null if + * {@link #getNavigationMode()} would not return + * {@link #NAVIGATION_MODE_STANDARD}. + * + * @return The current ActionBar subtitle or null. + */ + public abstract CharSequence getSubtitle(); + + /** + * Returns the tab at the specified index. + * + * @param index Index value in the range 0-get + * @return Tab at specified index + */ + public abstract ActionBar.Tab getTabAt(int index); + + /** + * Returns the number of tabs currently registered with the action bar. + * + * @return Tab count + */ + public abstract int getTabCount(); + + /** + * Returns the current ActionBar title in standard mode. Returns null if + * {@link #getNavigationMode()} would not return + * {@link #NAVIGATION_MODE_STANDARD}. + * + * @return The current ActionBar title or null. + */ + public abstract CharSequence getTitle(); + + /** + * Hide the ActionBar if it is not currently showing. If the window hosting + * the ActionBar does not have the feature + * {@link android.support.v4.view.Window#FEATURE_ACTION_BAR_OVERLAY} + * it will resize application content to fit the new space available. + */ + public abstract void hide(); + + /** + * @return {@code true} if the ActionBar is showing, {@code false} + * otherwise. + */ + public abstract boolean isShowing(); + + /** + * Create and return a new ActionBar.Tab. This tab will not be included in + * the action bar until it is added. + * + * @return A new Tab + * @see #addTab(Tab) + * @see #addTab(Tab, boolean) + * @see #addTab(Tab, int) + * @see #addTab(Tab, int, boolean) + */ + public abstract ActionBar.Tab newTab(); + + /** + * Remove all tabs from the action bar and deselect the current tab. + */ + public abstract void removeAllTabs(); + + /** + * Remove a menu visibility listener. This listener will no longer receive + * menu visibility change events. + * + * @param listener A listener to remove that was previously added + */ + public abstract void removeOnMenuVisibilityListener(ActionBar.OnMenuVisibilityListener listener); + + /** + * Remove a tab from the action bar. If the removed tab was selected it will + * be deselected and another tab will be selected if present. + * + * @param tab The tab to remove + */ + public abstract void removeTab(ActionBar.Tab tab); + + /** + * Remove a tab from the action bar. If the removed tab was selected it will + * be deselected and another tab will be selected if present. + * + * @param position Position of the tab to remove + */ + public abstract void removeTabAt(int position); + + /** + *

Select the specified tab. If it is not a child of this action bar it + * will be added.

+ * + *

Note: If you want to select by index, use + * {@link #setSelectedNavigationItem(int)}.

+ * + * @param tab Tab to select + */ + public abstract void selectTab(ActionBar.Tab tab); + + /** + * Set the ActionBar's background. + * + * @param d Background drawable + */ + public abstract void setBackgroundDrawable(Drawable d); + + /** + *

Set the action bar into custom navigation mode, supplying a view for + * custom navigation.

+ * + *

Custom navigation views appear between the application icon and any + * action buttons and may use any space available there. Common use cases + * for custom navigation views might include an auto-suggesting address bar + * for a browser or other navigation mechanisms that do not translate well + * to provided navigation modes.

+ * + *

The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for the + * custom view to be displayed.

+ * + * @param resId Resource ID of a layout to inflate into the ActionBar. + * @see #setDisplayOptions(int, int) + */ + public abstract void setCustomView(int resId); + + /** + * Set the action bar into custom navigation mode, supplying a view for + * custom navigation. Custom navigation views appear between the application + * icon and any action buttons and may use any space available there. Common + * use cases for custom navigation views might include an auto-suggesting + * address bar for a browser or other navigation mechanisms that do not + * translate well to provided navigation modes. + * + * @param view Custom navigation view to place in the ActionBar. + */ + public abstract void setCustomView(View view); + + /** + *

Set the action bar into custom navigation mode, supplying a view for + * custom navigation.

+ * + *

Custom navigation views appear between the application icon and any + * action buttons and may use any space available there. Common use cases + * for custom navigation views might include an auto-suggesting address bar + * for a browser or other navigation mechanisms that do not translate well + * to provided navigation modes.

+ * + *

The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for the + * custom view to be displayed.

+ * + * @param view Custom navigation view to place in the ActionBar. + * @param layoutParams How this custom view should layout in the bar. + * @see #setDisplayOptions(int, int) + */ + public abstract void setCustomView(View view, ActionBar.LayoutParams layoutParams); + + /** + *

Set whether home should be displayed as an "up" affordance. Set this + * to true if selecting "home" returns up by a single level in your UI + * rather than back to the top level or front page.

+ * + *

To set several display options at once, see the setDisplayOptions + * methods.

+ * + * @param showHomeAsUp {@code true} to show the user that selecting home + * will return one level up rather than to the top level of the app. + * @see #setDisplayOptions(int) + * @see #setDisplayOptions(int, int) + */ + public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); + + /** + *

Set selected display options. Only the options specified by mask will + * be changed. To change all display option bits at once, see + * {@link #setDisplayOptions(int)}. + * + *

Example: {@code setDisplayOptions(0, DISPLAY_SHOW_HOME)} will disable + * the {@link #DISPLAY_SHOW_HOME} option. + * {@code setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO)} + * will enable {@link #DISPLAY_SHOW_HOME} and disable + * {@link #DISPLAY_USE_LOGO}.

+ * + * @param options A combination of the bits defined by the DISPLAY_ + * constants defined in ActionBar. + * @param mask A bit mask declaring which display options should be changed. + */ + public abstract void setDisplayOptions(int options, int mask); + + /** + * Set display options. This changes all display option bits at once. To + * change a limited subset of display options, see + * {@link #setDisplayOptions(int, int)}. + * + * @param options A combination of the bits defined by the DISPLAY_ + * constants defined in ActionBar. + */ + public abstract void setDisplayOptions(int options); + + /** + *

Set whether a custom view should be displayed, if set.

+ * + *

To set several display options at once, see the setDisplayOptions + * methods.

+ * + * @param showCustom {@code true} if the currently set custom view should be + * displayed, {@code false} otherwise. + * @see #setDisplayOptions(int) + * @see #setDisplayOptions(int, int) + */ + public abstract void setDisplayShowCustomEnabled(boolean showCustom); + + /** + *

Set whether to include the application home affordance in the action + * bar. Home is presented as either an activity icon or logo.

+ * + *

To set several display options at once, see the setDisplayOptions + * methods.

+ * + * @param showHome {@code true} to show home, {@code false} otherwise. + * @see #setDisplayOptions(int) + * @see #setDisplayOptions(int, int) + */ + public abstract void setDisplayShowHomeEnabled(boolean showHome); + + /** + *

Set whether an activity title/subtitle should be displayed.

+ * + *

To set several display options at once, see the setDisplayOptions + * methods.

+ * + * @param showTitle {@code true} to display a title/subtitle if present. + * @see #setDisplayOptions(int) + * @see #setDisplayOptions(int, int) + */ + public abstract void setDisplayShowTitleEnabled(boolean showTitle); + + /** + *

Set whether to display the activity logo rather than the activity + * icon. A logo is often a wider, more detailed image.

+ * + *

To set several display options at once, see the setDisplayOptions + * methods.

+ * + * @param useLogo {@code true} to use the activity logo, {@code false} to + * use the activity icon. + * @see #setDisplayOptions(int) + * @see #setDisplayOptions(int, int) + */ + public abstract void setDisplayUseLogoEnabled(boolean useLogo); + + /** + * Set the adapter and navigation callback for list navigation mode. The + * supplied adapter will provide views for the expanded list as well as the + * currently selected item. (These may be displayed differently.) The + * supplied OnNavigationListener will alert the application when the user + * changes the current list selection. + * + * @param adapter An adapter that will provide views both to display the + * current navigation selection and populate views within the dropdown + * navigation menu. + * @param callback An OnNavigationListener that will receive events when the + * user selects a navigation item. + */ + public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, ActionBar.OnNavigationListener callback); + + /** + * Set the current navigation mode. + * + * @param mode The new mode to set. + * @see #NAVIGATION_MODE_STANDARD + * @see #NAVIGATION_MODE_LIST + * @see #NAVIGATION_MODE_TABS + */ + public abstract void setNavigationMode(int mode); + + /** + * Set the selected navigation item in list or tabbed navigation modes. + * + * @param position Position of the item to select. + */ + public abstract void setSelectedNavigationItem(int position); + + /** + * Set the action bar's subtitle. This will only be displayed if + * @link #DISPLAY_SHOW_TITLE} is set. + * + * @param resId Resource ID of subtitle string to set + * @see #setSubtitle(CharSequence) + * @see #setDisplayOptions(int, int) + */ + public abstract void setSubtitle(int resId); + + /** + * Set the action bar's subtitle. This will only be displayed if + * @{link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the subtitle + * entirely. + * + * @param subtitle Subtitle to set + * @see #setSubtitle(int) + * @see #setDisplayOptions(int, int) + */ + public abstract void setSubtitle(CharSequence subtitle); + + /** + * Set the action bar's title. This will only be displayed if + * @{link #DISPLAY_SHOW_TITLE} is set. + * + * @param title Title to set + * @see #setTitle(int) + * @see #setDisplayOptions(int, int) + */ + public abstract void setTitle(CharSequence title); + + /** + * Set the action bar's title. This will only be displayed if + * {@link #DISPLAY_SHOW_TITLE} is set. + * + * @param resId Resource ID of title string to set + * @see #setTitle(CharSequence) + * @see #setDisplayOptions(int, int) + */ + public abstract void setTitle(int resId); + + /** + * Show the ActionBar if it is not currently showing. If the window hosting + * the ActionBar does not have the feature + * {@link android.support.v4.view.Window#FEATURE_ACTION_BAR_OVERLAY} + * it will resize application content to fit the new space available. + */ + public abstract void show(); +} \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/BackStackRecord.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/BackStackRecord.java new file mode 100644 index 00000000..8da02c67 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/BackStackRecord.java @@ -0,0 +1,721 @@ +/* + * 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 android.support.v4.app; + +import android.os.Build; +import android.os.Parcel; +import android.os.Parcelable; +import android.text.TextUtils; +import android.util.Log; +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.util.ArrayList; +import com.actionbarsherlock.R; + +final class BackStackState implements Parcelable { + final int[] mOps; + final int mTransition; + final int mTransitionStyle; + final String mName; + final int mIndex; + final int mBreadCrumbTitleRes; + final CharSequence mBreadCrumbTitleText; + final int mBreadCrumbShortTitleRes; + final CharSequence mBreadCrumbShortTitleText; + + public BackStackState(FragmentManagerImpl fm, BackStackRecord bse) { + int numRemoved = 0; + BackStackRecord.Op op = bse.mHead; + while (op != null) { + if (op.removed != null) numRemoved += op.removed.size(); + op = op.next; + } + mOps = new int[bse.mNumOp*5 + numRemoved]; + + if (!bse.mAddToBackStack) { + throw new IllegalStateException("Not on back stack"); + } + + op = bse.mHead; + int pos = 0; + while (op != null) { + mOps[pos++] = op.cmd; + mOps[pos++] = op.fragment.mIndex; + mOps[pos++] = op.enterAnim; + mOps[pos++] = op.exitAnim; + if (op.removed != null) { + final int N = op.removed.size(); + mOps[pos++] = N; + for (int i=0; i 0) { + op.removed = new ArrayList(N); + for (int i=0; i CREATOR + = new Parcelable.Creator() { + public BackStackState createFromParcel(Parcel in) { + return new BackStackState(in); + } + + public BackStackState[] newArray(int size) { + return new BackStackState[size]; + } + }; +} + +/** + * @hide Entry of an operation on the fragment back stack. + */ +final class BackStackRecord extends FragmentTransaction implements + FragmentManager.BackStackEntry, Runnable { + static final String TAG = "BackStackEntry"; + + private static final boolean IS_HONEYCOMB = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; + + final FragmentManagerImpl mManager; + + static final int OP_NULL = 0; + static final int OP_ADD = 1; + static final int OP_REPLACE = 2; + static final int OP_REMOVE = 3; + static final int OP_HIDE = 4; + static final int OP_SHOW = 5; + static final int OP_DETACH = 6; + static final int OP_ATTACH = 7; + + static final class Op { + Op next; + Op prev; + int cmd; + Fragment fragment; + int enterAnim; + int exitAnim; + ArrayList removed; + } + + Op mHead; + Op mTail; + int mNumOp; + int mEnterAnim; + int mExitAnim; + int mTransition; + int mTransitionStyle; + boolean mAddToBackStack; + boolean mAllowAddToBackStack = true; + String mName; + boolean mCommitted; + int mIndex; + + int mBreadCrumbTitleRes; + CharSequence mBreadCrumbTitleText; + int mBreadCrumbShortTitleRes; + CharSequence mBreadCrumbShortTitleText; + + public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { + writer.print(prefix); writer.print("mName="); writer.print(mName); + writer.print(" mIndex="); writer.print(mIndex); + writer.print(" mCommitted="); writer.println(mCommitted); + if (mTransition != FragmentTransaction.TRANSIT_NONE) { + writer.print(prefix); writer.print("mTransition=#"); + writer.print(Integer.toHexString(mTransition)); + writer.print(" mTransitionStyle=#"); + writer.println(Integer.toHexString(mTransitionStyle)); + } + if (mEnterAnim != 0 || mExitAnim !=0) { + writer.print(prefix); writer.print("mEnterAnim=#"); + writer.print(Integer.toHexString(mEnterAnim)); + writer.print(" mExitAnim=#"); + writer.println(Integer.toHexString(mExitAnim)); + } + if (mBreadCrumbTitleRes != 0 || mBreadCrumbTitleText != null) { + writer.print(prefix); writer.print("mBreadCrumbTitleRes=#"); + writer.print(Integer.toHexString(mBreadCrumbTitleRes)); + writer.print(" mBreadCrumbTitleText="); + writer.println(mBreadCrumbTitleText); + } + if (mBreadCrumbShortTitleRes != 0 || mBreadCrumbShortTitleText != null) { + writer.print(prefix); writer.print("mBreadCrumbShortTitleRes=#"); + writer.print(Integer.toHexString(mBreadCrumbShortTitleRes)); + writer.print(" mBreadCrumbShortTitleText="); + writer.println(mBreadCrumbShortTitleText); + } + + if (mHead != null) { + writer.print(prefix); writer.println("Operations:"); + String innerPrefix = prefix + " "; + Op op = mHead; + int num = 0; + while (op != null) { + writer.print(prefix); writer.print(" Op #"); writer.print(num); + writer.println(":"); + writer.print(innerPrefix); writer.print("cmd="); writer.print(op.cmd); + writer.print(" fragment="); writer.println(op.fragment); + if (op.enterAnim != 0 || op.exitAnim != 0) { + writer.print(prefix); writer.print("enterAnim="); writer.print(op.enterAnim); + writer.print(" exitAnim="); writer.println(op.exitAnim); + } + if (op.removed != null && op.removed.size() > 0) { + for (int i=0; i=0; i--) { + Fragment r = op.removed.get(i); + r.mBackStackNesting += amt; + if (FragmentManagerImpl.DEBUG) Log.v(TAG, "Bump nesting of " + + r + " to " + r.mBackStackNesting); + } + } + op = op.next; + } + } + + public int commit() { + return commitInternal(false); + } + + public int commitAllowingStateLoss() { + return commitInternal(true); + } + + int commitInternal(boolean allowStateLoss) { + if (mCommitted) throw new IllegalStateException("commit already called"); + if (FragmentManagerImpl.DEBUG) Log.v(TAG, "Commit: " + this); + mCommitted = true; + if (mAddToBackStack) { + mIndex = mManager.allocBackStackIndex(this); + } else { + mIndex = -1; + } + mManager.enqueueAction(this, allowStateLoss); + return mIndex; + } + + public void run() { + if (FragmentManagerImpl.DEBUG) Log.v(TAG, "Run: " + this); + + if (mAddToBackStack) { + if (mIndex < 0) { + throw new IllegalStateException("addToBackStack() called after commit()"); + } + } + + bumpBackStackNesting(1); + + Op op = mHead; + while (op != null) { + switch (op.cmd) { + case OP_ADD: { + Fragment f = op.fragment; + f.mNextAnim = op.enterAnim; + mManager.addFragment(f, false); + } break; + case OP_REPLACE: { + Fragment f = op.fragment; + if (mManager.mAdded != null) { + for (int i=0; i= 0) { + mManager.freeBackStackIndex(mIndex); + mIndex = -1; + } + } + + public String getName() { + return mName; + } + + public int getTransition() { + return mTransition; + } + + public int getTransitionStyle() { + return mTransitionStyle; + } + + public boolean isEmpty() { + return mNumOp == 0; + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/DialogFragment.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/DialogFragment.java new file mode 100644 index 00000000..a5b89a91 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/DialogFragment.java @@ -0,0 +1,396 @@ +/* + * 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 android.support.v4.app; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; + +/** + * Static library support version of the framework's {@link android.app.DialogFragment}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + */ +public class DialogFragment extends Fragment + implements DialogInterface.OnCancelListener, DialogInterface.OnDismissListener { + + /** + * Style for {@link #setStyle(int, int)}: a basic, + * normal dialog. + */ + public static final int STYLE_NORMAL = 0; + + /** + * Style for {@link #setStyle(int, int)}: don't include + * a title area. + */ + public static final int STYLE_NO_TITLE = 1; + + /** + * Style for {@link #setStyle(int, int)}: don't draw + * any frame at all; the view hierarchy returned by {@link #onCreateView} + * is entirely responsible for drawing the dialog. + */ + public static final int STYLE_NO_FRAME = 2; + + /** + * Style for {@link #setStyle(int, int)}: like + * {@link #STYLE_NO_FRAME}, but also disables all input to the dialog. + * The user can not touch it, and its window will not receive input focus. + */ + public static final int STYLE_NO_INPUT = 3; + + private static final String SAVED_DIALOG_STATE_TAG = "android:savedDialogState"; + private static final String SAVED_STYLE = "android:style"; + private static final String SAVED_THEME = "android:theme"; + private static final String SAVED_CANCELABLE = "android:cancelable"; + private static final String SAVED_SHOWS_DIALOG = "android:showsDialog"; + private static final String SAVED_BACK_STACK_ID = "android:backStackId"; + + int mStyle = STYLE_NORMAL; + int mTheme = 0; + boolean mCancelable = true; + boolean mShowsDialog = false; + int mBackStackId = -1; + + Dialog mDialog; + boolean mDestroyed; + boolean mRemoved; + + public DialogFragment() { + } + + /** + * Call to customize the basic appearance and behavior of the + * fragment's dialog. This can be used for some common dialog behaviors, + * taking care of selecting flags, theme, and other options for you. The + * same effect can be achieve by manually setting Dialog and Window + * attributes yourself. Calling this after the fragment's Dialog is + * created will have no effect. + * + * @param style Selects a standard style: may be {@link #STYLE_NORMAL}, + * {@link #STYLE_NO_TITLE}, {@link #STYLE_NO_FRAME}, or + * {@link #STYLE_NO_INPUT}. + * @param theme Optional custom theme. If 0, an appropriate theme (based + * on the style) will be selected for you. + */ + public void setStyle(int style, int theme) { + mStyle = style; + if (mStyle == STYLE_NO_FRAME || mStyle == STYLE_NO_INPUT) { + mTheme = android.R.style.Theme_Panel; + } + if (theme != 0) { + mTheme = theme; + } + } + + /** + * Display the dialog, adding the fragment to the given FragmentManager. This + * is a convenience for explicitly creating a transaction, adding the + * fragment to it with the given tag, and committing it. This does + * not add the transaction to the back stack. When the fragment + * is dismissed, a new transaction will be executed to remove it from + * the activity. + * @param manager The FragmentManager this fragment will be added to. + * @param tag The tag for this fragment, as per + * {@link FragmentTransaction#add(Fragment, String) FragmentTransaction.add}. + */ + public void show(FragmentManager manager, String tag) { + setShowsDialog(true); + FragmentTransaction ft = manager.beginTransaction(); + ft.add(this, tag); + ft.commit(); + } + + /** + * Display the dialog, adding the fragment using an existing transaction + * and then committing the transaction. + * @param transaction An existing transaction in which to add the fragment. + * @param tag The tag for this fragment, as per + * {@link FragmentTransaction#add(Fragment, String) FragmentTransaction.add}. + * @return Returns the identifier of the committed transaction, as per + * {@link FragmentTransaction#commit() FragmentTransaction.commit()}. + */ + public int show(FragmentTransaction transaction, String tag) { + setShowsDialog(true); + transaction.add(this, tag); + mRemoved = false; + mBackStackId = transaction.commit(); + return mBackStackId; + } + + /** + * Dismiss the fragment and its dialog. If the fragment was added to the + * back stack, all back stack state up to and including this entry will + * be popped. Otherwise, a new transaction will be committed to remove + * the fragment. + */ + public void dismiss() { + dismissInternal(false); + } + + void dismissInternal(boolean allowStateLoss) { + if (mDialog != null) { + mDialog.dismiss(); + mDialog = null; + } + mRemoved = true; + if (mBackStackId >= 0) { + getFragmentManager().popBackStack(mBackStackId, + FragmentManager.POP_BACK_STACK_INCLUSIVE); + mBackStackId = -1; + } else { + FragmentTransaction ft = getFragmentManager().beginTransaction(); + ft.remove(this); + if (allowStateLoss) { + ft.commitAllowingStateLoss(); + } else { + ft.commit(); + } + } + } + + public Dialog getDialog() { + return mDialog; + } + + public int getTheme() { + return mTheme; + } + + /** + * Control whether the shown Dialog is cancelable. Use this instead of + * directly calling {@link Dialog#setCancelable(boolean) + * Dialog.setCancelable(boolean)}, because DialogFragment needs to change + * its behavior based on this. + * + * @param cancelable If true, the dialog is cancelable. The default + * is true. + */ + public void setCancelable(boolean cancelable) { + mCancelable = cancelable; + if (mDialog != null) mDialog.setCancelable(cancelable); + } + + /** + * Return the current value of {@link #setCancelable(boolean)}. + */ + public boolean isCancelable() { + return mCancelable; + } + + /** + * Controls whether this fragment should be shown in a dialog. If not + * set, no Dialog will be created in {@link #onActivityCreated(Bundle)}, + * and the fragment's view hierarchy will thus not be added to it. This + * allows you to instead use it as a normal fragment (embedded inside of + * its activity). + * + *

This is normally set for you based on whether the fragment is + * associated with a container view ID passed to + * {@link FragmentTransaction#add(int, Fragment) FragmentTransaction.add(int, Fragment)}. + * If the fragment was added with a container, setShowsDialog will be + * initialized to false; otherwise, it will be true. + * + * @param showsDialog If true, the fragment will be displayed in a Dialog. + * If false, no Dialog will be created and the fragment's view hierarchly + * left undisturbed. + */ + public void setShowsDialog(boolean showsDialog) { + mShowsDialog = showsDialog; + } + + /** + * Return the current value of {@link #setShowsDialog(boolean)}. + */ + public boolean getShowsDialog() { + return mShowsDialog; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + //SEE: http://stackoverflow.com/questions/5637894/dialogfragments-with-devices-api-level-11/7560686#7560686 + //mShowsDialog = mContainerId == 0; + + if (savedInstanceState != null) { + mStyle = savedInstanceState.getInt(SAVED_STYLE, STYLE_NORMAL); + mTheme = savedInstanceState.getInt(SAVED_THEME, 0); + mCancelable = savedInstanceState.getBoolean(SAVED_CANCELABLE, true); + mShowsDialog = savedInstanceState.getBoolean(SAVED_SHOWS_DIALOG, mShowsDialog); + mBackStackId = savedInstanceState.getInt(SAVED_BACK_STACK_ID, -1); + } + + } + + /** @hide */ + @Override + public LayoutInflater getLayoutInflater(Bundle savedInstanceState) { + if (!mShowsDialog) { + return super.getLayoutInflater(savedInstanceState); + } + + mDialog = onCreateDialog(savedInstanceState); + mDestroyed = false; + switch (mStyle) { + case STYLE_NO_INPUT: + mDialog.getWindow().addFlags( + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | + WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE); + // fall through... + case STYLE_NO_FRAME: + case STYLE_NO_TITLE: + mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + } + return (LayoutInflater)mDialog.getContext().getSystemService( + Context.LAYOUT_INFLATER_SERVICE); + } + + /** + * Override to build your own custom Dialog container. This is typically + * used to show an AlertDialog instead of a generic Dialog; when doing so, + * {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)} does not need + * to be implemented since the AlertDialog takes care of its own content. + * + *

This method will be called after {@link #onCreate(Bundle)} and + * before {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}. The + * default implementation simply instantiates and returns a {@link Dialog} + * class. + * + *

Note: DialogFragment own the {@link Dialog#setOnCancelListener + * Dialog.setOnCancelListener} and {@link Dialog#setOnDismissListener + * Dialog.setOnDismissListener} callbacks. You must not set them yourself. + * To find out about these events, override {@link #onCancel(DialogInterface)} + * and {@link #onDismiss(DialogInterface)}.

+ * + * @param savedInstanceState The last saved instance state of the Fragment, + * or null if this is a freshly created Fragment. + * + * @return Return a new Dialog instance to be displayed by the Fragment. + */ + public Dialog onCreateDialog(Bundle savedInstanceState) { + return new Dialog(getActivity(), getTheme()); + } + + public void onCancel(DialogInterface dialog) { + } + + public void onDismiss(DialogInterface dialog) { + if (!mRemoved) { + // Note: we need to use allowStateLoss, because the dialog + // dispatches this asynchronously so we can receive the call + // after the activity is paused. Worst case, when the user comes + // back to the activity they see the dialog again. + dismissInternal(true); + } + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + + if (!mShowsDialog) { + return; + } + + View view = getView(); + if (view != null) { + if (view.getParent() != null) { + throw new IllegalStateException("DialogFragment can not be attached to a container view"); + } + mDialog.setContentView(view); + } + mDialog.setOwnerActivity(getActivity()); + mDialog.setCancelable(mCancelable); + mDialog.setOnCancelListener(this); + mDialog.setOnDismissListener(this); + if (savedInstanceState != null) { + Bundle dialogState = savedInstanceState.getBundle(SAVED_DIALOG_STATE_TAG); + if (dialogState != null) { + mDialog.onRestoreInstanceState(dialogState); + } + } + } + + @Override + public void onStart() { + super.onStart(); + if (mDialog != null) { + mRemoved = false; + mDialog.show(); + } + } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + if (mDialog != null) { + Bundle dialogState = mDialog.onSaveInstanceState(); + if (dialogState != null) { + outState.putBundle(SAVED_DIALOG_STATE_TAG, dialogState); + } + } + if (mStyle != STYLE_NORMAL) { + outState.putInt(SAVED_STYLE, mStyle); + } + if (mTheme != 0) { + outState.putInt(SAVED_THEME, mTheme); + } + if (!mCancelable) { + outState.putBoolean(SAVED_CANCELABLE, mCancelable); + } + if (!mShowsDialog) { + outState.putBoolean(SAVED_SHOWS_DIALOG, mShowsDialog); + } + if (mBackStackId != -1) { + outState.putInt(SAVED_BACK_STACK_ID, mBackStackId); + } + } + + @Override + public void onStop() { + super.onStop(); + if (mDialog != null) { + mDialog.hide(); + } + } + + /** + * Remove dialog. + */ + @Override + public void onDestroyView() { + super.onDestroyView(); + mDestroyed = true; + if (mDialog != null) { + // Set removed here because this dismissal is just to hide + // the dialog -- we don't want this to cause the fragment to + // actually be removed. + mRemoved = true; + mDialog.dismiss(); + mDialog = null; + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/Fragment.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/Fragment.java new file mode 100644 index 00000000..b701fddf --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/Fragment.java @@ -0,0 +1,1339 @@ +/* + * 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 android.support.v4.app; + +import android.app.Activity; +import android.content.ComponentCallbacks; +import android.content.Context; +import android.content.Intent; +import android.content.res.Configuration; +import android.content.res.Resources; +import android.os.Bundle; +import android.os.Parcel; +import android.os.Parcelable; +import android.support.v4.util.DebugUtils; +import android.support.v4.view.Menu; +import android.support.v4.view.MenuItem; +import android.util.AttributeSet; +import android.util.SparseArray; +import android.view.ContextMenu; +import android.view.LayoutInflater; +import android.view.MenuInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.ContextMenu.ContextMenuInfo; +import android.view.View.OnCreateContextMenuListener; +import android.view.animation.Animation; +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.util.HashMap; + +final class FragmentState implements Parcelable { + final String mClassName; + final int mIndex; + final boolean mFromLayout; + final int mFragmentId; + final int mContainerId; + final String mTag; + final boolean mRetainInstance; + final boolean mDetached; + final Bundle mArguments; + + Bundle mSavedFragmentState; + + Fragment mInstance; + + public FragmentState(Fragment frag) { + mClassName = frag.getClass().getName(); + mIndex = frag.mIndex; + mFromLayout = frag.mFromLayout; + mFragmentId = frag.mFragmentId; + mContainerId = frag.mContainerId; + mTag = frag.mTag; + mRetainInstance = frag.mRetainInstance; + mDetached = frag.mDetached; + mArguments = frag.mArguments; + } + + public FragmentState(Parcel in) { + mClassName = in.readString(); + mIndex = in.readInt(); + mFromLayout = in.readInt() != 0; + mFragmentId = in.readInt(); + mContainerId = in.readInt(); + mTag = in.readString(); + mRetainInstance = in.readInt() != 0; + mDetached = in.readInt() != 0; + mArguments = in.readBundle(); + mSavedFragmentState = in.readBundle(); + } + + public Fragment instantiate(SupportActivity activity) { + if (mInstance != null) { + return mInstance; + } + + if (mArguments != null) { + mArguments.setClassLoader(activity.getClassLoader()); + } + + mInstance = Fragment.instantiate(activity.asActivity(), mClassName, mArguments); + + if (mSavedFragmentState != null) { + mSavedFragmentState.setClassLoader(activity.getClassLoader()); + mInstance.mSavedFragmentState = mSavedFragmentState; + } + mInstance.setIndex(mIndex); + mInstance.mFromLayout = mFromLayout; + mInstance.mRestored = true; + mInstance.mFragmentId = mFragmentId; + mInstance.mContainerId = mContainerId; + mInstance.mTag = mTag; + mInstance.mRetainInstance = mRetainInstance; + mInstance.mDetached = mDetached; + mInstance.mFragmentManager = activity.getInternalCallbacks().getFragments(); + + return mInstance; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(mClassName); + dest.writeInt(mIndex); + dest.writeInt(mFromLayout ? 1 : 0); + dest.writeInt(mFragmentId); + dest.writeInt(mContainerId); + dest.writeString(mTag); + dest.writeInt(mRetainInstance ? 1 : 0); + dest.writeInt(mDetached ? 1 : 0); + dest.writeBundle(mArguments); + dest.writeBundle(mSavedFragmentState); + } + + public static final Parcelable.Creator CREATOR + = new Parcelable.Creator() { + public FragmentState createFromParcel(Parcel in) { + return new FragmentState(in); + } + + public FragmentState[] newArray(int size) { + return new FragmentState[size]; + } + }; +} + +/** + * Static library support version of the framework's {@link android.app.Fragment}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + */ +public class Fragment implements ComponentCallbacks, OnCreateContextMenuListener { + private static final HashMap> sClassMap = + new HashMap>(); + + static final int INITIALIZING = 0; // Not yet created. + static final int CREATED = 1; // Created. + static final int ACTIVITY_CREATED = 2; // The activity has finished its creation. + static final int STOPPED = 3; // Fully created, not started. + static final int STARTED = 4; // Created and started, not resumed. + static final int RESUMED = 5; // Created started and resumed. + + int mState = INITIALIZING; + + // Non-null if the fragment's view hierarchy is currently animating away, + // meaning we need to wait a bit on completely destroying it. This is the + // view that is animating. + View mAnimatingAway; + + // If mAnimatingAway != null, this is the state we should move to once the + // animation is done. + int mStateAfterAnimating; + + // When instantiated from saved state, this is the saved state. + Bundle mSavedFragmentState; + SparseArray mSavedViewState; + + // Index into active fragment array. + int mIndex = -1; + + // Internal unique name for this fragment; + String mWho; + + // Construction arguments; + Bundle mArguments; + + // Target fragment. + Fragment mTarget; + + // For use when retaining a fragment: this is the index of the last mTarget. + int mTargetIndex = -1; + + // Target request code. + int mTargetRequestCode; + + // True if the fragment is in the list of added fragments. + boolean mAdded; + + // If set this fragment is being removed from its activity. + boolean mRemoving; + + // True if the fragment is in the resumed state. + boolean mResumed; + + // Set to true if this fragment was instantiated from a layout file. + boolean mFromLayout; + + // Set to true when the view has actually been inflated in its layout. + boolean mInLayout; + + // True if this fragment has been restored from previously saved state. + boolean mRestored; + + // Number of active back stack entries this fragment is in. + int mBackStackNesting; + + // The fragment manager we are associated with. Set as soon as the + // fragment is used in a transaction; cleared after it has been removed + // from all transactions. + FragmentManager mFragmentManager; + + // Set as soon as a fragment is added to a transaction (or removed), + // to be able to do validation. + SupportActivity mImmediateActivity; + + // Activity this fragment is attached to. + SupportActivity mActivity; + + // The optional identifier for this fragment -- either the container ID if it + // was dynamically added to the view hierarchy, or the ID supplied in + // layout. + int mFragmentId; + + // When a fragment is being dynamically added to the view hierarchy, this + // is the identifier of the parent container it is being added to. + int mContainerId; + + // The optional named tag for this fragment -- usually used to find + // fragments that are not part of the layout. + String mTag; + + // Set to true when the app has requested that this fragment be hidden + // from the user. + boolean mHidden; + + // Set to true when the app has requested that this fragment be deactivated. + boolean mDetached; + + // If set this fragment would like its instance retained across + // configuration changes. + boolean mRetainInstance; + + // If set this fragment is being retained across the current config change. + boolean mRetaining; + + // If set this fragment has menu items to contribute. + boolean mHasMenu; + + // Used to control whether or not this fragments menus (both options and + // context) are exposed regardless of whether or not they actually exist. + boolean mExposesMenu = true; + + // Used to verify that subclasses call through to super class. + boolean mCalled; + + // If app has requested a specific animation, this is the one to use. + int mNextAnim; + + // The parent container of the fragment after dynamically added to UI. + ViewGroup mContainer; + + // The View generated for this fragment. + View mView; + + // The real inner view that will save/restore state. + View mInnerView; + + LoaderManagerImpl mLoaderManager; + boolean mLoadersStarted; + boolean mCheckedForLoaderManager; + + /** + * State information that has been retrieved from a fragment instance + * through {@link FragmentManager#saveFragmentInstanceState(Fragment) + * FragmentManager.saveFragmentInstanceState}. + */ + public static class SavedState implements Parcelable { + final Bundle mState; + + SavedState(Bundle state) { + mState = state; + } + + SavedState(Parcel in, ClassLoader loader) { + mState = in.readBundle(); + if (loader != null && mState != null) { + mState.setClassLoader(loader); + } + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeBundle(mState); + } + + public static final Parcelable.Creator CREATOR + = new Parcelable.Creator() { + public SavedState createFromParcel(Parcel in) { + return new SavedState(in, null); + } + + public SavedState[] newArray(int size) { + return new SavedState[size]; + } + }; + } + + /** + * Thrown by {@link Fragment#instantiate(Context, String, Bundle)} when + * there is an instantiation failure. + */ + static public class InstantiationException extends RuntimeException { + private static final long serialVersionUID = 8423238441973733190L; + + public InstantiationException(String msg, Exception cause) { + super(msg, cause); + } + } + + /** + * Default constructor. Every fragment must have an + * empty constructor, so it can be instantiated when restoring its + * activity's state. It is strongly recommended that subclasses do not + * have other constructors with parameters, since these constructors + * will not be called when the fragment is re-instantiated; instead, + * arguments can be supplied by the caller with {@link #setArguments} + * and later retrieved by the Fragment with {@link #getArguments}. + * + *

Applications should generally not implement a constructor. The + * first place application code an run where the fragment is ready to + * be used is in {@link #onAttach(Activity)}, the point where the fragment + * is actually associated with its activity. Some applications may also + * want to implement {@link #onInflate} to retrieve attributes from a + * layout resource, though should take care here because this happens for + * the fragment is attached to its activity. + */ + public Fragment() { + } + + /** + * Like {@link #instantiate(Context, String, Bundle)} but with a null + * argument Bundle. + */ + public static Fragment instantiate(Context context, String fname) { + return instantiate(context, fname, null); + } + + /** + * Create a new instance of a Fragment with the given class name. This is + * the same as calling its empty constructor. + * + * @param context The calling context being used to instantiate the fragment. + * This is currently just used to get its ClassLoader. + * @param fname The class name of the fragment to instantiate. + * @param args Bundle of arguments to supply to the fragment, which it + * can retrieve with {@link #getArguments()}. May be null. + * @return Returns a new fragment instance. + * @throws InstantiationException If there is a failure in instantiating + * the given fragment class. This is a runtime exception; it is not + * normally expected to happen. + */ + public static Fragment instantiate(Context context, String fname, Bundle args) { + try { + Class clazz = sClassMap.get(fname); + if (clazz == null) { + // Class not found in the cache, see if it's real, and try to add it + clazz = context.getClassLoader().loadClass(fname); + sClassMap.put(fname, clazz); + } + Fragment f = (Fragment)clazz.newInstance(); + if (args != null) { + args.setClassLoader(f.getClass().getClassLoader()); + f.mArguments = args; + } + return f; + } catch (ClassNotFoundException e) { + throw new InstantiationException("Unable to instantiate fragment " + fname + + ": make sure class name exists, is public, and has an" + + " empty constructor that is public", e); + } catch (java.lang.InstantiationException e) { + throw new InstantiationException("Unable to instantiate fragment " + fname + + ": make sure class name exists, is public, and has an" + + " empty constructor that is public", e); + } catch (IllegalAccessException e) { + throw new InstantiationException("Unable to instantiate fragment " + fname + + ": make sure class name exists, is public, and has an" + + " empty constructor that is public", e); + } + } + + final void restoreViewState() { + if (mSavedViewState != null) { + mInnerView.restoreHierarchyState(mSavedViewState); + mSavedViewState = null; + } + } + + final void setIndex(int index) { + mIndex = index; + mWho = "android:fragment:" + mIndex; + } + + final boolean isInBackStack() { + return mBackStackNesting > 0; + } + + /** + * Subclasses can not override equals(). + */ + @Override final public boolean equals(Object o) { + return super.equals(o); + } + + /** + * Subclasses can not override hashCode(). + */ + @Override final public int hashCode() { + return super.hashCode(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(128); + DebugUtils.buildShortClassTag(this, sb); + if (mIndex >= 0) { + sb.append(" #"); + sb.append(mIndex); + } + if (mFragmentId != 0) { + sb.append(" id=0x"); + sb.append(Integer.toHexString(mFragmentId)); + } + if (mTag != null) { + sb.append(" "); + sb.append(mTag); + } + sb.append('}'); + return sb.toString(); + } + + /** + * Return the identifier this fragment is known by. This is either + * the android:id value supplied in a layout or the container view ID + * supplied when adding the fragment. + */ + final public int getId() { + return mFragmentId; + } + + /** + * Get the tag name of the fragment, if specified. + */ + final public String getTag() { + return mTag; + } + + /** + * Supply the construction arguments for this fragment. This can only + * be called before the fragment has been attached to its activity; that + * is, you should call it immediately after constructing the fragment. The + * arguments supplied here will be retained across fragment destroy and + * creation. + */ + public void setArguments(Bundle args) { + if (mIndex >= 0) { + throw new IllegalStateException("Fragment already active"); + } + mArguments = args; + } + + /** + * Return the arguments supplied when the fragment was instantiated, + * if any. + */ + final public Bundle getArguments() { + return mArguments; + } + + /** + * Set the initial saved state that this Fragment should restore itself + * from when first being constructed, as returned by + * {@link FragmentManager#saveFragmentInstanceState(Fragment) + * FragmentManager.saveFragmentInstanceState}. + * + * @param state The state the fragment should be restored from. + */ + public void setInitialSavedState(SavedState state) { + if (mIndex >= 0) { + throw new IllegalStateException("Fragment already active"); + } + mSavedFragmentState = state != null && state.mState != null + ? state.mState : null; + } + + /** + * Optional target for this fragment. This may be used, for example, + * if this fragment is being started by another, and when done wants to + * give a result back to the first. The target set here is retained + * across instances via {@link FragmentManager#putFragment + * FragmentManager.putFragment()}. + * + * @param fragment The fragment that is the target of this one. + * @param requestCode Optional request code, for convenience if you + * are going to call back with {@link #onActivityResult(int, int, Intent)}. + */ + public void setTargetFragment(Fragment fragment, int requestCode) { + mTarget = fragment; + mTargetRequestCode = requestCode; + } + + /** + * Return the target fragment set by {@link #setTargetFragment}. + */ + final public Fragment getTargetFragment() { + return mTarget; + } + + /** + * Return the target request code set by {@link #setTargetFragment}. + */ + final public int getTargetRequestCode() { + return mTargetRequestCode; + } + + /** + * Return the Activity this fragment is currently associated with. + * + * @see #getSupportActivity() + */ + final public Activity getActivity() { + return (mActivity != null) ? mActivity.asActivity() : null; + } + + /** + * Return the SupportActivity interface for the activity in which this + * fragment is currently associated. + * + * @see #getActivity() + */ + final public SupportActivity getSupportActivity() { + return mActivity; + } + + /** + * Return getActivity().getResources(). + */ + final public Resources getResources() { + if (mActivity == null) { + throw new IllegalStateException("Fragment " + this + " not attached to Activity"); + } + return mActivity.getResources(); + } + + /** + * Return a localized, styled CharSequence from the application's package's + * default string table. + * + * @param resId Resource id for the CharSequence text + */ + public final CharSequence getText(int resId) { + return getResources().getText(resId); + } + + /** + * Return a localized string from the application's package's + * default string table. + * + * @param resId Resource id for the string + */ + public final String getString(int resId) { + return getResources().getString(resId); + } + + /** + * Return a localized formatted string from the application's package's + * default string table, substituting the format arguments as defined in + * {@link java.util.Formatter} and {@link java.lang.String#format}. + * + * @param resId Resource id for the format string + * @param formatArgs The format arguments that will be used for substitution. + */ + + public final String getString(int resId, Object... formatArgs) { + return getResources().getString(resId, formatArgs); + } + + /** + * Return the FragmentManager for interacting with fragments associated + * with this fragment's activity. Note that this will be non-null slightly + * before {@link #getActivity()}, during the time from when the fragment is + * placed in a {@link FragmentTransaction} until it is committed and + * attached to its activity. + */ + final public FragmentManager getFragmentManager() { + return mFragmentManager; + } + + /** + * A clone of {@link #getFragmentManager()} to maintain naming conventions + * throughout the compatibility library. + */ + final public FragmentManager getSupportFragmentManager() { + return mFragmentManager; + } + + /** + * Return true if the fragment is currently added to its activity. + */ + final public boolean isAdded() { + return mActivity != null && mAdded; + } + + /** + * Return true if the fragment has been explicitly detached from the UI. + * That is, {@link FragmentTransaction#detach(Fragment) + * FragmentTransaction.detach(Fragment)} has been used on it. + */ + final public boolean isDetached() { + return mDetached; + } + + /** + * Return true if this fragment is currently being removed from its + * activity. This is not whether its activity is finishing, but + * rather whether it is in the process of being removed from its activity. + */ + final public boolean isRemoving() { + return mRemoving; + } + + /** + * Return true if the layout is included as part of an activity view + * hierarchy via the <fragment> tag. This will always be true when + * fragments are created through the <fragment> tag, except + * in the case where an old fragment is restored from a previous state and + * it does not appear in the layout of the current state. + */ + final public boolean isInLayout() { + return mInLayout; + } + + /** + * Return true if the fragment is in the resumed state. This is true + * for the duration of {@link #onResume()} and {@link #onPause()} as well. + */ + final public boolean isResumed() { + return mResumed; + } + + /** + * Return true if the fragment is currently visible to the user. This means + * it: (1) has been added, (2) has its view attached to the window, and + * (3) is not hidden. + */ + final public boolean isVisible() { + return isAdded() && !isHidden() && mView != null + && mView.getWindowToken() != null && mView.getVisibility() == View.VISIBLE; + } + + /** + * Return true if the fragment has been hidden. By default fragments + * are shown. You can find out about changes to this state with + * {@link #onHiddenChanged}. Note that the hidden state is orthogonal + * to other states -- that is, to be visible to the user, a fragment + * must be both started and not hidden. + */ + final public boolean isHidden() { + return mHidden; + } + + /** + * Called when the hidden state (as returned by {@link #isHidden()} of + * the fragment has changed. Fragments start out not hidden; this will + * be called whenever the fragment changes state from that. + * @param hidden True if the fragment is now hidden, false if it is not + * visible. + */ + public void onHiddenChanged(boolean hidden) { + } + + /** + * Control whether a fragment instance is retained across Activity + * re-creation (such as from a configuration change). This can only + * be used with fragments not in the back stack. If set, the fragment + * lifecycle will be slightly different when an activity is recreated: + *

    + *
  • {@link #onDestroy()} will not be called (but {@link #onDetach()} still + * will be, because the fragment is being detached from its current activity). + *
  • {@link #onCreate(Bundle)} will not be called since the fragment + * is not being re-created. + *
  • {@link #onAttach(Activity)} and {@link #onActivityCreated(Bundle)} will + * still be called. + *
+ */ + public void setRetainInstance(boolean retain) { + mRetainInstance = retain; + } + + final public boolean getRetainInstance() { + return mRetainInstance; + } + + /** + * Report that this fragment would like to participate in populating + * the options menu by receiving a call to {@link #onCreateOptionsMenu} + * and related methods. + * + * @param hasMenu If true, the fragment has menu items to contribute. + */ + public void setHasOptionsMenu(boolean hasMenu) { + if (mHasMenu != hasMenu) { + mHasMenu = hasMenu; + if (isAdded() && !isHidden()) { + mActivity.invalidateOptionsMenu(); + } + } + } + + /** + * Return the LoaderManager for this fragment, creating it if needed. + */ + public LoaderManager getLoaderManager() { + if (mLoaderManager != null) { + return mLoaderManager; + } + if (mActivity == null) { + throw new IllegalStateException("Fragment " + this + " not attached to Activity"); + } + mCheckedForLoaderManager = true; + mLoaderManager = mActivity.getInternalCallbacks().getLoaderManager(mIndex, mLoadersStarted, true); + return mLoaderManager; + } + + /** + * Call {@link Activity#startActivity(Intent)} on the fragment's + * containing Activity. + */ + public void startActivity(Intent intent) { + if (mActivity == null) { + throw new IllegalStateException("Fragment " + this + " not attached to Activity"); + } + mActivity.startActivityFromFragment(this, intent, -1); + } + + /** + * Call {@link Activity#startActivityForResult(Intent, int)} on the fragment's + * containing Activity. + */ + public void startActivityForResult(Intent intent, int requestCode) { + if (mActivity == null) { + throw new IllegalStateException("Fragment " + this + " not attached to Activity"); + } + mActivity.startActivityFromFragment(this, intent, requestCode); + } + + /** + * Receive the result from a previous call to + * {@link #startActivityForResult(Intent, int)}. This follows the + * related Activity API as described there in + * {@link Activity#onActivityResult(int, int, Intent)}. + * + * @param requestCode The integer request code originally supplied to + * startActivityForResult(), allowing you to identify who this + * result came from. + * @param resultCode The integer result code returned by the child activity + * through its setResult(). + * @param data An Intent, which can return result data to the caller + * (various data can be attached to Intent "extras"). + */ + public void onActivityResult(int requestCode, int resultCode, Intent data) { + } + + /** + * @hide Hack so that DialogFragment can make its Dialog before creating + * its views, and the view construction can use the dialog's context for + * inflation. Maybe this should become a public API. Note sure. + */ + public LayoutInflater getLayoutInflater(Bundle savedInstanceState) { + return mActivity.getLayoutInflater(); + } + + /** + * Called when a fragment is being created as part of a view layout + * inflation, typically from setting the content view of an activity. This + * may be called immediately after the fragment is created from a + * tag in a layout file. Note this is before the fragment's + * {@link #onAttach(Activity)} has been called; all you should do here is + * parse the attributes and save them away. + * + *

This is called every time the fragment is inflated, even if it is + * being inflated into a new instance with saved state. It typically makes + * sense to re-parse the parameters each time, to allow them to change with + * different configurations.

+ * + *

Here is a typical implementation of a fragment that can take parameters + * both through attributes supplied here as well from {@link #getArguments()}:

+ * + * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentArguments.java + * fragment} + * + *

Note that parsing the XML attributes uses a "styleable" resource. The + * declaration for the styleable used here is:

+ * + * {@sample development/samples/ApiDemos/res/values/attrs.xml fragment_arguments} + * + *

The fragment can then be declared within its activity's content layout + * through a tag like this:

+ * + * {@sample development/samples/ApiDemos/res/layout/fragment_arguments.xml from_attributes} + * + *

This fragment can also be created dynamically from arguments given + * at runtime in the arguments Bundle; here is an example of doing so at + * creation of the containing activity:

+ * + * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentArguments.java + * create} + * + * @param activity The Activity that is inflating this fragment. + * @param attrs The attributes at the tag where the fragment is + * being created. + * @param savedInstanceState If the fragment is being re-created from + * a previous saved state, this is the state. + */ + public void onInflate(SupportActivity activity, AttributeSet attrs, Bundle savedInstanceState) { + mCalled = true; + } + + /** + * Called when a fragment is first attached to its activity. + * {@link #onCreate(Bundle)} will be called after this. + */ + public void onAttach(SupportActivity activity) { + mCalled = true; + } + + /** + * Called when a fragment loads an animation. + */ + public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { + return null; + } + + /** + * Called to do initial creation of a fragment. This is called after + * {@link #onAttach(Activity)} and before + * {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}. + * + *

Note that this can be called while the fragment's activity is + * still in the process of being created. As such, you can not rely + * on things like the activity's content view hierarchy being initialized + * at this point. If you want to do work once the activity itself is + * created, see {@link #onActivityCreated(Bundle)}. + * + * @param savedInstanceState If the fragment is being re-created from + * a previous saved state, this is the state. + */ + public void onCreate(Bundle savedInstanceState) { + mCalled = true; + } + + /** + * Called to have the fragment instantiate its user interface view. + * This is optional, and non-graphical fragments can return null (which + * is the default implementation). This will be called between + * {@link #onCreate(Bundle)} and {@link #onActivityCreated(Bundle)}. + * + *

If you return a View from here, you will later be called in + * {@link #onDestroyView} when the view is being released. + * + * @param inflater The LayoutInflater object that can be used to inflate + * any views in the fragment, + * @param container If non-null, this is the parent view that the fragment's + * UI should be attached to. The fragment should not add the view itself, + * but this can be used to generate the LayoutParams of the view. + * @param savedInstanceState If non-null, this fragment is being re-constructed + * from a previous saved state as given here. + * + * @return Return the View for the fragment's UI, or null. + */ + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + return null; + } + + /** + * Called immediately after {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)} + * has returned, but before any saved state has been restored in to the view. + * This gives subclasses a chance to initialize themselves once + * they know their view hierarchy has been completely created. The fragment's + * view hierarchy is not however attached to its parent at this point. + * @param view The View returned by {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}. + * @param savedInstanceState If non-null, this fragment is being re-constructed + * from a previous saved state as given here. + */ + public void onViewCreated(View view, Bundle savedInstanceState) { + } + + /** + * Get the root view for the fragment's layout (the one returned by {@link #onCreateView}), + * if provided. + * + * @return The fragment's root view, or null if it has no layout. + */ + public View getView() { + return mView; + } + + /** + * Called when the fragment's activity has been created and this + * fragment's view hierarchy instantiated. It can be used to do final + * initialization once these pieces are in place, such as retrieving + * views or restoring state. It is also useful for fragments that use + * {@link #setRetainInstance(boolean)} to retain their instance, + * as this callback tells the fragment when it is fully associated with + * the new activity instance. This is called after {@link #onCreateView} + * and before {@link #onStart()}. + * + * @param savedInstanceState If the fragment is being re-created from + * a previous saved state, this is the state. + */ + public void onActivityCreated(Bundle savedInstanceState) { + mCalled = true; + } + + /** + * Called when the Fragment is visible to the user. This is generally + * tied to {@link Activity#onStart() Activity.onStart} of the containing + * Activity's lifecycle. + */ + public void onStart() { + mCalled = true; + + if (!mLoadersStarted) { + mLoadersStarted = true; + if (!mCheckedForLoaderManager) { + mCheckedForLoaderManager = true; + mLoaderManager = mActivity.getInternalCallbacks().getLoaderManager(mIndex, mLoadersStarted, false); + } + if (mLoaderManager != null) { + mLoaderManager.doStart(); + } + } + } + + /** + * Called when the fragment is visible to the user and actively running. + * This is generally + * tied to {@link Activity#onResume() Activity.onResume} of the containing + * Activity's lifecycle. + */ + public void onResume() { + mCalled = true; + } + + /** + * Called to ask the fragment to save its current dynamic state, so it + * can later be reconstructed in a new instance of its process is + * restarted. If a new instance of the fragment later needs to be + * created, the data you place in the Bundle here will be available + * in the Bundle given to {@link #onCreate(Bundle)}, + * {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}, and + * {@link #onActivityCreated(Bundle)}. + * + *

This corresponds to {@link Activity#onSaveInstanceState(Bundle) + * Activity.onSaveInstanceState(Bundle)} and most of the discussion there + * applies here as well. Note however: this method may be called + * at any time before {@link #onDestroy()}. There are many situations + * where a fragment may be mostly torn down (such as when placed on the + * back stack with no UI showing), but its state will not be saved until + * its owning activity actually needs to save its state. + * + * @param outState Bundle in which to place your saved state. + */ + public void onSaveInstanceState(Bundle outState) { + } + + public void onConfigurationChanged(Configuration newConfig) { + mCalled = true; + } + + /** + * Called when the Fragment is no longer resumed. This is generally + * tied to {@link Activity#onPause() Activity.onPause} of the containing + * Activity's lifecycle. + */ + public void onPause() { + mCalled = true; + } + + /** + * Called when the Fragment is no longer started. This is generally + * tied to {@link Activity#onStop() Activity.onStop} of the containing + * Activity's lifecycle. + */ + public void onStop() { + mCalled = true; + } + + public void onLowMemory() { + mCalled = true; + } + + /** + * Called when the view previously created by {@link #onCreateView} has + * been detached from the fragment. The next time the fragment needs + * to be displayed, a new view will be created. This is called + * after {@link #onStop()} and before {@link #onDestroy()}. It is called + * regardless of whether {@link #onCreateView} returned a + * non-null view. Internally it is called after the view's state has + * been saved but before it has been removed from its parent. + */ + public void onDestroyView() { + mCalled = true; + } + + /** + * Called when the fragment is no longer in use. This is called + * after {@link #onStop()} and before {@link #onDetach()}. + */ + public void onDestroy() { + mCalled = true; + //Log.v("foo", "onDestroy: mCheckedForLoaderManager=" + mCheckedForLoaderManager + // + " mLoaderManager=" + mLoaderManager); + if (!mCheckedForLoaderManager) { + mCheckedForLoaderManager = true; + mLoaderManager = mActivity.getInternalCallbacks().getLoaderManager(mIndex, mLoadersStarted, false); + } + if (mLoaderManager != null) { + mLoaderManager.doDestroy(); + } + } + + /** + * Called by the fragment manager once this fragment has been removed, + * so that we don't have any left-over state if the application decides + * to re-use the instance. This only clears state that the framework + * internally manages, not things the application sets. + */ + void initState() { + mIndex = -1; + mWho = null; + mAdded = false; + mRemoving = false; + mResumed = false; + mFromLayout = false; + mInLayout = false; + mRestored = false; + mBackStackNesting = 0; + mFragmentManager = null; + mActivity = null; + mImmediateActivity = null; + mFragmentId = 0; + mContainerId = 0; + mTag = null; + mHidden = false; + mDetached = false; + mRetaining = false; + mLoaderManager = null; + mLoadersStarted = false; + mCheckedForLoaderManager = false; + } + + /** + * Called when the fragment is no longer attached to its activity. This + * is called after {@link #onDestroy()}. + */ + public void onDetach() { + mCalled = true; + } + + /** + * Initialize the contents of the Activity's standard options menu. You + * should place your menu items in to menu. For this method + * to be called, you must have first called {@link #setHasOptionsMenu}. See + * {@link Activity#onCreateOptionsMenu(Menu) Activity.onCreateOptionsMenu} + * for more information. + * + * @param menu The options menu in which you place your items. + * + * @see #setHasOptionsMenu + * @see #onPrepareOptionsMenu + * @see #onOptionsItemSelected + */ + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + } + + /** + * Prepare the Screen's standard options menu to be displayed. This is + * called right before the menu is shown, every time it is shown. You can + * use this method to efficiently enable/disable items or otherwise + * dynamically modify the contents. See + * {@link Activity#onPrepareOptionsMenu(Menu) Activity.onPrepareOptionsMenu} + * for more information. + * + * @param menu The options menu as last shown or first initialized by + * onCreateOptionsMenu(). + * + * @see #setHasOptionsMenu + * @see #onCreateOptionsMenu + */ + public void onPrepareOptionsMenu(Menu menu) { + } + + /** + * Called when this fragment's option menu items are no longer being + * included in the overall options menu. Receiving this call means that + * the menu needed to be rebuilt, but this fragment's items were not + * included in the newly built menu (its {@link #onCreateOptionsMenu(Menu, MenuInflater)} + * was not called). + */ + public void onDestroyOptionsMenu() { + } + + /** + * This hook is called whenever an item in your options menu is selected. + * The default implementation simply returns false to have the normal + * processing happen (calling the item's Runnable or sending a message to + * its Handler as appropriate). You can use this method for any items + * for which you would like to do processing without those other + * facilities. + * + *

Derived classes should call through to the base class for it to + * perform the default menu handling. + * + * @param item The menu item that was selected. + * + * @return boolean Return false to allow normal menu processing to + * proceed, true to consume it here. + * + * @see #onCreateOptionsMenu + */ + public boolean onOptionsItemSelected(MenuItem item) { + return false; + } + + /** + * This hook is called whenever the options menu is being closed (either by the user canceling + * the menu with the back/menu button, or when an item is selected). + * + * @param menu The options menu as last shown or first initialized by + * onCreateOptionsMenu(). + */ + public void onOptionsMenuClosed(android.view.Menu menu) { + } + + /** + * Called when a context menu for the {@code view} is about to be shown. + * Unlike {@link #onCreateOptionsMenu}, this will be called every + * time the context menu is about to be shown and should be populated for + * the view (or item inside the view for {@link AdapterView} subclasses, + * this can be found in the {@code menuInfo})). + *

+ * Use {@link #onContextItemSelected(android.view.MenuItem)} to know when an + * item has been selected. + *

+ * The default implementation calls up to + * {@link Activity#onCreateContextMenu Activity.onCreateContextMenu}, though + * you can not call this implementation if you don't want that behavior. + *

+ * It is not safe to hold onto the context menu after this method returns. + * {@inheritDoc} + */ + public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { + getActivity().onCreateContextMenu(menu, v, menuInfo); + } + + /** + * Registers a context menu to be shown for the given view (multiple views + * can show the context menu). This method will set the + * {@link OnCreateContextMenuListener} on the view to this fragment, so + * {@link #onCreateContextMenu(ContextMenu, View, ContextMenuInfo)} will be + * called when it is time to show the context menu. + * + * @see #unregisterForContextMenu(View) + * @param view The view that should show a context menu. + */ + public void registerForContextMenu(View view) { + view.setOnCreateContextMenuListener(this); + } + + /** + * Prevents a context menu to be shown for the given view. This method will + * remove the {@link OnCreateContextMenuListener} on the view. + * + * @see #registerForContextMenu(View) + * @param view The view that should stop showing a context menu. + */ + public void unregisterForContextMenu(View view) { + view.setOnCreateContextMenuListener(null); + } + + /** + * This hook is called whenever an item in a context menu is selected. The + * default implementation simply returns false to have the normal processing + * happen (calling the item's Runnable or sending a message to its Handler + * as appropriate). You can use this method for any items for which you + * would like to do processing without those other facilities. + *

+ * Use {@link MenuItem#getMenuInfo()} to get extra information set by the + * View that added this menu item. + *

+ * Derived classes should call through to the base class for it to perform + * the default menu handling. + * + * @param item The context menu item that was selected. + * @return boolean Return false to allow normal context menu processing to + * proceed, true to consume it here. + */ + public boolean onContextItemSelected(android.view.MenuItem item) { + return false; + } + + /** + * Print the Fragments's state into the given stream. + * + * @param prefix Text to print at the front of each line. + * @param fd The raw file descriptor that the dump is being sent to. + * @param writer The PrintWriter to which you should dump your state. This will be + * closed for you after you return. + * @param args additional arguments to the dump request. + */ + public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { + writer.print(prefix); writer.print("mFragmentId=#"); + writer.print(Integer.toHexString(mFragmentId)); + writer.print(" mContainerId#="); + writer.print(Integer.toHexString(mContainerId)); + writer.print(" mTag="); writer.println(mTag); + writer.print(prefix); writer.print("mState="); writer.print(mState); + writer.print(" mIndex="); writer.print(mIndex); + writer.print(" mWho="); writer.print(mWho); + writer.print(" mBackStackNesting="); writer.println(mBackStackNesting); + writer.print(prefix); writer.print("mAdded="); writer.print(mAdded); + writer.print(" mRemoving="); writer.print(mRemoving); + writer.print(" mResumed="); writer.print(mResumed); + writer.print(" mFromLayout="); writer.print(mFromLayout); + writer.print(" mInLayout="); writer.println(mInLayout); + writer.print(prefix); writer.print("mHidden="); writer.print(mHidden); + writer.print(" mDetached="); writer.print(mDetached); + writer.print(" mRetainInstance="); writer.print(mRetainInstance); + writer.print(" mRetaining="); writer.print(mRetaining); + writer.print(" mHasMenu="); writer.println(mHasMenu); + if (mFragmentManager != null) { + writer.print(prefix); writer.print("mFragmentManager="); + writer.println(mFragmentManager); + } + if (mImmediateActivity != null) { + writer.print(prefix); writer.print("mImmediateActivity="); + writer.println(mImmediateActivity); + } + if (mActivity != null) { + writer.print(prefix); writer.print("mActivity="); + writer.println(mActivity); + } + if (mArguments != null) { + writer.print(prefix); writer.print("mArguments="); writer.println(mArguments); + } + if (mSavedFragmentState != null) { + writer.print(prefix); writer.print("mSavedFragmentState="); + writer.println(mSavedFragmentState); + } + if (mSavedViewState != null) { + writer.print(prefix); writer.print("mSavedViewState="); + writer.println(mSavedViewState); + } + if (mTarget != null) { + writer.print(prefix); writer.print("mTarget="); writer.print(mTarget); + writer.print(" mTargetRequestCode="); + writer.println(mTargetRequestCode); + } + if (mNextAnim != 0) { + writer.print(prefix); writer.print("mNextAnim="); writer.println(mNextAnim); + } + if (mContainer != null) { + writer.print(prefix); writer.print("mContainer="); writer.println(mContainer); + } + if (mView != null) { + writer.print(prefix); writer.print("mView="); writer.println(mView); + } + if (mInnerView != null) { + writer.print(prefix); writer.print("mInnerView="); writer.println(mView); + } + if (mAnimatingAway != null) { + writer.print(prefix); writer.print("mAnimatingAway="); writer.println(mAnimatingAway); + writer.print(prefix); writer.print("mStateAfterAnimating="); + writer.println(mStateAfterAnimating); + } + if (mLoaderManager != null) { + writer.print(prefix); writer.println("Loader Manager:"); + mLoaderManager.dump(prefix + " ", fd, writer, args); + } + } + + void performStart() { + onStart(); + if (mLoaderManager != null) { + mLoaderManager.doReportStart(); + } + } + + void performStop() { + onStop(); + } + + void performReallyStop(boolean retaining) { + if (mLoadersStarted) { + mLoadersStarted = false; + if (!mCheckedForLoaderManager) { + mCheckedForLoaderManager = true; + mLoaderManager = mActivity.getInternalCallbacks().getLoaderManager(mIndex, mLoadersStarted, false); + } + if (mLoaderManager != null) { + if (!retaining) { + mLoaderManager.doStop(); + } else { + mLoaderManager.doRetain(); + } + } + } + } + + void performDestroyView() { + onDestroyView(); + if (mLoaderManager != null) { + mLoaderManager.doReportNextStart(); + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentActivity.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentActivity.java new file mode 100644 index 00000000..d3e4b703 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentActivity.java @@ -0,0 +1,1213 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2011 Jake Wharton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.support.v4.app; + +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.HashMap; +import com.actionbarsherlock.R; +import com.actionbarsherlock.internal.app.ActionBarWrapper; +import com.actionbarsherlock.internal.app.ActionBarImpl; +import com.actionbarsherlock.internal.view.menu.MenuBuilder; +import com.actionbarsherlock.internal.view.menu.MenuInflaterWrapper; +import com.actionbarsherlock.internal.view.menu.MenuItemImpl; +import com.actionbarsherlock.internal.view.menu.MenuItemWrapper; +import com.actionbarsherlock.internal.view.menu.MenuWrapper; +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.content.res.Configuration; +import android.content.res.TypedArray; +import android.content.res.Resources.Theme; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.os.Parcelable; +import android.support.v4.view.ActionMode; +import android.support.v4.view.Menu; +import android.support.v4.view.MenuInflater; +import android.support.v4.view.MenuItem; +import android.support.v4.view.Window; +import android.util.AttributeSet; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.ViewGroup.LayoutParams; +import android.widget.FrameLayout; + +/** + * Base class for activities that want to use the support-based ActionBar, + * Fragment, and Loader APIs. + * + *

Known limitations:

+ *
    + *
  • When using the <fragment> tag, this implementation can not + * use the parent view's ID as the new fragment's ID. You must explicitly + * specify an ID (or tag) in the <fragment>.

    + *
  • Prior to Honeycomb (3.0), an activity's state was saved before pausing. + * Fragments are a significant amount of new state, and dynamic enough that one + * often wants them to change between pausing and stopping. These classes + * throw an exception if you try to change the fragment state after it has been + * saved, to avoid accidental loss of UI state. However this is too restrictive + * prior to Honeycomb, where the state is saved before pausing. To address this, + * when running on platforms prior to Honeycomb an exception will not be thrown + * if you change fragments between the state save and the activity being stopped. + * This means that is some cases if the activity is restored from its last saved + * state, this may be a snapshot slightly before what the user last saw.

    + *
+ */ +public class FragmentActivity extends Activity implements SupportActivity { + private static final String TAG = "FragmentActivity"; + private static final boolean DEBUG = false; + + //The following are used so FragmentMapActivity gets the same resources WITHOUT inlining the values in its jar. + static int R$layout$screen_action_bar_overlay = R.layout.abs__screen_action_bar_overlay; + static int R$layout$screen_action_bar = R.layout.abs__screen_action_bar; + static int R$layout$screen_simple = R.layout.abs__screen_simple; + static int R$id$content = R.id.abs__content; + static int[] R$styleable$SherlockTheme = R.styleable.SherlockTheme; + static int R$styleable$SherlockTheme_windowActionBar = R.styleable.SherlockTheme_windowActionBar; + static int R$styleable$SherlockTheme_windowActionModeOverlay = R.styleable.SherlockTheme_windowActionModeOverlay; + + private static final String FRAGMENTS_TAG = "android:support:fragments"; + + static final boolean IS_HONEYCOMB = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; + + static final int MSG_REALLY_STOPPED = 1; + static final int MSG_RESUME_PENDING = 2; + + private static final int WINDOW_FLAG_ACTION_BAR = 1 << Window.FEATURE_ACTION_BAR; + private static final int WINDOW_FLAG_ACTION_BAR_ITEM_TEXT = 1 << Window.FEATURE_ACTION_BAR_ITEM_TEXT; + private static final int WINDOW_FLAG_ACTION_BAR_OVERLAY = 1 << Window.FEATURE_ACTION_BAR_OVERLAY; + private static final int WINDOW_FLAG_ACTION_MODE_OVERLAY = 1 << Window.FEATURE_ACTION_MODE_OVERLAY; + private static final int WINDOW_FLAG_INDETERMINANTE_PROGRESS = 1 << Window.FEATURE_INDETERMINATE_PROGRESS; + + final SupportActivity.InternalCallbacks mInternalCallbacks = new SupportActivity.InternalCallbacks() { + @Override + void invalidateSupportFragmentIndex(int index) { + FragmentActivity.this.invalidateSupportFragmentIndex(index); + } + + @Override + LoaderManagerImpl getLoaderManager(int index, boolean started, boolean create) { + return FragmentActivity.this.getLoaderManager(index, started, create); + } + + @Override + Handler getHandler() { + return mHandler; + } + + @Override + FragmentManagerImpl getFragments() { + return mFragments; + } + + @Override + void ensureSupportActionBarAttached() { + FragmentActivity.this.ensureSupportActionBarAttached(); + } + }; + + final Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_REALLY_STOPPED: + if (mStopped) { + doReallyStop(false); + } + break; + case MSG_RESUME_PENDING: + mFragments.dispatchResume(); + mFragments.execPendingActions(); + break; + default: + super.handleMessage(msg); + } + } + }; + final FragmentManagerImpl mFragments = new FragmentManagerImpl(); + + ActionBar mActionBar; + boolean mIsActionBarImplAttached; + long mWindowFlags = 0; + + final MenuBuilder mSupportMenu; + final MenuBuilder.Callback mSupportMenuCallback = new MenuBuilder.Callback() { + @Override + public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) { + return FragmentActivity.this.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, item); + } + }; + + boolean mCreated; + boolean mResumed; + boolean mStopped; + boolean mReallyStopped; + + boolean mOptionsMenuInvalidated; + boolean mOptionsMenuCreateResult; + + boolean mCheckedForLoaderManager; + boolean mLoadersStarted; + HCSparseArray mAllLoaderManagers; + LoaderManagerImpl mLoaderManager; + + static final class NonConfigurationInstances { + Object activity; + HashMap children; + ArrayList fragments; + HCSparseArray loaders; + } + + static class FragmentTag { + public static final int[] Fragment = { + 0x01010003, 0x010100d0, 0x010100d1 + }; + public static final int Fragment_id = 1; + public static final int Fragment_name = 0; + public static final int Fragment_tag = 2; + } + + + + public FragmentActivity() { + super(); + + if (IS_HONEYCOMB) { + mActionBar = ActionBarWrapper.createFor(this); + mSupportMenu = null; //Everything should be done natively + } else { + mSupportMenu = new MenuBuilder(this); + mSupportMenu.setCallback(mSupportMenuCallback); + } + } + + @Override + public SupportActivity.InternalCallbacks getInternalCallbacks() { + return mInternalCallbacks; + } + + @Override + public Activity asActivity() { + return this; + } + + protected void ensureSupportActionBarAttached() { + if (IS_HONEYCOMB) { + return; + } + if (!mIsActionBarImplAttached) { + if (isChild()) { + //Do not allow an action bar if we have a parent activity + mWindowFlags &= ~WINDOW_FLAG_ACTION_BAR; + } + if ((mWindowFlags & WINDOW_FLAG_ACTION_BAR) == WINDOW_FLAG_ACTION_BAR) { + if ((mWindowFlags & WINDOW_FLAG_ACTION_BAR_OVERLAY) == WINDOW_FLAG_ACTION_BAR_OVERLAY) { + super.setContentView(R.layout.abs__screen_action_bar_overlay); + } else { + super.setContentView(R.layout.abs__screen_action_bar); + } + + mActionBar = new ActionBarImpl(this); + ((ActionBarImpl)mActionBar).init(); + + final boolean textEnabled = ((mWindowFlags & WINDOW_FLAG_ACTION_BAR_ITEM_TEXT) == WINDOW_FLAG_ACTION_BAR_ITEM_TEXT); + mSupportMenu.setShowsActionItemText(textEnabled); + + if ((mWindowFlags & WINDOW_FLAG_INDETERMINANTE_PROGRESS) == WINDOW_FLAG_INDETERMINANTE_PROGRESS) { + ((ActionBarImpl)mActionBar).setProgressBarIndeterminateVisibility(false); + } + + //TODO set other flags + } else { + if ((mWindowFlags & WINDOW_FLAG_INDETERMINANTE_PROGRESS) == WINDOW_FLAG_INDETERMINANTE_PROGRESS) { + super.requestWindowFeature((int)Window.FEATURE_INDETERMINATE_PROGRESS); + } + super.setContentView(R.layout.abs__screen_simple); + } + + invalidateOptionsMenu(); + mIsActionBarImplAttached = true; + } + } + + // ------------------------------------------------------------------------ + // HOOKS INTO ACTIVITY + // ------------------------------------------------------------------------ + + /** + * Enable extended window features. + * + * @param featureId The desired feature as defined in + * {@link android.support.v4.view.Window}. + * @return Returns {@code true} if the requested feature is supported and + * now enabled. + */ + @Override + public boolean requestWindowFeature(long featureId) { + if (!IS_HONEYCOMB) { + switch ((int)featureId) { + case (int)Window.FEATURE_ACTION_BAR: + case (int)Window.FEATURE_ACTION_BAR_ITEM_TEXT: + case (int)Window.FEATURE_ACTION_BAR_OVERLAY: + case (int)Window.FEATURE_ACTION_MODE_OVERLAY: + case (int)Window.FEATURE_INDETERMINATE_PROGRESS: + mWindowFlags |= (1 << featureId); + return true; + } + } + return super.requestWindowFeature((int)featureId); + } + + @Override + public android.view.MenuInflater getMenuInflater() { + if (IS_HONEYCOMB) { + if (DEBUG) Log.d(TAG, "getMenuInflater(): Wrapping native inflater."); + + //Wrap the native inflater so it can unwrap the native menu first + return new MenuInflaterWrapper(this, super.getMenuInflater()); + } + + if (DEBUG) Log.d(TAG, "getMenuInflater(): Returning support inflater."); + + //Use our custom menu inflater + return new MenuInflater(this, super.getMenuInflater()); + } + + @Override + public void setContentView(int layoutResId) { + ensureSupportActionBarAttached(); + if (IS_HONEYCOMB) { + super.setContentView(layoutResId); + } else { + FrameLayout contentView = (FrameLayout)findViewById(R.id.abs__content); + contentView.removeAllViews(); + getLayoutInflater().inflate(layoutResId, contentView, true); + } + } + + @Override + public void setContentView(View view, LayoutParams params) { + ensureSupportActionBarAttached(); + if (IS_HONEYCOMB) { + super.setContentView(view, params); + } else { + FrameLayout contentView = (FrameLayout)findViewById(R.id.abs__content); + contentView.removeAllViews(); + contentView.addView(view, params); + } + } + + @Override + public void setContentView(View view) { + ensureSupportActionBarAttached(); + if (IS_HONEYCOMB) { + super.setContentView(view); + } else { + FrameLayout contentView = (FrameLayout)findViewById(R.id.abs__content); + contentView.removeAllViews(); + contentView.addView(view); + } + } + + @Override + public void setTitle(CharSequence title) { + if (IS_HONEYCOMB || (getSupportActionBar() == null)) { + super.setTitle(title); + } else { + getSupportActionBar().setTitle(title); + } + } + + @Override + public void setTitle(int titleId) { + if (IS_HONEYCOMB || (getSupportActionBar() == null)) { + super.setTitle(titleId); + } else { + getSupportActionBar().setTitle(titleId); + } + } + + /** + * Dispatch incoming result to the correct fragment. + */ + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + int index = requestCode>>16; + if (index != 0) { + index--; + if (mFragments.mActive == null || index < 0 || index >= mFragments.mActive.size()) { + Log.w(TAG, "Activity result fragment index out of range: 0x" + + Integer.toHexString(requestCode)); + return; + } + Fragment frag = mFragments.mActive.get(index); + if (frag == null) { + Log.w(TAG, "Activity result no fragment exists for index: 0x" + + Integer.toHexString(requestCode)); + } else { + frag.onActivityResult(requestCode&0xffff, resultCode, data); + } + return; + } + + super.onActivityResult(requestCode, resultCode, data); + } + + @Override + protected void onApplyThemeResource(Theme theme, int resid, boolean first) { + TypedArray attrs = theme.obtainStyledAttributes(resid, R.styleable.SherlockTheme); + + final boolean actionBar = attrs.getBoolean(R.styleable.SherlockTheme_windowActionBar, false); + mWindowFlags |= actionBar ? WINDOW_FLAG_ACTION_BAR : 0; + + final boolean actionModeOverlay = attrs.getBoolean(R.styleable.SherlockTheme_windowActionModeOverlay, false); + mWindowFlags |= actionModeOverlay ? WINDOW_FLAG_ACTION_MODE_OVERLAY : 0; + + attrs.recycle(); + super.onApplyThemeResource(theme, resid, first); + } + + /** + * Take care of popping the fragment back stack or finishing the activity + * as appropriate. + */ + @Override + public void onBackPressed() { + if (!mFragments.popBackStackImmediate()) { + finish(); + } + } + + /** + * Dispatch configuration change to all fragments. + */ + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + mFragments.dispatchConfigurationChanged(newConfig); + } + + /** + * Perform initialization of all fragments and loaders. + */ + @Override + protected void onCreate(Bundle savedInstanceState) { + mFragments.attachActivity(this); + // Old versions of the platform didn't do this! + if (getLayoutInflater().getFactory() == null) { + getLayoutInflater().setFactory(this); + } + + super.onCreate(savedInstanceState); + + NonConfigurationInstances nc = (NonConfigurationInstances) + getLastNonConfigurationInstance(); + if (nc != null) { + mAllLoaderManagers = nc.loaders; + } + if (savedInstanceState != null) { + Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG); + mFragments.restoreAllState(p, nc != null ? nc.fragments : null); + } + mFragments.dispatchCreate(); + } + + /** + *

Initialize the contents of the Activity's standard options menu. You + * should place your menu items in to menu.

+ * + *

The default implementation populates the menu with standard system + * menu items. These are placed in the {@link Menu.CATEGORY_SYSTEM} group + * so that they will be correctly ordered with application-defined menu + * items. Deriving classes should always call through to the base + * implementation.

+ * + *

You can safely hold on to menu (and any items created from it), + * making modifications to it as desired, until the next time + * {@code onCreateOptionsMenu()} is called.

+ * + *

When you add items to the menu, you can implement the Activity's + * {@link #onOptionsItemSelected(MenuItem)} method to handle them + * there.

+ * + * @param menu The options menu in which you place your items. + * @return You must return true for the menu to be displayed; if you return + * false it will not be shown. + */ + @Override + public boolean onCreateOptionsMenu(Menu menu) { + if (DEBUG) Log.d(TAG, "onCreateOptionsMenu(Menu): Returning " + menu.hasVisibleItems()); + return menu.hasVisibleItems(); + } + + @Override + public final boolean onCreateOptionsMenu(android.view.Menu menu) { + // Prior to Honeycomb, the framework can't invalidate the options + // menu, so we must always say we have one in case the app later + // invalidates it and needs to have it shown. + boolean result = true; + + if (IS_HONEYCOMB) { + if (DEBUG) Log.d(TAG, "onCreateOptionsMenu(android.view.Menu): Calling support method with wrapped native menu."); + MenuWrapper wrapped = new MenuWrapper(menu); + result = onCreateOptionsMenu(wrapped); + result |= mFragments.dispatchCreateOptionsMenu(wrapped, getMenuInflater()); + } + + if (DEBUG) Log.d(TAG, "onCreateOptionsMenu(android.view.Menu): Returning " + result); + return result; + } + + /** + * Add support for inflating the <fragment> tag. + */ + @Override + public View onCreateView(String name, Context context, AttributeSet attrs) { + if (!"fragment".equals(name)) { + return super.onCreateView(name, context, attrs); + } + + String fname = attrs.getAttributeValue(null, "class"); + TypedArray a = context.obtainStyledAttributes(attrs, FragmentTag.Fragment); + if (fname == null) { + fname = a.getString(FragmentTag.Fragment_name); + } + int id = a.getResourceId(FragmentTag.Fragment_id, View.NO_ID); + String tag = a.getString(FragmentTag.Fragment_tag); + a.recycle(); + + View parent = null; // NOTE: no way to get parent pre-Honeycomb. + int containerId = parent != null ? parent.getId() : 0; + if (containerId == View.NO_ID && id == View.NO_ID && tag == null) { + throw new IllegalArgumentException(attrs.getPositionDescription() + + ": Must specify unique android:id, android:tag, or have a parent with an id for " + fname); + } + + // If we restored from a previous state, we may already have + // instantiated this fragment from the state and should use + // that instance instead of making a new one. + Fragment fragment = id != View.NO_ID ? mFragments.findFragmentById(id) : null; + if (fragment == null && tag != null) { + fragment = mFragments.findFragmentByTag(tag); + } + if (fragment == null && containerId != View.NO_ID) { + fragment = mFragments.findFragmentById(containerId); + } + + if (FragmentManagerImpl.DEBUG) Log.v(TAG, "onCreateView: id=0x" + + Integer.toHexString(id) + " fname=" + fname + + " existing=" + fragment); + if (fragment == null) { + fragment = Fragment.instantiate(this, fname); + fragment.mFromLayout = true; + fragment.mFragmentId = id != 0 ? id : containerId; + fragment.mContainerId = containerId; + fragment.mTag = tag; + fragment.mInLayout = true; + fragment.mImmediateActivity = this; + fragment.mFragmentManager = mFragments; + fragment.onInflate(this, attrs, fragment.mSavedFragmentState); + mFragments.addFragment(fragment, true); + + } else if (fragment.mInLayout) { + // A fragment already exists and it is not one we restored from + // previous state. + throw new IllegalArgumentException(attrs.getPositionDescription() + + ": Duplicate id 0x" + Integer.toHexString(id) + + ", tag " + tag + ", or parent id 0x" + Integer.toHexString(containerId) + + " with another fragment for " + fname); + } else { + // This fragment was retained from a previous instance; get it + // going now. + fragment.mInLayout = true; + fragment.mImmediateActivity = this; + // If this fragment is newly instantiated (either right now, or + // from last saved state), then give it the attributes to + // initialize itself. + if (!fragment.mRetaining) { + fragment.onInflate(this, attrs, fragment.mSavedFragmentState); + } + mFragments.moveToState(fragment); + } + + if (fragment.mView == null) { + throw new IllegalStateException("Fragment " + fname + + " did not create a view."); + } + if (id != 0) { + fragment.mView.setId(id); + } + if (fragment.mView.getTag() == null) { + fragment.mView.setTag(tag); + } + return fragment.mView; + } + + @Override + public void invalidateOptionsMenu() { + if (DEBUG) Log.d(TAG, "supportInvalidateOptionsMenu(): Invalidating menu."); + + if (IS_HONEYCOMB) { + HoneycombInvalidateOptionsMenu.invoke(this); + } else { + mSupportMenu.clear(); + + mOptionsMenuCreateResult = onCreateOptionsMenu(mSupportMenu); + mOptionsMenuCreateResult |= mFragments.dispatchCreateOptionsMenu(mSupportMenu, getMenuInflater()); + + if (getSupportActionBar() != null) { + //Since we now know we are using a custom action bar, perform the + //inflation callback to allow it to display any items it wants. + //Any items that were displayed will have a boolean toggled so that we + //do not display them on the options menu. + ((ActionBarImpl)mActionBar).onMenuInflated(mSupportMenu); + } + + // Whoops, older platform... we'll use a hack, to manually rebuild + // the options menu the next time it is prepared. + mOptionsMenuInvalidated = true; + } + } + + private static final class HoneycombInvalidateOptionsMenu { + static void invoke(Activity activity) { + activity.getWindow().invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL); + } + } + + /** + * Destroy all fragments and loaders. + */ + @Override + protected void onDestroy() { + super.onDestroy(); + + doReallyStop(false); + + mFragments.dispatchDestroy(); + if (mLoaderManager != null) { + mLoaderManager.doDestroy(); + } + } + + /** + * Take care of calling onBackPressed() for pre-Eclair platforms. + */ + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if (android.os.Build.VERSION.SDK_INT < 5 /* ECLAIR */ + && keyCode == KeyEvent.KEYCODE_BACK + && event.getRepeatCount() == 0) { + // Take care of calling this method on earlier versions of + // the platform where it doesn't exist. + onBackPressed(); + return true; + } + + return super.onKeyDown(keyCode, event); + } + + /** + * Dispatch onLowMemory() to all fragments. + */ + @Override + public void onLowMemory() { + super.onLowMemory(); + mFragments.dispatchLowMemory(); + } + + /** + * Dispatch context and options menu to fragments. + */ + @Override + public final boolean onMenuItemSelected(int featureId, android.view.MenuItem item) { + if (super.onMenuItemSelected(featureId, item)) { + return true; + } + + switch (featureId) { + case Window.FEATURE_OPTIONS_PANEL: + return mFragments.dispatchOptionsItemSelected(new MenuItemWrapper(item)); + + case Window.FEATURE_CONTEXT_MENU: + return mFragments.dispatchContextItemSelected(new MenuItemWrapper(item)); + + default: + return false; + } + } + + @Override + public boolean onMenuItemSelected(int featureId, MenuItem item) { + if (onOptionsItemSelected(item)) { + return true; + } + + switch (featureId) { + case Window.FEATURE_OPTIONS_PANEL: + return mFragments.dispatchOptionsItemSelected(item); + + case Window.FEATURE_CONTEXT_MENU: + return mFragments.dispatchContextItemSelected(item); + + default: + return false; + } + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + return super.onOptionsItemSelected(item); + } + + @Override + public final boolean onOptionsItemSelected(android.view.MenuItem item) { + return onOptionsItemSelected(new MenuItemWrapper(item)); + } + + /** + * Call onOptionsMenuClosed() on fragments. + */ + @Override + public void onPanelClosed(int featureId, android.view.Menu menu) { + switch (featureId) { + case Window.FEATURE_OPTIONS_PANEL: + mFragments.dispatchOptionsMenuClosed(menu); + + if (!IS_HONEYCOMB && (getSupportActionBar() != null)) { + if (DEBUG) Log.d(TAG, "onPanelClosed(int, android.view.Menu): Dispatch menu visibility false to custom action bar."); + ((ActionBarImpl)mActionBar).onMenuVisibilityChanged(false); + } + break; + } + super.onPanelClosed(featureId, menu); + } + + /** + * Dispatch onPause() to fragments. + */ + @Override + protected void onPause() { + super.onPause(); + mResumed = false; + if (mHandler.hasMessages(MSG_RESUME_PENDING)) { + mHandler.removeMessages(MSG_RESUME_PENDING); + mFragments.dispatchResume(); + } + mFragments.dispatchPause(); + } + + /** + * Dispatch onResume() to fragments. + */ + @Override + protected void onResume() { + super.onResume(); + mHandler.sendEmptyMessage(MSG_RESUME_PENDING); + mResumed = true; + mFragments.execPendingActions(); + } + + /** + * Dispatch onResume() to fragments. + */ + @Override + protected void onPostResume() { + super.onPostResume(); + mHandler.removeMessages(MSG_RESUME_PENDING); + mFragments.dispatchResume(); + mFragments.execPendingActions(); + } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + boolean result = menu.hasVisibleItems(); + if (DEBUG) Log.d(TAG, "onPrepareOptionsMenu(Menu): Returning " + result); + return result; + } + + @Override + public final boolean onPrepareOptionsMenu(android.view.Menu menu) { + boolean result = super.onPrepareOptionsMenu(menu); + + if (!IS_HONEYCOMB) { + if (DEBUG) { + Log.d(TAG, "onPrepareOptionsMenu(android.view.Menu): mOptionsMenuCreateResult = " + mOptionsMenuCreateResult); + Log.d(TAG, "onPrepareOptionsMenu(android.view.Menu): mOptionsMenuInvalidated = " + mOptionsMenuInvalidated); + } + + boolean prepareResult = true; + if (mOptionsMenuCreateResult) { + if (DEBUG) Log.d(TAG, "onPrepareOptionsMenu(android.view.Menu): Calling support method with custom menu."); + prepareResult = onPrepareOptionsMenu(mSupportMenu); + if (DEBUG) Log.d(TAG, "onPrepareOptionsMenu(android.view.Menu): Support method result returned " + prepareResult); + if (prepareResult) { + if (DEBUG) Log.d(TAG, "onPrepareOptionsMenu(android.view.Menu): Dispatching fragment method with custom menu."); + mFragments.dispatchPrepareOptionsMenu(mSupportMenu); + } + } + + if (mOptionsMenuInvalidated) { + if (DEBUG) Log.d(TAG, "onPrepareOptionsMenu(android.view.Menu): Clearing existing options menu."); + menu.clear(); + mOptionsMenuInvalidated = false; + + if (mOptionsMenuCreateResult && prepareResult) { + if (DEBUG) Log.d(TAG, "onPrepareOptionsMenu(android.view.Menu): Adding any action items that are not displayed on the action bar."); + //Only add items that have not already been added to our custom + //action bar implementation + for (MenuItemImpl item : mSupportMenu.getItems()) { + if (!item.isShownOnActionBar()) { + item.addTo(menu); + } + } + } + } + + if (mOptionsMenuCreateResult && prepareResult && menu.hasVisibleItems()) { + if (getSupportActionBar() != null) { + if (DEBUG) Log.d(TAG, "onPrepareOptionsMenu(android.view.Menu): Dispatch menu visibility true to custom action bar."); + ((ActionBarImpl)mActionBar).onMenuVisibilityChanged(true); + } + result = true; + } + } else { + if (DEBUG) Log.d(TAG, "onPrepareOptionsMenu(android.view.Menu): Calling support method with wrapped native menu."); + final MenuWrapper wrappedMenu = new MenuWrapper(menu); + result = onPrepareOptionsMenu(wrappedMenu); + if (result) { + if (DEBUG) Log.d(TAG, "onPrepareOptionsMenu(android.view.Menu): Dispatching fragment method with wrapped native menu."); + mFragments.dispatchPrepareOptionsMenu(wrappedMenu); + } + } + + if (DEBUG) Log.d(TAG, "onPrepareOptionsMenu(android.view.Menu): Returning " + result); + return result; + } + + /** + * Cause this Activity to be recreated with a new instance. This results in + * essentially the same flow as when the Activity is created due to a + * configuration change -- the current instance will go through its + * lifecycle to onDestroy() and a new instance then created after it. + */ + @Override + public void recreate() { + //This SUCKS! Figure out a way to call the super method and support Android 1.6 + /* + if (IS_HONEYCOMB) { + super.recreate(); + } else { + */ + final Intent intent = getIntent(); + intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); + + startActivity(intent); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) { + OverridePendingTransition.invoke(this); + } + + finish(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) { + OverridePendingTransition.invoke(this); + } + /* + } + */ + } + + private static final class OverridePendingTransition { + static void invoke(Activity activity) { + activity.overridePendingTransition(0, 0); + } + } + + /** + * Retain all appropriate fragment and loader state. You can NOT + * override this yourself! + */ + @Override + public final Object onRetainNonConfigurationInstance() { + if (mStopped) { + doReallyStop(true); + } + + ArrayList fragments = mFragments.retainNonConfig(); + boolean retainLoaders = false; + if (mAllLoaderManagers != null) { + // prune out any loader managers that were already stopped and so + // have nothing useful to retain. + for (int i=mAllLoaderManagers.size()-1; i>=0; i--) { + LoaderManagerImpl lm = mAllLoaderManagers.valueAt(i); + if (lm.mRetaining) { + retainLoaders = true; + } else { + lm.doDestroy(); + mAllLoaderManagers.removeAt(i); + } + } + } + if (fragments == null && !retainLoaders) { + return null; + } + + NonConfigurationInstances nci = new NonConfigurationInstances(); + nci.activity = null; + nci.children = null; + nci.fragments = fragments; + nci.loaders = mAllLoaderManagers; + return nci; + } + + /** + * Save all appropriate fragment state. + */ + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + Parcelable p = mFragments.saveAllState(); + if (p != null) { + outState.putParcelable(FRAGMENTS_TAG, p); + } + } + + /** + * Dispatch onStart() to all fragments. Ensure any created loaders are + * now started. + */ + @Override + protected void onStart() { + super.onStart(); + + mStopped = false; + mHandler.removeMessages(MSG_REALLY_STOPPED); + + if (!mCreated) { + mCreated = true; + ensureSupportActionBarAttached(); //Needed for retained fragments + mFragments.dispatchActivityCreated(); + } + + mFragments.noteStateNotSaved(); + mFragments.execPendingActions(); + + if (!mLoadersStarted) { + mLoadersStarted = true; + if (mLoaderManager != null) { + mLoaderManager.doStart(); + } else if (!mCheckedForLoaderManager) { + mLoaderManager = getLoaderManager(-1, mLoadersStarted, false); + } + mCheckedForLoaderManager = true; + } + // NOTE: HC onStart goes here. + + mFragments.dispatchStart(); + if (mAllLoaderManagers != null) { + for (int i=mAllLoaderManagers.size()-1; i>=0; i--) { + LoaderManagerImpl lm = mAllLoaderManagers.valueAt(i); + lm.finishRetain(); + lm.doReportStart(); + } + } + } + + /** + * Dispatch onStop() to all fragments. Ensure all loaders are stopped. + */ + @Override + protected void onStop() { + super.onStop(); + + mStopped = true; + mHandler.sendEmptyMessage(MSG_REALLY_STOPPED); + + mFragments.dispatchStop(); + } + + /** + *

Sets the visibility of the indeterminate progress bar in the + * title.

+ * + *

In order for the progress bar to be shown, the feature must be + * requested via {@link #requestWindowFeature(long)}.

+ * + *

This method must be used instead of + * {@link #setProgressBarIndeterminateVisibility(boolean)} for + * ActionBarSherlock. Pass {@link Boolean.TRUE} or + * {@link Boolean.FALSE} to ensure the appropriate one is called.

+ * + * @param visible Whether to show the progress bars in the title. + */ + @Override + public void setProgressBarIndeterminateVisibility(Boolean visible) { + if (IS_HONEYCOMB || (getSupportActionBar() == null)) { + super.setProgressBarIndeterminateVisibility(visible); + } else if ((mWindowFlags & WINDOW_FLAG_INDETERMINANTE_PROGRESS) == WINDOW_FLAG_INDETERMINANTE_PROGRESS) { + ((ActionBarImpl)mActionBar).setProgressBarIndeterminateVisibility(visible); + } + } + + // ------------------------------------------------------------------------ + // NEW METHODS + // ------------------------------------------------------------------------ + + /** + * Print the Activity's state into the given stream. This gets invoked if + * you run "adb shell dumpsys activity ". + * + * @param prefix Desired prefix to prepend at each line of output. + * @param fd The raw file descriptor that the dump is being sent to. + * @param writer The PrintWriter to which you should dump your state. This will be + * closed for you after you return. + * @param args additional arguments to the dump request. + */ + @Override + public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { + if (IS_HONEYCOMB) { + //This can only work if we can call the super-class impl. :/ + //ActivityCompatHoneycomb.dump(this, prefix, fd, writer, args); + } + writer.print(prefix); writer.print("Local FragmentActivity "); + writer.print(Integer.toHexString(System.identityHashCode(this))); + writer.println(" State:"); + String innerPrefix = prefix + " "; + writer.print(innerPrefix); writer.print("mCreated="); + writer.print(mCreated); writer.print("mResumed="); + writer.print(mResumed); writer.print(" mStopped="); + writer.print(mStopped); writer.print(" mReallyStopped="); + writer.println(mReallyStopped); + writer.print(innerPrefix); writer.print("mLoadersStarted="); + writer.println(mLoadersStarted); + if (mLoaderManager != null) { + writer.print(prefix); writer.print("Loader Manager "); + writer.print(Integer.toHexString(System.identityHashCode(mLoaderManager))); + writer.println(":"); + mLoaderManager.dump(prefix + " ", fd, writer, args); + } + mFragments.dump(prefix, fd, writer, args); + } + + void doReallyStop(boolean retaining) { + if (!mReallyStopped) { + mReallyStopped = true; + mHandler.removeMessages(MSG_REALLY_STOPPED); + onReallyStop(retaining); + } + } + + /** + * Pre-HC, we didn't have a way to determine whether an activity was + * being stopped for a config change or not until we saw + * onRetainNonConfigurationInstance() called after onStop(). However + * we need to know this, to know whether to retain fragments. This will + * tell us what we need to know. + */ + void onReallyStop(boolean retaining) { + if (mLoadersStarted) { + mLoadersStarted = false; + if (mLoaderManager != null) { + if (!retaining) { + mLoaderManager.doStop(); + } else { + mLoaderManager.doRetain(); + } + } + } + + mFragments.dispatchReallyStop(retaining); + } + + // ------------------------------------------------------------------------ + // ACTION BAR AND ACTION MODE SUPPORT + // ------------------------------------------------------------------------ + + /** + * Retrieve a reference to this activity's action bar handler. + * + * @return The handler for the appropriate action bar, or null. + */ + @Override + public ActionBar getSupportActionBar() { + return (mActionBar != null) ? mActionBar.getPublicInstance() : null; + } + + /** + * Notifies the activity that an action mode has finished. Activity + * subclasses overriding this method should call the superclass + * implementation. + * + * @param mode The action mode that just finished. + */ + @Override + public void onActionModeFinished(ActionMode mode) { + } + + /** + * Notifies the Activity that an action mode has been started. Activity + * subclasses overriding this method should call the superclass + * implementation. + * + * @param mode The new action mode. + */ + @Override + public void onActionModeStarted(ActionMode mode) { + } + + /** + *

Give the Activity a chance to control the UI for an action mode + * requested by the system.

+ * + *

Note: If you are looking for a notification callback that an action + * mode has been started for this activity, see + * {@link #onActionModeStarted(ActionMode)}.

+ * + * @param callback The callback that should control the new action mode + * @return The new action mode, or null if the activity does not want to + * provide special handling for this action mode. (It will be handled by the + * system.) + */ + @Override + public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) { + return null; + } + + /** + * Start an action mode. + * + * @param callback Callback that will manage lifecycle events for this + * context mode + * @return The ContextMode that was started, or null if it was cancelled + * @see android.support.v4.view.ActionMode + */ + @Override + public final ActionMode startActionMode(final ActionMode.Callback callback) { + //Give the activity override a chance to handle the action mode + ActionMode actionMode = onWindowStartingActionMode(callback); + + if (actionMode == null) { + //If the activity did not handle, send to action bar for platform- + //specific implementation + actionMode = mActionBar.startActionMode(callback); + } + if (actionMode != null) { + //Send the activity callback that our action mode was started + onActionModeStarted(actionMode); + } + + //Return to the caller + return actionMode; + } + + // ------------------------------------------------------------------------ + // FRAGMENT SUPPORT + // ------------------------------------------------------------------------ + + /** + * Called when a fragment is attached to the activity. + */ + @Override + public void onAttachFragment(Fragment fragment) { + } + + /** + * Return the FragmentManager for interacting with fragments associated + * with this activity. + */ + @Override + public FragmentManager getSupportFragmentManager() { + return mFragments; + } + + /** + * Modifies the standard behavior to allow results to be delivered to fragments. + * This imposes a restriction that requestCode be <= 0xffff. + */ + @Override + public void startActivityForResult(Intent intent, int requestCode) { + if (requestCode != -1 && (requestCode&0xffff0000) != 0) { + throw new IllegalArgumentException("Can only use lower 16 bits for requestCode"); + } + super.startActivityForResult(intent, requestCode); + } + + /** + * Called by Fragment.startActivityForResult() to implement its behavior. + */ + @Override + public void startActivityFromFragment(Fragment fragment, Intent intent, + int requestCode) { + if (requestCode == -1) { + super.startActivityForResult(intent, -1); + return; + } + if ((requestCode&0xffff0000) != 0) { + throw new IllegalArgumentException("Can only use lower 16 bits for requestCode"); + } + super.startActivityForResult(intent, ((fragment.mIndex+1)<<16) + (requestCode&0xffff)); + } + + void invalidateSupportFragmentIndex(int index) { + //Log.v(TAG, "invalidateFragmentIndex: index=" + index); + if (mAllLoaderManagers != null) { + LoaderManagerImpl lm = mAllLoaderManagers.get(index); + if (lm != null) { + lm.doDestroy(); + } + mAllLoaderManagers.remove(index); + } + } + + // ------------------------------------------------------------------------ + // LOADER SUPPORT + // ------------------------------------------------------------------------ + + /** + * Return the LoaderManager for this fragment, creating it if needed. + */ + @Override + public LoaderManager getSupportLoaderManager() { + if (mLoaderManager != null) { + return mLoaderManager; + } + mCheckedForLoaderManager = true; + mLoaderManager = getLoaderManager(-1, mLoadersStarted, true); + return mLoaderManager; + } + + LoaderManagerImpl getLoaderManager(int index, boolean started, boolean create) { + if (mAllLoaderManagers == null) { + mAllLoaderManagers = new HCSparseArray(); + } + LoaderManagerImpl lm = mAllLoaderManagers.get(index); + if (lm == null) { + if (create) { + lm = new LoaderManagerImpl(this, started); + mAllLoaderManagers.put(index, lm); + } + } else { + lm.updateActivity(this); + } + return lm; + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentManager.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentManager.java new file mode 100644 index 00000000..dd3c736b --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentManager.java @@ -0,0 +1,1923 @@ +/* + * 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 android.support.v4.app; + +import android.content.Context; +import android.content.res.Configuration; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.os.Parcel; +import android.os.Parcelable; +import android.support.v4.util.DebugUtils; +import android.support.v4.util.LogWriter; +import android.support.v4.view.Menu; +import android.support.v4.view.MenuItem; +import android.util.Log; +import android.util.SparseArray; +import android.view.animation.AccelerateInterpolator; +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; +import android.view.animation.AnimationSet; +import android.view.animation.AnimationUtils; +import android.view.animation.DecelerateInterpolator; +import android.view.animation.Interpolator; +import android.view.animation.ScaleAnimation; +import android.view.animation.Animation.AnimationListener; +import android.view.MenuInflater; +import android.view.View; +import android.view.ViewGroup; + +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Arrays; + +/** + * Static library support version of the framework's {@link android.app.FragmentManager}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + * + *

Your activity must derive from {@link FragmentActivity} to use this. + */ +public abstract class FragmentManager { + /** + * Representation of an entry on the fragment back stack, as created + * with {@link FragmentTransaction#addToBackStack(String) + * FragmentTransaction.addToBackStack()}. Entries can later be + * retrieved with {@link FragmentManager#getBackStackEntryAt(int) + * FragmentManager.getBackStackEntry()}. + * + *

Note that you should never hold on to a BackStackEntry object; + * the identifier as returned by {@link #getId} is the only thing that + * will be persisted across activity instances. + */ + public interface BackStackEntry { + /** + * Return the unique identifier for the entry. This is the only + * representation of the entry that will persist across activity + * instances. + */ + public int getId(); + + /** + * Return the full bread crumb title resource identifier for the entry, + * or 0 if it does not have one. + */ + public int getBreadCrumbTitleRes(); + + /** + * Return the short bread crumb title resource identifier for the entry, + * or 0 if it does not have one. + */ + public int getBreadCrumbShortTitleRes(); + + /** + * Return the full bread crumb title for the entry, or null if it + * does not have one. + */ + public CharSequence getBreadCrumbTitle(); + + /** + * Return the short bread crumb title for the entry, or null if it + * does not have one. + */ + public CharSequence getBreadCrumbShortTitle(); + } + + /** + * Interface to watch for changes to the back stack. + */ + public interface OnBackStackChangedListener { + /** + * Called whenever the contents of the back stack change. + */ + public void onBackStackChanged(); + } + + /** + * Start a series of edit operations on the Fragments associated with + * this FragmentManager. + * + *

Note: A fragment transaction can only be created/committed prior + * to an activity saving its state. If you try to commit a transaction + * after {@link FragmentActivity#onSaveInstanceState FragmentActivity.onSaveInstanceState()} + * (and prior to a following {@link FragmentActivity#onStart FragmentActivity.onStart} + * or {@link FragmentActivity#onResume FragmentActivity.onResume()}, you will get an error. + * This is because the framework takes care of saving your current fragments + * in the state, and if changes are made after the state is saved then they + * will be lost.

+ */ + public abstract FragmentTransaction beginTransaction(); + + /** @hide -- remove once prebuilts are in. */ + @Deprecated + public FragmentTransaction openTransaction() { + return beginTransaction(); + } + + /** + * After a {@link FragmentTransaction} is committed with + * {@link FragmentTransaction#commit FragmentTransaction.commit()}, it + * is scheduled to be executed asynchronously on the process's main thread. + * If you want to immediately executing any such pending operations, you + * can call this function (only from the main thread) to do so. Note that + * all callbacks and other related behavior will be done from within this + * call, so be careful about where this is called from. + * + * @return Returns true if there were any pending transactions to be + * executed. + */ + public abstract boolean executePendingTransactions(); + + /** + * Finds a fragment that was identified by the given id either when inflated + * from XML or as the container ID when added in a transaction. This first + * searches through fragments that are currently added to the manager's + * activity; if no such fragment is found, then all fragments currently + * on the back stack associated with this ID are searched. + * @return The fragment if found or null otherwise. + */ + public abstract Fragment findFragmentById(int id); + + /** + * Finds a fragment that was identified by the given tag either when inflated + * from XML or as supplied when added in a transaction. This first + * searches through fragments that are currently added to the manager's + * activity; if no such fragment is found, then all fragments currently + * on the back stack are searched. + * @return The fragment if found or null otherwise. + */ + public abstract Fragment findFragmentByTag(String tag); + + /** + * Flag for {@link #popBackStack(String, int)} + * and {@link #popBackStack(int, int)}: If set, and the name or ID of + * a back stack entry has been supplied, then all matching entries will + * be consumed until one that doesn't match is found or the bottom of + * the stack is reached. Otherwise, all entries up to but not including that entry + * will be removed. + */ + public static final int POP_BACK_STACK_INCLUSIVE = 1<<0; + + /** + * Pop the top state off the back stack. Returns true if there was one + * to pop, else false. This function is asynchronous -- it enqueues the + * request to pop, but the action will not be performed until the application + * returns to its event loop. + */ + public abstract void popBackStack(); + + /** + * Like {@link #popBackStack()}, but performs the operation immediately + * inside of the call. This is like calling {@link #executePendingTransactions()} + * afterwards. + * @return Returns true if there was something popped, else false. + */ + public abstract boolean popBackStackImmediate(); + + /** + * Pop the last fragment transition from the manager's fragment + * back stack. If there is nothing to pop, false is returned. + * This function is asynchronous -- it enqueues the + * request to pop, but the action will not be performed until the application + * returns to its event loop. + * + * @param name If non-null, this is the name of a previous back state + * to look for; if found, all states up to that state will be popped. The + * {@link #POP_BACK_STACK_INCLUSIVE} flag can be used to control whether + * the named state itself is popped. If null, only the top state is popped. + * @param flags Either 0 or {@link #POP_BACK_STACK_INCLUSIVE}. + */ + public abstract void popBackStack(String name, int flags); + + /** + * Like {@link #popBackStack(String, int)}, but performs the operation immediately + * inside of the call. This is like calling {@link #executePendingTransactions()} + * afterwards. + * @return Returns true if there was something popped, else false. + */ + public abstract boolean popBackStackImmediate(String name, int flags); + + /** + * Pop all back stack states up to the one with the given identifier. + * This function is asynchronous -- it enqueues the + * request to pop, but the action will not be performed until the application + * returns to its event loop. + * + * @param id Identifier of the stated to be popped. If no identifier exists, + * false is returned. + * The identifier is the number returned by + * {@link FragmentTransaction#commit() FragmentTransaction.commit()}. The + * {@link #POP_BACK_STACK_INCLUSIVE} flag can be used to control whether + * the named state itself is popped. + * @param flags Either 0 or {@link #POP_BACK_STACK_INCLUSIVE}. + */ + public abstract void popBackStack(int id, int flags); + + /** + * Like {@link #popBackStack(int, int)}, but performs the operation immediately + * inside of the call. This is like calling {@link #executePendingTransactions()} + * afterwards. + * @return Returns true if there was something popped, else false. + */ + public abstract boolean popBackStackImmediate(int id, int flags); + + /** + * Return the number of entries currently in the back stack. + */ + public abstract int getBackStackEntryCount(); + + /** + * Return the BackStackEntry at index index in the back stack; + * entries start index 0 being the bottom of the stack. + */ + public abstract BackStackEntry getBackStackEntryAt(int index); + + /** + * Add a new listener for changes to the fragment back stack. + */ + public abstract void addOnBackStackChangedListener(OnBackStackChangedListener listener); + + /** + * Remove a listener that was previously added with + * {@link #addOnBackStackChangedListener(OnBackStackChangedListener)}. + */ + public abstract void removeOnBackStackChangedListener(OnBackStackChangedListener listener); + + /** + * Put a reference to a fragment in a Bundle. This Bundle can be + * persisted as saved state, and when later restoring + * {@link #getFragment(Bundle, String)} will return the current + * instance of the same fragment. + * + * @param bundle The bundle in which to put the fragment reference. + * @param key The name of the entry in the bundle. + * @param fragment The Fragment whose reference is to be stored. + */ + public abstract void putFragment(Bundle bundle, String key, Fragment fragment); + + /** + * Retrieve the current Fragment instance for a reference previously + * placed with {@link #putFragment(Bundle, String, Fragment)}. + * + * @param bundle The bundle from which to retrieve the fragment reference. + * @param key The name of the entry in the bundle. + * @return Returns the current Fragment instance that is associated with + * the given reference. + */ + public abstract Fragment getFragment(Bundle bundle, String key); + + /** + * Save the current instance state of the given Fragment. This can be + * used later when creating a new instance of the Fragment and adding + * it to the fragment manager, to have it create itself to match the + * current state returned here. Note that there are limits on how + * this can be used: + * + *
    + *
  • The Fragment must currently be attached to the FragmentManager. + *
  • A new Fragment created using this saved state must be the same class + * type as the Fragment it was created from. + *
  • The saved state can not contain dependencies on other fragments -- + * that is it can't use {@link #putFragment(Bundle, String, Fragment)} to + * store a fragment reference because that reference may not be valid when + * this saved state is later used. Likewise the Fragment's target and + * result code are not included in this state. + *
+ * + * @param f The Fragment whose state is to be saved. + * @return The generated state. This will be null if there was no + * interesting state created by the fragment. + */ + public abstract Fragment.SavedState saveFragmentInstanceState(Fragment f); + + /** + * Print the FragmentManager's state into the given stream. + * + * @param prefix Text to print at the front of each line. + * @param fd The raw file descriptor that the dump is being sent to. + * @param writer A PrintWriter to which the dump is to be set. + * @param args Additional arguments to the dump request. + */ + public abstract void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args); + + /** + * Control whether the framework's internal fragment manager debugging + * logs are turned on. If enabled, you will see output in logcat as + * the framework performs fragment operations. + */ + public static void enableDebugLogging(boolean enabled) { + FragmentManagerImpl.DEBUG = enabled; + } +} + +final class FragmentManagerState implements Parcelable { + FragmentState[] mActive; + int[] mAdded; + BackStackState[] mBackStack; + + public FragmentManagerState() { + } + + public FragmentManagerState(Parcel in) { + mActive = in.createTypedArray(FragmentState.CREATOR); + mAdded = in.createIntArray(); + mBackStack = in.createTypedArray(BackStackState.CREATOR); + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel dest, int flags) { + dest.writeTypedArray(mActive, flags); + dest.writeIntArray(mAdded); + dest.writeTypedArray(mBackStack, flags); + } + + public static final Parcelable.Creator CREATOR + = new Parcelable.Creator() { + public FragmentManagerState createFromParcel(Parcel in) { + return new FragmentManagerState(in); + } + + public FragmentManagerState[] newArray(int size) { + return new FragmentManagerState[size]; + } + }; +} + +/** + * Container for fragments associated with an activity. + */ +final class FragmentManagerImpl extends FragmentManager { + static boolean DEBUG = false; + static final String TAG = "FragmentManager"; + + static final boolean HONEYCOMB = android.os.Build.VERSION.SDK_INT >= 11; + + static final String TARGET_REQUEST_CODE_STATE_TAG = "android:target_req_state"; + static final String TARGET_STATE_TAG = "android:target_state"; + static final String VIEW_STATE_TAG = "android:view_state"; + + ArrayList mPendingActions; + Runnable[] mTmpActions; + boolean mExecutingActions; + + ArrayList mActive; + ArrayList mAdded; + ArrayList mAvailIndices; + ArrayList mBackStack; + ArrayList mCreatedMenus; + + // Must be accessed while locked. + ArrayList mBackStackIndices; + ArrayList mAvailBackStackIndices; + + ArrayList mBackStackChangeListeners; + + int mCurState = Fragment.INITIALIZING; + SupportActivity mActivity; + + boolean mNeedMenuInvalidate; + boolean mStateSaved; + boolean mDestroyed; + String mNoTransactionsBecause; + + // Temporary vars for state save and restore. + Bundle mStateBundle = null; + SparseArray mStateArray = null; + + Runnable mExecCommit = new Runnable() { + @Override + public void run() { + execPendingActions(); + } + }; + + @Override + public FragmentTransaction beginTransaction() { + return new BackStackRecord(this); + } + + @Override + public boolean executePendingTransactions() { + return execPendingActions(); + } + + @Override + public void popBackStack() { + enqueueAction(new Runnable() { + @Override public void run() { + popBackStackState(mActivity.getInternalCallbacks().getHandler(), null, -1, 0); + } + }, false); + } + + @Override + public boolean popBackStackImmediate() { + checkStateLoss(); + executePendingTransactions(); + return popBackStackState(mActivity.getInternalCallbacks().getHandler(), null, -1, 0); + } + + @Override + public void popBackStack(final String name, final int flags) { + enqueueAction(new Runnable() { + @Override public void run() { + popBackStackState(mActivity.getInternalCallbacks().getHandler(), name, -1, flags); + } + }, false); + } + + @Override + public boolean popBackStackImmediate(String name, int flags) { + checkStateLoss(); + executePendingTransactions(); + return popBackStackState(mActivity.getInternalCallbacks().getHandler(), name, -1, flags); + } + + @Override + public void popBackStack(final int id, final int flags) { + if (id < 0) { + throw new IllegalArgumentException("Bad id: " + id); + } + enqueueAction(new Runnable() { + @Override public void run() { + popBackStackState(mActivity.getInternalCallbacks().getHandler(), null, id, flags); + } + }, false); + } + + @Override + public boolean popBackStackImmediate(int id, int flags) { + checkStateLoss(); + executePendingTransactions(); + if (id < 0) { + throw new IllegalArgumentException("Bad id: " + id); + } + return popBackStackState(mActivity.getInternalCallbacks().getHandler(), null, id, flags); + } + + @Override + public int getBackStackEntryCount() { + return mBackStack != null ? mBackStack.size() : 0; + } + + @Override + public BackStackEntry getBackStackEntryAt(int index) { + return mBackStack.get(index); + } + + @Override + public void addOnBackStackChangedListener(OnBackStackChangedListener listener) { + if (mBackStackChangeListeners == null) { + mBackStackChangeListeners = new ArrayList(); + } + mBackStackChangeListeners.add(listener); + } + + @Override + public void removeOnBackStackChangedListener(OnBackStackChangedListener listener) { + if (mBackStackChangeListeners != null) { + mBackStackChangeListeners.remove(listener); + } + } + + @Override + public void putFragment(Bundle bundle, String key, Fragment fragment) { + if (fragment.mIndex < 0) { + throw new IllegalStateException("Fragment " + fragment + + " is not currently in the FragmentManager"); + } + bundle.putInt(key, fragment.mIndex); + } + + @Override + public Fragment getFragment(Bundle bundle, String key) { + int index = bundle.getInt(key, -1); + if (index == -1) { + return null; + } + if (index >= mActive.size()) { + throw new IllegalStateException("Fragement no longer exists for key " + + key + ": index " + index); + } + Fragment f = mActive.get(index); + if (f == null) { + throw new IllegalStateException("Fragement no longer exists for key " + + key + ": index " + index); + } + return f; + } + + @Override + public Fragment.SavedState saveFragmentInstanceState(Fragment fragment) { + if (fragment.mIndex < 0) { + throw new IllegalStateException("Fragment " + fragment + + " is not currently in the FragmentManager"); + } + if (fragment.mState > Fragment.INITIALIZING) { + Bundle result = saveFragmentBasicState(fragment); + return result != null ? new Fragment.SavedState(result) : null; + } + return null; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(128); + sb.append("FragmentManager{"); + sb.append(Integer.toHexString(System.identityHashCode(this))); + sb.append(" in "); + DebugUtils.buildShortClassTag(mActivity, sb); + sb.append("}}"); + return sb.toString(); + } + + @Override + public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { + String innerPrefix = prefix + " "; + + int N; + if (mActive != null) { + N = mActive.size(); + if (N > 0) { + writer.print(prefix); writer.print("Active Fragments in "); + writer.print(Integer.toHexString(System.identityHashCode(this))); + writer.println(":"); + for (int i=0; i 0) { + writer.print(prefix); writer.println("Added Fragments:"); + for (int i=0; i 0) { + writer.print(prefix); writer.println("Fragments Created Menus:"); + for (int i=0; i 0) { + writer.print(prefix); writer.println("Back Stack:"); + for (int i=0; i 0) { + writer.print(prefix); writer.println("Back Stack Indices:"); + for (int i=0; i 0) { + writer.print(prefix); writer.print("mAvailBackStackIndices: "); + writer.println(Arrays.toString(mAvailBackStackIndices.toArray())); + } + } + + if (mPendingActions != null) { + N = mPendingActions.size(); + if (N > 0) { + writer.print(prefix); writer.println("Pending Actions:"); + for (int i=0; i Fragment.CREATED) { + newState = Fragment.CREATED; + } + if (f.mRemoving && newState > f.mState) { + // While removing a fragment, we can't change it to a higher state. + newState = f.mState; + } + + if (f.mState < newState) { + // For fragments that are created from a layout, when restoring from + // state we don't want to allow them to be created until they are + // being reloaded from the layout. + if (f.mFromLayout && !f.mInLayout) { + return; + } + if (f.mAnimatingAway != null) { + // The fragment is currently being animated... but! Now we + // want to move our state back up. Give up on waiting for the + // animation, move to whatever the final state should be once + // the animation is done, and then we can proceed from there. + f.mAnimatingAway = null; + moveToState(f, f.mStateAfterAnimating, 0, 0); + } + switch (f.mState) { + case Fragment.INITIALIZING: + if (DEBUG) Log.v(TAG, "moveto CREATED: " + f); + if (f.mSavedFragmentState != null) { + f.mSavedViewState = f.mSavedFragmentState.getSparseParcelableArray( + FragmentManagerImpl.VIEW_STATE_TAG); + f.mTarget = getFragment(f.mSavedFragmentState, + FragmentManagerImpl.TARGET_STATE_TAG); + if (f.mTarget != null) { + f.mTargetRequestCode = f.mSavedFragmentState.getInt( + FragmentManagerImpl.TARGET_REQUEST_CODE_STATE_TAG, 0); + } + } + f.mActivity = mActivity; + f.mFragmentManager = mActivity.getInternalCallbacks().getFragments(); + f.mCalled = false; + f.onAttach(mActivity); + if (!f.mCalled) { + throw new SuperNotCalledException("Fragment " + f + + " did not call through to super.onAttach()"); + } + mActivity.onAttachFragment(f); + + if (!f.mRetaining) { + f.mCalled = false; + f.onCreate(f.mSavedFragmentState); + if (!f.mCalled) { + throw new SuperNotCalledException("Fragment " + f + + " did not call through to super.onCreate()"); + } + } + f.mRetaining = false; + if (f.mFromLayout) { + // For fragments that are part of the content view + // layout, we need to instantiate the view immediately + // and the inflater will take care of adding it. + f.mView = f.onCreateView(f.getLayoutInflater(f.mSavedFragmentState), + null, f.mSavedFragmentState); + if (f.mView != null) { + f.mInnerView = f.mView; + f.mView = NoSaveStateFrameLayout.wrap(f.mView); + if (f.mHidden) f.mView.setVisibility(View.GONE); + f.onViewCreated(f.mView, f.mSavedFragmentState); + } else { + f.mInnerView = null; + } + } + case Fragment.CREATED: + if (newState > Fragment.CREATED) { + if (DEBUG) Log.v(TAG, "moveto ACTIVITY_CREATED: " + f); + if (!f.mFromLayout) { + ViewGroup container = null; + if (f.mContainerId != 0) { + container = (ViewGroup)mActivity.findViewById(f.mContainerId); + if (container == null && !f.mRestored) { + throw new IllegalArgumentException("No view found for id 0x" + + Integer.toHexString(f.mContainerId) + + " for fragment " + f); + } + } + f.mContainer = container; + f.mView = f.onCreateView(f.getLayoutInflater(f.mSavedFragmentState), + container, f.mSavedFragmentState); + if (f.mView != null) { + f.mInnerView = f.mView; + f.mView = NoSaveStateFrameLayout.wrap(f.mView); + if (container != null) { + Animation anim = loadAnimation(f, transit, true, + transitionStyle); + if (anim != null) { + f.mView.startAnimation(anim); + } + container.addView(f.mView); + } + if (f.mHidden) f.mView.setVisibility(View.GONE); + f.onViewCreated(f.mView, f.mSavedFragmentState); + } else { + f.mInnerView = null; + } + } + + f.mCalled = false; + f.onActivityCreated(f.mSavedFragmentState); + if (!f.mCalled) { + throw new SuperNotCalledException("Fragment " + f + + " did not call through to super.onActivityCreated()"); + } + if (f.mView != null) { + f.restoreViewState(); + } + f.mSavedFragmentState = null; + } + case Fragment.ACTIVITY_CREATED: + case Fragment.STOPPED: + if (newState > Fragment.STOPPED) { + if (DEBUG) Log.v(TAG, "moveto STARTED: " + f); + f.mCalled = false; + f.performStart(); + if (!f.mCalled) { + throw new SuperNotCalledException("Fragment " + f + + " did not call through to super.onStart()"); + } + } + case Fragment.STARTED: + if (newState > Fragment.STARTED) { + if (DEBUG) Log.v(TAG, "moveto RESUMED: " + f); + f.mCalled = false; + f.mResumed = true; + f.onResume(); + if (!f.mCalled) { + throw new SuperNotCalledException("Fragment " + f + + " did not call through to super.onResume()"); + } + } + } + } else if (f.mState > newState) { + switch (f.mState) { + case Fragment.RESUMED: + if (newState < Fragment.RESUMED) { + if (DEBUG) Log.v(TAG, "movefrom RESUMED: " + f); + f.mCalled = false; + f.onPause(); + if (!f.mCalled) { + throw new SuperNotCalledException("Fragment " + f + + " did not call through to super.onPause()"); + } + f.mResumed = false; + } + case Fragment.STARTED: + if (newState < Fragment.STARTED) { + if (DEBUG) Log.v(TAG, "movefrom STARTED: " + f); + f.mCalled = false; + f.performStop(); + if (!f.mCalled) { + throw new SuperNotCalledException("Fragment " + f + + " did not call through to super.onStop()"); + } + } + case Fragment.STOPPED: + case Fragment.ACTIVITY_CREATED: + if (newState < Fragment.ACTIVITY_CREATED) { + if (DEBUG) Log.v(TAG, "movefrom ACTIVITY_CREATED: " + f); + if (f.mView != null) { + // Need to save the current view state if not + // done already. + if (!mActivity.isFinishing() && f.mSavedViewState == null) { + saveFragmentViewState(f); + } + } + f.mCalled = false; + f.performDestroyView(); + if (!f.mCalled) { + throw new SuperNotCalledException("Fragment " + f + + " did not call through to super.onDestroyView()"); + } + if (f.mView != null && f.mContainer != null) { + Animation anim = null; + if (mCurState > Fragment.INITIALIZING && !mDestroyed) { + anim = loadAnimation(f, transit, false, + transitionStyle); + } + if (anim != null) { + final Fragment fragment = f; + f.mAnimatingAway = f.mView; + f.mStateAfterAnimating = newState; + anim.setAnimationListener(new AnimationListener() { + @Override + public void onAnimationEnd(Animation animation) { + if (fragment.mAnimatingAway != null) { + fragment.mAnimatingAway = null; + moveToState(fragment, fragment.mStateAfterAnimating, + 0, 0); + } + } + @Override + public void onAnimationRepeat(Animation animation) { + } + @Override + public void onAnimationStart(Animation animation) { + } + }); + f.mView.startAnimation(anim); + } + f.mContainer.removeView(f.mView); + } + f.mContainer = null; + f.mView = null; + f.mInnerView = null; + } + case Fragment.CREATED: + if (newState < Fragment.CREATED) { + if (mDestroyed) { + if (f.mAnimatingAway != null) { + // The fragment's containing activity is + // being destroyed, but this fragment is + // currently animating away. Stop the + // animation right now -- it is not needed, + // and we can't wait any more on destroying + // the fragment. + View v = f.mAnimatingAway; + f.mAnimatingAway = null; + v.clearAnimation(); + } + } + if (f.mAnimatingAway != null) { + // We are waiting for the fragment's view to finish + // animating away. Just make a note of the state + // the fragment now should move to once the animation + // is done. + f.mStateAfterAnimating = newState; + newState = Fragment.CREATED; + } else { + if (DEBUG) Log.v(TAG, "movefrom CREATED: " + f); + if (!f.mRetaining) { + f.mCalled = false; + f.onDestroy(); + if (!f.mCalled) { + throw new SuperNotCalledException("Fragment " + f + + " did not call through to super.onDestroy()"); + } + } + + f.mCalled = false; + f.onDetach(); + if (!f.mCalled) { + throw new SuperNotCalledException("Fragment " + f + + " did not call through to super.onDetach()"); + } + if (!f.mRetaining) { + makeInactive(f); + } else { + f.mImmediateActivity = null; + f.mActivity = null; + f.mFragmentManager = null; + } + } + } + } + } + + f.mState = newState; + } + + void moveToState(Fragment f) { + moveToState(f, mCurState, 0, 0); + } + + void moveToState(int newState, boolean always) { + moveToState(newState, 0, 0, always); + } + + void moveToState(int newState, int transit, int transitStyle, boolean always) { + if (mActivity == null && newState != Fragment.INITIALIZING) { + throw new IllegalStateException("No activity"); + } + + if (!always && mCurState == newState) { + return; + } + + mCurState = newState; + if (mActive != null) { + for (int i=0; i= 0) { + return; + } + + if (mAvailIndices == null || mAvailIndices.size() <= 0) { + if (mActive == null) { + mActive = new ArrayList(); + } + f.setIndex(mActive.size()); + mActive.add(f); + + } else { + f.setIndex(mAvailIndices.remove(mAvailIndices.size()-1)); + mActive.set(f.mIndex, f); + } + } + + void makeInactive(Fragment f) { + if (f.mIndex < 0) { + return; + } + + if (DEBUG) Log.v(TAG, "Freeing fragment index " + f.mIndex); + mActive.set(f.mIndex, null); + if (mAvailIndices == null) { + mAvailIndices = new ArrayList(); + } + mAvailIndices.add(f.mIndex); + mActivity.getInternalCallbacks().invalidateSupportFragmentIndex(f.mIndex); + f.initState(); + } + + public void addFragment(Fragment fragment, boolean moveToStateNow) { + if (mAdded == null) { + mAdded = new ArrayList(); + } + if (DEBUG) Log.v(TAG, "add: " + fragment); + makeActive(fragment); + if (!fragment.mDetached) { + mAdded.add(fragment); + fragment.mAdded = true; + fragment.mRemoving = false; + if (fragment.mHasMenu && fragment.mExposesMenu) { + mNeedMenuInvalidate = true; + } + if (moveToStateNow) { + moveToState(fragment); + } + } + } + + public void removeFragment(Fragment fragment, int transition, int transitionStyle) { + if (DEBUG) Log.v(TAG, "remove: " + fragment + " nesting=" + fragment.mBackStackNesting); + final boolean inactive = !fragment.isInBackStack(); + if (!fragment.mDetached || inactive) { + mAdded.remove(fragment); + if (fragment.mHasMenu && fragment.mExposesMenu) { + mNeedMenuInvalidate = true; + } + fragment.mAdded = false; + fragment.mRemoving = true; + moveToState(fragment, inactive ? Fragment.INITIALIZING : Fragment.CREATED, + transition, transitionStyle); + } + } + + public void hideFragment(Fragment fragment, int transition, int transitionStyle) { + if (DEBUG) Log.v(TAG, "hide: " + fragment); + if (!fragment.mHidden) { + fragment.mHidden = true; + if (fragment.mView != null) { + Animation anim = loadAnimation(fragment, transition, true, + transitionStyle); + if (anim != null) { + fragment.mView.startAnimation(anim); + } + fragment.mView.setVisibility(View.GONE); + } + if (fragment.mAdded && fragment.mHasMenu && fragment.mExposesMenu) { + mNeedMenuInvalidate = true; + } + fragment.onHiddenChanged(true); + } + } + + public void showFragment(Fragment fragment, int transition, int transitionStyle) { + if (DEBUG) Log.v(TAG, "show: " + fragment); + if (fragment.mHidden) { + fragment.mHidden = false; + if (fragment.mView != null) { + Animation anim = loadAnimation(fragment, transition, true, + transitionStyle); + if (anim != null) { + fragment.mView.startAnimation(anim); + } + fragment.mView.setVisibility(View.VISIBLE); + } + if (fragment.mAdded && fragment.mHasMenu && fragment.mExposesMenu) { + mNeedMenuInvalidate = true; + } + fragment.onHiddenChanged(false); + } + } + + public void detachFragment(Fragment fragment, int transition, int transitionStyle) { + if (DEBUG) Log.v(TAG, "detach: " + fragment); + if (!fragment.mDetached) { + fragment.mDetached = true; + if (fragment.mAdded) { + // We are not already in back stack, so need to remove the fragment. + mAdded.remove(fragment); + if (fragment.mHasMenu && fragment.mExposesMenu) { + mNeedMenuInvalidate = true; + } + fragment.mAdded = false; + moveToState(fragment, Fragment.CREATED, transition, transitionStyle); + } + } + } + + public void attachFragment(Fragment fragment, int transition, int transitionStyle) { + if (DEBUG) Log.v(TAG, "attach: " + fragment); + if (fragment.mDetached) { + fragment.mDetached = false; + if (!fragment.mAdded) { + mAdded.add(fragment); + fragment.mAdded = true; + if (fragment.mHasMenu && fragment.mExposesMenu) { + mNeedMenuInvalidate = true; + } + moveToState(fragment, mCurState, transition, transitionStyle); + } + } + } + + public Fragment findFragmentById(int id) { + if (mActive != null) { + // First look through added fragments. + for (int i=mAdded.size()-1; i>=0; i--) { + Fragment f = mAdded.get(i); + if (f != null && f.mFragmentId == id) { + return f; + } + } + // Now for any known fragment. + for (int i=mActive.size()-1; i>=0; i--) { + Fragment f = mActive.get(i); + if (f != null && f.mFragmentId == id) { + return f; + } + } + } + return null; + } + + public Fragment findFragmentByTag(String tag) { + if (mActive != null && tag != null) { + // First look through added fragments. + for (int i=mAdded.size()-1; i>=0; i--) { + Fragment f = mAdded.get(i); + if (f != null && tag.equals(f.mTag)) { + return f; + } + } + // Now for any known fragment. + for (int i=mActive.size()-1; i>=0; i--) { + Fragment f = mActive.get(i); + if (f != null && tag.equals(f.mTag)) { + return f; + } + } + } + return null; + } + + public Fragment findFragmentByWho(String who) { + if (mActive != null && who != null) { + for (int i=mActive.size()-1; i>=0; i--) { + Fragment f = mActive.get(i); + if (f != null && who.equals(f.mWho)) { + return f; + } + } + } + return null; + } + + private void checkStateLoss() { + if (mStateSaved) { + throw new IllegalStateException( + "Can not perform this action after onSaveInstanceState"); + } + if (mNoTransactionsBecause != null) { + throw new IllegalStateException( + "Can not perform this action inside of " + mNoTransactionsBecause); + } + } + + public void enqueueAction(Runnable action, boolean allowStateLoss) { + if (!allowStateLoss) { + checkStateLoss(); + } + synchronized (this) { + if (mActivity == null) { + throw new IllegalStateException("Activity has been destroyed"); + } + mActivity.getInternalCallbacks().ensureSupportActionBarAttached(); + if (mPendingActions == null) { + mPendingActions = new ArrayList(); + } + mPendingActions.add(action); + if (mPendingActions.size() == 1) { + mActivity.getInternalCallbacks().getHandler().removeCallbacks(mExecCommit); + mActivity.getInternalCallbacks().getHandler().post(mExecCommit); + } + } + } + + public int allocBackStackIndex(BackStackRecord bse) { + synchronized (this) { + if (mAvailBackStackIndices == null || mAvailBackStackIndices.size() <= 0) { + if (mBackStackIndices == null) { + mBackStackIndices = new ArrayList(); + } + int index = mBackStackIndices.size(); + if (DEBUG) Log.v(TAG, "Setting back stack index " + index + " to " + bse); + mBackStackIndices.add(bse); + return index; + + } else { + int index = mAvailBackStackIndices.remove(mAvailBackStackIndices.size()-1); + if (DEBUG) Log.v(TAG, "Adding back stack index " + index + " with " + bse); + mBackStackIndices.set(index, bse); + return index; + } + } + } + + public void setBackStackIndex(int index, BackStackRecord bse) { + synchronized (this) { + if (mBackStackIndices == null) { + mBackStackIndices = new ArrayList(); + } + int N = mBackStackIndices.size(); + if (index < N) { + if (DEBUG) Log.v(TAG, "Setting back stack index " + index + " to " + bse); + mBackStackIndices.set(index, bse); + } else { + while (N < index) { + mBackStackIndices.add(null); + if (mAvailBackStackIndices == null) { + mAvailBackStackIndices = new ArrayList(); + } + if (DEBUG) Log.v(TAG, "Adding available back stack index " + N); + mAvailBackStackIndices.add(N); + N++; + } + if (DEBUG) Log.v(TAG, "Adding back stack index " + index + " with " + bse); + mBackStackIndices.add(bse); + } + } + } + + public void freeBackStackIndex(int index) { + synchronized (this) { + mBackStackIndices.set(index, null); + if (mAvailBackStackIndices == null) { + mAvailBackStackIndices = new ArrayList(); + } + if (DEBUG) Log.v(TAG, "Freeing back stack index " + index); + mAvailBackStackIndices.add(index); + } + } + + /** + * Only call from main thread! + */ + public boolean execPendingActions() { + if (mExecutingActions) { + throw new IllegalStateException("Recursive entry to executePendingTransactions"); + } + + if (Looper.myLooper() != mActivity.getInternalCallbacks().getHandler().getLooper()) { + throw new IllegalStateException("Must be called from main thread of process"); + } + + boolean didSomething = false; + + while (true) { + int numActions; + + synchronized (this) { + if (mPendingActions == null || mPendingActions.size() == 0) { + return didSomething; + } + + numActions = mPendingActions.size(); + if (mTmpActions == null || mTmpActions.length < numActions) { + mTmpActions = new Runnable[numActions]; + } + mPendingActions.toArray(mTmpActions); + mPendingActions.clear(); + mActivity.getInternalCallbacks().getHandler().removeCallbacks(mExecCommit); + } + + mExecutingActions = true; + for (int i=0; i(); + } + mBackStack.add(state); + reportBackStackChanged(); + } + + boolean popBackStackState(Handler handler, String name, int id, int flags) { + if (mBackStack == null) { + return false; + } + if (name == null && id < 0 && (flags&POP_BACK_STACK_INCLUSIVE) == 0) { + int last = mBackStack.size()-1; + if (last < 0) { + return false; + } + final BackStackRecord bss = mBackStack.remove(last); + bss.popFromBackStack(true); + reportBackStackChanged(); + } else { + int index = -1; + if (name != null || id >= 0) { + // If a name or ID is specified, look for that place in + // the stack. + index = mBackStack.size()-1; + while (index >= 0) { + BackStackRecord bss = mBackStack.get(index); + if (name != null && name.equals(bss.getName())) { + break; + } + if (id >= 0 && id == bss.mIndex) { + break; + } + index--; + } + if (index < 0) { + return false; + } + if ((flags&POP_BACK_STACK_INCLUSIVE) != 0) { + index--; + // Consume all following entries that match. + while (index >= 0) { + BackStackRecord bss = mBackStack.get(index); + if ((name != null && name.equals(bss.getName())) + || (id >= 0 && id == bss.mIndex)) { + index--; + continue; + } + break; + } + } + } + if (index == mBackStack.size()-1) { + return false; + } + final ArrayList states + = new ArrayList(); + for (int i=mBackStack.size()-1; i>index; i--) { + states.add(mBackStack.remove(i)); + } + final int LAST = states.size()-1; + for (int i=0; i<=LAST; i++) { + if (DEBUG) Log.v(TAG, "Popping back stack state: " + states.get(i)); + states.get(i).popFromBackStack(i == LAST); + } + reportBackStackChanged(); + } + return true; + } + + ArrayList retainNonConfig() { + ArrayList fragments = null; + if (mActive != null) { + for (int i=0; i(); + } + fragments.add(f); + f.mRetaining = true; + f.mTargetIndex = f.mTarget != null ? f.mTarget.mIndex : -1; + } + } + } + return fragments; + } + + void saveFragmentViewState(Fragment f) { + if (f.mInnerView == null) { + return; + } + if (mStateArray == null) { + mStateArray = new SparseArray(); + } else { + mStateArray.clear(); + } + f.mInnerView.saveHierarchyState(mStateArray); + if (mStateArray.size() > 0) { + f.mSavedViewState = mStateArray; + mStateArray = null; + } + } + + Bundle saveFragmentBasicState(Fragment f) { + Bundle result = null; + + if (mStateBundle == null) { + mStateBundle = new Bundle(); + } + f.onSaveInstanceState(mStateBundle); + if (!mStateBundle.isEmpty()) { + result = mStateBundle; + mStateBundle = null; + } + + if (f.mView != null) { + saveFragmentViewState(f); + } + if (f.mSavedViewState != null) { + if (result == null) { + result = new Bundle(); + } + result.putSparseParcelableArray( + FragmentManagerImpl.VIEW_STATE_TAG, f.mSavedViewState); + } + + return result; + } + + Parcelable saveAllState() { + // Make sure all pending operations have now been executed to get + // our state update-to-date. + execPendingActions(); + + if (HONEYCOMB) { + // As of Honeycomb, we save state after pausing. Prior to that + // it is before pausing. With fragments this is an issue, since + // there are many things you may do after pausing but before + // stopping that change the fragment state. For those older + // devices, we will not at this point say that we have saved + // the state, so we will allow them to continue doing fragment + // transactions. This retains the same semantics as Honeycomb, + // though you do have the risk of losing the very most recent state + // if the process is killed... we'll live with that. + mStateSaved = true; + } + + if (mActive == null || mActive.size() <= 0) { + return null; + } + + // First collect all active fragments. + int N = mActive.size(); + FragmentState[] active = new FragmentState[N]; + boolean haveFragments = false; + for (int i=0; i Fragment.INITIALIZING && fs.mSavedFragmentState == null) { + fs.mSavedFragmentState = saveFragmentBasicState(f); + + if (f.mTarget != null) { + if (f.mTarget.mIndex < 0) { + String msg = "Failure saving state: " + f + + " has target not in fragment manager: " + f.mTarget; + Log.e(TAG, msg); + dump(" ", null, new PrintWriter(new LogWriter(TAG)), new String[] { }); + throw new IllegalStateException(msg); + } + if (fs.mSavedFragmentState == null) { + fs.mSavedFragmentState = new Bundle(); + } + putFragment(fs.mSavedFragmentState, + FragmentManagerImpl.TARGET_STATE_TAG, f.mTarget); + if (f.mTargetRequestCode != 0) { + fs.mSavedFragmentState.putInt( + FragmentManagerImpl.TARGET_REQUEST_CODE_STATE_TAG, + f.mTargetRequestCode); + } + } + + } else { + fs.mSavedFragmentState = f.mSavedFragmentState; + } + + if (DEBUG) Log.v(TAG, "Saved state of " + f + ": " + + fs.mSavedFragmentState); + } + } + + if (!haveFragments) { + if (DEBUG) Log.v(TAG, "saveAllState: no fragments!"); + return null; + } + + int[] added = null; + BackStackState[] backStack = null; + + // Build list of currently added fragments. + if (mAdded != null) { + N = mAdded.size(); + if (N > 0) { + added = new int[N]; + for (int i=0; i 0) { + backStack = new BackStackState[N]; + for (int i=0; i nonConfig) { + // If there is no saved state at all, then there can not be + // any nonConfig fragments either, so that is that. + if (state == null) return; + FragmentManagerState fms = (FragmentManagerState)state; + if (fms.mActive == null) return; + + // First re-attach any non-config instances we are retaining back + // to their saved state, so we don't try to instantiate them again. + if (nonConfig != null) { + for (int i=0; i(fms.mActive.length); + if (mAvailIndices != null) { + mAvailIndices.clear(); + } + for (int i=0; i(); + } + if (DEBUG) Log.v(TAG, "restoreAllState: adding avail #" + i); + mAvailIndices.add(i); + } + } + + // Update the target of all retained fragments. + if (nonConfig != null) { + for (int i=0; i= 0) { + if (f.mTargetIndex < mActive.size()) { + f.mTarget = mActive.get(f.mTargetIndex); + } else { + Log.w(TAG, "Re-attaching retained fragment " + f + + " target no longer exists: " + f.mTargetIndex); + f.mTarget = null; + } + } + } + } + + // Build the list of currently added fragments. + if (fms.mAdded != null) { + mAdded = new ArrayList(fms.mAdded.length); + for (int i=0; i(fms.mBackStack.length); + for (int i=0; i= 0) { + setBackStackIndex(bse.mIndex, bse); + } + } + } else { + mBackStack = null; + } + } + + public void attachActivity(SupportActivity activity) { + if (mActivity != null) throw new IllegalStateException(); + mActivity = activity; + } + + public void noteStateNotSaved() { + mStateSaved = false; + } + + public void dispatchCreate() { + mStateSaved = false; + moveToState(Fragment.CREATED, false); + } + + public void dispatchActivityCreated() { + mStateSaved = false; + moveToState(Fragment.ACTIVITY_CREATED, false); + } + + public void dispatchStart() { + mStateSaved = false; + moveToState(Fragment.STARTED, false); + } + + public void dispatchResume() { + mStateSaved = false; + moveToState(Fragment.RESUMED, false); + } + + public void dispatchPause() { + moveToState(Fragment.STARTED, false); + } + + public void dispatchStop() { + // See saveAllState() for the explanation of this. We do this for + // all platform versions, to keep our behavior more consistent between + // them. + mStateSaved = true; + + moveToState(Fragment.STOPPED, false); + } + + public void dispatchReallyStop(boolean retaining) { + if (mActive != null) { + for (int i=0; i newMenus = null; + if (mActive != null) { + for (int i=0; i(); + } + newMenus.add(f); + } + } + } + + if (mCreatedMenus != null) { + for (int i=0; i mLastFragment = null; + private int mLastPosition = -1; + private boolean mOptionsMenuPotentiallyStale; + + public FragmentPagerAdapter(FragmentManager fm) { + mFragmentManager = fm; + } + + /** + * Return the Fragment associated with a specified position. + */ + public abstract Fragment getItem(int position); + + @Override + public void startUpdate(View container) { + mOptionsMenuPotentiallyStale = false; + } + + @Override + public Object instantiateItem(View container, int position) { + if (mCurTransaction == null) { + mCurTransaction = mFragmentManager.beginTransaction(); + } + + // Do we already have this fragment? + String name = makeFragmentName(container.getId(), position); + Fragment fragment = mFragmentManager.findFragmentByTag(name); + if (fragment != null) { + if (DEBUG) Log.v(TAG, "Attaching item #" + position + ": f=" + fragment); + mCurTransaction.attach(fragment); + } else { + fragment = getItem(position); + if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment); + mCurTransaction.add(container.getId(), fragment, + makeFragmentName(container.getId(), position)); + } + + fragment.mExposesMenu = false; + return fragment; + } + + @Override + public void destroyItem(View container, int position, Object object) { + if (mCurTransaction == null) { + mCurTransaction = mFragmentManager.beginTransaction(); + } + Fragment fragment = (Fragment)object; + fragment.mExposesMenu = true; + if (DEBUG) Log.v(TAG, "Detaching item #" + position + ": f=" + fragment + + " v=" + fragment.getView()); + mCurTransaction.detach(fragment); + } + + @Override + public void onItemSelected(int position, Object object) { + if (position == mLastPosition) { + return; + } + if ((mLastFragment != null) && (mLastFragment.get() != null)) { + mLastFragment.get().mExposesMenu = false; + } + Fragment fragment = (Fragment)object; + fragment.mExposesMenu = true; + mLastFragment = new WeakReference(fragment); + mLastPosition = position; + mOptionsMenuPotentiallyStale = true; + } + + @Override + public void finishUpdate(View container) { + if (mCurTransaction != null) { + mCurTransaction.commit(); + mCurTransaction = null; + mOptionsMenuPotentiallyStale = true; + } + if (mOptionsMenuPotentiallyStale) { + mFragmentManager.executePendingTransactions(); + ((FragmentManagerImpl)mFragmentManager).mActivity.invalidateOptionsMenu(); + } + } + + @Override + public boolean isViewFromObject(View view, Object object) { + return ((Fragment)object).getView() == view; + } + + @Override + public Parcelable saveState() { + return null; + } + + @Override + public void restoreState(Parcelable state, ClassLoader loader) { + } + + private static String makeFragmentName(int viewId, int index) { + return "android:switcher:" + viewId + ":" + index; + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentStatePagerAdapter.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentStatePagerAdapter.java new file mode 100644 index 00000000..8567e83d --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentStatePagerAdapter.java @@ -0,0 +1,168 @@ +/* + * 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 android.support.v4.app; + +import java.util.ArrayList; + +import android.os.Bundle; +import android.os.Parcelable; +import android.support.v4.view.PagerAdapter; +import android.util.Log; +import android.view.View; + +public abstract class FragmentStatePagerAdapter extends PagerAdapter { + private static final String TAG = "FragmentStatePagerAdapter"; + private static final boolean DEBUG = false; + + private final FragmentManager mFragmentManager; + private FragmentTransaction mCurTransaction = null; + + private ArrayList mSavedState = new ArrayList(); + private ArrayList mFragments = new ArrayList(); + + public FragmentStatePagerAdapter(FragmentManager fm) { + mFragmentManager = fm; + } + + /** + * Return the Fragment associated with a specified position. + */ + public abstract Fragment getItem(int position); + + @Override + public void startUpdate(View container) { + } + + @Override + public Object instantiateItem(View container, int position) { + // If we already have this item instantiated, there is nothing + // to do. This can happen when we are restoring the entire pager + // from its saved state, where the fragment manager has already + // taken care of restoring the fragments we previously had instantiated. + if (mFragments.size() > position) { + Fragment f = mFragments.get(position); + if (f != null) { + return f; + } + } + + if (mCurTransaction == null) { + mCurTransaction = mFragmentManager.beginTransaction(); + } + + Fragment fragment = getItem(position); + if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment); + if (mSavedState.size() > position) { + Fragment.SavedState fss = mSavedState.get(position); + if (fss != null) { + fragment.setInitialSavedState(fss); + } + } + while (mFragments.size() <= position) { + mFragments.add(null); + } + mFragments.set(position, fragment); + mCurTransaction.add(container.getId(), fragment); + + return fragment; + } + + @Override + public void destroyItem(View container, int position, Object object) { + Fragment fragment = (Fragment)object; + + if (mCurTransaction == null) { + mCurTransaction = mFragmentManager.beginTransaction(); + } + if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object + + " v=" + ((Fragment)object).getView()); + while (mSavedState.size() <= position) { + mSavedState.add(null); + } + mSavedState.set(position, mFragmentManager.saveFragmentInstanceState(fragment)); + mFragments.set(position, null); + + mCurTransaction.remove(fragment); + } + + @Override + public void finishUpdate(View container) { + if (mCurTransaction != null) { + mCurTransaction.commit(); + mCurTransaction = null; + mFragmentManager.executePendingTransactions(); + } + } + + @Override + public boolean isViewFromObject(View view, Object object) { + return ((Fragment)object).getView() == view; + } + + @Override + public Parcelable saveState() { + Bundle state = null; + if (mSavedState.size() > 0) { + state = new Bundle(); + Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()]; + mSavedState.toArray(fss); + state.putParcelableArray("states", fss); + } + for (int i=0; i keys = bundle.keySet(); + for (String key: keys) { + if (key.startsWith("f")) { + int index = Integer.parseInt(key.substring(1)); + Fragment f = mFragmentManager.getFragment(bundle, key); + if (f != null) { + while (mFragments.size() <= index) { + mFragments.add(null); + } + mFragments.set(index, f); + } else { + Log.w(TAG, "Bad fragment at key " + key); + } + } + } + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentTransaction.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentTransaction.java new file mode 100644 index 00000000..b8dfd5f6 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/FragmentTransaction.java @@ -0,0 +1,262 @@ +/* + * 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 android.support.v4.app; + +/** + * Static library support version of the framework's {@link android.app.FragmentTransaction}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + */ +public abstract class FragmentTransaction { + /** + * Calls {@link #add(int, Fragment, String)} with a 0 containerViewId. + */ + public abstract FragmentTransaction add(Fragment fragment, String tag); + + /** + * Calls {@link #add(int, Fragment, String)} with a null tag. + */ + public abstract FragmentTransaction add(int containerViewId, Fragment fragment); + + /** + * Add a fragment to the activity state. This fragment may optionally + * also have its view (if {@link Fragment#onCreateView Fragment.onCreateView} + * returns non-null) into a container view of the activity. + * + * @param containerViewId Optional identifier of the container this fragment is + * to be placed in. If 0, it will not be placed in a container. + * @param fragment The fragment to be added. This fragment must not already + * be added to the activity. + * @param tag Optional tag name for the fragment, to later retrieve the + * fragment with {@link FragmentManager#findFragmentByTag(String) + * FragmentManager.findFragmentByTag(String)}. + * + * @return Returns the same FragmentTransaction instance. + */ + public abstract FragmentTransaction add(int containerViewId, Fragment fragment, String tag); + + /** + * Calls {@link #replace(int, Fragment, String)} with a null tag. + */ + public abstract FragmentTransaction replace(int containerViewId, Fragment fragment); + + /** + * Replace an existing fragment that was added to a container. This is + * essentially the same as calling {@link #remove(Fragment)} for all + * currently added fragments that were added with the same containerViewId + * and then {@link #add(int, Fragment, String)} with the same arguments + * given here. + * + * @param containerViewId Identifier of the container whose fragment(s) are + * to be replaced. + * @param fragment The new fragment to place in the container. + * @param tag Optional tag name for the fragment, to later retrieve the + * fragment with {@link FragmentManager#findFragmentByTag(String) + * FragmentManager.findFragmentByTag(String)}. + * + * @return Returns the same FragmentTransaction instance. + */ + public abstract FragmentTransaction replace(int containerViewId, Fragment fragment, String tag); + + /** + * Remove an existing fragment. If it was added to a container, its view + * is also removed from that container. + * + * @param fragment The fragment to be removed. + * + * @return Returns the same FragmentTransaction instance. + */ + public abstract FragmentTransaction remove(Fragment fragment); + + /** + * Hides an existing fragment. This is only relevant for fragments whose + * views have been added to a container, as this will cause the view to + * be hidden. + * + * @param fragment The fragment to be hidden. + * + * @return Returns the same FragmentTransaction instance. + */ + public abstract FragmentTransaction hide(Fragment fragment); + + /** + * Shows a previously hidden fragment. This is only relevant for fragments whose + * views have been added to a container, as this will cause the view to + * be shown. + * + * @param fragment The fragment to be shown. + * + * @return Returns the same FragmentTransaction instance. + */ + public abstract FragmentTransaction show(Fragment fragment); + + /** + * Detach the given fragment from the UI. This is the same state as + * when it is put on the back stack: the fragment is removed from + * the UI, however its state is still being actively managed by the + * fragment manager. When going into this state its view hierarchy + * is destroyed. + * + * @param fragment The fragment to be detached. + * + * @return Returns the same FragmentTransaction instance. + */ + public abstract FragmentTransaction detach(Fragment fragment); + + /** + * Re-attach a fragment after it had previously been deatched from + * the UI with {@link #detach(Fragment)}. This + * causes its view hierarchy to be re-created, attached to the UI, + * and displayed. + * + * @param fragment The fragment to be attached. + * + * @return Returns the same FragmentTransaction instance. + */ + public abstract FragmentTransaction attach(Fragment fragment); + + /** + * @return true if this transaction contains no operations, + * false otherwise. + */ + public abstract boolean isEmpty(); + + /** + * Bit mask that is set for all enter transitions. + */ + public static final int TRANSIT_ENTER_MASK = 0x1000; + + /** + * Bit mask that is set for all exit transitions. + */ + public static final int TRANSIT_EXIT_MASK = 0x2000; + + /** Not set up for a transition. */ + public static final int TRANSIT_UNSET = -1; + /** No animation for transition. */ + public static final int TRANSIT_NONE = 0; + /** Fragment is being added onto the stack */ + public static final int TRANSIT_FRAGMENT_OPEN = 1 | TRANSIT_ENTER_MASK; + /** Fragment is being removed from the stack */ + public static final int TRANSIT_FRAGMENT_CLOSE = 2 | TRANSIT_EXIT_MASK; + /** Fragment should simply fade in or out; that is, no strong navigation associated + * with it except that it is appearing or disappearing for some reason. */ + public static final int TRANSIT_FRAGMENT_FADE = 3 | TRANSIT_ENTER_MASK; + + /** + * Set specific animation resources to run for the fragments that are + * entering and exiting in this transaction. + */ + public abstract FragmentTransaction setCustomAnimations(int enter, int exit); + + /** + * Select a standard transition animation for this transaction. May be + * one of {@link #TRANSIT_NONE}, {@link #TRANSIT_FRAGMENT_OPEN}, + * or {@link #TRANSIT_FRAGMENT_CLOSE} + */ + public abstract FragmentTransaction setTransition(int transit); + + /** + * Set a custom style resource that will be used for resolving transit + * animations. + */ + public abstract FragmentTransaction setTransitionStyle(int styleRes); + + /** + * Add this transaction to the back stack. This means that the transaction + * will be remembered after it is committed, and will reverse its operation + * when later popped off the stack. + * + * @param name An optional name for this back stack state, or null. + */ + public abstract FragmentTransaction addToBackStack(String name); + + /** + * Returns true if this FragmentTransaction is allowed to be added to the back + * stack. If this method would return false, {@link #addToBackStack(String)} + * will throw {@link IllegalStateException}. + * + * @return True if {@link #addToBackStack(String)} is permitted on this transaction. + */ + public abstract boolean isAddToBackStackAllowed(); + + /** + * Disallow calls to {@link #addToBackStack(String)}. Any future calls to + * addToBackStack will throw {@link IllegalStateException}. If addToBackStack + * has already been called, this method will throw IllegalStateException. + */ + public abstract FragmentTransaction disallowAddToBackStack(); + + /** + * Set the full title to show as a bread crumb when this transaction + * is on the back stack, as used by {@link FragmentBreadCrumbs}. + * + * @param res A string resource containing the title. + */ + public abstract FragmentTransaction setBreadCrumbTitle(int res); + + /** + * Like {@link #setBreadCrumbTitle(int)} but taking a raw string; this + * method is not recommended, as the string can not be changed + * later if the locale changes. + */ + public abstract FragmentTransaction setBreadCrumbTitle(CharSequence text); + + /** + * Set the short title to show as a bread crumb when this transaction + * is on the back stack, as used by {@link FragmentBreadCrumbs}. + * + * @param res A string resource containing the title. + */ + public abstract FragmentTransaction setBreadCrumbShortTitle(int res); + + /** + * Like {@link #setBreadCrumbShortTitle(int)} but taking a raw string; this + * method is not recommended, as the string can not be changed + * later if the locale changes. + */ + public abstract FragmentTransaction setBreadCrumbShortTitle(CharSequence text); + + /** + * Schedules a commit of this transaction. The commit does + * not happen immediately; it will be scheduled as work on the main thread + * to be done the next time that thread is ready. + * + *

A transaction can only be committed with this method + * prior to its containing activity saving its state. If the commit is + * attempted after that point, an exception will be thrown. This is + * because the state after the commit can be lost if the activity needs to + * be restored from its state. See {@link #commitAllowingStateLoss()} for + * situations where it may be okay to lose the commit.

+ * + * @return Returns the identifier of this transaction's back stack entry, + * if {@link #addToBackStack(String)} had been called. Otherwise, returns + * a negative number. + */ + public abstract int commit(); + + /** + * Like {@link #commit} but allows the commit to be executed after an + * activity's state is saved. This is dangerous because the commit can + * be lost if the activity needs to later be restored from its state, so + * this should only be used for cases where it is okay for the UI state + * to change unexpectedly on the user. + */ + public abstract int commitAllowingStateLoss(); +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/HCSparseArray.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/HCSparseArray.java new file mode 100644 index 00000000..f6cf9fe2 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/HCSparseArray.java @@ -0,0 +1,360 @@ +/* + * 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 android.support.v4.app; + +/** + * A copy of Honeycomb's SparseArray, only so we can have the removeAt() method. + */ +public class HCSparseArray { + private static final Object DELETED = new Object(); + private boolean mGarbage = false; + + /** + * Creates a new SparseArray containing no mappings. + */ + public HCSparseArray() { + this(10); + } + + /** + * Creates a new SparseArray containing no mappings that will not + * require any additional memory allocation to store the specified + * number of mappings. + */ + public HCSparseArray(int initialCapacity) { + initialCapacity = idealIntArraySize(initialCapacity); + + mKeys = new int[initialCapacity]; + mValues = new Object[initialCapacity]; + mSize = 0; + } + + /** + * Gets the Object mapped from the specified key, or null + * if no such mapping has been made. + */ + public E get(int key) { + return get(key, null); + } + + /** + * Gets the Object mapped from the specified key, or the specified Object + * if no such mapping has been made. + */ + @SuppressWarnings("unchecked") + public E get(int key, E valueIfKeyNotFound) { + int i = binarySearch(mKeys, 0, mSize, key); + + if (i < 0 || mValues[i] == DELETED) { + return valueIfKeyNotFound; + } else { + return (E) mValues[i]; + } + } + + /** + * Removes the mapping from the specified key, if there was any. + */ + public void delete(int key) { + int i = binarySearch(mKeys, 0, mSize, key); + + if (i >= 0) { + if (mValues[i] != DELETED) { + mValues[i] = DELETED; + mGarbage = true; + } + } + } + + /** + * Alias for {@link #delete(int)}. + */ + public void remove(int key) { + delete(key); + } + + /** + * Removes the mapping at the specified index. + */ + public void removeAt(int index) { + if (mValues[index] != DELETED) { + mValues[index] = DELETED; + mGarbage = true; + } + } + + private void gc() { + // Log.e("SparseArray", "gc start with " + mSize); + + int n = mSize; + int o = 0; + int[] keys = mKeys; + Object[] values = mValues; + + for (int i = 0; i < n; i++) { + Object val = values[i]; + + if (val != DELETED) { + if (i != o) { + keys[o] = keys[i]; + values[o] = val; + } + + o++; + } + } + + mGarbage = false; + mSize = o; + + // Log.e("SparseArray", "gc end with " + mSize); + } + + /** + * Adds a mapping from the specified key to the specified value, + * replacing the previous mapping from the specified key if there + * was one. + */ + public void put(int key, E value) { + int i = binarySearch(mKeys, 0, mSize, key); + + if (i >= 0) { + mValues[i] = value; + } else { + i = ~i; + + if (i < mSize && mValues[i] == DELETED) { + mKeys[i] = key; + mValues[i] = value; + return; + } + + if (mGarbage && mSize >= mKeys.length) { + gc(); + + // Search again because indices may have changed. + i = ~binarySearch(mKeys, 0, mSize, key); + } + + if (mSize >= mKeys.length) { + int n = idealIntArraySize(mSize + 1); + + int[] nkeys = new int[n]; + Object[] nvalues = new Object[n]; + + // Log.e("SparseArray", "grow " + mKeys.length + " to " + n); + System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length); + System.arraycopy(mValues, 0, nvalues, 0, mValues.length); + + mKeys = nkeys; + mValues = nvalues; + } + + if (mSize - i != 0) { + // Log.e("SparseArray", "move " + (mSize - i)); + System.arraycopy(mKeys, i, mKeys, i + 1, mSize - i); + System.arraycopy(mValues, i, mValues, i + 1, mSize - i); + } + + mKeys[i] = key; + mValues[i] = value; + mSize++; + } + } + + /** + * Returns the number of key-value mappings that this SparseArray + * currently stores. + */ + public int size() { + if (mGarbage) { + gc(); + } + + return mSize; + } + + /** + * Given an index in the range 0...size()-1, returns + * the key from the indexth key-value mapping that this + * SparseArray stores. + */ + public int keyAt(int index) { + if (mGarbage) { + gc(); + } + + return mKeys[index]; + } + + /** + * Given an index in the range 0...size()-1, returns + * the value from the indexth key-value mapping that this + * SparseArray stores. + */ + @SuppressWarnings("unchecked") + public E valueAt(int index) { + if (mGarbage) { + gc(); + } + + return (E) mValues[index]; + } + + /** + * Given an index in the range 0...size()-1, sets a new + * value for the indexth key-value mapping that this + * SparseArray stores. + */ + public void setValueAt(int index, E value) { + if (mGarbage) { + gc(); + } + + mValues[index] = value; + } + + /** + * Returns the index for which {@link #keyAt} would return the + * specified key, or a negative number if the specified + * key is not mapped. + */ + public int indexOfKey(int key) { + if (mGarbage) { + gc(); + } + + return binarySearch(mKeys, 0, mSize, key); + } + + /** + * Returns an index for which {@link #valueAt} would return the + * specified key, or a negative number if no keys map to the + * specified value. + * Beware that this is a linear search, unlike lookups by key, + * and that multiple keys can map to the same value and this will + * find only one of them. + */ + public int indexOfValue(E value) { + if (mGarbage) { + gc(); + } + + for (int i = 0; i < mSize; i++) + if (mValues[i] == value) + return i; + + return -1; + } + + /** + * Removes all key-value mappings from this SparseArray. + */ + public void clear() { + int n = mSize; + Object[] values = mValues; + + for (int i = 0; i < n; i++) { + values[i] = null; + } + + mSize = 0; + mGarbage = false; + } + + /** + * Puts a key/value pair into the array, optimizing for the case where + * the key is greater than all existing keys in the array. + */ + public void append(int key, E value) { + if (mSize != 0 && key <= mKeys[mSize - 1]) { + put(key, value); + return; + } + + if (mGarbage && mSize >= mKeys.length) { + gc(); + } + + int pos = mSize; + if (pos >= mKeys.length) { + int n = idealIntArraySize(pos + 1); + + int[] nkeys = new int[n]; + Object[] nvalues = new Object[n]; + + // Log.e("SparseArray", "grow " + mKeys.length + " to " + n); + System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length); + System.arraycopy(mValues, 0, nvalues, 0, mValues.length); + + mKeys = nkeys; + mValues = nvalues; + } + + mKeys[pos] = key; + mValues[pos] = value; + mSize = pos + 1; + } + + private static int binarySearch(int[] a, int start, int len, int key) { + int high = start + len, low = start - 1, guess; + + while (high - low > 1) { + guess = (high + low) / 2; + + if (a[guess] < key) + low = guess; + else + high = guess; + } + + if (high == start + len) + return ~(start + len); + else if (a[high] == key) + return high; + else + return ~high; + } + + /*private void checkIntegrity() { + for (int i = 1; i < mSize; i++) { + if (mKeys[i] <= mKeys[i - 1]) { + for (int j = 0; j < mSize; j++) { + Log.e("FAIL", j + ": " + mKeys[j] + " -> " + mValues[j]); + } + + throw new RuntimeException(); + } + } + }*/ + + static int idealByteArraySize(int need) { + for (int i = 4; i < 32; i++) + if (need <= (1 << i) - 12) + return (1 << i) - 12; + + return need; + } + + static int idealIntArraySize(int need) { + return idealByteArraySize(need * 4) / 4; + } + + private int[] mKeys; + private Object[] mValues; + private int mSize; +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/ListFragment.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/ListFragment.java new file mode 100644 index 00000000..7f8666ff --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/ListFragment.java @@ -0,0 +1,375 @@ +/* + * 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 android.support.v4.app; + +import android.content.Context; +import android.os.Bundle; +import android.os.Handler; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.AnimationUtils; +import android.widget.AdapterView; +import android.widget.FrameLayout; +import android.widget.LinearLayout; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.TextView; + +/** + * Static library support version of the framework's {@link android.app.ListFragment}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + */ +public class ListFragment extends Fragment { + static final int INTERNAL_EMPTY_ID = 0x00ff0001; + static final int INTERNAL_PROGRESS_CONTAINER_ID = 0x00ff0002; + static final int INTERNAL_LIST_CONTAINER_ID = 0x00ff0003; + + final private Handler mHandler = new Handler(); + + final private Runnable mRequestFocus = new Runnable() { + public void run() { + mList.focusableViewAvailable(mList); + } + }; + + final private AdapterView.OnItemClickListener mOnClickListener + = new AdapterView.OnItemClickListener() { + public void onItemClick(AdapterView parent, View v, int position, long id) { + onListItemClick((ListView)parent, v, position, id); + } + }; + + ListAdapter mAdapter; + ListView mList; + View mEmptyView; + TextView mStandardEmptyView; + View mProgressContainer; + View mListContainer; + CharSequence mEmptyText; + boolean mListShown; + + public ListFragment() { + } + + /** + * Provide default implementation to return a simple list view. Subclasses + * can override to replace with their own layout. If doing so, the + * returned view hierarchy must have a ListView whose id + * is {@link android.R.id#list android.R.id.list} and can optionally + * have a sibling view id {@link android.R.id#empty android.R.id.empty} + * that is to be shown when the list is empty. + * + *

If you are overriding this method with your own custom content, + * consider including the standard layout {@link android.R.layout#list_content} + * in your layout file, so that you continue to retain all of the standard + * behavior of ListFragment. In particular, this is currently the only + * way to have the built-in indeterminant progress state be shown. + */ + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + final Context context = getActivity(); + + FrameLayout root = new FrameLayout(context); + + // ------------------------------------------------------------------ + + LinearLayout pframe = new LinearLayout(context); + pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); + pframe.setOrientation(LinearLayout.VERTICAL); + pframe.setVisibility(View.GONE); + pframe.setGravity(Gravity.CENTER); + + ProgressBar progress = new ProgressBar(context, null, + android.R.attr.progressBarStyleLarge); + pframe.addView(progress, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + + root.addView(pframe, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + + // ------------------------------------------------------------------ + + FrameLayout lframe = new FrameLayout(context); + lframe.setId(INTERNAL_LIST_CONTAINER_ID); + + TextView tv = new TextView(context); + tv.setId(INTERNAL_EMPTY_ID); + tv.setGravity(Gravity.CENTER); + lframe.addView(tv, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + + ListView lv = new ListView(context); + lv.setId(android.R.id.list); + lv.setDrawSelectorOnTop(false); + lframe.addView(lv, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + + root.addView(lframe, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + + // ------------------------------------------------------------------ + + root.setLayoutParams(new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + + return root; + } + + /** + * Attach to list view once the view hierarchy has been created. + */ + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + ensureList(); + } + + /** + * Detach from list view. + */ + @Override + public void onDestroyView() { + mHandler.removeCallbacks(mRequestFocus); + mList = null; + mListShown = false; + mEmptyView = mProgressContainer = mListContainer = null; + mStandardEmptyView = null; + super.onDestroyView(); + } + + /** + * This method will be called when an item in the list is selected. + * Subclasses should override. Subclasses can call + * getListView().getItemAtPosition(position) if they need to access the + * data associated with the selected item. + * + * @param l The ListView where the click happened + * @param v The view that was clicked within the ListView + * @param position The position of the view in the list + * @param id The row id of the item that was clicked + */ + public void onListItemClick(ListView l, View v, int position, long id) { + } + + /** + * Provide the cursor for the list view. + */ + public void setListAdapter(ListAdapter adapter) { + boolean hadAdapter = mAdapter != null; + mAdapter = adapter; + if (mList != null) { + mList.setAdapter(adapter); + if (!mListShown && !hadAdapter) { + // The list was hidden, and previously didn't have an + // adapter. It is now time to show it. + setListShown(true, getView().getWindowToken() != null); + } + } + } + + /** + * Set the currently selected list item to the specified + * position with the adapter's data + * + * @param position + */ + public void setSelection(int position) { + ensureList(); + mList.setSelection(position); + } + + /** + * Get the position of the currently selected list item. + */ + public int getSelectedItemPosition() { + ensureList(); + return mList.getSelectedItemPosition(); + } + + /** + * Get the cursor row ID of the currently selected list item. + */ + public long getSelectedItemId() { + ensureList(); + return mList.getSelectedItemId(); + } + + /** + * Get the activity's list view widget. + */ + public ListView getListView() { + ensureList(); + return mList; + } + + /** + * The default content for a ListFragment has a TextView that can + * be shown when the list is empty. If you would like to have it + * shown, call this method to supply the text it should use. + */ + public void setEmptyText(CharSequence text) { + ensureList(); + if (mStandardEmptyView == null) { + throw new IllegalStateException("Can't be used with a custom content view"); + } + mStandardEmptyView.setText(text); + if (mEmptyText == null) { + mList.setEmptyView(mStandardEmptyView); + } + mEmptyText = text; + } + + /** + * Control whether the list is being displayed. You can make it not + * displayed if you are waiting for the initial data to show in it. During + * this time an indeterminant progress indicator will be shown instead. + * + *

Applications do not normally need to use this themselves. The default + * behavior of ListFragment is to start with the list not being shown, only + * showing it once an adapter is given with {@link #setListAdapter(ListAdapter)}. + * If the list at that point had not been shown, when it does get shown + * it will be do without the user ever seeing the hidden state. + * + * @param shown If true, the list view is shown; if false, the progress + * indicator. The initial value is true. + */ + public void setListShown(boolean shown) { + setListShown(shown, true); + } + + /** + * Like {@link #setListShown(boolean)}, but no animation is used when + * transitioning from the previous state. + */ + public void setListShownNoAnimation(boolean shown) { + setListShown(shown, false); + } + + /** + * Control whether the list is being displayed. You can make it not + * displayed if you are waiting for the initial data to show in it. During + * this time an indeterminant progress indicator will be shown instead. + * + * @param shown If true, the list view is shown; if false, the progress + * indicator. The initial value is true. + * @param animate If true, an animation will be used to transition to the + * new state. + */ + private void setListShown(boolean shown, boolean animate) { + ensureList(); + if (mProgressContainer == null) { + throw new IllegalStateException("Can't be used with a custom content view"); + } + if (mListShown == shown) { + return; + } + mListShown = shown; + if (shown) { + if (animate) { + mProgressContainer.startAnimation(AnimationUtils.loadAnimation( + getActivity(), android.R.anim.fade_out)); + mListContainer.startAnimation(AnimationUtils.loadAnimation( + getActivity(), android.R.anim.fade_in)); + } else { + mProgressContainer.clearAnimation(); + mListContainer.clearAnimation(); + } + mProgressContainer.setVisibility(View.GONE); + mListContainer.setVisibility(View.VISIBLE); + } else { + if (animate) { + mProgressContainer.startAnimation(AnimationUtils.loadAnimation( + getActivity(), android.R.anim.fade_in)); + mListContainer.startAnimation(AnimationUtils.loadAnimation( + getActivity(), android.R.anim.fade_out)); + } else { + mProgressContainer.clearAnimation(); + mListContainer.clearAnimation(); + } + mProgressContainer.setVisibility(View.VISIBLE); + mListContainer.setVisibility(View.GONE); + } + } + + /** + * Get the ListAdapter associated with this activity's ListView. + */ + public ListAdapter getListAdapter() { + return mAdapter; + } + + private void ensureList() { + if (mList != null) { + return; + } + View root = getView(); + if (root == null) { + throw new IllegalStateException("Content view not yet created"); + } + if (root instanceof ListView) { + mList = (ListView)root; + } else { + mStandardEmptyView = (TextView)root.findViewById(INTERNAL_EMPTY_ID); + if (mStandardEmptyView == null) { + mEmptyView = root.findViewById(android.R.id.empty); + } else { + mStandardEmptyView.setVisibility(View.GONE); + } + mProgressContainer = root.findViewById(INTERNAL_PROGRESS_CONTAINER_ID); + mListContainer = root.findViewById(INTERNAL_LIST_CONTAINER_ID); + View rawListView = root.findViewById(android.R.id.list); + if (!(rawListView instanceof ListView)) { + if (rawListView == null) { + throw new RuntimeException( + "Your content must have a ListView whose id attribute is " + + "'android.R.id.list'"); + } + throw new RuntimeException( + "Content has view with id attribute 'android.R.id.list' " + + "that is not a ListView class"); + } + mList = (ListView)rawListView; + if (mEmptyView != null) { + mList.setEmptyView(mEmptyView); + } else if (mEmptyText != null) { + mStandardEmptyView.setText(mEmptyText); + mList.setEmptyView(mStandardEmptyView); + } + } + mListShown = true; + mList.setOnItemClickListener(mOnClickListener); + if (mAdapter != null) { + ListAdapter adapter = mAdapter; + mAdapter = null; + setListAdapter(adapter); + } else { + // We are starting without an adapter, so assume we won't + // have our data right away and start with the progress indicator. + if (mProgressContainer != null) { + setListShown(false, false); + } + } + mHandler.post(mRequestFocus); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/LoaderManager.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/LoaderManager.java new file mode 100644 index 00000000..69258ce8 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/LoaderManager.java @@ -0,0 +1,803 @@ +/* + * 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 android.support.v4.app; + +import android.os.Bundle; +import android.support.v4.content.Loader; +import android.support.v4.util.DebugUtils; +import android.util.Log; + +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.lang.reflect.Modifier; + +/** + * Static library support version of the framework's {@link android.app.LoaderManager}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + * + *

Your activity must derive from {@link FragmentActivity} to use this. + */ +public abstract class LoaderManager { + /** + * Callback interface for a client to interact with the manager. + */ + public interface LoaderCallbacks { + /** + * Instantiate and return a new Loader for the given ID. + * + * @param id The ID whose loader is to be created. + * @param args Any arguments supplied by the caller. + * @return Return a new Loader instance that is ready to start loading. + */ + public Loader onCreateLoader(int id, Bundle args); + + /** + * Called when a previously created loader has finished its load. Note + * that normally an application is not allowed to commit fragment + * transactions while in this call, since it can happen after an + * activity's state is saved. See {@link FragmentManager#beginTransaction() + * FragmentManager.openTransaction()} for further discussion on this. + * + *

This function is guaranteed to be called prior to the release of + * the last data that was supplied for this Loader. At this point + * you should remove all use of the old data (since it will be released + * soon), but should not do your own release of the data since its Loader + * owns it and will take care of that. The Loader will take care of + * management of its data so you don't have to. In particular: + * + *

    + *
  • The Loader will monitor for changes to the data, and report + * them to you through new calls here. You should not monitor the + * data yourself. For example, if the data is a {@link android.database.Cursor} + * and you place it in a {@link android.widget.CursorAdapter}, use + * the {@link android.widget.CursorAdapter#CursorAdapter(android.content.Context, + * android.database.Cursor, int)} constructor without passing + * in either {@link android.widget.CursorAdapter#FLAG_AUTO_REQUERY} + * or {@link android.widget.CursorAdapter#FLAG_REGISTER_CONTENT_OBSERVER} + * (that is, use 0 for the flags argument). This prevents the CursorAdapter + * from doing its own observing of the Cursor, which is not needed since + * when a change happens you will get a new Cursor throw another call + * here. + *

  • The Loader will release the data once it knows the application + * is no longer using it. For example, if the data is + * a {@link android.database.Cursor} from a {@link android.content.CursorLoader}, + * you should not call close() on it yourself. If the Cursor is being placed in a + * {@link android.widget.CursorAdapter}, you should use the + * {@link android.widget.CursorAdapter#swapCursor(android.database.Cursor)} + * method so that the old Cursor is not closed. + *
+ * + * @param loader The Loader that has finished. + * @param data The data generated by the Loader. + */ + public void onLoadFinished(Loader loader, D data); + + /** + * Called when a previously created loader is being reset, and thus + * making its data unavailable. The application should at this point + * remove any references it has to the Loader's data. + * + * @param loader The Loader that is being reset. + */ + public void onLoaderReset(Loader loader); + } + + /** + * Ensures a loader is initialized and active. If the loader doesn't + * already exist, one is created and (if the activity/fragment is currently + * started) starts the loader. Otherwise the last created + * loader is re-used. + * + *

In either case, the given callback is associated with the loader, and + * will be called as the loader state changes. If at the point of call + * the caller is in its started state, and the requested loader + * already exists and has generated its data, then + * callback {@link LoaderCallbacks#onLoadFinished} will + * be called immediately (inside of this function), so you must be prepared + * for this to happen. + * + * @param id A unique identifier for this loader. Can be whatever you want. + * Identifiers are scoped to a particular LoaderManager instance. + * @param args Optional arguments to supply to the loader at construction. + * If a loader already exists (a new one does not need to be created), this + * parameter will be ignored and the last arguments continue to be used. + * @param callback Interface the LoaderManager will call to report about + * changes in the state of the loader. Required. + */ + public abstract Loader initLoader(int id, Bundle args, + LoaderManager.LoaderCallbacks callback); + + /** + * Starts a new or restarts an existing {@link android.content.Loader} in + * this manager, registers the callbacks to it, + * and (if the activity/fragment is currently started) starts loading it. + * If a loader with the same id has previously been + * started it will automatically be destroyed when the new loader completes + * its work. The callback will be delivered before the old loader + * is destroyed. + * + * @param id A unique identifier for this loader. Can be whatever you want. + * Identifiers are scoped to a particular LoaderManager instance. + * @param args Optional arguments to supply to the loader at construction. + * @param callback Interface the LoaderManager will call to report about + * changes in the state of the loader. Required. + */ + public abstract Loader restartLoader(int id, Bundle args, + LoaderManager.LoaderCallbacks callback); + + /** + * Stops and removes the loader with the given ID. If this loader + * had previously reported data to the client through + * {@link LoaderCallbacks#onLoadFinished(Loader, Object)}, a call + * will be made to {@link LoaderCallbacks#onLoaderReset(Loader)}. + */ + public abstract void destroyLoader(int id); + + /** + * Return the Loader with the given id or null if no matching Loader + * is found. + */ + public abstract Loader getLoader(int id); + + /** + * Print the LoaderManager's state into the given stream. + * + * @param prefix Text to print at the front of each line. + * @param fd The raw file descriptor that the dump is being sent to. + * @param writer A PrintWriter to which the dump is to be set. + * @param args Additional arguments to the dump request. + */ + public abstract void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args); + + /** + * Control whether the framework's internal loader manager debugging + * logs are turned on. If enabled, you will see output in logcat as + * the framework performs loader operations. + */ + public static void enableDebugLogging(boolean enabled) { + LoaderManagerImpl.DEBUG = enabled; + } +} + +class LoaderManagerImpl extends LoaderManager { + static final String TAG = "LoaderManager"; + static boolean DEBUG = false; + + // These are the currently active loaders. A loader is here + // from the time its load is started until it has been explicitly + // stopped or restarted by the application. + final HCSparseArray mLoaders = new HCSparseArray(); + + // These are previously run loaders. This list is maintained internally + // to avoid destroying a loader while an application is still using it. + // It allows an application to restart a loader, but continue using its + // previously run loader until the new loader's data is available. + final HCSparseArray mInactiveLoaders = new HCSparseArray(); + + SupportActivity mActivity; + boolean mStarted; + boolean mRetaining; + boolean mRetainingStarted; + + boolean mCreatingLoader; + + final class LoaderInfo implements Loader.OnLoadCompleteListener { + final int mId; + final Bundle mArgs; + LoaderManager.LoaderCallbacks mCallbacks; + Loader mLoader; + boolean mHaveData; + boolean mDeliveredData; + Object mData; + boolean mStarted; + boolean mRetaining; + boolean mRetainingStarted; + boolean mReportNextStart; + boolean mDestroyed; + boolean mListenerRegistered; + + LoaderInfo mPendingLoader; + + public LoaderInfo(int id, Bundle args, LoaderManager.LoaderCallbacks callbacks) { + mId = id; + mArgs = args; + mCallbacks = callbacks; + } + + void start() { + if (mRetaining && mRetainingStarted) { + // Our owner is started, but we were being retained from a + // previous instance in the started state... so there is really + // nothing to do here, since the loaders are still started. + mStarted = true; + return; + } + + if (mStarted) { + // If loader already started, don't restart. + return; + } + + mStarted = true; + + if (DEBUG) Log.v(TAG, " Starting: " + this); + if (mLoader == null && mCallbacks != null) { + mLoader = mCallbacks.onCreateLoader(mId, mArgs); + } + if (mLoader != null) { + if (mLoader.getClass().isMemberClass() + && !Modifier.isStatic(mLoader.getClass().getModifiers())) { + throw new IllegalArgumentException( + "Object returned from onCreateLoader must not be a non-static inner member class: " + + mLoader); + } + if (!mListenerRegistered) { + mLoader.registerListener(mId, this); + mListenerRegistered = true; + } + mLoader.startLoading(); + } + } + + void retain() { + if (DEBUG) Log.v(TAG, " Retaining: " + this); + mRetaining = true; + mRetainingStarted = mStarted; + mStarted = false; + mCallbacks = null; + } + + void finishRetain() { + if (mRetaining) { + if (DEBUG) Log.v(TAG, " Finished Retaining: " + this); + mRetaining = false; + if (mStarted != mRetainingStarted) { + if (!mStarted) { + // This loader was retained in a started state, but + // at the end of retaining everything our owner is + // no longer started... so make it stop. + stop(); + } + } + } + + if (mStarted && mHaveData && !mReportNextStart) { + // This loader has retained its data, either completely across + // a configuration change or just whatever the last data set + // was after being restarted from a stop, and now at the point of + // finishing the retain we find we remain started, have + // our data, and the owner has a new callback... so + // let's deliver the data now. + callOnLoadFinished(mLoader, mData); + } + } + + void reportStart() { + if (mStarted) { + if (mReportNextStart) { + mReportNextStart = false; + if (mHaveData) { + callOnLoadFinished(mLoader, mData); + } + } + } + } + + void stop() { + if (DEBUG) Log.v(TAG, " Stopping: " + this); + mStarted = false; + if (!mRetaining) { + if (mLoader != null && mListenerRegistered) { + // Let the loader know we're done with it + mListenerRegistered = false; + mLoader.unregisterListener(this); + mLoader.stopLoading(); + } + } + } + + void destroy() { + if (DEBUG) Log.v(TAG, " Destroying: " + this); + mDestroyed = true; + boolean needReset = mDeliveredData; + mDeliveredData = false; + if (mCallbacks != null && mLoader != null && mHaveData && needReset) { + if (DEBUG) Log.v(TAG, " Reseting: " + this); + String lastBecause = null; + if (mActivity != null) { + lastBecause = mActivity.getInternalCallbacks().getFragments().mNoTransactionsBecause; + mActivity.getInternalCallbacks().getFragments().mNoTransactionsBecause = "onLoaderReset"; + } + try { + mCallbacks.onLoaderReset(mLoader); + } finally { + if (mActivity != null) { + mActivity.getInternalCallbacks().getFragments().mNoTransactionsBecause = lastBecause; + } + } + } + mCallbacks = null; + mData = null; + mHaveData = false; + if (mLoader != null) { + if (mListenerRegistered) { + mListenerRegistered = false; + mLoader.unregisterListener(this); + } + mLoader.reset(); + } + if (mPendingLoader != null) { + mPendingLoader.destroy(); + } + } + + @Override public void onLoadComplete(Loader loader, Object data) { + if (DEBUG) Log.v(TAG, "onLoadComplete: " + this); + + if (mDestroyed) { + if (DEBUG) Log.v(TAG, " Ignoring load complete -- destroyed"); + return; + } + + if (mLoaders.get(mId) != this) { + // This data is not coming from the current active loader. + // We don't care about it. + if (DEBUG) Log.v(TAG, " Ignoring load complete -- not active"); + return; + } + + LoaderInfo pending = mPendingLoader; + if (pending != null) { + // There is a new request pending and we were just + // waiting for the old one to complete before starting + // it. So now it is time, switch over to the new loader. + if (DEBUG) Log.v(TAG, " Switching to pending loader: " + pending); + mPendingLoader = null; + mLoaders.put(mId, null); + destroy(); + installLoader(pending); + return; + } + + // Notify of the new data so the app can switch out the old data before + // we try to destroy it. + if (mData != data || !mHaveData) { + mData = data; + mHaveData = true; + if (mStarted) { + callOnLoadFinished(loader, data); + } + } + + //if (DEBUG) Log.v(TAG, " onLoadFinished returned: " + this); + + // We have now given the application the new loader with its + // loaded data, so it should have stopped using the previous + // loader. If there is a previous loader on the inactive list, + // clean it up. + LoaderInfo info = mInactiveLoaders.get(mId); + if (info != null && info != this) { + info.mDeliveredData = false; + info.destroy(); + mInactiveLoaders.remove(mId); + } + } + + void callOnLoadFinished(Loader loader, Object data) { + if (mCallbacks != null) { + String lastBecause = null; + if (mActivity != null) { + lastBecause = mActivity.getInternalCallbacks().getFragments().mNoTransactionsBecause; + mActivity.getInternalCallbacks().getFragments().mNoTransactionsBecause = "onLoadFinished"; + } + try { + if (DEBUG) Log.v(TAG, " onLoadFinished in " + loader + ": " + + loader.dataToString(data)); + mCallbacks.onLoadFinished(loader, data); + } finally { + if (mActivity != null) { + mActivity.getInternalCallbacks().getFragments().mNoTransactionsBecause = lastBecause; + } + } + mDeliveredData = true; + } + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(64); + sb.append("LoaderInfo{"); + sb.append(Integer.toHexString(System.identityHashCode(this))); + sb.append(" #"); + sb.append(mId); + sb.append(" : "); + DebugUtils.buildShortClassTag(mLoader, sb); + sb.append("}}"); + return sb.toString(); + } + + public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { + writer.print(prefix); writer.print("mId="); writer.print(mId); + writer.print(" mArgs="); writer.println(mArgs); + writer.print(prefix); writer.print("mCallbacks="); writer.println(mCallbacks); + writer.print(prefix); writer.print("mLoader="); writer.println(mLoader); + if (mLoader != null) { + mLoader.dump(prefix + " ", fd, writer, args); + } + if (mHaveData || mDeliveredData) { + writer.print(prefix); writer.print("mHaveData="); writer.print(mHaveData); + writer.print(" mDeliveredData="); writer.println(mDeliveredData); + writer.print(prefix); writer.print("mData="); writer.println(mData); + } + writer.print(prefix); writer.print("mStarted="); writer.print(mStarted); + writer.print(" mReportNextStart="); writer.print(mReportNextStart); + writer.print(" mDestroyed="); writer.println(mDestroyed); + writer.print(prefix); writer.print("mRetaining="); writer.print(mRetaining); + writer.print(" mRetainingStarted="); writer.print(mRetainingStarted); + writer.print(" mListenerRegistered="); writer.println(mListenerRegistered); + if (mPendingLoader != null) { + writer.print(prefix); writer.println("Pending Loader "); + writer.print(mPendingLoader); writer.println(":"); + mPendingLoader.dump(prefix + " ", fd, writer, args); + } + } + } + + LoaderManagerImpl(SupportActivity activity, boolean started) { + mActivity = activity; + mStarted = started; + } + + void updateActivity(SupportActivity activity) { + mActivity = activity; + } + + private LoaderInfo createLoader(int id, Bundle args, + LoaderManager.LoaderCallbacks callback) { + LoaderInfo info = new LoaderInfo(id, args, (LoaderManager.LoaderCallbacks)callback); + Loader loader = callback.onCreateLoader(id, args); + info.mLoader = (Loader)loader; + return info; + } + + private LoaderInfo createAndInstallLoader(int id, Bundle args, + LoaderManager.LoaderCallbacks callback) { + try { + mCreatingLoader = true; + LoaderInfo info = createLoader(id, args, callback); + installLoader(info); + return info; + } finally { + mCreatingLoader = false; + } + } + + void installLoader(LoaderInfo info) { + mLoaders.put(info.mId, info); + if (mStarted) { + // The activity will start all existing loaders in it's onStart(), + // so only start them here if we're past that point of the activitiy's + // life cycle + info.start(); + } + } + + /** + * Call to initialize a particular ID with a Loader. If this ID already + * has a Loader associated with it, it is left unchanged and any previous + * callbacks replaced with the newly provided ones. If there is not currently + * a Loader for the ID, a new one is created and started. + * + *

This function should generally be used when a component is initializing, + * to ensure that a Loader it relies on is created. This allows it to re-use + * an existing Loader's data if there already is one, so that for example + * when an {@link Activity} is re-created after a configuration change it + * does not need to re-create its loaders. + * + *

Note that in the case where an existing Loader is re-used, the + * args given here will be ignored because you will + * continue using the previous Loader. + * + * @param id A unique (to this LoaderManager instance) identifier under + * which to manage the new Loader. + * @param args Optional arguments that will be propagated to + * {@link LoaderCallbacks#onCreateLoader(int, Bundle) LoaderCallbacks.onCreateLoader()}. + * @param callback Interface implementing management of this Loader. Required. + * Its onCreateLoader() method will be called while inside of the function to + * instantiate the Loader object. + */ + @SuppressWarnings("unchecked") + public Loader initLoader(int id, Bundle args, LoaderManager.LoaderCallbacks callback) { + if (mCreatingLoader) { + throw new IllegalStateException("Called while creating a loader"); + } + + LoaderInfo info = mLoaders.get(id); + + if (DEBUG) Log.v(TAG, "initLoader in " + this + ": args=" + args); + + if (info == null) { + // Loader doesn't already exist; create. + info = createAndInstallLoader(id, args, (LoaderManager.LoaderCallbacks)callback); + if (DEBUG) Log.v(TAG, " Created new loader " + info); + } else { + if (DEBUG) Log.v(TAG, " Re-using existing loader " + info); + info.mCallbacks = (LoaderManager.LoaderCallbacks)callback; + } + + if (info.mHaveData && mStarted) { + // If the loader has already generated its data, report it now. + info.callOnLoadFinished(info.mLoader, info.mData); + } + + return (Loader)info.mLoader; + } + + /** + * Call to re-create the Loader associated with a particular ID. If there + * is currently a Loader associated with this ID, it will be + * canceled/stopped/destroyed as appropriate. A new Loader with the given + * arguments will be created and its data delivered to you once available. + * + *

This function does some throttling of Loaders. If too many Loaders + * have been created for the given ID but not yet generated their data, + * new calls to this function will create and return a new Loader but not + * actually start it until some previous loaders have completed. + * + *

After calling this function, any previous Loaders associated with + * this ID will be considered invalid, and you will receive no further + * data updates from them. + * + * @param id A unique (to this LoaderManager instance) identifier under + * which to manage the new Loader. + * @param args Optional arguments that will be propagated to + * {@link LoaderCallbacks#onCreateLoader(int, Bundle) LoaderCallbacks.onCreateLoader()}. + * @param callback Interface implementing management of this Loader. Required. + * Its onCreateLoader() method will be called while inside of the function to + * instantiate the Loader object. + */ + @SuppressWarnings("unchecked") + public Loader restartLoader(int id, Bundle args, LoaderManager.LoaderCallbacks callback) { + if (mCreatingLoader) { + throw new IllegalStateException("Called while creating a loader"); + } + + LoaderInfo info = mLoaders.get(id); + if (DEBUG) Log.v(TAG, "restartLoader in " + this + ": args=" + args); + if (info != null) { + LoaderInfo inactive = mInactiveLoaders.get(id); + if (inactive != null) { + if (info.mHaveData) { + // This loader now has data... we are probably being + // called from within onLoadComplete, where we haven't + // yet destroyed the last inactive loader. So just do + // that now. + if (DEBUG) Log.v(TAG, " Removing last inactive loader: " + info); + inactive.mDeliveredData = false; + inactive.destroy(); + info.mLoader.abandon(); + mInactiveLoaders.put(id, info); + } else { + // We already have an inactive loader for this ID that we are + // waiting for! What to do, what to do... + if (!info.mStarted) { + // The current Loader has not been started... we thus + // have no reason to keep it around, so bam, slam, + // thank-you-ma'am. + if (DEBUG) Log.v(TAG, " Current loader is stopped; replacing"); + mLoaders.put(id, null); + info.destroy(); + } else { + // Now we have three active loaders... we'll queue + // up this request to be processed once one of the other loaders + // finishes. + if (info.mPendingLoader != null) { + if (DEBUG) Log.v(TAG, " Removing pending loader: " + info.mPendingLoader); + info.mPendingLoader.destroy(); + info.mPendingLoader = null; + } + if (DEBUG) Log.v(TAG, " Enqueuing as new pending loader"); + info.mPendingLoader = createLoader(id, args, + (LoaderManager.LoaderCallbacks)callback); + return (Loader)info.mPendingLoader.mLoader; + } + } + } else { + // Keep track of the previous instance of this loader so we can destroy + // it when the new one completes. + if (DEBUG) Log.v(TAG, " Making last loader inactive: " + info); + info.mLoader.abandon(); + mInactiveLoaders.put(id, info); + } + } + + info = createAndInstallLoader(id, args, (LoaderManager.LoaderCallbacks)callback); + return (Loader)info.mLoader; + } + + /** + * Rip down, tear apart, shred to pieces a current Loader ID. After returning + * from this function, any Loader objects associated with this ID are + * destroyed. Any data associated with them is destroyed. You better not + * be using it when you do this. + * @param id Identifier of the Loader to be destroyed. + */ + public void destroyLoader(int id) { + if (mCreatingLoader) { + throw new IllegalStateException("Called while creating a loader"); + } + + if (DEBUG) Log.v(TAG, "destroyLoader in " + this + " of " + id); + int idx = mLoaders.indexOfKey(id); + if (idx >= 0) { + LoaderInfo info = mLoaders.valueAt(idx); + mLoaders.removeAt(idx); + info.destroy(); + } + idx = mInactiveLoaders.indexOfKey(id); + if (idx >= 0) { + LoaderInfo info = mInactiveLoaders.valueAt(idx); + mInactiveLoaders.removeAt(idx); + info.destroy(); + } + } + + /** + * Return the most recent Loader object associated with the + * given ID. + */ + @SuppressWarnings("unchecked") + public Loader getLoader(int id) { + if (mCreatingLoader) { + throw new IllegalStateException("Called while creating a loader"); + } + + LoaderInfo loaderInfo = mLoaders.get(id); + if (loaderInfo != null) { + if (loaderInfo.mPendingLoader != null) { + return (Loader)loaderInfo.mPendingLoader.mLoader; + } + return (Loader)loaderInfo.mLoader; + } + return null; + } + + void doStart() { + if (DEBUG) Log.v(TAG, "Starting in " + this); + if (mStarted) { + RuntimeException e = new RuntimeException("here"); + e.fillInStackTrace(); + Log.w(TAG, "Called doStart when already started: " + this, e); + return; + } + + mStarted = true; + + // Call out to sub classes so they can start their loaders + // Let the existing loaders know that we want to be notified when a load is complete + for (int i = mLoaders.size()-1; i >= 0; i--) { + mLoaders.valueAt(i).start(); + } + } + + void doStop() { + if (DEBUG) Log.v(TAG, "Stopping in " + this); + if (!mStarted) { + RuntimeException e = new RuntimeException("here"); + e.fillInStackTrace(); + Log.w(TAG, "Called doStop when not started: " + this, e); + return; + } + + for (int i = mLoaders.size()-1; i >= 0; i--) { + mLoaders.valueAt(i).stop(); + } + mStarted = false; + } + + void doRetain() { + if (DEBUG) Log.v(TAG, "Retaining in " + this); + if (!mStarted) { + RuntimeException e = new RuntimeException("here"); + e.fillInStackTrace(); + Log.w(TAG, "Called doRetain when not started: " + this, e); + return; + } + + mRetaining = true; + mStarted = false; + for (int i = mLoaders.size()-1; i >= 0; i--) { + mLoaders.valueAt(i).retain(); + } + } + + void finishRetain() { + if (mRetaining) { + if (DEBUG) Log.v(TAG, "Finished Retaining in " + this); + + mRetaining = false; + for (int i = mLoaders.size()-1; i >= 0; i--) { + mLoaders.valueAt(i).finishRetain(); + } + } + } + + void doReportNextStart() { + for (int i = mLoaders.size()-1; i >= 0; i--) { + mLoaders.valueAt(i).mReportNextStart = true; + } + } + + void doReportStart() { + for (int i = mLoaders.size()-1; i >= 0; i--) { + mLoaders.valueAt(i).reportStart(); + } + } + + void doDestroy() { + if (!mRetaining) { + if (DEBUG) Log.v(TAG, "Destroying Active in " + this); + for (int i = mLoaders.size()-1; i >= 0; i--) { + mLoaders.valueAt(i).destroy(); + } + } + + if (DEBUG) Log.v(TAG, "Destroying Inactive in " + this); + for (int i = mInactiveLoaders.size()-1; i >= 0; i--) { + mInactiveLoaders.valueAt(i).destroy(); + } + mInactiveLoaders.clear(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(128); + sb.append("LoaderManager{"); + sb.append(Integer.toHexString(System.identityHashCode(this))); + sb.append(" in "); + DebugUtils.buildShortClassTag(mActivity, sb); + sb.append("}}"); + return sb.toString(); + } + + @Override + public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { + if (mLoaders.size() > 0) { + writer.print(prefix); writer.println("Active Loaders:"); + String innerPrefix = prefix + " "; + for (int i=0; i < mLoaders.size(); i++) { + LoaderInfo li = mLoaders.valueAt(i); + writer.print(prefix); writer.print(" #"); writer.print(mLoaders.keyAt(i)); + writer.print(": "); writer.println(li.toString()); + li.dump(innerPrefix, fd, writer, args); + } + } + if (mInactiveLoaders.size() > 0) { + writer.print(prefix); writer.println("Inactive Loaders:"); + String innerPrefix = prefix + " "; + for (int i=0; i < mInactiveLoaders.size(); i++) { + LoaderInfo li = mInactiveLoaders.valueAt(i); + writer.print(prefix); writer.print(" #"); writer.print(mInactiveLoaders.keyAt(i)); + writer.print(": "); writer.println(li.toString()); + li.dump(innerPrefix, fd, writer, args); + } + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/NoSaveStateFrameLayout.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/NoSaveStateFrameLayout.java new file mode 100644 index 00000000..a2177e32 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/NoSaveStateFrameLayout.java @@ -0,0 +1,63 @@ +/* + * 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 android.support.v4.app; + +import android.content.Context; +import android.os.Parcelable; +import android.util.SparseArray; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +/** + * Pre-Honeycomb versions of the platform don't have View.setSaveFromParentEnabled(), + * so instead we insert this between the view and its parent. + */ +public class NoSaveStateFrameLayout extends FrameLayout { + static ViewGroup wrap(View child) { + NoSaveStateFrameLayout wrapper = new NoSaveStateFrameLayout(child.getContext()); + ViewGroup.LayoutParams childParams = child.getLayoutParams(); + if (childParams != null) { + wrapper.setLayoutParams(childParams); + } + NoSaveStateFrameLayout.LayoutParams lp = new NoSaveStateFrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT); + child.setLayoutParams(lp); + wrapper.addView(child); + return wrapper; + } + + public NoSaveStateFrameLayout(Context context) { + super(context); + } + + /** + * Override to prevent freezing of any child views. + */ + @Override + protected void dispatchSaveInstanceState(SparseArray container) { + dispatchFreezeSelfOnly(container); + } + + /** + * Override to prevent thawing of any child views. + */ + @Override + protected void dispatchRestoreInstanceState(SparseArray container) { + dispatchThawSelfOnly(container); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/SuperNotCalledException.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/SuperNotCalledException.java new file mode 100644 index 00000000..d306b965 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/SuperNotCalledException.java @@ -0,0 +1,27 @@ +/* + * 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 android.support.v4.app; + +import android.util.AndroidRuntimeException; + +final class SuperNotCalledException extends AndroidRuntimeException { + private static final long serialVersionUID = -5247191382770859874L; + + public SuperNotCalledException(String msg) { + super(msg); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/SupportActivity.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/SupportActivity.java new file mode 100644 index 00000000..3d956684 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/SupportActivity.java @@ -0,0 +1,295 @@ +package android.support.v4.app; + +import java.io.File; +import java.io.FileDescriptor; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import android.app.Activity; +import android.app.Application; +import android.app.PendingIntent; +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.ContentResolver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.ServiceConnection; +import android.content.SharedPreferences; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.AssetManager; +import android.content.res.Configuration; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.support.v4.view.ActionMode; +import android.support.v4.view.Menu; +import android.support.v4.view.MenuItem; +import android.util.AttributeSet; +import android.view.ContextMenu; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.MenuInflater; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.view.accessibility.AccessibilityEvent; + +/** + *

Instances of this interface represent an activity provided by the support + * library (e.g., {@link FragmentActivity}).

+ * + *

Provided are all of the methods which would be available if you were + * accessing the underlying activity directly and you can safely assume that + * any instances of this interface can be cast to an {@link Activity}. It is + * preferred, however, that you call {@link #asActivity()} instead.

+ */ +public interface SupportActivity { + public static abstract class InternalCallbacks { + abstract void ensureSupportActionBarAttached(); + abstract Handler getHandler(); + abstract FragmentManagerImpl getFragments(); + abstract LoaderManagerImpl getLoaderManager(int index, boolean started, boolean create); + abstract void invalidateSupportFragmentIndex(int index); + } + + InternalCallbacks getInternalCallbacks(); + Activity asActivity(); + + /*** Activity methods ***/ + void addContentView(View view, ViewGroup.LayoutParams params); + void closeContextMenu(); + void closeOptionsMenu(); + PendingIntent createPendingResult(int requestCode, Intent data, int flags); + void dismissDialog(int id); + boolean dispatchKeyEvent(KeyEvent event); + boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event); + boolean dispatchTouchEvent(MotionEvent ev); + boolean dispatchTrackballEvent(MotionEvent ev); + View findViewById(int id); + void finish(); + void finishActivity(int requestCode); + void finishActivityFromChild(Activity child, int requestCode); + void finishFromChild(Activity child); + Application getApplication(); + ComponentName getCallingActivity(); + String getCallingPackage(); + int getChangingConfigurations(); + ComponentName getComponentName(); + View getCurrentFocus(); + Intent getIntent(); + Object getLastNonConfigurationInstance(); + LayoutInflater getLayoutInflater(); + String getLocalClassName(); + MenuInflater getMenuInflater(); + Activity getParent(); + SharedPreferences getPreferences(int mode); + int getRequestedOrientation(); + Object getSystemService(String name); + int getTaskId(); + CharSequence getTitle(); + int getTitleColor(); + int getVolumeControlStream(); + Window getWindow(); + WindowManager getWindowManager(); + boolean hasWindowFocus(); + boolean isChild(); + boolean isFinishing(); + boolean isTaskRoot(); + Cursor managedQuery(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder); + boolean moveTaskToBack(boolean nonRoot); + void onConfigurationChanged(Configuration newConfig); + void onContentChanged(); + boolean onContextItemSelected(android.view.MenuItem item); + void onContextMenuClosed(android.view.Menu menu); + void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo); + CharSequence onCreateDescription(); + boolean onCreateOptionsMenu(android.view.Menu menu); + boolean onCreatePanelMenu(int featureId, android.view.Menu menu); + View onCreatePanelView(int featureId); + boolean onCreateThumbnail(Bitmap outBitmap, Canvas canvas); + View onCreateView(String name, Context context, AttributeSet attrs); + boolean onKeyDown(int keyCode, KeyEvent event); + boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event); + boolean onKeyUp(int keyCode, KeyEvent event); + void onLowMemory(); + boolean onMenuItemSelected(int featureId, android.view.MenuItem item); + boolean onMenuOpened(int featureId, android.view.Menu menu); + boolean onOptionsItemSelected(android.view.MenuItem item); + void onOptionsMenuClosed(android.view.Menu menu); + void onPanelClosed(int featureId, android.view.Menu menu); + boolean onPrepareOptionsMenu(android.view.Menu menu); + boolean onPreparePanel(int featureId, View view, android.view.Menu menu); + Object onRetainNonConfigurationInstance(); + boolean onSearchRequested(); + boolean onTouchEvent(MotionEvent event); + boolean onTrackballEvent(MotionEvent event); + void onUserInteraction(); + void onWindowAttributesChanged(WindowManager.LayoutParams params); + void onWindowFocusChanged(boolean hasFocus); + void openContextMenu(View view); + void openOptionsMenu(); + void registerForContextMenu(View view); + void removeDialog(int id); + boolean requestWindowFeature(int featureId); + void runOnUiThread(Runnable action); + void setContentView(int layoutResId); + void setContentView(View view); + void setContentView(View view, ViewGroup.LayoutParams params); + void setDefaultKeyMode(int mode); + void setFeatureDrawable(int featureId, Drawable drawable); + void setFeatureDrawableAlpha(int featureId, int alpha); + void setFeatureDrawableResource(int featureId, int resId); + void setFeatureDrawableUri(int featureId, Uri uri); + void setIntent(Intent newIntent); + void setProgress(int progress); + void setProgressBarIndeterminate(boolean indeterminate); + void setProgressBarIndeterminateVisibility(boolean visible); + void setProgressBarVisibility(boolean visible); + void setRequestedOrientation(int requestedOrientation); + void setResult(int resultCode); + void setResult(int resultCode, Intent data); + void setSecondaryProgress(int secondaryProgress); + void setTitle(int titleId); + void setTitle(CharSequence title); + void setTitleColor(int textColor); + void setVisible(boolean visible); + void setVolumeControlStream(int streamType); + void showDialog(int id); + void startActivity(Intent intent); + void startActivityForResult(Intent intent, int requestCode); + void startActivityFromChild(Activity child, Intent intent, int requestCode); + boolean startActivityIfNeeded(Intent intent, int requestCode); + void startManagingCursor(Cursor c); + boolean startNextMatchingActivity(Intent intent); + void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchDate, boolean globalSearch); + void stopManagingCursor(Cursor c); + void takeKeyEvents(boolean get); + void unregisterForContextMenu(View view); + + /*** ContextThemeWrapper methods ***/ + //Object getSystemService(String name); + Resources.Theme getTheme(); + void setTheme(int resId); + + /*** ContextWrapper methods ***/ + //void attachBaseContext(Context base); + boolean bindService(Intent service, ServiceConnection conn, int flags); + int checkCallingOrSelfPermission(String permission); + int checkCallingOrSelfUriPermission(Uri uri, int modeFlags); + int checkCallingPermission(String permission); + int checkCallingUriPermission(Uri uri, int modeFlags); + int checkPermission(String permission, int pid, int uid); + int checkUriPermission(Uri uri, int pid, int uid, int modeFlags); + int checkUriPermission(Uri uri, String readPermission, String writePermission, int pid, int uid, int modeFlags); + @Deprecated void clearWallpaper() throws IOException; + Context createPackageContext(String packageName, int flags) throws NameNotFoundException; + String[] databaseList(); + boolean deleteDatabase(String name); + boolean deleteFile(String name); + void enforceCallingOrSelfPermission(String permission, String message); + void enforceCallingOrSelfUriPermission(Uri uri, int modeFlags, String message); + void enforceCallingPermission(String permission, String message); + void enforceCallingUriPermission(Uri uri, int modeFlags, String message); + void enforcePermission(String permission, int pid, int uid, String message); + void enforceUriPermission(Uri uri, int pid, int uid, int modeFlags, String message); + void enforceUriPermission(Uri uri, String readPermission, String writePermission, int pid, int uid, int modeFlags, String message); + String[] fileList(); + Context getApplicationContext(); + ApplicationInfo getApplicationInfo(); + AssetManager getAssets(); + Context getBaseContext(); + File getCacheDir(); + ClassLoader getClassLoader(); + ContentResolver getContentResolver(); + File getDatabasePath(String name); + File getDir(String name, int mode); + File getFileStreamPath(String name); + File getFilesDir(); + Looper getMainLooper(); + String getPackageCodePath(); + PackageManager getPackageManager(); + String getPackageName(); + String getPackageResourcePath(); + Resources getResources(); + SharedPreferences getSharedPreferences(String name, int mode); + //Object getSystemService(String name); + //Resources.Theme getTheme(); + Drawable getWallpaper(); + int getWallpaperDesiredMinimumHeight(); + int getWallpaperDesiredMinimumWidth(); + void grantUriPermission(String toPackage, Uri uri, int modeFlags); + boolean isRestricted(); + FileInputStream openFileInput(String name) throws FileNotFoundException; + FileOutputStream openFileOutput(String name, int mode) throws FileNotFoundException; + SQLiteDatabase openOrCreateDatabase(String name, int mode, SQLiteDatabase.CursorFactory factory); + @Deprecated Drawable peekWallpaper(); + Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter); + Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler); + void removeStickyBroadcast(Intent intent); + void revokeUriPermission(Uri uri, int modeFlags); + void sendBroadcast(Intent intent); + void sendBroadcast(Intent intent, String receiverPermission); + void sendOrderedBroadcast(Intent intent, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras); + void sendOrderedBroadcast(Intent intent, String receiverPermission); + void sendStickyBroadcast(Intent intent); + //void setTheme(int resid); + void setWallpaper(Bitmap bitmap) throws IOException; + void setWallpaper(InputStream data) throws IOException; + //void startActivity(Intent intent); + boolean startInstrumentation(ComponentName className, String profileFile, Bundle arguments); + ComponentName startService(Intent service); + boolean stopService(Intent name); + void unbindService(ServiceConnection conn); + void unregisterReceiver(BroadcastReceiver receiver); + + /*** Context methods ***/ + String getString(int resId); + String getString(int resId, Object... formatArgs); + CharSequence getText(int resId); + //boolean isRestricted(); + TypedArray obtainStyledAttributes(int[] attrs); + TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs); + TypedArray obtainStyledAttributes(int resId, int[] attrs); + TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs, int defStyleAttr, int defStyleRes); + + /*** Activity methods (emulated API 5+) ***/ + void onBackPressed(); + + /*** Activity methods (emulated API 11+) ***/ + void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args); + ActionBar getSupportActionBar(); //getActionBar() + FragmentManager getSupportFragmentManager(); //getFragmentManager() + LoaderManager getSupportLoaderManager(); //getLoaderManager() + void invalidateOptionsMenu(); + void onActionModeFinished(ActionMode mode); + void onActionModeStarted(ActionMode mode); + void onAttachFragment(Fragment fragment); + boolean onCreateOptionsMenu(Menu menu); + boolean onMenuItemSelected(int featureId, MenuItem item); + boolean onOptionsItemSelected(MenuItem item); + boolean onPrepareOptionsMenu(Menu menu); + ActionMode onWindowStartingActionMode(ActionMode.Callback callback); + void recreate(); + ActionMode startActionMode(ActionMode.Callback callback); + void startActivityFromFragment(Fragment fragment, Intent intent, int requestCode); + + /*** Parallel helper methods ***/ + boolean requestWindowFeature(long featureId); + void setProgressBarIndeterminateVisibility(Boolean visible); +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/content/AsyncTaskLoader.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/content/AsyncTaskLoader.java new file mode 100644 index 00000000..08debdd6 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/content/AsyncTaskLoader.java @@ -0,0 +1,287 @@ +/* + * 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 android.support.v4.content; + +import android.content.Context; +import android.os.AsyncTask; +import android.os.Handler; +import android.os.SystemClock; +import android.support.v4.util.TimeUtils; +import android.util.Log; + +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.util.concurrent.CountDownLatch; + +/** + * Static library support version of the framework's {@link android.content.AsyncTaskLoader}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + */ +public abstract class AsyncTaskLoader extends Loader { + static final String TAG = "AsyncTaskLoader"; + static final boolean DEBUG = false; + + final class LoadTask extends AsyncTask implements Runnable { + + D result; + boolean waiting; + + private CountDownLatch done = new CountDownLatch(1); + + /* Runs on a worker thread */ + @Override + protected D doInBackground(Void... params) { + if (DEBUG) Log.v(TAG, this + " >>> doInBackground"); + result = AsyncTaskLoader.this.onLoadInBackground(); + if (DEBUG) Log.v(TAG, this + " <<< doInBackground"); + return result; + } + + /* Runs on the UI thread */ + @Override + protected void onPostExecute(D data) { + if (DEBUG) Log.v(TAG, this + " onPostExecute"); + try { + AsyncTaskLoader.this.dispatchOnLoadComplete(this, data); + } finally { + done.countDown(); + } + } + + @Override + protected void onCancelled() { + if (DEBUG) Log.v(TAG, this + " onCancelled"); + try { + AsyncTaskLoader.this.dispatchOnCancelled(this, result); + } finally { + done.countDown(); + } + } + + @Override + public void run() { + waiting = false; + AsyncTaskLoader.this.executePendingTask(); + } + } + + volatile LoadTask mTask; + volatile LoadTask mCancellingTask; + + long mUpdateThrottle; + long mLastLoadCompleteTime = -10000; + Handler mHandler; + + public AsyncTaskLoader(Context context) { + super(context); + } + + /** + * Set amount to throttle updates by. This is the minimum time from + * when the last {@link #onLoadInBackground()} call has completed until + * a new load is scheduled. + * + * @param delayMS Amount of delay, in milliseconds. + */ + public void setUpdateThrottle(long delayMS) { + mUpdateThrottle = delayMS; + if (delayMS != 0) { + mHandler = new Handler(); + } + } + + @Override + protected void onForceLoad() { + super.onForceLoad(); + cancelLoad(); + mTask = new LoadTask(); + if (DEBUG) Log.v(TAG, "Preparing load: mTask=" + mTask); + executePendingTask(); + } + + /** + * Attempt to cancel the current load task. See {@link AsyncTask#cancel(boolean)} + * for more info. Must be called on the main thread of the process. + * + *

Cancelling is not an immediate operation, since the load is performed + * in a background thread. If there is currently a load in progress, this + * method requests that the load be cancelled, and notes this is the case; + * once the background thread has completed its work its remaining state + * will be cleared. If another load request comes in during this time, + * it will be held until the cancelled load is complete. + * + * @return Returns false if the task could not be cancelled, + * typically because it has already completed normally, or + * because {@link #startLoading()} hasn't been called; returns + * true otherwise. + */ + public boolean cancelLoad() { + if (DEBUG) Log.v(TAG, "cancelLoad: mTask=" + mTask); + if (mTask != null) { + if (mCancellingTask != null) { + // There was a pending task already waiting for a previous + // one being canceled; just drop it. + if (DEBUG) Log.v(TAG, + "cancelLoad: still waiting for cancelled task; dropping next"); + if (mTask.waiting) { + mTask.waiting = false; + mHandler.removeCallbacks(mTask); + } + mTask = null; + return false; + } else if (mTask.waiting) { + // There is a task, but it is waiting for the time it should + // execute. We can just toss it. + if (DEBUG) Log.v(TAG, "cancelLoad: task is waiting, dropping it"); + mTask.waiting = false; + mHandler.removeCallbacks(mTask); + mTask = null; + return false; + } else { + boolean cancelled = mTask.cancel(false); + if (DEBUG) Log.v(TAG, "cancelLoad: cancelled=" + cancelled); + if (cancelled) { + mCancellingTask = mTask; + } + mTask = null; + return cancelled; + } + } + return false; + } + + /** + * Called if the task was canceled before it was completed. Gives the class a chance + * to properly dispose of the result. + */ + public void onCanceled(D data) { + } + + void executePendingTask() { + if (mCancellingTask == null && mTask != null) { + if (mTask.waiting) { + mTask.waiting = false; + mHandler.removeCallbacks(mTask); + } + if (mUpdateThrottle > 0) { + long now = SystemClock.uptimeMillis(); + if (now < (mLastLoadCompleteTime+mUpdateThrottle)) { + // Not yet time to do another load. + if (DEBUG) Log.v(TAG, "Waiting until " + + (mLastLoadCompleteTime+mUpdateThrottle) + + " to execute: " + mTask); + mTask.waiting = true; + mHandler.postAtTime(mTask, mLastLoadCompleteTime+mUpdateThrottle); + return; + } + } + if (DEBUG) Log.v(TAG, "Executing: " + mTask); + mTask.execute((Void[]) null); + // XXX TO DO: use reflection to call this version. + //mTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null); + } + } + + void dispatchOnCancelled(LoadTask task, D data) { + onCanceled(data); + if (mCancellingTask == task) { + if (DEBUG) Log.v(TAG, "Cancelled task is now canceled!"); + mLastLoadCompleteTime = SystemClock.uptimeMillis(); + mCancellingTask = null; + executePendingTask(); + } + } + + void dispatchOnLoadComplete(LoadTask task, D data) { + if (mTask != task) { + if (DEBUG) Log.v(TAG, "Load complete of old task, trying to cancel"); + dispatchOnCancelled(task, data); + } else { + if (isAbandoned()) { + // This cursor has been abandoned; just cancel the new data. + onCanceled(data); + } else { + mLastLoadCompleteTime = SystemClock.uptimeMillis(); + mTask = null; + if (DEBUG) Log.v(TAG, "Delivering result"); + deliverResult(data); + } + } + } + + /** + */ + public abstract D loadInBackground(); + + /** + * Called on a worker thread to perform the actual load. Implementations should not deliver the + * result directly, but should return them from this method, which will eventually end up + * calling {@link #deliverResult} on the UI thread. If implementations need to process + * the results on the UI thread they may override {@link #deliverResult} and do so + * there. + * + * @return Implementations must return the result of their load operation. + */ + protected D onLoadInBackground() { + return loadInBackground(); + } + + /** + * Locks the current thread until the loader completes the current load + * operation. Returns immediately if there is no load operation running. + * Should not be called from the UI thread: calling it from the UI + * thread would cause a deadlock. + *

+ * Use for testing only. Never call this from a UI thread. + * + * @hide + */ + public void waitForLoader() { + LoadTask task = mTask; + if (task != null) { + try { + task.done.await(); + } catch (InterruptedException e) { + // Ignore + } + } + } + + @Override + public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { + super.dump(prefix, fd, writer, args); + if (mTask != null) { + writer.print(prefix); writer.print("mTask="); writer.print(mTask); + writer.print(" waiting="); writer.println(mTask.waiting); + } + if (mCancellingTask != null) { + writer.print(prefix); writer.print("mCancellingTask="); writer.print(mCancellingTask); + writer.print(" waiting="); writer.println(mCancellingTask.waiting); + } + if (mUpdateThrottle != 0) { + writer.print(prefix); writer.print("mUpdateThrottle="); + TimeUtils.formatDuration(mUpdateThrottle, writer); + writer.print(" mLastLoadCompleteTime="); + TimeUtils.formatDuration(mLastLoadCompleteTime, + SystemClock.uptimeMillis(), writer); + writer.println(); + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/content/CursorLoader.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/content/CursorLoader.java new file mode 100644 index 00000000..51ad8b54 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/content/CursorLoader.java @@ -0,0 +1,215 @@ +/* + * 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 android.support.v4.content; + +import android.content.Context; +import android.database.ContentObserver; +import android.database.Cursor; +import android.net.Uri; + +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.util.Arrays; + +/** + * Static library support version of the framework's {@link android.content.CursorLoader}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + */ +public class CursorLoader extends AsyncTaskLoader { + final ForceLoadContentObserver mObserver; + + Uri mUri; + String[] mProjection; + String mSelection; + String[] mSelectionArgs; + String mSortOrder; + + Cursor mCursor; + + /* Runs on a worker thread */ + @Override + public Cursor loadInBackground() { + Cursor cursor = getContext().getContentResolver().query(mUri, mProjection, mSelection, + mSelectionArgs, mSortOrder); + if (cursor != null) { + // Ensure the cursor window is filled + cursor.getCount(); + registerContentObserver(cursor, mObserver); + } + return cursor; + } + + /** + * Registers an observer to get notifications from the content provider + * when the cursor needs to be refreshed. + */ + void registerContentObserver(Cursor cursor, ContentObserver observer) { + cursor.registerContentObserver(mObserver); + } + + /* Runs on the UI thread */ + @Override + public void deliverResult(Cursor cursor) { + if (isReset()) { + // An async query came in while the loader is stopped + if (cursor != null) { + cursor.close(); + } + return; + } + Cursor oldCursor = mCursor; + mCursor = cursor; + + if (isStarted()) { + super.deliverResult(cursor); + } + + if (oldCursor != null && oldCursor != cursor && !oldCursor.isClosed()) { + oldCursor.close(); + } + } + + /** + * Creates an empty unspecified CursorLoader. You must follow this with + * calls to {@link #setUri(Uri)}, {@link #setSelection(String)}, etc + * to specify the query to perform. + */ + public CursorLoader(Context context) { + super(context); + mObserver = new ForceLoadContentObserver(); + } + + /** + * Creates a fully-specified CursorLoader. See + * {@link ContentResolver#query(Uri, String[], String, String[], String) + * ContentResolver.query()} for documentation on the meaning of the + * parameters. These will be passed as-is to that call. + */ + public CursorLoader(Context context, Uri uri, String[] projection, String selection, + String[] selectionArgs, String sortOrder) { + super(context); + mObserver = new ForceLoadContentObserver(); + mUri = uri; + mProjection = projection; + mSelection = selection; + mSelectionArgs = selectionArgs; + mSortOrder = sortOrder; + } + + /** + * Starts an asynchronous load of the contacts list data. When the result is ready the callbacks + * will be called on the UI thread. If a previous load has been completed and is still valid + * the result may be passed to the callbacks immediately. + * + * Must be called from the UI thread + */ + @Override + protected void onStartLoading() { + if (mCursor != null) { + deliverResult(mCursor); + } + if (takeContentChanged() || mCursor == null) { + forceLoad(); + } + } + + /** + * Must be called from the UI thread + */ + @Override + protected void onStopLoading() { + // Attempt to cancel the current load task if possible. + cancelLoad(); + } + + @Override + public void onCanceled(Cursor cursor) { + if (cursor != null && !cursor.isClosed()) { + cursor.close(); + } + } + + @Override + protected void onReset() { + super.onReset(); + + // Ensure the loader is stopped + onStopLoading(); + + if (mCursor != null && !mCursor.isClosed()) { + mCursor.close(); + } + mCursor = null; + } + + public Uri getUri() { + return mUri; + } + + public void setUri(Uri uri) { + mUri = uri; + } + + public String[] getProjection() { + return mProjection; + } + + public void setProjection(String[] projection) { + mProjection = projection; + } + + public String getSelection() { + return mSelection; + } + + public void setSelection(String selection) { + mSelection = selection; + } + + public String[] getSelectionArgs() { + return mSelectionArgs; + } + + public void setSelectionArgs(String[] selectionArgs) { + mSelectionArgs = selectionArgs; + } + + public String getSortOrder() { + return mSortOrder; + } + + public void setSortOrder(String sortOrder) { + mSortOrder = sortOrder; + } + + @Override + public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { + super.dump(prefix, fd, writer, args); + writer.print(prefix); writer.print("mUri="); writer.println(mUri); + writer.print(prefix); writer.print("mProjection="); + writer.println(Arrays.toString(mProjection)); + writer.print(prefix); writer.print("mSelection="); writer.println(mSelection); + writer.print(prefix); writer.print("mSelectionArgs="); + writer.println(Arrays.toString(mSelectionArgs)); + writer.print(prefix); writer.print("mSortOrder="); writer.println(mSortOrder); + writer.print(prefix); writer.print("mCursor="); writer.println(mCursor); + writer.print(prefix); writer.print("mContentChanged="); writer.println(mContentChanged); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/content/Loader.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/content/Loader.java new file mode 100644 index 00000000..b9f2c6a8 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/content/Loader.java @@ -0,0 +1,358 @@ +/* + * 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 android.support.v4.content; + +import android.content.Context; +import android.database.ContentObserver; +import android.os.Handler; +import android.support.v4.util.DebugUtils; + +import java.io.FileDescriptor; +import java.io.PrintWriter; + +/** + * Static library support version of the framework's {@link android.content.Loader}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + */ +public class Loader { + int mId; + OnLoadCompleteListener mListener; + Context mContext; + boolean mStarted = false; + boolean mAbandoned = false; + boolean mReset = true; + boolean mContentChanged = false; + + public final class ForceLoadContentObserver extends ContentObserver { + public ForceLoadContentObserver() { + super(new Handler()); + } + + @Override + public boolean deliverSelfNotifications() { + return true; + } + + @Override + public void onChange(boolean selfChange) { + onContentChanged(); + } + } + + public interface OnLoadCompleteListener { + /** + * Called on the thread that created the Loader when the load is complete. + * + * @param loader the loader that completed the load + * @param data the result of the load + */ + public void onLoadComplete(Loader loader, D data); + } + + /** + * Stores away the application context associated with context. Since Loaders can be used + * across multiple activities it's dangerous to store the context directly. + * + * @param context used to retrieve the application context. + */ + public Loader(Context context) { + mContext = context.getApplicationContext(); + } + + /** + * Sends the result of the load to the registered listener. Should only be called by subclasses. + * + * Must be called from the process's main thread. + * + * @param data the result of the load + */ + public void deliverResult(D data) { + if (mListener != null) { + mListener.onLoadComplete(this, data); + } + } + + /** + * @return an application context retrieved from the Context passed to the constructor. + */ + public Context getContext() { + return mContext; + } + + /** + * @return the ID of this loader + */ + public int getId() { + return mId; + } + + /** + * Registers a class that will receive callbacks when a load is complete. + * The callback will be called on the process's main thread so it's safe to + * pass the results to widgets. + * + *

Must be called from the process's main thread. + */ + public void registerListener(int id, OnLoadCompleteListener listener) { + if (mListener != null) { + throw new IllegalStateException("There is already a listener registered"); + } + mListener = listener; + mId = id; + } + + /** + * Remove a listener that was previously added with {@link #registerListener}. + * + * Must be called from the process's main thread. + */ + public void unregisterListener(OnLoadCompleteListener listener) { + if (mListener == null) { + throw new IllegalStateException("No listener register"); + } + if (mListener != listener) { + throw new IllegalArgumentException("Attempting to unregister the wrong listener"); + } + mListener = null; + } + + /** + * Return whether this load has been started. That is, its {@link #startLoading()} + * has been called and no calls to {@link #stopLoading()} or + * {@link #reset()} have yet been made. + */ + public boolean isStarted() { + return mStarted; + } + + /** + * Return whether this loader has been abandoned. In this state, the + * loader must not report any new data, and must keep + * its last reported data valid until it is finally reset. + */ + public boolean isAbandoned() { + return mAbandoned; + } + + /** + * Return whether this load has been reset. That is, either the loader + * has not yet been started for the first time, or its {@link #reset()} + * has been called. + */ + public boolean isReset() { + return mReset; + } + + /** + * Starts an asynchronous load of the Loader's data. When the result + * is ready the callbacks will be called on the process's main thread. + * If a previous load has been completed and is still valid + * the result may be passed to the callbacks immediately. + * The loader will monitor the source of + * the data set and may deliver future callbacks if the source changes. + * Calling {@link #stopLoading} will stop the delivery of callbacks. + * + *

This updates the Loader's internal state so that + * {@link #isStarted()} and {@link #isReset()} will return the correct + * values, and then calls the implementation's {@link #onStartLoading()}. + * + *

Must be called from the process's main thread. + */ + public final void startLoading() { + mStarted = true; + mReset = false; + mAbandoned = false; + onStartLoading(); + } + + /** + * Subclasses must implement this to take care of loading their data, + * as per {@link #startLoading()}. This is not called by clients directly, + * but as a result of a call to {@link #startLoading()}. + */ + protected void onStartLoading() { + } + + /** + * Force an asynchronous load. Unlike {@link #startLoading()} this will ignore a previously + * loaded data set and load a new one. This simply calls through to the + * implementation's {@link #onForceLoad()}. You generally should only call this + * when the loader is started -- that is, {@link #isStarted()} returns true. + * + *

Must be called from the process's main thread. + */ + public void forceLoad() { + onForceLoad(); + } + + /** + * Subclasses must implement this to take care of requests to {@link #forceLoad()}. + * This will always be called from the process's main thread. + */ + protected void onForceLoad() { + } + + /** + * Stops delivery of updates until the next time {@link #startLoading()} is called. + * Implementations should not invalidate their data at this point -- + * clients are still free to use the last data the loader reported. They will, + * however, typically stop reporting new data if the data changes; they can + * still monitor for changes, but must not report them to the client until and + * if {@link #startLoading()} is later called. + * + *

This updates the Loader's internal state so that + * {@link #isStarted()} will return the correct + * value, and then calls the implementation's {@link #onStopLoading()}. + * + *

Must be called from the process's main thread. + */ + public void stopLoading() { + mStarted = false; + onStopLoading(); + } + + /** + * Subclasses must implement this to take care of stopping their loader, + * as per {@link #stopLoading()}. This is not called by clients directly, + * but as a result of a call to {@link #stopLoading()}. + * This will always be called from the process's main thread. + */ + protected void onStopLoading() { + } + + /** + * Tell the Loader that it is being abandoned. This is called prior + * to {@link #reset} to have it retain its current data but not report + * any new data. + */ + public void abandon() { + mAbandoned = true; + onAbandon(); + } + + /** + * Subclasses implement this to take care of being abandoned. This is + * an optional intermediate state prior to {@link #onReset()} -- it means that + * the client is no longer interested in any new data from the loader, + * so the loader must not report any further updates. However, the + * loader must keep its last reported data valid until the final + * {@link #onReset()} happens. You can retrieve the current abandoned + * state with {@link #isAbandoned}. + */ + protected void onAbandon() { + } + + /** + * Resets the state of the Loader. The Loader should at this point free + * all of its resources, since it may never be called again; however, its + * {@link #startLoading()} may later be called at which point it must be + * able to start running again. + * + *

This updates the Loader's internal state so that + * {@link #isStarted()} and {@link #isReset()} will return the correct + * values, and then calls the implementation's {@link #onReset()}. + * + *

Must be called from the process's main thread. + */ + public void reset() { + onReset(); + mReset = true; + mStarted = false; + mAbandoned = false; + mContentChanged = false; + } + + /** + * Subclasses must implement this to take care of resetting their loader, + * as per {@link #reset()}. This is not called by clients directly, + * but as a result of a call to {@link #reset()}. + * This will always be called from the process's main thread. + */ + protected void onReset() { + } + + /** + * Take the current flag indicating whether the loader's content had + * changed while it was stopped. If it had, true is returned and the + * flag is cleared. + */ + public boolean takeContentChanged() { + boolean res = mContentChanged; + mContentChanged = false; + return res; + } + + /** + * Called when {@link ForceLoadContentObserver} detects a change. The + * default implementation checks to see if the loader is currently started; + * if so, it simply calls {@link #forceLoad()}; otherwise, it sets a flag + * so that {@link #takeContentChanged()} returns true. + * + *

Must be called from the process's main thread. + */ + public void onContentChanged() { + if (mStarted) { + forceLoad(); + } else { + // This loader has been stopped, so we don't want to load + // new data right now... but keep track of it changing to + // refresh later if we start again. + mContentChanged = true; + } + } + + /** + * For debugging, converts an instance of the Loader's data class to + * a string that can be printed. Must handle a null data. + */ + public String dataToString(D data) { + StringBuilder sb = new StringBuilder(64); + DebugUtils.buildShortClassTag(data, sb); + sb.append("}"); + return sb.toString(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(64); + DebugUtils.buildShortClassTag(this, sb); + sb.append(" id="); + sb.append(mId); + sb.append("}"); + return sb.toString(); + } + + /** + * Print the Loader's state into the given stream. + * + * @param prefix Text to print at the front of each line. + * @param fd The raw file descriptor that the dump is being sent to. + * @param writer A PrintWriter to which the dump is to be set. + * @param args Additional arguments to the dump request. + */ + public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { + writer.print(prefix); writer.print("mId="); writer.print(mId); + writer.print(" mListener="); writer.println(mListener); + writer.print(prefix); writer.print("mStarted="); writer.print(mStarted); + writer.print(" mContentChanged="); writer.print(mContentChanged); + writer.print(" mAbandoned="); writer.print(mAbandoned); + writer.print(" mReset="); writer.println(mReset); + } +} \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/os/ParcelableCompat.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/os/ParcelableCompat.java new file mode 100644 index 00000000..714af337 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/os/ParcelableCompat.java @@ -0,0 +1,48 @@ +/* + * 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 android.support.v4.os; + +import android.os.Parcel; +import android.os.Parcelable; + +public class ParcelableCompat { + public static Parcelable.Creator newCreator( + ParcelableCompatCreatorCallbacks callbacks) { + if (android.os.Build.VERSION.SDK_INT >= 13) { + ParcelableCompatCreatorHoneycombMR2Stub.instantiate(callbacks); + } + return new CompatCreator(callbacks); + } + + static class CompatCreator implements Parcelable.Creator { + final ParcelableCompatCreatorCallbacks mCallbacks; + + public CompatCreator(ParcelableCompatCreatorCallbacks callbacks) { + mCallbacks = callbacks; + } + + @Override + public T createFromParcel(Parcel source) { + return mCallbacks.createFromParcel(source, null); + } + + @Override + public T[] newArray(int size) { + return mCallbacks.newArray(size); + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/os/ParcelableCompatCreatorCallbacks.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/os/ParcelableCompatCreatorCallbacks.java new file mode 100644 index 00000000..8678cfb7 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/os/ParcelableCompatCreatorCallbacks.java @@ -0,0 +1,24 @@ +/* + * 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 android.support.v4.os; + +import android.os.Parcel; + +public interface ParcelableCompatCreatorCallbacks { + public T createFromParcel(Parcel in, ClassLoader loader); + public T[] newArray(int size); +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/os/ParcelableCompatHoneycombMR2.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/os/ParcelableCompatHoneycombMR2.java new file mode 100644 index 00000000..08acb550 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/os/ParcelableCompatHoneycombMR2.java @@ -0,0 +1,46 @@ +/* + * 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 android.support.v4.os; + +import android.os.Parcel; +import android.os.Parcelable; + +class ParcelableCompatCreatorHoneycombMR2Stub { + static Parcelable.Creator instantiate(ParcelableCompatCreatorCallbacks callbacks) { + return new ParcelableCompatCreatorHoneycombMR2(callbacks); + } +} + +class ParcelableCompatCreatorHoneycombMR2 implements Parcelable.ClassLoaderCreator { + private final ParcelableCompatCreatorCallbacks mCallbacks; + + public ParcelableCompatCreatorHoneycombMR2(ParcelableCompatCreatorCallbacks callbacks) { + mCallbacks = callbacks; + } + + public T createFromParcel(Parcel in) { + return mCallbacks.createFromParcel(in, null); + } + + public T createFromParcel(Parcel in, ClassLoader loader) { + return mCallbacks.createFromParcel(in, loader); + } + + public T[] newArray(int size) { + return mCallbacks.newArray(size); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/DebugUtils.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/DebugUtils.java new file mode 100644 index 00000000..16c63a9f --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/DebugUtils.java @@ -0,0 +1,40 @@ +/* + * 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 android.support.v4.util; + +/** + * Useful debugging utilities that are not available on all versions of Android. + */ +public class DebugUtils { + public static void buildShortClassTag(Object cls, StringBuilder out) { + if (cls == null) { + out.append("null"); + } else { + String simpleName = cls.getClass().getSimpleName(); + if (simpleName == null || simpleName.length() <= 0) { + simpleName = cls.getClass().getName(); + int end = simpleName.lastIndexOf('.'); + if (end > 0) { + simpleName = simpleName.substring(end+1); + } + } + out.append(simpleName); + out.append('{'); + out.append(Integer.toHexString(System.identityHashCode(cls))); + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/LogWriter.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/LogWriter.java new file mode 100644 index 00000000..3b9d12b0 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/LogWriter.java @@ -0,0 +1,72 @@ +/* + * 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 android.support.v4.util; + +import android.util.Log; + +import java.io.Writer; + +/** + * Useful logging utility that is not available on all versions of Android. + */ +public class LogWriter extends Writer { + private final String mTag; + private StringBuilder mBuilder = new StringBuilder(128); + + /** + * Create a new Writer that sends to the log with the given priority + * and tag. + * + * @param priority The desired log priority: + * {@link android.util.Log#VERBOSE Log.VERBOSE}, + * {@link android.util.Log#DEBUG Log.DEBUG}, + * {@link android.util.Log#INFO Log.INFO}, + * {@link android.util.Log#WARN Log.WARN}, or + * {@link android.util.Log#ERROR Log.ERROR}. + * @param tag A string tag to associate with each printed log statement. + */ + public LogWriter(String tag) { + mTag = tag; + } + + @Override public void close() { + flushBuilder(); + } + + @Override public void flush() { + flushBuilder(); + } + + @Override public void write(char[] buf, int offset, int count) { + for(int i = 0; i < count; i++) { + char c = buf[offset + i]; + if ( c == '\n') { + flushBuilder(); + } + else { + mBuilder.append(c); + } + } + } + + private void flushBuilder() { + if (mBuilder.length() > 0) { + Log.d(mTag, mBuilder.toString()); + mBuilder.delete(0, mBuilder.length()); + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/LruCache.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/LruCache.java new file mode 100644 index 00000000..a7a2ee27 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/LruCache.java @@ -0,0 +1,323 @@ +/* + * 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 android.support.v4.util; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Static library version of {@code android.util.LruCache}. Used to write apps + * that run on API levels prior to 12. When running on API level 12 or above, + * this implementation is still used; it does not try to switch to the + * framework's implementation. See the framework SDK documentation for a class + * overview. + */ +public class LruCache { + private final LinkedHashMap map; + + /** Size of this cache in units. Not necessarily the number of elements. */ + private int size; + private int maxSize; + + private int putCount; + private int createCount; + private int evictionCount; + private int hitCount; + private int missCount; + + /** + * @param maxSize for caches that do not override {@link #sizeOf}, this is + * the maximum number of entries in the cache. For all other caches, + * this is the maximum sum of the sizes of the entries in this cache. + */ + public LruCache(int maxSize) { + if (maxSize <= 0) { + throw new IllegalArgumentException("maxSize <= 0"); + } + this.maxSize = maxSize; + this.map = new LinkedHashMap(0, 0.75f, true); + } + + /** + * Returns the value for {@code key} if it exists in the cache or can be + * created by {@code #create}. If a value was returned, it is moved to the + * head of the queue. This returns null if a value is not cached and cannot + * be created. + */ + public final V get(K key) { + if (key == null) { + throw new NullPointerException("key == null"); + } + + V mapValue; + synchronized (this) { + mapValue = map.get(key); + if (mapValue != null) { + hitCount++; + return mapValue; + } + missCount++; + } + + /* + * Attempt to create a value. This may take a long time, and the map + * may be different when create() returns. If a conflicting value was + * added to the map while create() was working, we leave that value in + * the map and release the created value. + */ + + V createdValue = create(key); + if (createdValue == null) { + return null; + } + + synchronized (this) { + createCount++; + mapValue = map.put(key, createdValue); + + if (mapValue != null) { + // There was a conflict so undo that last put + map.put(key, mapValue); + } else { + size += safeSizeOf(key, createdValue); + } + } + + if (mapValue != null) { + entryRemoved(false, key, createdValue, mapValue); + return mapValue; + } else { + trimToSize(maxSize); + return createdValue; + } + } + + /** + * Caches {@code value} for {@code key}. The value is moved to the head of + * the queue. + * + * @return the previous value mapped by {@code key}. + */ + public final V put(K key, V value) { + if (key == null || value == null) { + throw new NullPointerException("key == null || value == null"); + } + + V previous; + synchronized (this) { + putCount++; + size += safeSizeOf(key, value); + previous = map.put(key, value); + if (previous != null) { + size -= safeSizeOf(key, previous); + } + } + + if (previous != null) { + entryRemoved(false, key, previous, value); + } + + trimToSize(maxSize); + return previous; + } + + /** + * @param maxSize the maximum size of the cache before returning. May be -1 + * to evict even 0-sized elements. + */ + private void trimToSize(int maxSize) { + while (true) { + K key; + V value; + synchronized (this) { + if (size < 0 || (map.isEmpty() && size != 0)) { + throw new IllegalStateException(getClass().getName() + + ".sizeOf() is reporting inconsistent results!"); + } + + if (size <= maxSize || map.isEmpty()) { + break; + } + + Map.Entry toEvict = map.entrySet().iterator().next(); + key = toEvict.getKey(); + value = toEvict.getValue(); + map.remove(key); + size -= safeSizeOf(key, value); + evictionCount++; + } + + entryRemoved(true, key, value, null); + } + } + + /** + * Removes the entry for {@code key} if it exists. + * + * @return the previous value mapped by {@code key}. + */ + public final V remove(K key) { + if (key == null) { + throw new NullPointerException("key == null"); + } + + V previous; + synchronized (this) { + previous = map.remove(key); + if (previous != null) { + size -= safeSizeOf(key, previous); + } + } + + if (previous != null) { + entryRemoved(false, key, previous, null); + } + + return previous; + } + + /** + * Called for entries that have been evicted or removed. This method is + * invoked when a value is evicted to make space, removed by a call to + * {@link #remove}, or replaced by a call to {@link #put}. The default + * implementation does nothing. + * + *

The method is called without synchronization: other threads may + * access the cache while this method is executing. + * + * @param evicted true if the entry is being removed to make space, false + * if the removal was caused by a {@link #put} or {@link #remove}. + * @param newValue the new value for {@code key}, if it exists. If non-null, + * this removal was caused by a {@link #put}. Otherwise it was caused by + * an eviction or a {@link #remove}. + */ + protected void entryRemoved(boolean evicted, K key, V oldValue, V newValue) {} + + /** + * Called after a cache miss to compute a value for the corresponding key. + * Returns the computed value or null if no value can be computed. The + * default implementation returns null. + * + *

The method is called without synchronization: other threads may + * access the cache while this method is executing. + * + *

If a value for {@code key} exists in the cache when this method + * returns, the created value will be released with {@link #entryRemoved} + * and discarded. This can occur when multiple threads request the same key + * at the same time (causing multiple values to be created), or when one + * thread calls {@link #put} while another is creating a value for the same + * key. + */ + protected V create(K key) { + return null; + } + + private int safeSizeOf(K key, V value) { + int result = sizeOf(key, value); + if (result < 0) { + throw new IllegalStateException("Negative size: " + key + "=" + value); + } + return result; + } + + /** + * Returns the size of the entry for {@code key} and {@code value} in + * user-defined units. The default implementation returns 1 so that size + * is the number of entries and max size is the maximum number of entries. + * + *

An entry's size must not change while it is in the cache. + */ + protected int sizeOf(K key, V value) { + return 1; + } + + /** + * Clear the cache, calling {@link #entryRemoved} on each removed entry. + */ + public final void evictAll() { + trimToSize(-1); // -1 will evict 0-sized elements + } + + /** + * For caches that do not override {@link #sizeOf}, this returns the number + * of entries in the cache. For all other caches, this returns the sum of + * the sizes of the entries in this cache. + */ + public synchronized final int size() { + return size; + } + + /** + * For caches that do not override {@link #sizeOf}, this returns the maximum + * number of entries in the cache. For all other caches, this returns the + * maximum sum of the sizes of the entries in this cache. + */ + public synchronized final int maxSize() { + return maxSize; + } + + /** + * Returns the number of times {@link #get} returned a value. + */ + public synchronized final int hitCount() { + return hitCount; + } + + /** + * Returns the number of times {@link #get} returned null or required a new + * value to be created. + */ + public synchronized final int missCount() { + return missCount; + } + + /** + * Returns the number of times {@link #create(Object)} returned a value. + */ + public synchronized final int createCount() { + return createCount; + } + + /** + * Returns the number of times {@link #put} was called. + */ + public synchronized final int putCount() { + return putCount; + } + + /** + * Returns the number of values that have been evicted. + */ + public synchronized final int evictionCount() { + return evictionCount; + } + + /** + * Returns a copy of the current contents of the cache, ordered from least + * recently accessed to most recently accessed. + */ + public synchronized final Map snapshot() { + return new LinkedHashMap(map); + } + + @Override public synchronized final String toString() { + int accesses = hitCount + missCount; + int hitPercent = accesses != 0 ? (100 * hitCount / accesses) : 0; + return String.format("LruCache[maxSize=%d,hits=%d,misses=%d,hitRate=%d%%]", + maxSize, hitCount, missCount, hitPercent); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/TimeUtils.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/TimeUtils.java new file mode 100644 index 00000000..65ac8544 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/util/TimeUtils.java @@ -0,0 +1,172 @@ +/* + * 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 android.support.v4.util; + +import java.io.PrintWriter; + +/** + * Useful time utilities that are not available on all versions of Android. + */ +public class TimeUtils { + /** @hide Field length that can hold 999 days of time */ + public static final int HUNDRED_DAY_FIELD_LEN = 19; + + private static final int SECONDS_PER_MINUTE = 60; + private static final int SECONDS_PER_HOUR = 60 * 60; + private static final int SECONDS_PER_DAY = 24 * 60 * 60; + + private static final Object sFormatSync = new Object(); + private static char[] sFormatStr = new char[HUNDRED_DAY_FIELD_LEN+5]; + + static private int accumField(int amt, int suffix, boolean always, int zeropad) { + if (amt > 99 || (always && zeropad >= 3)) { + return 3+suffix; + } + if (amt > 9 || (always && zeropad >= 2)) { + return 2+suffix; + } + if (always || amt > 0) { + return 1+suffix; + } + return 0; + } + + static private int printField(char[] formatStr, int amt, char suffix, int pos, + boolean always, int zeropad) { + if (always || amt > 0) { + final int startPos = pos; + if ((always && zeropad >= 3) || amt > 99) { + int dig = amt/100; + formatStr[pos] = (char)(dig + '0'); + pos++; + amt -= (dig*100); + } + if ((always && zeropad >= 2) || amt > 9 || startPos != pos) { + int dig = amt/10; + formatStr[pos] = (char)(dig + '0'); + pos++; + amt -= (dig*10); + } + formatStr[pos] = (char)(amt + '0'); + pos++; + formatStr[pos] = suffix; + pos++; + } + return pos; + } + + private static int formatDurationLocked(long duration, int fieldLen) { + if (sFormatStr.length < fieldLen) { + sFormatStr = new char[fieldLen]; + } + + char[] formatStr = sFormatStr; + + if (duration == 0) { + int pos = 0; + fieldLen -= 1; + while (pos < fieldLen) { + formatStr[pos] = ' '; + } + formatStr[pos] = '0'; + return pos+1; + } + + char prefix; + if (duration > 0) { + prefix = '+'; + } else { + prefix = '-'; + duration = -duration; + } + + int millis = (int)(duration%1000); + int seconds = (int) Math.floor(duration / 1000); + int days = 0, hours = 0, minutes = 0; + + if (seconds > SECONDS_PER_DAY) { + days = seconds / SECONDS_PER_DAY; + seconds -= days * SECONDS_PER_DAY; + } + if (seconds > SECONDS_PER_HOUR) { + hours = seconds / SECONDS_PER_HOUR; + seconds -= hours * SECONDS_PER_HOUR; + } + if (seconds > SECONDS_PER_MINUTE) { + minutes = seconds / SECONDS_PER_MINUTE; + seconds -= minutes * SECONDS_PER_MINUTE; + } + + int pos = 0; + + if (fieldLen != 0) { + int myLen = accumField(days, 1, false, 0); + myLen += accumField(hours, 1, myLen > 0, 2); + myLen += accumField(minutes, 1, myLen > 0, 2); + myLen += accumField(seconds, 1, myLen > 0, 2); + myLen += accumField(millis, 2, true, myLen > 0 ? 3 : 0) + 1; + while (myLen < fieldLen) { + formatStr[pos] = ' '; + pos++; + myLen++; + } + } + + formatStr[pos] = prefix; + pos++; + + int start = pos; + boolean zeropad = fieldLen != 0; + pos = printField(formatStr, days, 'd', pos, false, 0); + pos = printField(formatStr, hours, 'h', pos, pos != start, zeropad ? 2 : 0); + pos = printField(formatStr, minutes, 'm', pos, pos != start, zeropad ? 2 : 0); + pos = printField(formatStr, seconds, 's', pos, pos != start, zeropad ? 2 : 0); + pos = printField(formatStr, millis, 'm', pos, true, (zeropad && pos != start) ? 3 : 0); + formatStr[pos] = 's'; + return pos + 1; + } + + /** @hide Just for debugging; not internationalized. */ + public static void formatDuration(long duration, StringBuilder builder) { + synchronized (sFormatSync) { + int len = formatDurationLocked(duration, 0); + builder.append(sFormatStr, 0, len); + } + } + + /** @hide Just for debugging; not internationalized. */ + public static void formatDuration(long duration, PrintWriter pw, int fieldLen) { + synchronized (sFormatSync) { + int len = formatDurationLocked(duration, fieldLen); + pw.print(new String(sFormatStr, 0, len)); + } + } + + /** @hide Just for debugging; not internationalized. */ + public static void formatDuration(long duration, PrintWriter pw) { + formatDuration(duration, pw, 0); + } + + /** @hide Just for debugging; not internationalized. */ + public static void formatDuration(long time, long now, PrintWriter pw) { + if (time == 0) { + pw.print("--"); + return; + } + formatDuration(time-now, pw, 0); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ActionMode.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ActionMode.java new file mode 100644 index 00000000..f265b3cd --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ActionMode.java @@ -0,0 +1,188 @@ +/* + * Copyright 2011 Jake Wharton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.support.v4.view; + +import android.view.View; + +/** + * Represents a contextual mode of the user interface. Action modes can be used + * for modal interactions with content and replace parts of the normal UI until + * finished. Examples of good action modes include selection modes, search, + * content editing, etc. + */ +public abstract class ActionMode { + /** + *

Callback interface for action modes. Supplied to + * {@link android.support.v4.app.FragmentActivity#startActionMode(Callback)}, + * a Callback configures and handles events raised by a user's interaction + * with an action mode.

+ * + *

An action mode's lifecycle is as follows: + *

    + *
  • {@link #onCreateActionMode(ActionMode, Menu)} once on initial + * creation
  • + *
  • {@link #onPrepareActionMode(ActionMode, Menu)} after creation and + * any time the ActionMode is invalidated
  • + *
  • {@link #onActionItemClicked(ActionMode, MenuItem)} any time a + * contextual action button is clicked
  • + *
  • {@link #onDestroyActionMode(ActionMode)} when the action mode is + * closed
  • + *
+ *

+ */ + public interface Callback { + /** + * Called to report a user click on an action button. + * + * @param mode The current ActionMode + * @param item The item that was clicked + * @return true if this callback handled the event, false if the + * standard MenuItem invocation should continue. + */ + boolean onActionItemClicked(ActionMode mode, MenuItem item); + + /** + * Called when action mode is first created. The menu supplied will be + * used to generate action buttons for the action mode. + * + * @param mode ActionMode being created + * @param menu Menu used to populate action buttons + * @return true if the action mode should be created, false if entering + * this mode should be aborted. + */ + boolean onCreateActionMode(ActionMode mode, Menu menu); + + /** + * Called when an action mode is about to be exited and destroyed. + * + * @param mode The current ActionMode being destroyed + */ + void onDestroyActionMode(ActionMode mode); + + /** + * Called to refresh an action mode's action menu whenever it is + * invalidated. + * + * @param mode ActionMode being prepared + * @param menu Menu used to populate action buttons + * @return true if the menu or action mode was updated, false otherwise. + */ + boolean onPrepareActionMode(ActionMode mode, Menu menu); + } + + /** + * Finish and close this action mode. The action mode's + * {@link ActionMode.Callback} will have its + * {@link ActionMode.Callback#onDestroyActionMode(ActionMode)} method + * called. + */ + public abstract void finish(); + + /** + * Returns the current custom view for this action mode. + * + * @return The current custom view + */ + public abstract View getCustomView(); + + /** + * Returns the menu of actions that this action mode presents. + * + * @return The action mode's menu. + */ + public abstract Menu getMenu(); + + /** + * Returns a {@link MenuInflater} with the ActionMode's context. + * + * @return Menu inflater. + */ + public abstract MenuInflater getMenuInflater(); + + /** + * Returns the current subtitle of this action mode. + * + * @return Subtitle text + */ + public abstract CharSequence getSubtitle(); + + /** + * Returns the current title of this action mode. + * + * @return Title text + */ + public abstract CharSequence getTitle(); + + /** + * Invalidate the action mode and refresh menu content. The mode's + * {@link ActionMode.Callback} will have its + * {@link ActionMode.Callback#onPrepareActionMode(ActionMode, Menu)} method + * called. If it returns true the menu will be scanned for updated content + * and any relevant changes will be reflected to the user. + */ + public abstract void invalidate(); + + /** + * Set a custom view for this action mode. The custom view will take the + * place of the title and subtitle. Useful for things like search boxes. + * + * @param view Custom view to use in place of the title/subtitle. + * @see #setTitle(CharSequence) + * @see #setSubtitle(CharSequence) + */ + public abstract void setCustomView(View view); + + /** + * Set the subtitle of the action mode. This method will have no visible + * effect if a custom view has been set. + * + * @param resId Resource ID of a string to set as the subtitle + * @see #setSubtitle(CharSequence) + * @see #setCustomView(View) + */ + public abstract void setSubtitle(int resId); + + /** + * Set the subtitle of the action mode. This method will have no visible + * effect if a custom view has been set. + * + * @param subtitle Subtitle string to set + * @see #setSubtitle(int) + * @see #setCustomView(View) + */ + public abstract void setSubtitle(CharSequence subtitle); + + /** + * Set the title of the action mode. This method will have no visible effect + * if a custom view has been set. + * + * @param resId Resource ID of a string to set as the title + * @see #setTitle(CharSequence) + * @see #setCustomView(View) + */ + public abstract void setTitle(int resId); + + /** + * Set the title of the action mode. This method will have no visible effect + * if a custom view has been set. + * + * @param title Title string to set + * @see #setTitle(int) + * @see #setCustomView(View) + */ + public abstract void setTitle(CharSequence title); +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/Menu.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/Menu.java new file mode 100644 index 00000000..39a69718 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/Menu.java @@ -0,0 +1,33 @@ +package android.support.v4.view; + +public interface Menu extends android.view.Menu { + @Override + MenuItem add(CharSequence title); + + @Override + MenuItem add(int groupId, int itemId, int order, int titleRes); + + @Override + MenuItem add(int titleRes); + + @Override + MenuItem add(int groupId, int itemId, int order, CharSequence title); + + @Override + SubMenu addSubMenu(int groupId, int itemId, int order, CharSequence title); + + @Override + SubMenu addSubMenu(int groupId, int itemId, int order, int titleRes); + + @Override + SubMenu addSubMenu(CharSequence title); + + @Override + SubMenu addSubMenu(int titleRes); + + @Override + MenuItem findItem(int id); + + @Override + MenuItem getItem(int index); +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MenuInflater.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MenuInflater.java new file mode 100644 index 00000000..f32a2aa1 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MenuInflater.java @@ -0,0 +1,464 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * 2011 Jake Wharton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.support.v4.view; + +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; +import android.content.Context; +import android.content.res.XmlResourceParser; +import android.util.AttributeSet; +import android.util.Xml; +import android.view.InflateException; +import android.view.MenuItem; +import android.view.View; +import com.actionbarsherlock.internal.view.menu.MenuBuilder; +import com.actionbarsherlock.internal.view.menu.MenuItemImpl; +import com.actionbarsherlock.internal.view.menu.SubMenuBuilder; + +/** + * This class is used to instantiate menu XML files into Menu objects. + *

+ * For performance reasons, menu inflation relies heavily on pre-processing of + * XML files that is done at build time. Therefore, it is not currently possible + * to use MenuInflater with an XmlPullParser over a plain XML file at runtime; + * it only works with an XmlPullParser returned from a compiled resource (R. + * something file.) + */ +public final class MenuInflater extends android.view.MenuInflater { + private static final Class[] ACTION_VIEW_CONSTRUCTOR_SIGNATURE = new Class[] { Context.class }; + private static final Class[] PARAM_TYPES = new Class[] { android.view.MenuItem.class }; + + /** Android XML namespace. */ + private static final String XML_NS = "http://schemas.android.com/apk/res/android"; + + /** Menu tag name in XML. */ + private static final String XML_MENU = "menu"; + + /** Group tag name in XML. */ + private static final String XML_GROUP = "group"; + + /** Item tag name in XML. */ + private static final String XML_ITEM = "item"; + + + /** Context from which to inflate resources. */ + private final Context mContext; + + /** Native inflater for context menu fallback. */ + private final android.view.MenuInflater mNativeMenuInflater; + + + /** + * Constructs a menu inflater. + * + * @see Activity#getMenuInflater() + */ + public MenuInflater(Context context, android.view.MenuInflater nativeMenuInflater) { + super(context); + mContext = context; + mNativeMenuInflater = nativeMenuInflater; + } + + + /** + * Inflate a menu hierarchy from the specified XML resource. Throws + * {@link InflateException} if there is an error. + * + * @param menuRes Resource ID for an XML layout resource to load (e.g., + * R.menu.main_activity) + * @param menu The Menu to inflate into. The items and submenus will be + * added to this Menu. + */ + @Override + public void inflate(int menuRes, android.view.Menu menu) { + if (!(menu instanceof MenuBuilder)) { + mNativeMenuInflater.inflate(menuRes, menu); + return; + } + + MenuBuilder actionBarMenu = (MenuBuilder)menu; + XmlResourceParser parser = null; + try { + parser = mContext.getResources().getLayout(menuRes); + AttributeSet attrs = Xml.asAttributeSet(parser); + + parseMenu(parser, attrs, actionBarMenu); + } catch (XmlPullParserException e) { + throw new InflateException("Error inflating menu XML", e); + } catch (IOException e) { + throw new InflateException("Error inflating menu XML", e); + } finally { + if (parser != null) parser.close(); + } + } + + /** + * Called internally to fill the given menu. If a sub menu is seen, it will + * call this recursively. + */ + private void parseMenu(XmlPullParser parser, AttributeSet attrs, MenuBuilder menu) + throws XmlPullParserException, IOException { + ActionBarMenuState menuState = new ActionBarMenuState(menu); + + int eventType = parser.getEventType(); + String tagName; + boolean lookingForEndOfUnknownTag = false; + String unknownTagName = null; + + // This loop will skip to the menu start tag + do { + if (eventType == XmlPullParser.START_TAG) { + tagName = parser.getName(); + if (tagName.equals(XML_MENU)) { + // Go to next tag + eventType = parser.next(); + break; + } + + throw new RuntimeException("Expecting menu, got " + tagName); + } + eventType = parser.next(); + } while (eventType != XmlPullParser.END_DOCUMENT); + + boolean reachedEndOfMenu = false; + while (!reachedEndOfMenu) { + switch (eventType) { + case XmlPullParser.START_TAG: + if (lookingForEndOfUnknownTag) { + break; + } + + tagName = parser.getName(); + if (tagName.equals(XML_GROUP)) { + menuState.readGroup(attrs); + } else if (tagName.equals(XML_ITEM)) { + menuState.readItem(attrs); + } else if (tagName.equals(XML_MENU)) { + // A menu start tag denotes a submenu for an item + SubMenuBuilder subMenu = menuState.addSubMenuItem(); + + // Parse the submenu into returned SubMenu + parseMenu(parser, attrs, subMenu); + } else { + lookingForEndOfUnknownTag = true; + unknownTagName = tagName; + } + break; + + case XmlPullParser.END_TAG: + tagName = parser.getName(); + if (lookingForEndOfUnknownTag && tagName.equals(unknownTagName)) { + lookingForEndOfUnknownTag = false; + unknownTagName = null; + } else if (tagName.equals(XML_GROUP)) { + menuState.resetGroup(); + } else if (tagName.equals(XML_ITEM)) { + // Add the item if it hasn't been added (if the item was + // a submenu, it would have been added already) + if (!menuState.hasAddedItem()) { + menuState.addItem(); + } + } else if (tagName.equals(XML_MENU)) { + reachedEndOfMenu = true; + } + break; + + case XmlPullParser.END_DOCUMENT: + throw new RuntimeException("Unexpected end of document"); + } + + eventType = parser.next(); + } + } + + + + /** + * State for the current menu. + *

+ * Groups can not be nested unless there is another menu (which will have + * its state class). + */ + private final class ActionBarMenuState { + private final MenuBuilder menu; + + /* + * Group state is set on items as they are added, allowing an item to + * override its group state. (As opposed to set on items at the group end tag.) + */ + private int groupId; + private int groupCategory; + private int groupOrder; + private int groupCheckable; + private boolean groupVisible; + private boolean groupEnabled; + + private boolean itemAdded; + private int itemId; + private int itemCategoryOrder; + private String itemTitle; + private String itemTitleCondensed; + private int itemIconResId; + private char itemAlphabeticShortcut; + private char itemNumericShortcut; + /** + * Sync to attrs.xml enum: + * - 0: none + * - 1: all + * - 2: exclusive + */ + private int itemCheckable; + private boolean itemChecked; + private boolean itemVisible; + private boolean itemEnabled; + private String itemListenerMethodName; + private int itemShowAsAction; + private int itemActionLayout; + private String itemActionViewClassName; + + private static final int defaultGroupId = View.NO_ID; + private static final int defaultItemId = View.NO_ID; + private static final int defaultItemCategory = 0; + private static final int defaultItemOrder = 0; + private static final int defaultItemCheckable = 0; + private static final boolean defaultItemChecked = false; + private static final boolean defaultItemVisible = true; + private static final boolean defaultItemEnabled = true; + private static final int defaultItemShowAsAction = 0; + private static final int defaultIconResId = View.NO_ID; + + /** Mirror of package-scoped Menu.CATEGORY_MASK. */ + private static final int Menu__CATEGORY_MASK = 0xffff0000; + /** Mirror of package-scoped Menu.USER_MASK. */ + private static final int Menu__USER_MASK = 0x0000ffff; + + public ActionBarMenuState(MenuBuilder menu) { + this.menu = menu; + + resetGroup(); + } + + public void resetGroup() { + groupId = defaultGroupId; + groupCategory = defaultItemCategory; + groupOrder = defaultItemOrder; + groupCheckable = defaultItemCheckable; + groupVisible = defaultItemVisible; + groupEnabled = defaultItemEnabled; + } + + /** + * Called when the parser is pointing to a group tag. + */ + public void readGroup(AttributeSet attrs) { + //TypedArray a = mContext.obtainStyledAttributes(attrs, com.android.internal.R.styleable.MenuGroup); + + //groupId = a.getResourceId(com.android.internal.R.styleable.MenuGroup_id, defaultGroupId); + groupId = attrs.getAttributeResourceValue(XML_NS, "id", defaultGroupId); + + //groupCategory = a.getInt(com.android.internal.R.styleable.MenuGroup_menuCategory, defaultItemCategory); + groupCategory = attrs.getAttributeIntValue(XML_NS, "menuCategory", defaultItemCategory); + + //groupOrder = a.getInt(com.android.internal.R.styleable.MenuGroup_orderInCategory, defaultItemOrder); + groupOrder = attrs.getAttributeIntValue(XML_NS, "orderInCategory", defaultItemOrder); + + //groupCheckable = a.getInt(com.android.internal.R.styleable.MenuGroup_checkableBehavior, defaultItemCheckable); + groupCheckable = attrs.getAttributeIntValue(XML_NS, "checkableBehavior", defaultItemCheckable); + + //groupVisible = a.getBoolean(com.android.internal.R.styleable.MenuGroup_visible, defaultItemVisible); + groupVisible = attrs.getAttributeBooleanValue(XML_NS, "visible", defaultItemVisible); + + //groupEnabled = a.getBoolean(com.android.internal.R.styleable.MenuGroup_enabled, defaultItemEnabled); + groupEnabled = attrs.getAttributeBooleanValue(XML_NS, "enabled", defaultItemEnabled); + + //a.recycle(); + } + + /** + * Called when the parser is pointing to an item tag. + */ + public void readItem(AttributeSet attrs) { + //TypedArray a = mContext.obtainStyledAttributes(attrs, com.android.internal.R.styleable.MenuItem); + + // Inherit attributes from the group as default value + + //itemId = a.getResourceId(com.android.internal.R.styleable.MenuItem_id, defaultItemId); + itemId = attrs.getAttributeResourceValue(XML_NS, "id", defaultItemId); + + //final int category = a.getInt(com.android.internal.R.styleable.MenuItem_menuCategory, groupCategory); + final int category = attrs.getAttributeIntValue(XML_NS, "menuCategory", groupCategory); + + //final int order = a.getInt(com.android.internal.R.styleable.MenuItem_orderInCategory, groupOrder); + final int order = attrs.getAttributeIntValue(XML_NS, "orderInCategory", groupOrder); + + //itemCategoryOrder = (category & Menu.CATEGORY_MASK) | (order & Menu.USER_MASK); + itemCategoryOrder = (category & Menu__CATEGORY_MASK) | (order & Menu__USER_MASK); + + //itemTitle = a.getString(com.android.internal.R.styleable.MenuItem_title); + final int itemTitleId = attrs.getAttributeResourceValue(XML_NS, "title", 0); + if (itemTitleId != 0) { + itemTitle = mContext.getString(itemTitleId); + } else { + itemTitle = attrs.getAttributeValue(XML_NS, "title"); + } + + //itemTitleCondensed = a.getString(com.android.internal.R.styleable.MenuItem_titleCondensed); + final int itemTitleCondensedId = attrs.getAttributeResourceValue(XML_NS, "titleCondensed", 0); + if (itemTitleCondensedId != 0) { + itemTitleCondensed = mContext.getString(itemTitleCondensedId); + } else { + itemTitleCondensed = attrs.getAttributeValue(XML_NS, "titleCondensed"); + } + + //itemIconResId = a.getResourceId(com.android.internal.R.styleable.MenuItem_icon, 0); + itemIconResId = attrs.getAttributeResourceValue(XML_NS, "icon", defaultIconResId); + + //itemAlphabeticShortcut = getShortcut(a.getString(com.android.internal.R.styleable.MenuItem_alphabeticShortcut)); + itemAlphabeticShortcut = getShortcut(attrs.getAttributeValue(XML_NS, "alphabeticShortcut")); + + //itemNumericShortcut = getShortcut(a.getString(com.android.internal.R.styleable.MenuItem_numericShortcut)); + itemNumericShortcut = getShortcut(attrs.getAttributeValue(XML_NS, "numericShortcut")); + + //if (a.hasValue(com.android.internal.R.styleable.MenuItem_checkable)) { + if (attrs.getAttributeValue(XML_NS, "checkable") != null) { + // Item has attribute checkable, use it + //itemCheckable = a.getBoolean(com.android.internal.R.styleable.MenuItem_checkable, false) ? 1 : 0; + itemCheckable = attrs.getAttributeBooleanValue(XML_NS, "checkable", false) ? 1 : 0; + } else { + // Item does not have attribute, use the group's (group can have one more state + // for checkable that represents the exclusive checkable) + itemCheckable = groupCheckable; + } + + //itemChecked = a.getBoolean(com.android.internal.R.styleable.MenuItem_checked, defaultItemChecked); + itemChecked = attrs.getAttributeBooleanValue(XML_NS, "checked", defaultItemChecked); + + //itemVisible = a.getBoolean(com.android.internal.R.styleable.MenuItem_visible, groupVisible); + itemVisible = attrs.getAttributeBooleanValue(XML_NS, "visible", groupVisible); + + //itemEnabled = a.getBoolean(com.android.internal.R.styleable.MenuItem_enabled, groupEnabled); + itemEnabled = attrs.getAttributeBooleanValue(XML_NS, "enabled", groupEnabled); + + //presumed emulation of 3.0+'s MenuInflator: + itemListenerMethodName = attrs.getAttributeValue(XML_NS, "onClick"); + itemShowAsAction = attrs.getAttributeIntValue(XML_NS, "showAsAction", defaultItemShowAsAction); + itemActionLayout = attrs.getAttributeResourceValue(XML_NS, "actionLayout", 0); + itemActionViewClassName = attrs.getAttributeValue(XML_NS, "actionViewClass"); + + //a.recycle(); + + itemAdded = false; + } + + private char getShortcut(String shortcutString) { + if (shortcutString == null) { + return 0; + } else { + return shortcutString.charAt(0); + } + } + + private void setItem(MenuItemImpl item) { + item.setChecked(itemChecked) + .setVisible(itemVisible) + .setEnabled(itemEnabled) + .setCheckable(itemCheckable >= 1) + .setTitleCondensed(itemTitleCondensed) + .setIcon(itemIconResId) + .setAlphabeticShortcut(itemAlphabeticShortcut) + .setNumericShortcut(itemNumericShortcut); + + if (itemShowAsAction > 0) { + item.setShowAsAction(itemShowAsAction); + } + if (itemListenerMethodName != null) { + if (MenuInflater.this.mContext.isRestricted()) { + throw new IllegalStateException("The android:onClick attribute cannot be used within a restricted context"); + } + item.setOnMenuItemClickListener(new InflatedOnMenuItemClickListener(itemListenerMethodName)); + } + if (itemCheckable >= 2) { + item.setExclusiveCheckable(true); + } + if (itemActionViewClassName != null) { + try { + Context context = MenuInflater.this.mContext; + ClassLoader loader = context.getClassLoader(); + Class actionViewClass = Class.forName(itemActionViewClassName, true, loader); + Constructor constructor = actionViewClass.getConstructor(ACTION_VIEW_CONSTRUCTOR_SIGNATURE); + View actionView = (View)constructor.newInstance(new Object[] { context }); + item.setActionView(actionView); + } catch (Exception e) { + throw new InflateException(e); + } + } else if (itemActionLayout > 0) { + item.setActionView(itemActionLayout); + } + } + + public void addItem() { + itemAdded = true; + setItem((MenuItemImpl)menu.add(groupId, itemId, itemCategoryOrder, itemTitle)); + } + + public SubMenuBuilder addSubMenuItem() { + itemAdded = true; + SubMenuBuilder subMenu = menu.addSubMenu(groupId, itemId, itemCategoryOrder, itemTitle); + setItem(subMenu.getItem()); + return subMenu; + } + + public boolean hasAddedItem() { + return itemAdded; + } + } + + class InflatedOnMenuItemClickListener implements android.view.MenuItem.OnMenuItemClickListener { + private Method mMethod; + + public InflatedOnMenuItemClickListener(String methodName) { + final Class localClass = MenuInflater.this.getClass(); + try { + mMethod = localClass.getMethod(methodName, PARAM_TYPES); + } catch (Exception e) { + StringBuilder b = new StringBuilder(); + b.append("Couldn't resolve menu item onClick handler "); + b.append(methodName); + b.append(" in class "); + b.append(localClass.getName()); + throw new InflateException(b.toString(), e); + } + } + + @Override + public boolean onMenuItemClick(MenuItem item) { + final Object[] params = new Object[] { item }; + try { + if (mMethod.getReturnType() == Boolean.TYPE) { + return (Boolean)mMethod.invoke(MenuInflater.this, params); + } + return false; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } +} \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MenuItem.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MenuItem.java new file mode 100644 index 00000000..49740ea4 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MenuItem.java @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * 2011 Jake Wharton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.support.v4.view; + +import com.actionbarsherlock.internal.view.menu.MenuItemWrapper; +import android.content.Intent; +import android.graphics.drawable.Drawable; +import android.view.View; + +/** + *

Interface for direct access to a previously created menu item.

+ * + *

An Item is returned by calling one of the {@link Menu#add(int)} + * methods.

+ * + *

For a feature set of specific menu types, see {@link Menu}.

+ */ +public interface MenuItem extends android.view.MenuItem { + /** + * Interface definition for a callback to be invoked when a menu item is + * clicked. + */ + public static abstract class OnMenuItemClickListener implements android.view.MenuItem.OnMenuItemClickListener { + /** + * Called when a menu item has been invoked. This is the first code + * that is executed; if it returns true, no other callbacks will be + * executed. + * + * @param item The menu item that was invoked. + * @return Return true to consume this click and prevent others from + * executing. + */ + public abstract boolean onMenuItemClick(MenuItem item); + + @Override + public final boolean onMenuItemClick(android.view.MenuItem item) { + return this.onMenuItemClick(new MenuItemWrapper(item)); + } + } + + + + /** + * Always show this item as a button in an Action Bar. Use sparingly! If too + * many items are set to always show in the Action Bar it can crowd the + * Action Bar and degrade the user experience on devices with smaller + * screens. A good rule of thumb is to have no more than 2 items set to + * always show at a time. + */ + public static final int SHOW_AS_ACTION_ALWAYS = android.view.MenuItem.SHOW_AS_ACTION_ALWAYS; + + /** + * Show this item as a button in an Action Bar if the system decides there + * is room for it. + */ + public static final int SHOW_AS_ACTION_IF_ROOM = android.view.MenuItem.SHOW_AS_ACTION_IF_ROOM; + + /** + * Never show this item as a button in an Action Bar. + */ + public static final int SHOW_AS_ACTION_NEVER = android.view.MenuItem.SHOW_AS_ACTION_NEVER; + + /** + * When this item is in the action bar, always show it with a text label + * even if it also has an icon specified. + */ + public static final int SHOW_AS_ACTION_WITH_TEXT = android.view.MenuItem.SHOW_AS_ACTION_WITH_TEXT; + + + + /** + * Returns the currently set action view for this menu item. + * + * @return The item's action view + * @see #setActionView(int) + * @see #setActionView(View) + * @see #setShowAsAction(int) + */ + View getActionView(); + + /** + * Set an action view for this menu item. An action view will be displayed + * in place of an automatically generated menu item element in the UI when + * this item is shown as an action within a parent. + * + * @param resId Layout resource to use for presenting this item to the user. + * @return This Item so additional setters can be called. + * @see #setActionView(View) + */ + MenuItem setActionView(int resId); + + /** + * Set an action view for this menu item. An action view will be displayed + * in place of an automatically generated menu item element in the UI when + * this item is shown as an action within a parent. + * + * @param view View to use for presenting this item to the user. + * @return This Item so additional setters can be called. + * @see #setActionView(int) + */ + MenuItem setActionView(View view); + + /** + * Sets how this item should display in the presence of an Action Bar. The + * parameter actionEnum is a flag set. One of + * {@link #SHOW_AS_ACTION_ALWAYS}, {@link #SHOW_AS_ACTION_IF_ROOM}, or + * {@link #SHOW_AS_ACTION_NEVER} should be used, and you may optionally OR + * the value with {@link #SHOW_AS_ACTION_WITH_TEXT}. + * {@link #SHOW_AS_ACTION_WITH_TEXT} requests that when the item is shown as + * an action, it should be shown with a text label. + * + * @param actionEnum How the item should display. One of + * {@link #SHOW_AS_ACTION_ALWAYS}, {@link #SHOW_AS_ACTION_IF_ROOM}, or + * {@link #SHOW_AS_ACTION_NEVER}. {@link #SHOW_AS_ACTION_NEVER} is the + * default. + */ + void setShowAsAction(int actionEnum); + + // --------------------------------------------------------------------- + // MENU ITEM SUPPORT + // --------------------------------------------------------------------- + + @Override + SubMenu getSubMenu(); + + @Override + MenuItem setAlphabeticShortcut(char alphaChar); + + @Override + MenuItem setCheckable(boolean checkable); + + @Override + MenuItem setChecked(boolean checked); + + @Override + MenuItem setEnabled(boolean enabled); + + @Override + MenuItem setIcon(Drawable icon); + + @Override + MenuItem setIcon(int iconRes); + + @Override + MenuItem setIntent(Intent intent); + + @Override + MenuItem setNumericShortcut(char numericChar); + + /** + * Set a custom listener for invocation of this menu item. + * + * @param menuItemClickListener The object to receive invokations. + * @return This Item so additional setters can be called. + */ + MenuItem setOnMenuItemClickListener(OnMenuItemClickListener menuItemClickListener); + + @Override + MenuItem setShortcut(char numericChar, char alphaChar); + + @Override + MenuItem setTitle(CharSequence title); + + @Override + MenuItem setTitle(int title); + + @Override + MenuItem setTitleCondensed(CharSequence title); + + @Override + MenuItem setVisible(boolean visible); +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MotionEventCompat.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MotionEventCompat.java new file mode 100644 index 00000000..3e5e13e1 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MotionEventCompat.java @@ -0,0 +1,180 @@ +/* + * 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 android.support.v4.view; + +import android.view.MotionEvent; + +/** + * Helper for accessing newer features in MotionEvent. + */ +public class MotionEventCompat { + /** + * Interface for the full API. + */ + interface MotionEventVersionImpl { + public int findPointerIndex(MotionEvent event, int pointerId); + public int getPointerId(MotionEvent event, int pointerIndex); + public float getX(MotionEvent event, int pointerIndex); + public float getY(MotionEvent event, int pointerIndex); + } + + /** + * Interface implementation that doesn't use anything about v4 APIs. + */ + static class BaseMotionEventVersionImpl implements MotionEventVersionImpl { + @Override + public int findPointerIndex(MotionEvent event, int pointerId) { + return -1; + } + @Override + public int getPointerId(MotionEvent event, int pointerIndex) { + return -1; + } + @Override + public float getX(MotionEvent event, int pointerIndex) { + return event.getX(); + } + @Override + public float getY(MotionEvent event, int pointerIndex) { + return event.getY(); + } + } + + /** + * Interface implementation for devices with at least v11 APIs. + */ + static class EclairMotionEventVersionImpl implements MotionEventVersionImpl { + @Override + public int findPointerIndex(MotionEvent event, int pointerId) { + return MotionEventCompatEclair.findPointerIndex(event, pointerId); + } + @Override + public int getPointerId(MotionEvent event, int pointerIndex) { + return MotionEventCompatEclair.getPointerId(event, pointerIndex); + } + @Override + public float getX(MotionEvent event, int pointerIndex) { + return MotionEventCompatEclair.getX(event, pointerIndex); + } + @Override + public float getY(MotionEvent event, int pointerIndex) { + return MotionEventCompatEclair.getY(event, pointerIndex); + } + } + + /** + * Select the correct implementation to use for the current platform. + */ + static final MotionEventVersionImpl IMPL; + static { + if (android.os.Build.VERSION.SDK_INT >= 5) { + IMPL = new EclairMotionEventVersionImpl(); + } else { + IMPL = new BaseMotionEventVersionImpl(); + } + } + + // ------------------------------------------------------------------- + + /** + * Synonym for {@link MotionEvent#ACTION_MASK}. + */ + public static final int ACTION_MASK = 0xff; + + /** + * Synonym for {@link MotionEvent#ACTION_POINTER_DOWN}. + */ + public static final int ACTION_POINTER_DOWN = 5; + + /** + * Synonym for {@link MotionEvent#ACTION_POINTER_UP}. + */ + public static final int ACTION_POINTER_UP = 6; + + /** + * Synonym for {@link MotionEvent#ACTION_HOVER_MOVE}. + */ + public static final int ACTION_HOVER_MOVE = 7; + + /** + * Synonym for {@link MotionEvent#ACTION_SCROLL}. + */ + public static final int ACTION_SCROLL = 8; + + /** + * Synonym for {@link MotionEvent#ACTION_POINTER_INDEX_MASK}. + */ + public static final int ACTION_POINTER_INDEX_MASK = 0xff00; + + /** + * Synonym for {@link MotionEvent#ACTION_POINTER_INDEX_SHIFT}. + */ + public static final int ACTION_POINTER_INDEX_SHIFT = 8; + + /** + * Call {@link MotionEvent#getAction}, returning only the {@link #ACTION_MASK} + * portion. + */ + public static int getActionMasked(MotionEvent event) { + return event.getAction() & ACTION_MASK; + } + + /** + * Call {@link MotionEvent#getAction}, returning only the pointer index + * portion + */ + public static int getActionIndex(MotionEvent event) { + return (event.getAction() & ACTION_POINTER_INDEX_MASK) + >> ACTION_POINTER_INDEX_SHIFT; + } + + /** + * Call {@link MotionEvent#findPointerIndex(int)}. + * If running on a pre-{@android.os.Build.VERSION_CODES#HONEYCOMB} device, + * does nothing and returns -1. + */ + public static int findPointerIndex(MotionEvent event, int pointerId) { + return IMPL.findPointerIndex(event, pointerId); + } + + /** + * Call {@link MotionEvent#getPointerId(int)}. + * If running on a pre-{@android.os.Build.VERSION_CODES#HONEYCOMB} device, + * {@link IndexOutOfBoundsException} is thrown. + */ + public static int getPointerId(MotionEvent event, int pointerIndex) { + return IMPL.getPointerId(event, pointerIndex); + } + + /** + * Call {@link MotionEvent#getX(int)}. + * If running on a pre-{@android.os.Build.VERSION_CODES#HONEYCOMB} device, + * {@link IndexOutOfBoundsException} is thrown. + */ + public static float getX(MotionEvent event, int pointerIndex) { + return IMPL.getX(event, pointerIndex); + } + + /** + * Call {@link MotionEvent#getY(int)}. + * If running on a pre-{@android.os.Build.VERSION_CODES#HONEYCOMB} device, + * {@link IndexOutOfBoundsException} is thrown. + */ + public static float getY(MotionEvent event, int pointerIndex) { + return IMPL.getY(event, pointerIndex); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MotionEventCompatEclair.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MotionEventCompatEclair.java new file mode 100644 index 00000000..dedb1d1d --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/MotionEventCompatEclair.java @@ -0,0 +1,37 @@ +/* + * 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 android.support.v4.view; + +import android.view.MotionEvent; + +/** + * Implementation of motion event compatibility that can call Eclair APIs. + */ +class MotionEventCompatEclair { + public static int findPointerIndex(MotionEvent event, int pointerId) { + return event.findPointerIndex(pointerId); + } + public static int getPointerId(MotionEvent event, int pointerIndex) { + return event.getPointerId(pointerIndex); + } + public static float getX(MotionEvent event, int pointerIndex) { + return event.getX(pointerIndex); + } + public static float getY(MotionEvent event, int pointerIndex) { + return event.getY(pointerIndex); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/PagerAdapter.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/PagerAdapter.java new file mode 100644 index 00000000..5b2e8a5a --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/PagerAdapter.java @@ -0,0 +1,138 @@ +/* + * 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 android.support.v4.view; + +import android.os.Parcelable; +import android.view.View; + +/** + * Base class providing the adapter to populate pages inside of + * a {@link ViewPager}. You will most likely want to use a more + * specific implementation of this, such as + * {@link android.support.v4.app.FragmentPagerAdapter} or + * {@link android.support.v4.app.FragmentStatePagerAdapter}. + */ +public abstract class PagerAdapter { + private DataSetObserver mObserver; + + public static final int POSITION_UNCHANGED = -1; + public static final int POSITION_NONE = -2; + + /** + * Used to watch for changes within the adapter. + */ + interface DataSetObserver { + public void onDataSetChanged(); + } + + /** + * Return the number of views available. + */ + public abstract int getCount(); + + /** + * Called when a change in the shown pages is going to start being made. + * @param container The containing View which is displaying this adapter's + * page views. + */ + public abstract void startUpdate(View container); + + /** + * Create the page for the given position. The adapter is responsible + * for adding the view to the container given here, although it only + * must ensure this is done by the time it returns from + * {@link #finishUpdate()}. + * + * @param container The containing View in which the page will be shown. + * @param position The page position to be instantiated. + * @return Returns an Object representing the new page. This does not + * need to be a View, but can be some other container of the page. + */ + public abstract Object instantiateItem(View container, int position); + + /** + * Remove a page for the given position. The adapter is responsible + * for removing the view from its container, although it only must ensure + * this is done by the time it returns from {@link #finishUpdate()}. + * + * @param container The containing View from which the page will be removed. + * @param position The page position to be removed. + * @param object The same object that was returned by + * {@link #instantiateItem(View, int)}. + */ + public abstract void destroyItem(View container, int position, Object object); + + /** + * Notification for when an item has been selected in the associated pager. + * This can be used to update the state of the item or activity based on which + * item is currently selected. + * + * @param position The selected page position. + * @param object The object of the selected page. + */ + public void onItemSelected(int position, Object object) { + //For rent. Call 1-800-VIEW-PGR. + } + + /** + * Called when the a change in the shown pages has been completed. At this + * point you must ensure that all of the pages have actually been added or + * removed from the container as appropriate. + * @param container The containing View which is displaying this adapter's + * page views. + */ + public abstract void finishUpdate(View container); + + public abstract boolean isViewFromObject(View view, Object object); + + public abstract Parcelable saveState(); + + public abstract void restoreState(Parcelable state, ClassLoader loader); + + /** + * Called when the host view is attempting to determine if an item's position + * has changed. Returns {@link #POSITION_UNCHANGED} if the position of the given + * item has not changed or {@link #POSITION_NONE} if the item is no longer present + * in the adapter. + * + *

The default implementation assumes that items will never + * change position and always returns {@link #POSITION_UNCHANGED}. + * + * @param object Object representing an item, previously returned by a call to + * {@link #instantiateItem(View, int)}. + * @return object's new position index from [0, {@link #getCount()}), + * {@link #POSITION_UNCHANGED} if the object's position has not changed, + * or {@link #POSITION_NONE} if the item is no longer present. + */ + public int getItemPosition(Object object) { + return POSITION_UNCHANGED; + } + + /** + * This method should be called by the application if the data backing this adapter has changed + * and associated views should update. + */ + public void notifyDataSetChanged() { + if (mObserver != null) { + mObserver.onDataSetChanged(); + } + } + + void setDataSetObserver(DataSetObserver observer) { + mObserver = observer; + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/SubMenu.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/SubMenu.java new file mode 100644 index 00000000..724f0ff5 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/SubMenu.java @@ -0,0 +1,30 @@ +package android.support.v4.view; + +import android.graphics.drawable.Drawable; +import android.view.View; + +public interface SubMenu extends android.view.SubMenu { + @Override + MenuItem getItem(); + + @Override + SubMenu setHeaderIcon(Drawable icon); + + @Override + SubMenu setHeaderIcon(int iconRes); + + @Override + SubMenu setHeaderTitle(CharSequence title); + + @Override + SubMenu setHeaderTitle(int titleRes); + + @Override + SubMenu setHeaderView(View view); + + @Override + SubMenu setIcon(Drawable icon); + + @Override + SubMenu setIcon(int iconRes); +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/VelocityTrackerCompat.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/VelocityTrackerCompat.java new file mode 100644 index 00000000..8c874906 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/VelocityTrackerCompat.java @@ -0,0 +1,92 @@ +/* + * 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 android.support.v4.view; + +import android.view.VelocityTracker; + +/** + * Helper for accessing newer features in VelocityTracker. + */ +public class VelocityTrackerCompat { + /** + * Interface for the full API. + */ + interface VelocityTrackerVersionImpl { + public float getXVelocity(VelocityTracker tracker, int pointerId); + public float getYVelocity(VelocityTracker tracker, int pointerId); + } + + /** + * Interface implementation that doesn't use anything about v4 APIs. + */ + static class BaseVelocityTrackerVersionImpl implements VelocityTrackerVersionImpl { + @Override + public float getXVelocity(VelocityTracker tracker, int pointerId) { + return tracker.getXVelocity(); + } + @Override + public float getYVelocity(VelocityTracker tracker, int pointerId) { + return tracker.getYVelocity(); + } + } + + /** + * Interface implementation for devices with at least v11 APIs. + */ + static class HoneycombVelocityTrackerVersionImpl implements VelocityTrackerVersionImpl { + @Override + public float getXVelocity(VelocityTracker tracker, int pointerId) { + return VelocityTrackerCompatHoneycomb.getXVelocity(tracker, pointerId); + } + @Override + public float getYVelocity(VelocityTracker tracker, int pointerId) { + return VelocityTrackerCompatHoneycomb.getYVelocity(tracker, pointerId); + } + } + + /** + * Select the correct implementation to use for the current platform. + */ + static final VelocityTrackerVersionImpl IMPL; + static { + if (android.os.Build.VERSION.SDK_INT >= 11) { + IMPL = new HoneycombVelocityTrackerVersionImpl(); + } else { + IMPL = new BaseVelocityTrackerVersionImpl(); + } + } + + // ------------------------------------------------------------------- + + /** + * Call {@link VelocityTracker#getXVelocity(int)}. + * If running on a pre-{@android.os.Build.VERSION_CODES#HONEYCOMB} device, + * returns {@link VelocityTracker#getXVelocity()}. + */ + public static float getXVelocity(VelocityTracker tracker, int pointerId) { + return IMPL.getXVelocity(tracker, pointerId); + } + + /** + * Call {@link VelocityTracker#getYVelocity(int)}. + * If running on a pre-{@android.os.Build.VERSION_CODES#HONEYCOMB} device, + * returns {@link VelocityTracker#getYVelocity()}. + */ + public static float getYVelocity(VelocityTracker tracker, int pointerId) { + return IMPL.getYVelocity(tracker, pointerId); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/VelocityTrackerCompatHoneycomb.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/VelocityTrackerCompatHoneycomb.java new file mode 100644 index 00000000..4f9d326c --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/VelocityTrackerCompatHoneycomb.java @@ -0,0 +1,31 @@ +/* + * 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 android.support.v4.view; + +import android.view.VelocityTracker; + +/** + * Implementation of velocity tracker compatibility that can call Honeycomb APIs. + */ +class VelocityTrackerCompatHoneycomb { + public static float getXVelocity(VelocityTracker tracker, int pointerId) { + return tracker.getXVelocity(pointerId); + } + public static float getYVelocity(VelocityTracker tracker, int pointerId) { + return tracker.getYVelocity(pointerId); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ViewConfigurationCompat.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ViewConfigurationCompat.java new file mode 100644 index 00000000..14446621 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ViewConfigurationCompat.java @@ -0,0 +1,74 @@ +/* + * 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 android.support.v4.view; + +import android.view.ViewConfiguration; + +/** + * Helper for accessing newer features in ViewConfiguration. + */ +public class ViewConfigurationCompat { + /** + * Interface for the full API. + */ + interface ViewConfigurationVersionImpl { + public int getScaledPagingTouchSlop(ViewConfiguration config); + } + + /** + * Interface implementation that doesn't use anything about v4 APIs. + */ + static class BaseViewConfigurationVersionImpl implements ViewConfigurationVersionImpl { + @Override + public int getScaledPagingTouchSlop(ViewConfiguration config) { + return config.getScaledTouchSlop(); + } + } + + /** + * Interface implementation for devices with at least v11 APIs. + */ + static class FroyoViewConfigurationVersionImpl implements ViewConfigurationVersionImpl { + @Override + public int getScaledPagingTouchSlop(ViewConfiguration config) { + return ViewConfigurationCompatFroyo.getScaledPagingTouchSlop(config); + } + } + + /** + * Select the correct implementation to use for the current platform. + */ + static final ViewConfigurationVersionImpl IMPL; + static { + if (android.os.Build.VERSION.SDK_INT >= 11) { + IMPL = new FroyoViewConfigurationVersionImpl(); + } else { + IMPL = new BaseViewConfigurationVersionImpl(); + } + } + + // ------------------------------------------------------------------- + + /** + * Call {@link ViewConfiguration#getScaledPagingTouchSlop()}. + * If running on a pre-{@android.os.Build.VERSION_CODES#FROYO} device, + * returns {@link ViewConfiguration#getScaledTouchSlop()}. + */ + public static int getScaledPagingTouchSlop(ViewConfiguration config) { + return IMPL.getScaledPagingTouchSlop(config); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ViewConfigurationCompatFroyo.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ViewConfigurationCompatFroyo.java new file mode 100644 index 00000000..e97a2a2e --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ViewConfigurationCompatFroyo.java @@ -0,0 +1,28 @@ +/* + * 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 android.support.v4.view; + +import android.view.ViewConfiguration; + +/** + * Implementation of menu compatibility that can call Honeycomb APIs. + */ +class ViewConfigurationCompatFroyo { + public static int getScaledPagingTouchSlop(ViewConfiguration config) { + return config.getScaledPagingTouchSlop(); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ViewPager.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ViewPager.java new file mode 100644 index 00000000..9d69975a --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/ViewPager.java @@ -0,0 +1,996 @@ +/* + * 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 android.support.v4.view; + +import android.os.Build; +import android.os.Parcel; +import android.os.Parcelable; + +import android.content.Context; +import android.support.v4.os.ParcelableCompat; +import android.support.v4.os.ParcelableCompatCreatorCallbacks; +import android.util.AttributeSet; +import android.util.Log; +import android.view.MotionEvent; +import android.view.VelocityTracker; +import android.view.View; +import android.view.ViewConfiguration; +import android.view.ViewGroup; +import android.widget.Scroller; + +import java.util.ArrayList; + +/** + * Layout manager that allows the user to flip left and right + * through pages of data. You supply an implementation of a + * {@link PagerAdapter} to generate the pages that the view shows. + * + *

Note this class is currently under early design and + * development. The API will likely change in later updates of + * the compatibility library, requiring changes to the source code + * of apps when they are compiled against the newer version.

+ */ +public class ViewPager extends ViewGroup { + private static final String TAG = "ViewPager"; + private static final boolean DEBUG = false; + + private static final boolean USE_CACHE = false; + + static class ItemInfo { + Object object; + int position; + boolean scrolling; + } + + private final ArrayList mItems = new ArrayList(); + + private PagerAdapter mAdapter; + private int mCurItem; // Index of currently displayed page. + private int mRestoredCurItem = -1; + private Parcelable mRestoredAdapterState = null; + private ClassLoader mRestoredClassLoader = null; + private Scroller mScroller; + private PagerAdapter.DataSetObserver mObserver; + + private int mChildWidthMeasureSpec; + private int mChildHeightMeasureSpec; + private boolean mInLayout; + + private boolean mScrollingCacheEnabled; + + private boolean mPopulatePending; + private boolean mScrolling; + + private boolean mIsBeingDragged; + private boolean mIsUnableToDrag; + private int mTouchSlop; + private float mInitialMotionX; + /** + * Position of the last motion event. + */ + private float mLastMotionX; + private float mLastMotionY; + /** + * ID of the active pointer. This is used to retain consistency during + * drags/flings if multiple pointers are used. + */ + private int mActivePointerId = INVALID_POINTER; + /** + * Sentinel value for no current active pointer. + * Used by {@link #mActivePointerId}. + */ + private static final int INVALID_POINTER = -1; + + /** + * Determines speed during touch scrolling + */ + private VelocityTracker mVelocityTracker; + private int mMinimumVelocity; + private int mMaximumVelocity; + + private OnPageChangeListener mOnPageChangeListener; + + /** + * Indicates that the pager is in an idle, settled state. The current page + * is fully in view and no animation is in progress. + */ + public static final int SCROLL_STATE_IDLE = 0; + + /** + * Indicates that the pager is currently being dragged by the user. + */ + public static final int SCROLL_STATE_DRAGGING = 1; + + /** + * Indicates that the pager is in the process of settling to a final position. + */ + public static final int SCROLL_STATE_SETTLING = 2; + + private int mScrollState = SCROLL_STATE_IDLE; + + /** + * Callback interface for responding to changing state of the selected page. + */ + public interface OnPageChangeListener { + + /** + * This method will be invoked when the current page is scrolled, either as part + * of a programmatically initiated smooth scroll or a user initiated touch scroll. + * + * @param position Position index of the first page currently being displayed. + * Page position+1 will be visible if positionOffset is nonzero. + * @param positionOffset Value from [0, 1) indicating the offset from the page at position. + * @param positionOffsetPixels Value in pixels indicating the offset from position. + */ + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels); + + /** + * This method will be invoked when a new page becomes selected. Animation is not + * necessarily complete. + * + * @param position Position index of the new selected page. + */ + public void onPageSelected(int position); + + /** + * Called when the scroll state changes. Useful for discovering when the user + * begins dragging, when the pager is automatically settling to the current page, + * or when it is fully stopped/idle. + * + * @param state The new scroll state. + * @see ViewPager#SCROLL_STATE_IDLE + * @see ViewPager#SCROLL_STATE_DRAGGING + * @see ViewPager#SCROLL_STATE_SETTLING + */ + public void onPageScrollStateChanged(int state); + } + + /** + * Simple implementation of the {@link OnPageChangeListener} interface with stub + * implementations of each method. Extend this if you do not intend to override + * every method of {@link OnPageChangeListener}. + */ + public static class SimpleOnPageChangeListener implements OnPageChangeListener { + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + // This space for rent + } + + @Override + public void onPageSelected(int position) { + // This space for rent + } + + @Override + public void onPageScrollStateChanged(int state) { + // This space for rent + } + } + + public ViewPager(Context context) { + super(context); + initViewPager(); + } + + public ViewPager(Context context, AttributeSet attrs) { + super(context, attrs); + initViewPager(); + } + + void initViewPager() { + setWillNotDraw(false); + mScroller = new Scroller(getContext()); + final ViewConfiguration configuration = ViewConfiguration.get(getContext()); + mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); + mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); + mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); + } + + private void setScrollState(int newState) { + if (mScrollState == newState) { + return; + } + + mScrollState = newState; + if (mOnPageChangeListener != null) { + mOnPageChangeListener.onPageScrollStateChanged(newState); + } + } + + public void setAdapter(PagerAdapter adapter) { + if (mAdapter != null) { + mAdapter.setDataSetObserver(null); + } + + mAdapter = adapter; + + if (mAdapter != null) { + if (mObserver == null) { + mObserver = new DataSetObserver(); + } + mAdapter.setDataSetObserver(mObserver); + mPopulatePending = false; + if (mRestoredCurItem >= 0) { + mAdapter.restoreState(mRestoredAdapterState, mRestoredClassLoader); + setCurrentItemInternal(mRestoredCurItem, false, true); + mRestoredCurItem = -1; + mRestoredAdapterState = null; + mRestoredClassLoader = null; + } else { + populate(); + } + } + } + + public PagerAdapter getAdapter() { + return mAdapter; + } + + public void setCurrentItem(int item) { + mPopulatePending = false; + setCurrentItemInternal(item, true, false); + } + + void setCurrentItemInternal(int item, boolean smoothScroll, boolean always) { + if (mAdapter == null || mAdapter.getCount() <= 0) { + setScrollingCacheEnabled(false); + return; + } + if (!always && mCurItem == item && mItems.size() != 0) { + setScrollingCacheEnabled(false); + return; + } + if (item < 0) { + item = 0; + } else if (item >= mAdapter.getCount()) { + item = mAdapter.getCount() - 1; + } + if (item > (mCurItem+1) || item < (mCurItem-1)) { + // We are doing a jump by more than one page. To avoid + // glitches, we want to keep all current pages in the view + // until the scroll ends. + for (int i=0; i 0; + int newCurrItem = -1; + + for (int i = 0; i < mItems.size(); i++) { + final ItemInfo ii = mItems.get(i); + final int newPos = mAdapter.getItemPosition(ii.object); + + if (newPos == PagerAdapter.POSITION_UNCHANGED) { + continue; + } + + if (newPos == PagerAdapter.POSITION_NONE) { + mItems.remove(i); + i--; + mAdapter.destroyItem(this, ii.position, ii.object); + needPopulate = true; + + if (mCurItem == ii.position) { + // Keep the current item in the valid range + newCurrItem = Math.max(0, Math.min(mCurItem, mAdapter.getCount() - 1)); + } + continue; + } + + if (ii.position != newPos) { + if (ii.position == mCurItem) { + // Our current item changed position. Follow it. + newCurrItem = newPos; + } + + ii.position = newPos; + needPopulate = true; + } + } + + if (newCurrItem >= 0) { + // TODO This currently causes a jump. + setCurrentItemInternal(newCurrItem, false, true); + needPopulate = true; + } + if (needPopulate) { + populate(); + requestLayout(); + } + } + + void populate() { + if (mAdapter == null) { + return; + } + + // Bail now if we are waiting to populate. This is to hold off + // on creating views from the time the user releases their finger to + // fling to a new position until we have finished the scroll to + // that position, avoiding glitches from happening at that point. + if (mPopulatePending) { + if (DEBUG) Log.i(TAG, "populate is pending, skipping for now..."); + return; + } + + // Also, don't populate until we are attached to a window. This is to + // avoid trying to populate before we have restored our view hierarchy + // state and conflicting with what is restored. + if (getWindowToken() == null) { + return; + } + + mAdapter.startUpdate(this); + + final int startPos = mCurItem > 0 ? mCurItem - 1 : mCurItem; + final int N = mAdapter.getCount(); + final int endPos = mCurItem < (N-1) ? mCurItem+1 : N-1; + + if (DEBUG) Log.v(TAG, "populating: startPos=" + startPos + " endPos=" + endPos); + + // Add and remove pages in the existing list. + int lastPos = -1; + for (int i=0; i endPos) && !ii.scrolling) { + if (DEBUG) Log.i(TAG, "removing: " + ii.position + " @ " + i); + mItems.remove(i); + i--; + mAdapter.destroyItem(this, ii.position, ii.object); + } else if (lastPos < endPos && ii.position > startPos) { + // The next item is outside of our range, but we have a gap + // between it and the last item where we want to have a page + // shown. Fill in the gap. + lastPos++; + if (lastPos < startPos) { + lastPos = startPos; + } + while (lastPos <= endPos && lastPos < ii.position) { + if (DEBUG) Log.i(TAG, "inserting: " + lastPos + " @ " + i); + addNewItem(lastPos, i); + lastPos++; + i++; + } + } + lastPos = ii.position; + } + + // Add any new pages we need at the end. + lastPos = mItems.size() > 0 ? mItems.get(mItems.size()-1).position : -1; + boolean first = (lastPos == -1); + if (lastPos < endPos) { + lastPos++; + lastPos = lastPos > startPos ? lastPos : startPos; + while (lastPos <= endPos) { + if (DEBUG) Log.i(TAG, "appending: " + lastPos); + addNewItem(lastPos, -1); + if (first && (lastPos == mCurItem)) { + //Creating first item for the first time + mAdapter.onItemSelected(mCurItem, mItems.get(mItems.size() - 1).object); + first = false; + } + lastPos++; + } + } + + if (DEBUG) { + Log.i(TAG, "Current page list:"); + for (int i=0; i CREATOR + = ParcelableCompat.newCreator(new ParcelableCompatCreatorCallbacks() { + @Override + public SavedState createFromParcel(Parcel in, ClassLoader loader) { + return new SavedState(in, loader); + } + @Override + public SavedState[] newArray(int size) { + return new SavedState[size]; + } + }); + + SavedState(Parcel in, ClassLoader loader) { + super(in); + if (loader == null) { + loader = getClass().getClassLoader(); + } + position = in.readInt(); + adapterState = in.readParcelable(loader); + this.loader = loader; + } + } + + @Override + public Parcelable onSaveInstanceState() { + Parcelable superState = super.onSaveInstanceState(); + SavedState ss = new SavedState(superState); + ss.position = mCurItem; + ss.adapterState = mAdapter.saveState(); + return ss; + } + + @Override + public void onRestoreInstanceState(Parcelable state) { + if (!(state instanceof SavedState)) { + super.onRestoreInstanceState(state); + return; + } + + SavedState ss = (SavedState)state; + super.onRestoreInstanceState(ss.getSuperState()); + + if (mAdapter != null) { + mAdapter.restoreState(ss.adapterState, ss.loader); + setCurrentItemInternal(ss.position, false, true); + } else { + mRestoredCurItem = ss.position; + mRestoredAdapterState = ss.adapterState; + mRestoredClassLoader = ss.loader; + } + } + + @Override + public void addView(View child, int index, LayoutParams params) { + if (mInLayout) { + addViewInLayout(child, index, params); + child.measure(mChildWidthMeasureSpec, mChildHeightMeasureSpec); + } else { + super.addView(child, index, params); + } + + if (USE_CACHE) { + if (child.getVisibility() != GONE) { + child.setDrawingCacheEnabled(mScrollingCacheEnabled); + } else { + child.setDrawingCacheEnabled(false); + } + } + } + + ItemInfo infoForChild(View child) { + for (int i=0; i Build.VERSION_CODES.DONUT) { + // If we don't have a valid id, the touch down wasn't on content. + break; + } + + final int pointerIndex = MotionEventCompat.findPointerIndex(ev, activePointerId); + final float x = MotionEventCompat.getX(ev, pointerIndex); + final float dx = x - mLastMotionX; + final float xDiff = Math.abs(dx); + final float y = MotionEventCompat.getY(ev, pointerIndex); + final float yDiff = Math.abs(y - mLastMotionY); + if (DEBUG) Log.v(TAG, "Moved x to " + x + "," + y + " diff=" + xDiff + "," + yDiff); + + if (xDiff > mTouchSlop && xDiff > yDiff) { + if (DEBUG) Log.v(TAG, "Starting drag!"); + mIsBeingDragged = true; + setScrollState(SCROLL_STATE_DRAGGING); + mLastMotionX = x; + setScrollingCacheEnabled(true); + } else { + if (yDiff > mTouchSlop) { + // The finger has moved enough in the vertical + // direction to be counted as a drag... abort + // any attempt to drag horizontally, to work correctly + // with children that have scrolling containers. + if (DEBUG) Log.v(TAG, "Starting unable to drag!"); + mIsUnableToDrag = true; + } + } + break; + } + + case MotionEvent.ACTION_DOWN: { + /* + * Remember location of down touch. + * ACTION_DOWN always refers to pointer index 0. + */ + mLastMotionX = mInitialMotionX = ev.getX(); + mLastMotionY = ev.getY(); + mActivePointerId = MotionEventCompat.getPointerId(ev, 0); + + if (mScrollState == SCROLL_STATE_SETTLING) { + // Let the user 'catch' the pager as it animates. + mIsBeingDragged = true; + mIsUnableToDrag = false; + setScrollState(SCROLL_STATE_DRAGGING); + } else { + completeScroll(); + mIsBeingDragged = false; + mIsUnableToDrag = false; + } + + if (DEBUG) Log.v(TAG, "Down at " + mLastMotionX + "," + mLastMotionY + + " mIsBeingDragged=" + mIsBeingDragged + + "mIsUnableToDrag=" + mIsUnableToDrag); + break; + } + + case MotionEventCompat.ACTION_POINTER_UP: + onSecondaryPointerUp(ev); + break; + } + + /* + * The only time we want to intercept motion events is if we are in the + * drag mode. + */ + return mIsBeingDragged; + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + + if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) { + // Don't handle edge touches immediately -- they may actually belong to one of our + // descendants. + return false; + } + + if (mAdapter == null || mAdapter.getCount() == 0) { + // Nothing to present or scroll; nothing to touch. + return false; + } + + if (mVelocityTracker == null) { + mVelocityTracker = VelocityTracker.obtain(); + } + mVelocityTracker.addMovement(ev); + + final int action = ev.getAction(); + + switch (action & MotionEventCompat.ACTION_MASK) { + case MotionEvent.ACTION_DOWN: { + /* + * If being flinged and user touches, stop the fling. isFinished + * will be false if being flinged. + */ + completeScroll(); + + // Remember where the motion event started + mLastMotionX = mInitialMotionX = ev.getX(); + mActivePointerId = MotionEventCompat.getPointerId(ev, 0); + break; + } + case MotionEvent.ACTION_MOVE: + if (!mIsBeingDragged) { + final int pointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId); + final float x = MotionEventCompat.getX(ev, pointerIndex); + final float xDiff = Math.abs(x - mLastMotionX); + final float y = MotionEventCompat.getY(ev, pointerIndex); + final float yDiff = Math.abs(y - mLastMotionY); + if (DEBUG) Log.v(TAG, "Moved x to " + x + "," + y + " diff=" + xDiff + "," + yDiff); + if (xDiff > mTouchSlop && xDiff > yDiff) { + if (DEBUG) Log.v(TAG, "Starting drag!"); + mIsBeingDragged = true; + mLastMotionX = x; + setScrollState(SCROLL_STATE_DRAGGING); + setScrollingCacheEnabled(true); + } + } + if (mIsBeingDragged) { + // Scroll to follow the motion event + final int activePointerIndex = MotionEventCompat.findPointerIndex( + ev, mActivePointerId); + final float x = MotionEventCompat.getX(ev, activePointerIndex); + final float deltaX = mLastMotionX - x; + mLastMotionX = x; + float scrollX = getScrollX() + deltaX; + final int width = getWidth(); + + final float leftBound = Math.max(0, (mCurItem - 1) * width); + final float rightBound = + Math.min(mCurItem + 1, mAdapter.getCount() - 1) * width; + if (scrollX < leftBound) { + scrollX = leftBound; + } else if (scrollX > rightBound) { + scrollX = rightBound; + } + // Don't lose the rounded component + mLastMotionX += scrollX - (int) scrollX; + scrollTo((int) scrollX, getScrollY()); + if (mOnPageChangeListener != null) { + final int position = (int) scrollX / width; + final int positionOffsetPixels = (int) scrollX % width; + final float positionOffset = (float) positionOffsetPixels / width; + mOnPageChangeListener.onPageScrolled(position, positionOffset, + positionOffsetPixels); + } + } + break; + case MotionEvent.ACTION_UP: + if (mIsBeingDragged) { + final VelocityTracker velocityTracker = mVelocityTracker; + velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity); + int initialVelocity = (int)VelocityTrackerCompat.getYVelocity( + velocityTracker, mActivePointerId); + mPopulatePending = true; + if ((Math.abs(initialVelocity) > mMinimumVelocity) + || Math.abs(mInitialMotionX-mLastMotionX) >= (getWidth()/3)) { + if (mLastMotionX > mInitialMotionX) { + setCurrentItemInternal(mCurItem-1, true, true); + } else { + setCurrentItemInternal(mCurItem+1, true, true); + } + } else { + setCurrentItemInternal(mCurItem, true, true); + } + + mActivePointerId = INVALID_POINTER; + endDrag(); + } + break; + case MotionEvent.ACTION_CANCEL: + if (mIsBeingDragged) { + setCurrentItemInternal(mCurItem, true, true); + mActivePointerId = INVALID_POINTER; + endDrag(); + } + break; + case MotionEventCompat.ACTION_POINTER_DOWN: { + final int index = MotionEventCompat.getActionIndex(ev); + final float x = MotionEventCompat.getX(ev, index); + mLastMotionX = x; + mActivePointerId = MotionEventCompat.getPointerId(ev, index); + break; + } + case MotionEventCompat.ACTION_POINTER_UP: + onSecondaryPointerUp(ev); + mLastMotionX = MotionEventCompat.getX(ev, + MotionEventCompat.findPointerIndex(ev, mActivePointerId)); + break; + } + return true; + } + + private void onSecondaryPointerUp(MotionEvent ev) { + final int pointerIndex = MotionEventCompat.getActionIndex(ev); + final int pointerId = MotionEventCompat.getPointerId(ev, pointerIndex); + if (pointerId == mActivePointerId) { + // This was our active pointer going up. Choose a new + // active pointer and adjust accordingly. + final int newPointerIndex = pointerIndex == 0 ? 1 : 0; + mLastMotionX = MotionEventCompat.getX(ev, newPointerIndex); + mActivePointerId = MotionEventCompat.getPointerId(ev, newPointerIndex); + if (mVelocityTracker != null) { + mVelocityTracker.clear(); + } + } + } + + private void endDrag() { + mIsBeingDragged = false; + mIsUnableToDrag = false; + + if (mVelocityTracker != null) { + mVelocityTracker.recycle(); + mVelocityTracker = null; + } + } + + private void setScrollingCacheEnabled(boolean enabled) { + if (mScrollingCacheEnabled != enabled) { + mScrollingCacheEnabled = enabled; + if (USE_CACHE) { + final int size = getChildCount(); + for (int i = 0; i < size; ++i) { + final View child = getChildAt(i); + if (child.getVisibility() != GONE) { + child.setDrawingCacheEnabled(enabled); + } + } + } + } + } + + private class DataSetObserver implements PagerAdapter.DataSetObserver { + @Override + public void onDataSetChanged() { + dataSetChanged(); + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/Window.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/Window.java new file mode 100644 index 00000000..f2a6400e --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/Window.java @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * 2011 Jake Wharton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.support.v4.view; + +import android.content.Context; + +/** + *

Abstract base class for a top-level window look and behavior policy. An + * instance of this class should be used as the top-level view added to the + * window manager. It provides standard UI policies such as a background, title + * area, default key processing, etc.

+ * + *

The only existing implementation of this abstract class is + * android.policy.PhoneWindow, which you should instantiate when needing a + * Window. Eventually that class will be refactored and a factory method added + * for creating Window instances without knowing about a particular + * implementation.

+ */ +public abstract class Window extends android.view.Window { + /* + * We use long values so that we can intercept the call to + * requestWindowFeature in our Activity. + */ + + /** + * Flag for enabling the Action Bar. This is enabled by default for some + * devices. The Action Bar replaces the title bar and provides an alternate + * location for an on-screen menu button on some devices. + */ + public static final long FEATURE_ACTION_BAR = android.view.Window.FEATURE_ACTION_BAR; + + /** + * Enable the pre-3.0 action bar implementation to honor the 'withText' + * attribute on menu items regardless of display resolution and/or density. + */ + //Hopefully the native Window.FEATURE_XXX numbering won't get this high anytime soon. + public static final long FEATURE_ACTION_BAR_ITEM_TEXT = 31; + + /** + * Flag for requesting an Action Bar that overlays window content. Normally + * an Action Bar will sit in the space above window content, but if this + * feature is requested along with {@link #FEATURE_ACTION_BAR} it will be + * layered over the window content itself. This is useful if you would like + * your app to have more control over how the Action Bar is displayed, such + * as letting application content scroll beneath an Action Bar with a + * transparent background or otherwise displaying a transparent/translucent + * Action Bar over application content. + */ + public static final long FEATURE_ACTION_BAR_OVERLAY = android.view.Window.FEATURE_ACTION_BAR_OVERLAY; + + /** + * Flag for specifying the behavior of action modes when an Action Bar is + * not present. If overlay is enabled, the action mode UI will be allowed to + * cover existing window content. + */ + public static final long FEATURE_ACTION_MODE_OVERLAY = android.view.Window.FEATURE_ACTION_MODE_OVERLAY; + + /** + * Flag for indeterminate progress . + */ + public static final long FEATURE_INDETERMINATE_PROGRESS = android.view.Window.FEATURE_INDETERMINATE_PROGRESS; + + + + /** + * Create a new instance for a context. + * + * @param context Context. + */ + public Window(Context context) { + super(context); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/CursorAdapter.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/CursorAdapter.java new file mode 100644 index 00000000..9c6b8184 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/CursorAdapter.java @@ -0,0 +1,484 @@ +/* + * 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 android.support.v4.widget; + +import android.content.Context; +import android.database.ContentObserver; +import android.database.Cursor; +import android.database.DataSetObserver; +import android.os.Handler; +import android.util.Config; +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.Filter; +import android.widget.FilterQueryProvider; +import android.widget.Filterable; + +/** + * Static library support version of the framework's {@link android.widget.CursorAdapter}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + */ +public abstract class CursorAdapter extends BaseAdapter implements Filterable, + CursorFilter.CursorFilterClient { + /** + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected boolean mDataValid; + /** + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected boolean mAutoRequery; + /** + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected Cursor mCursor; + /** + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected Context mContext; + /** + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected int mRowIDColumn; + /** + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected ChangeObserver mChangeObserver; + /** + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected DataSetObserver mDataSetObserver; + /** + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected CursorFilter mCursorFilter; + /** + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected FilterQueryProvider mFilterQueryProvider; + + /** + * If set the adapter will call requery() on the cursor whenever a content change + * notification is delivered. Implies {@link #FLAG_REGISTER_CONTENT_OBSERVER}. + * + * @deprecated This option is discouraged, as it results in Cursor queries + * being performed on the application's UI thread and thus can cause poor + * responsiveness or even Application Not Responding errors. As an alternative, + * use {@link android.app.LoaderManager} with a {@link android.content.CursorLoader}. + */ + @Deprecated + public static final int FLAG_AUTO_REQUERY = 0x01; + + /** + * If set the adapter will register a content observer on the cursor and will call + * {@link #onContentChanged()} when a notification comes in. Be careful when + * using this flag: you will need to unset the current Cursor from the adapter + * to avoid leaks due to its registered observers. This flag is not needed + * when using a CursorAdapter with a + * {@link android.content.CursorLoader}. + */ + public static final int FLAG_REGISTER_CONTENT_OBSERVER = 0x02; + + /** + * Constructor that always enables auto-requery. + * + * @deprecated This option is discouraged, as it results in Cursor queries + * being performed on the application's UI thread and thus can cause poor + * responsiveness or even Application Not Responding errors. As an alternative, + * use {@link android.app.LoaderManager} with a {@link android.content.CursorLoader}. + * + * @param c The cursor from which to get the data. + * @param context The context + */ + @Deprecated + public CursorAdapter(Context context, Cursor c) { + init(context, c, FLAG_AUTO_REQUERY); + } + + /** + * Constructor that allows control over auto-requery. It is recommended + * you not use this, but instead {@link #CursorAdapter(Context, Cursor, int)}. + * When using this constructor, {@link #FLAG_REGISTER_CONTENT_OBSERVER} + * will always be set. + * + * @param c The cursor from which to get the data. + * @param context The context + * @param autoRequery If true the adapter will call requery() on the + * cursor whenever it changes so the most recent + * data is always displayed. Using true here is discouraged. + */ + public CursorAdapter(Context context, Cursor c, boolean autoRequery) { + init(context, c, autoRequery ? FLAG_AUTO_REQUERY : FLAG_REGISTER_CONTENT_OBSERVER); + } + + /** + * Recommended constructor. + * + * @param c The cursor from which to get the data. + * @param context The context + * @param flags Flags used to determine the behavior of the adapter; may + * be any combination of {@link #FLAG_AUTO_REQUERY} and + * {@link #FLAG_REGISTER_CONTENT_OBSERVER}. + */ + public CursorAdapter(Context context, Cursor c, int flags) { + init(context, c, flags); + } + + /** + * @deprecated Don't use this, use the normal constructor. This will + * be removed in the future. + */ + @Deprecated + protected void init(Context context, Cursor c, boolean autoRequery) { + init(context, c, autoRequery ? FLAG_AUTO_REQUERY : FLAG_REGISTER_CONTENT_OBSERVER); + } + + void init(Context context, Cursor c, int flags) { + if ((flags & FLAG_AUTO_REQUERY) == FLAG_AUTO_REQUERY) { + flags |= FLAG_REGISTER_CONTENT_OBSERVER; + mAutoRequery = true; + } else { + mAutoRequery = false; + } + boolean cursorPresent = c != null; + mCursor = c; + mDataValid = cursorPresent; + mContext = context; + mRowIDColumn = cursorPresent ? c.getColumnIndexOrThrow("_id") : -1; + if ((flags & FLAG_REGISTER_CONTENT_OBSERVER) == FLAG_REGISTER_CONTENT_OBSERVER) { + mChangeObserver = new ChangeObserver(); + mDataSetObserver = new MyDataSetObserver(); + } else { + mChangeObserver = null; + mDataSetObserver = null; + } + + if (cursorPresent) { + if (mChangeObserver != null) c.registerContentObserver(mChangeObserver); + if (mDataSetObserver != null) c.registerDataSetObserver(mDataSetObserver); + } + } + + /** + * Returns the cursor. + * @return the cursor. + */ + public Cursor getCursor() { + return mCursor; + } + + /** + * @see android.widget.ListAdapter#getCount() + */ + public int getCount() { + if (mDataValid && mCursor != null) { + return mCursor.getCount(); + } else { + return 0; + } + } + + /** + * @see android.widget.ListAdapter#getItem(int) + */ + public Object getItem(int position) { + if (mDataValid && mCursor != null) { + mCursor.moveToPosition(position); + return mCursor; + } else { + return null; + } + } + + /** + * @see android.widget.ListAdapter#getItemId(int) + */ + public long getItemId(int position) { + if (mDataValid && mCursor != null) { + if (mCursor.moveToPosition(position)) { + return mCursor.getLong(mRowIDColumn); + } else { + return 0; + } + } else { + return 0; + } + } + + @Override + public boolean hasStableIds() { + return true; + } + + /** + * @see android.widget.ListAdapter#getView(int, View, ViewGroup) + */ + public View getView(int position, View convertView, ViewGroup parent) { + if (!mDataValid) { + throw new IllegalStateException("this should only be called when the cursor is valid"); + } + if (!mCursor.moveToPosition(position)) { + throw new IllegalStateException("couldn't move cursor to position " + position); + } + View v; + if (convertView == null) { + v = newView(mContext, mCursor, parent); + } else { + v = convertView; + } + bindView(v, mContext, mCursor); + return v; + } + + @Override + public View getDropDownView(int position, View convertView, ViewGroup parent) { + if (mDataValid) { + mCursor.moveToPosition(position); + View v; + if (convertView == null) { + v = newDropDownView(mContext, mCursor, parent); + } else { + v = convertView; + } + bindView(v, mContext, mCursor); + return v; + } else { + return null; + } + } + + /** + * Makes a new view to hold the data pointed to by cursor. + * @param context Interface to application's global information + * @param cursor The cursor from which to get the data. The cursor is already + * moved to the correct position. + * @param parent The parent to which the new view is attached to + * @return the newly created view. + */ + public abstract View newView(Context context, Cursor cursor, ViewGroup parent); + + /** + * Makes a new drop down view to hold the data pointed to by cursor. + * @param context Interface to application's global information + * @param cursor The cursor from which to get the data. The cursor is already + * moved to the correct position. + * @param parent The parent to which the new view is attached to + * @return the newly created view. + */ + public View newDropDownView(Context context, Cursor cursor, ViewGroup parent) { + return newView(context, cursor, parent); + } + + /** + * Bind an existing view to the data pointed to by cursor + * @param view Existing view, returned earlier by newView + * @param context Interface to application's global information + * @param cursor The cursor from which to get the data. The cursor is already + * moved to the correct position. + */ + public abstract void bindView(View view, Context context, Cursor cursor); + + /** + * Change the underlying cursor to a new cursor. If there is an existing cursor it will be + * closed. + * + * @param cursor The new cursor to be used + */ + public void changeCursor(Cursor cursor) { + Cursor old = swapCursor(cursor); + if (old != null) { + old.close(); + } + } + + /** + * Swap in a new Cursor, returning the old Cursor. Unlike + * {@link #changeCursor(Cursor)}, the returned old Cursor is not + * closed. + * + * @param newCursor The new cursor to be used. + * @return Returns the previously set Cursor, or null if there wasa not one. + * If the given new Cursor is the same instance is the previously set + * Cursor, null is also returned. + */ + public Cursor swapCursor(Cursor newCursor) { + if (newCursor == mCursor) { + return null; + } + Cursor oldCursor = mCursor; + if (oldCursor != null) { + if (mChangeObserver != null) oldCursor.unregisterContentObserver(mChangeObserver); + if (mDataSetObserver != null) oldCursor.unregisterDataSetObserver(mDataSetObserver); + } + mCursor = newCursor; + if (newCursor != null) { + if (mChangeObserver != null) newCursor.registerContentObserver(mChangeObserver); + if (mDataSetObserver != null) newCursor.registerDataSetObserver(mDataSetObserver); + mRowIDColumn = newCursor.getColumnIndexOrThrow("_id"); + mDataValid = true; + // notify the observers about the new cursor + notifyDataSetChanged(); + } else { + mRowIDColumn = -1; + mDataValid = false; + // notify the observers about the lack of a data set + notifyDataSetInvalidated(); + } + return oldCursor; + } + + /** + *

Converts the cursor into a CharSequence. Subclasses should override this + * method to convert their results. The default implementation returns an + * empty String for null values or the default String representation of + * the value.

+ * + * @param cursor the cursor to convert to a CharSequence + * @return a CharSequence representing the value + */ + public CharSequence convertToString(Cursor cursor) { + return cursor == null ? "" : cursor.toString(); + } + + /** + * Runs a query with the specified constraint. This query is requested + * by the filter attached to this adapter. + * + * The query is provided by a + * {@link android.widget.FilterQueryProvider}. + * If no provider is specified, the current cursor is not filtered and returned. + * + * After this method returns the resulting cursor is passed to {@link #changeCursor(Cursor)} + * and the previous cursor is closed. + * + * This method is always executed on a background thread, not on the + * application's main thread (or UI thread.) + * + * Contract: when constraint is null or empty, the original results, + * prior to any filtering, must be returned. + * + * @param constraint the constraint with which the query must be filtered + * + * @return a Cursor representing the results of the new query + * + * @see #getFilter() + * @see #getFilterQueryProvider() + * @see #setFilterQueryProvider(android.widget.FilterQueryProvider) + */ + public Cursor runQueryOnBackgroundThread(CharSequence constraint) { + if (mFilterQueryProvider != null) { + return mFilterQueryProvider.runQuery(constraint); + } + + return mCursor; + } + + public Filter getFilter() { + if (mCursorFilter == null) { + mCursorFilter = new CursorFilter(this); + } + return mCursorFilter; + } + + /** + * Returns the query filter provider used for filtering. When the + * provider is null, no filtering occurs. + * + * @return the current filter query provider or null if it does not exist + * + * @see #setFilterQueryProvider(android.widget.FilterQueryProvider) + * @see #runQueryOnBackgroundThread(CharSequence) + */ + public FilterQueryProvider getFilterQueryProvider() { + return mFilterQueryProvider; + } + + /** + * Sets the query filter provider used to filter the current Cursor. + * The provider's + * {@link android.widget.FilterQueryProvider#runQuery(CharSequence)} + * method is invoked when filtering is requested by a client of + * this adapter. + * + * @param filterQueryProvider the filter query provider or null to remove it + * + * @see #getFilterQueryProvider() + * @see #runQueryOnBackgroundThread(CharSequence) + */ + public void setFilterQueryProvider(FilterQueryProvider filterQueryProvider) { + mFilterQueryProvider = filterQueryProvider; + } + + /** + * Called when the {@link ContentObserver} on the cursor receives a change notification. + * The default implementation provides the auto-requery logic, but may be overridden by + * sub classes. + * + * @see ContentObserver#onChange(boolean) + */ + protected void onContentChanged() { + if (mAutoRequery && mCursor != null && !mCursor.isClosed()) { + if (Config.LOGV) Log.v("Cursor", "Auto requerying " + mCursor + " due to update"); + mDataValid = mCursor.requery(); + } + } + + private class ChangeObserver extends ContentObserver { + public ChangeObserver() { + super(new Handler()); + } + + @Override + public boolean deliverSelfNotifications() { + return true; + } + + @Override + public void onChange(boolean selfChange) { + onContentChanged(); + } + } + + private class MyDataSetObserver extends DataSetObserver { + @Override + public void onChanged() { + mDataValid = true; + notifyDataSetChanged(); + } + + @Override + public void onInvalidated() { + mDataValid = false; + notifyDataSetInvalidated(); + } + } + +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/CursorFilter.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/CursorFilter.java new file mode 100644 index 00000000..69b87be2 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/CursorFilter.java @@ -0,0 +1,71 @@ +/* + * 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 android.support.v4.widget; + +import android.database.Cursor; +import android.widget.Filter; + +/** + *

The CursorFilter delegates most of the work to the CursorAdapter. + * Subclasses should override these delegate methods to run the queries + * and convert the results into String that can be used by auto-completion + * widgets.

+ */ +class CursorFilter extends Filter { + + CursorFilterClient mClient; + + interface CursorFilterClient { + CharSequence convertToString(Cursor cursor); + Cursor runQueryOnBackgroundThread(CharSequence constraint); + Cursor getCursor(); + void changeCursor(Cursor cursor); + } + + CursorFilter(CursorFilterClient client) { + mClient = client; + } + + @Override + public CharSequence convertResultToString(Object resultValue) { + return mClient.convertToString((Cursor) resultValue); + } + + @Override + protected FilterResults performFiltering(CharSequence constraint) { + Cursor cursor = mClient.runQueryOnBackgroundThread(constraint); + + FilterResults results = new FilterResults(); + if (cursor != null) { + results.count = cursor.getCount(); + results.values = cursor; + } else { + results.count = 0; + results.values = null; + } + return results; + } + + @Override + protected void publishResults(CharSequence constraint, FilterResults results) { + Cursor oldCursor = mClient.getCursor(); + + if (results.values != null && results.values != oldCursor) { + mClient.changeCursor((Cursor) results.values); + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/ResourceCursorAdapter.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/ResourceCursorAdapter.java new file mode 100644 index 00000000..12dce787 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/ResourceCursorAdapter.java @@ -0,0 +1,131 @@ +/* + * 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 android.support.v4.widget; + +import android.content.Context; +import android.database.Cursor; +import android.view.View; +import android.view.ViewGroup; +import android.view.LayoutInflater; + +/** + * Static library support version of the framework's {@link android.widget.ResourceCursorAdapter}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + */ +public abstract class ResourceCursorAdapter extends CursorAdapter { + private int mLayout; + + private int mDropDownLayout; + + private LayoutInflater mInflater; + + /** + * Constructor the enables auto-requery. + * + * @deprecated This option is discouraged, as it results in Cursor queries + * being performed on the application's UI thread and thus can cause poor + * responsiveness or even Application Not Responding errors. As an alternative, + * use {@link android.app.LoaderManager} with a {@link android.content.CursorLoader}. + * + * @param context The context where the ListView associated with this adapter is running + * @param layout resource identifier of a layout file that defines the views + * for this list item. Unless you override them later, this will + * define both the item views and the drop down views. + */ + @Deprecated + public ResourceCursorAdapter(Context context, int layout, Cursor c) { + super(context, c); + mLayout = mDropDownLayout = layout; + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + /** + * Constructor with default behavior as per + * {@link CursorAdapter#CursorAdapter(Context, Cursor, boolean)}; it is recommended + * you not use this, but instead {@link #ResourceCursorAdapter(Context, int, Cursor, int)}. + * When using this constructor, {@link #FLAG_REGISTER_CONTENT_OBSERVER} + * will always be set. + * + * @param context The context where the ListView associated with this adapter is running + * @param layout resource identifier of a layout file that defines the views + * for this list item. Unless you override them later, this will + * define both the item views and the drop down views. + * @param c The cursor from which to get the data. + * @param autoRequery If true the adapter will call requery() on the + * cursor whenever it changes so the most recent + * data is always displayed. Using true here is discouraged. + */ + public ResourceCursorAdapter(Context context, int layout, Cursor c, boolean autoRequery) { + super(context, c, autoRequery); + mLayout = mDropDownLayout = layout; + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + /** + * Standard constructor. + * + * @param context The context where the ListView associated with this adapter is running + * @param layout Resource identifier of a layout file that defines the views + * for this list item. Unless you override them later, this will + * define both the item views and the drop down views. + * @param c The cursor from which to get the data. + * @param flags Flags used to determine the behavior of the adapter, + * as per {@link CursorAdapter#CursorAdapter(Context, Cursor, int)}. + */ + public ResourceCursorAdapter(Context context, int layout, Cursor c, int flags) { + super(context, c, flags); + mLayout = mDropDownLayout = layout; + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + /** + * Inflates view(s) from the specified XML file. + * + * @see android.widget.CursorAdapter#newView(android.content.Context, + * android.database.Cursor, ViewGroup) + */ + @Override + public View newView(Context context, Cursor cursor, ViewGroup parent) { + return mInflater.inflate(mLayout, parent, false); + } + + @Override + public View newDropDownView(Context context, Cursor cursor, ViewGroup parent) { + return mInflater.inflate(mDropDownLayout, parent, false); + } + + /** + *

Sets the layout resource of the item views.

+ * + * @param layout the layout resources used to create item views + */ + public void setViewResource(int layout) { + mLayout = layout; + } + + /** + *

Sets the layout resource of the drop down views.

+ * + * @param dropDownLayout the layout resources used to create drop down views + */ + public void setDropDownViewResource(int dropDownLayout) { + mDropDownLayout = dropDownLayout; + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/SimpleCursorAdapter.java b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/SimpleCursorAdapter.java new file mode 100644 index 00000000..4b81b11f --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/android/support/v4/widget/SimpleCursorAdapter.java @@ -0,0 +1,398 @@ +/* + * 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 android.support.v4.widget; + +import android.content.Context; +import android.database.Cursor; +import android.net.Uri; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +/** + * Static library support version of the framework's {@link android.widget.SimpleCursorAdapter}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + */ +public class SimpleCursorAdapter extends ResourceCursorAdapter { + /** + * A list of columns containing the data to bind to the UI. + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected int[] mFrom; + /** + * A list of View ids representing the views to which the data must be bound. + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected int[] mTo; + + private int mStringConversionColumn = -1; + private CursorToStringConverter mCursorToStringConverter; + private ViewBinder mViewBinder; + + String[] mOriginalFrom; + + /** + * Constructor the enables auto-requery. + * + * @deprecated This option is discouraged, as it results in Cursor queries + * being performed on the application's UI thread and thus can cause poor + * responsiveness or even Application Not Responding errors. As an alternative, + * use {@link android.app.LoaderManager} with a {@link android.content.CursorLoader}. + */ + @Deprecated + public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) { + super(context, layout, c); + mTo = to; + mOriginalFrom = from; + findColumns(from); + } + + /** + * Standard constructor. + * + * @param context The context where the ListView associated with this + * SimpleListItemFactory is running + * @param layout resource identifier of a layout file that defines the views + * for this list item. The layout file should include at least + * those named views defined in "to" + * @param c The database cursor. Can be null if the cursor is not available yet. + * @param from A list of column names representing the data to bind to the UI. Can be null + * if the cursor is not available yet. + * @param to The views that should display column in the "from" parameter. + * These should all be TextViews. The first N views in this list + * are given the values of the first N columns in the from + * parameter. Can be null if the cursor is not available yet. + * @param flags Flags used to determine the behavior of the adapter, + * as per {@link CursorAdapter#CursorAdapter(Context, Cursor, int)}. + */ + public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, + int[] to, int flags) { + super(context, layout, c, flags); + mTo = to; + mOriginalFrom = from; + findColumns(from); + } + + /** + * Binds all of the field names passed into the "to" parameter of the + * constructor with their corresponding cursor columns as specified in the + * "from" parameter. + * + * Binding occurs in two phases. First, if a + * {@link android.widget.SimpleCursorAdapter.ViewBinder} is available, + * {@link ViewBinder#setViewValue(android.view.View, android.database.Cursor, int)} + * is invoked. If the returned value is true, binding has occured. If the + * returned value is false and the view to bind is a TextView, + * {@link #setViewText(TextView, String)} is invoked. If the returned value is + * false and the view to bind is an ImageView, + * {@link #setViewImage(ImageView, String)} is invoked. If no appropriate + * binding can be found, an {@link IllegalStateException} is thrown. + * + * @throws IllegalStateException if binding cannot occur + * + * @see android.widget.CursorAdapter#bindView(android.view.View, + * android.content.Context, android.database.Cursor) + * @see #getViewBinder() + * @see #setViewBinder(android.widget.SimpleCursorAdapter.ViewBinder) + * @see #setViewImage(ImageView, String) + * @see #setViewText(TextView, String) + */ + @Override + public void bindView(View view, Context context, Cursor cursor) { + final ViewBinder binder = mViewBinder; + final int count = mTo.length; + final int[] from = mFrom; + final int[] to = mTo; + + for (int i = 0; i < count; i++) { + final View v = view.findViewById(to[i]); + if (v != null) { + boolean bound = false; + if (binder != null) { + bound = binder.setViewValue(v, cursor, from[i]); + } + + if (!bound) { + String text = cursor.getString(from[i]); + if (text == null) { + text = ""; + } + + if (v instanceof TextView) { + setViewText((TextView) v, text); + } else if (v instanceof ImageView) { + setViewImage((ImageView) v, text); + } else { + throw new IllegalStateException(v.getClass().getName() + " is not a " + + " view that can be bounds by this SimpleCursorAdapter"); + } + } + } + } + } + + /** + * Returns the {@link ViewBinder} used to bind data to views. + * + * @return a ViewBinder or null if the binder does not exist + * + * @see #bindView(android.view.View, android.content.Context, android.database.Cursor) + * @see #setViewBinder(android.widget.SimpleCursorAdapter.ViewBinder) + */ + public ViewBinder getViewBinder() { + return mViewBinder; + } + + /** + * Sets the binder used to bind data to views. + * + * @param viewBinder the binder used to bind data to views, can be null to + * remove the existing binder + * + * @see #bindView(android.view.View, android.content.Context, android.database.Cursor) + * @see #getViewBinder() + */ + public void setViewBinder(ViewBinder viewBinder) { + mViewBinder = viewBinder; + } + + /** + * Called by bindView() to set the image for an ImageView but only if + * there is no existing ViewBinder or if the existing ViewBinder cannot + * handle binding to an ImageView. + * + * By default, the value will be treated as an image resource. If the + * value cannot be used as an image resource, the value is used as an + * image Uri. + * + * Intended to be overridden by Adapters that need to filter strings + * retrieved from the database. + * + * @param v ImageView to receive an image + * @param value the value retrieved from the cursor + */ + public void setViewImage(ImageView v, String value) { + try { + v.setImageResource(Integer.parseInt(value)); + } catch (NumberFormatException nfe) { + v.setImageURI(Uri.parse(value)); + } + } + + /** + * Called by bindView() to set the text for a TextView but only if + * there is no existing ViewBinder or if the existing ViewBinder cannot + * handle binding to an TextView. + * + * Intended to be overridden by Adapters that need to filter strings + * retrieved from the database. + * + * @param v TextView to receive text + * @param text the text to be set for the TextView + */ + public void setViewText(TextView v, String text) { + v.setText(text); + } + + /** + * Return the index of the column used to get a String representation + * of the Cursor. + * + * @return a valid index in the current Cursor or -1 + * + * @see android.widget.CursorAdapter#convertToString(android.database.Cursor) + * @see #setStringConversionColumn(int) + * @see #setCursorToStringConverter(android.widget.SimpleCursorAdapter.CursorToStringConverter) + * @see #getCursorToStringConverter() + */ + public int getStringConversionColumn() { + return mStringConversionColumn; + } + + /** + * Defines the index of the column in the Cursor used to get a String + * representation of that Cursor. The column is used to convert the + * Cursor to a String only when the current CursorToStringConverter + * is null. + * + * @param stringConversionColumn a valid index in the current Cursor or -1 to use the default + * conversion mechanism + * + * @see android.widget.CursorAdapter#convertToString(android.database.Cursor) + * @see #getStringConversionColumn() + * @see #setCursorToStringConverter(android.widget.SimpleCursorAdapter.CursorToStringConverter) + * @see #getCursorToStringConverter() + */ + public void setStringConversionColumn(int stringConversionColumn) { + mStringConversionColumn = stringConversionColumn; + } + + /** + * Returns the converter used to convert the filtering Cursor + * into a String. + * + * @return null if the converter does not exist or an instance of + * {@link android.widget.SimpleCursorAdapter.CursorToStringConverter} + * + * @see #setCursorToStringConverter(android.widget.SimpleCursorAdapter.CursorToStringConverter) + * @see #getStringConversionColumn() + * @see #setStringConversionColumn(int) + * @see android.widget.CursorAdapter#convertToString(android.database.Cursor) + */ + public CursorToStringConverter getCursorToStringConverter() { + return mCursorToStringConverter; + } + + /** + * Sets the converter used to convert the filtering Cursor + * into a String. + * + * @param cursorToStringConverter the Cursor to String converter, or + * null to remove the converter + * + * @see #setCursorToStringConverter(android.widget.SimpleCursorAdapter.CursorToStringConverter) + * @see #getStringConversionColumn() + * @see #setStringConversionColumn(int) + * @see android.widget.CursorAdapter#convertToString(android.database.Cursor) + */ + public void setCursorToStringConverter(CursorToStringConverter cursorToStringConverter) { + mCursorToStringConverter = cursorToStringConverter; + } + + /** + * Returns a CharSequence representation of the specified Cursor as defined + * by the current CursorToStringConverter. If no CursorToStringConverter + * has been set, the String conversion column is used instead. If the + * conversion column is -1, the returned String is empty if the cursor + * is null or Cursor.toString(). + * + * @param cursor the Cursor to convert to a CharSequence + * + * @return a non-null CharSequence representing the cursor + */ + @Override + public CharSequence convertToString(Cursor cursor) { + if (mCursorToStringConverter != null) { + return mCursorToStringConverter.convertToString(cursor); + } else if (mStringConversionColumn > -1) { + return cursor.getString(mStringConversionColumn); + } + + return super.convertToString(cursor); + } + + /** + * Create a map from an array of strings to an array of column-id integers in mCursor. + * If mCursor is null, the array will be discarded. + * + * @param from the Strings naming the columns of interest + */ + private void findColumns(String[] from) { + if (mCursor != null) { + int i; + int count = from.length; + if (mFrom == null || mFrom.length != count) { + mFrom = new int[count]; + } + for (i = 0; i < count; i++) { + mFrom[i] = mCursor.getColumnIndexOrThrow(from[i]); + } + } else { + mFrom = null; + } + } + + @Override + public Cursor swapCursor(Cursor c) { + Cursor res = super.swapCursor(c); + // rescan columns in case cursor layout is different + findColumns(mOriginalFrom); + return res; + } + + /** + * Change the cursor and change the column-to-view mappings at the same time. + * + * @param c The database cursor. Can be null if the cursor is not available yet. + * @param from A list of column names representing the data to bind to the UI. Can be null + * if the cursor is not available yet. + * @param to The views that should display column in the "from" parameter. + * These should all be TextViews. The first N views in this list + * are given the values of the first N columns in the from + * parameter. Can be null if the cursor is not available yet. + */ + public void changeCursorAndColumns(Cursor c, String[] from, int[] to) { + mOriginalFrom = from; + mTo = to; + super.changeCursor(c); + findColumns(mOriginalFrom); + } + + /** + * This class can be used by external clients of SimpleCursorAdapter + * to bind values fom the Cursor to views. + * + * You should use this class to bind values from the Cursor to views + * that are not directly supported by SimpleCursorAdapter or to + * change the way binding occurs for views supported by + * SimpleCursorAdapter. + * + * @see SimpleCursorAdapter#bindView(android.view.View, android.content.Context, android.database.Cursor) + * @see SimpleCursorAdapter#setViewImage(ImageView, String) + * @see SimpleCursorAdapter#setViewText(TextView, String) + */ + public static interface ViewBinder { + /** + * Binds the Cursor column defined by the specified index to the specified view. + * + * When binding is handled by this ViewBinder, this method must return true. + * If this method returns false, SimpleCursorAdapter will attempts to handle + * the binding on its own. + * + * @param view the view to bind the data to + * @param cursor the cursor to get the data from + * @param columnIndex the column at which the data can be found in the cursor + * + * @return true if the data was bound to the view, false otherwise + */ + boolean setViewValue(View view, Cursor cursor, int columnIndex); + } + + /** + * This class can be used by external clients of SimpleCursorAdapter + * to define how the Cursor should be converted to a String. + * + * @see android.widget.CursorAdapter#convertToString(android.database.Cursor) + */ + public static interface CursorToStringConverter { + /** + * Returns a CharSequence representing the specified Cursor. + * + * @param cursor the cursor for which a CharSequence representation + * is requested + * + * @return a non-null CharSequence representing the cursor + */ + CharSequence convertToString(Cursor cursor); + } + +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/app/ActionBarImpl.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/app/ActionBarImpl.java new file mode 100644 index 00000000..7cc6c8d2 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/app/ActionBarImpl.java @@ -0,0 +1,422 @@ +/* + * Copyright (C) 2011 Jake Wharton + * Copyright (C) 2010 Johan Nilsson + * + * 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.internal.app; + +import java.util.ArrayList; +import java.util.List; +import android.app.Activity; +import android.graphics.drawable.Drawable; +import android.support.v4.app.ActionBar; +import android.support.v4.app.SupportActivity; +import android.support.v4.view.ActionMode; +import android.support.v4.view.MenuItem; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.SpinnerAdapter; +import com.actionbarsherlock.R; +import com.actionbarsherlock.internal.view.menu.ActionMenuItemView; +import com.actionbarsherlock.internal.view.menu.MenuBuilder; +import com.actionbarsherlock.internal.view.menu.MenuItemImpl; +import com.actionbarsherlock.internal.widget.ActionBarContainer; +import com.actionbarsherlock.internal.widget.ActionBarView; + +public final class ActionBarImpl extends ActionBar { + /** Action bar container. */ + private ActionBarContainer mContainerView; + + /** Action bar view. */ + private ActionBarView mActionView; + + /** List of listeners to the menu visibility. */ + private final List mMenuListeners = new ArrayList(); + + + + public ActionBarImpl(T activity) { + super(activity); + } + + + // ------------------------------------------------------------------------ + // ACTION BAR SHERLOCK SUPPORT + // ------------------------------------------------------------------------ + + @Override + protected ActionBar getPublicInstance() { + return this; + } + + public void init() { + mActionView = (ActionBarView)mActivity.findViewById(R.id.abs__action_bar); + mContainerView = (ActionBarContainer)mActivity.findViewById(R.id.abs__action_bar_container); + + if (mActionView == null) { + throw new IllegalStateException(getClass().getSimpleName() + " can only be used with a screen_*.xml layout"); + } + + if (mActionView.getTitle() == null) { + mActionView.setTitle(mActivity.getTitle()); + } + } + + public void onMenuInflated(MenuBuilder menu) { + if (mActionView == null) { + return; + } + + final int maxItems = mActivity.getResources().getInteger(R.integer.abs__max_action_buttons); + + //Iterate and grab as many actions as we can up to maxItems honoring + //their showAsAction values + int ifItems = 0; + final int count = menu.size(); + boolean showsActionItemText = menu.getShowsActionItemText(); + List keep = new ArrayList(); + for (int i = 0; i < count; i++) { + MenuItemImpl item = (MenuItemImpl)menu.getItem(i); + + //Items without an icon or custom view are forced into the overflow menu + if (!showsActionItemText && (item.getIcon() == null) && (item.getActionView() == null)) { + continue; + } + if (showsActionItemText && ((item.getTitle() == null) || "".equals(item.getTitle()))) { + continue; + } + + if ((item.getShowAsAction() & MenuItem.SHOW_AS_ACTION_ALWAYS) != 0) { + //Show always therefore add to keep list + keep.add(item); + + if ((keep.size() > maxItems) && (ifItems > 0)) { + //If we have exceeded the max and there are "ifRoom" items + //then iterate backwards to remove one and add it to the + //head of the classic items list. + for (int j = keep.size() - 1; j >= 0; j--) { + if ((keep.get(j).getShowAsAction() & MenuItem.SHOW_AS_ACTION_IF_ROOM) != 0) { + keep.remove(j); + ifItems -= 1; + break; + } + } + } + } else if (((item.getShowAsAction() & MenuItem.SHOW_AS_ACTION_IF_ROOM) != 0) + && (keep.size() < maxItems)) { + //"ifRoom" items are added if we have not exceeded the max. + keep.add(item); + ifItems += 1; + } + } + + //Mark items that will be shown on the action bar as such so they do + //not show up on the activity options menu + mActionView.removeAllItems(); + for (MenuItemImpl item : keep) { + item.setIsShownOnActionBar(true); + + //Get a new item for this menu item + ActionMenuItemView actionItem = mActionView.newItem(); + actionItem.initialize(item, MenuBuilder.TYPE_ACTION_BAR); + + //Associate the itemview with the item so changes will be reflected + item.setItemView(MenuBuilder.TYPE_ACTION_BAR, actionItem); + + //Add to the action bar for display + mActionView.addItem(actionItem); + } + } + + public void onMenuVisibilityChanged(boolean isVisible) { + //Marshal to all listeners + for (OnMenuVisibilityListener listener : mMenuListeners) { + listener.onMenuVisibilityChanged(isVisible); + } + } + + public void setProgressBarIndeterminateVisibility(boolean visible) { + if (mActionView != null) { + mActionView.setProgressBarIndeterminateVisibility(visible); + } + } + + // ------------------------------------------------------------------------ + // ACTION MODE METHODS + // ------------------------------------------------------------------------ + + @Override + protected ActionMode startActionMode(ActionMode.Callback callback) { + throw new RuntimeException("Not implemented."); + } + + // ------------------------------------------------------------------------ + // ACTION BAR METHODS + // ------------------------------------------------------------------------ + + @Override + public void addOnMenuVisibilityListener(OnMenuVisibilityListener listener) { + if (!mMenuListeners.contains(listener)) { + mMenuListeners.add(listener); + } + } + + @Override + public void addTab(Tab tab) { + mActionView.addTab(tab); + } + + @Override + public void addTab(Tab tab, boolean setSelected) { + mActionView.addTab(tab, setSelected); + } + + @Override + public void addTab(Tab tab, int position) { + mActionView.addTab(tab, position); + } + + @Override + public void addTab(ActionBar.Tab tab, int position, boolean setSelected) { + mActionView.addTab(tab, position, setSelected); + } + + @Override + public View getCustomView() { + return mActionView.getCustomView(); + } + + @Override + public int getDisplayOptions() { + return mActionView.getDisplayOptions(); + } + + @Override + public int getHeight() { + return mActionView.getHeight(); + } + + @Override + public int getNavigationItemCount() { + switch (mActionView.getNavigationMode()) { + default: + case ActionBar.NAVIGATION_MODE_STANDARD: + return 0; + + case ActionBar.NAVIGATION_MODE_LIST: + SpinnerAdapter dropdownAdapter = mActionView.getDropdownAdapter(); + return (dropdownAdapter != null) ? dropdownAdapter.getCount() : 0; + + case ActionBar.NAVIGATION_MODE_TABS: + return mActionView.getTabCount(); + } + } + + @Override + public int getNavigationMode() { + return mActionView.getNavigationMode(); + } + + @Override + public int getSelectedNavigationIndex() { + switch (mActionView.getNavigationMode()) { + default: + case ActionBar.NAVIGATION_MODE_STANDARD: + return -1; + + case ActionBar.NAVIGATION_MODE_LIST: + return mActionView.getDropdownSelectedPosition(); + + case ActionBar.NAVIGATION_MODE_TABS: + return mActionView.getSelectedTab().getPosition(); + } + } + + @Override + public ActionBar.Tab getSelectedTab() { + return mActionView.getSelectedTab(); + } + + @Override + public CharSequence getSubtitle() { + return mActionView.getSubtitle(); + } + + @Override + public ActionBar.Tab getTabAt(int index) { + return mActionView.getTabAt(index); + } + + @Override + public int getTabCount() { + return mActionView.getTabCount(); + } + + @Override + public CharSequence getTitle() { + return mActionView.getTitle(); + } + + @Override + public void hide() { + //TODO: animate + mContainerView.setVisibility(View.GONE); + } + + @Override + public boolean isShowing() { + return mContainerView.getVisibility() == View.VISIBLE; + } + + @Override + public ActionBar.Tab newTab() { + return mActionView.newTab(); + } + + @Override + public void removeAllTabs() { + mActionView.removeAllTabs(); + } + + @Override + public void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener) { + mMenuListeners.remove(listener); + } + + @Override + public void removeTab(ActionBar.Tab tab) { + removeTabAt(tab.getPosition()); + } + + @Override + public void removeTabAt(int position) { + mActionView.removeTabAt(position); + } + + @Override + public void setBackgroundDrawable(Drawable d) { + mContainerView.setBackgroundDrawable(d); + } + + @Override + public void setCustomView(int resId) { + View view = LayoutInflater.from(mContext).inflate(resId, mActionView, false); + setCustomView(view); + } + + @Override + public void setCustomView(View view) { + mActionView.setCustomNavigationView(view); + } + + @Override + public void setCustomView(View view, ActionBar.LayoutParams layoutParams) { + view.setLayoutParams(layoutParams); + mActionView.setCustomNavigationView(view); + } + + @Override + public void setDisplayHomeAsUpEnabled(boolean showHomeAsUp) { + setDisplayOptions(showHomeAsUp ? ActionBar.DISPLAY_HOME_AS_UP : 0, ActionBar.DISPLAY_HOME_AS_UP); + } + + @Override + public void setDisplayOptions(int options) { + mActionView.setDisplayOptions(options); + } + + @Override + public void setDisplayOptions(int newOptions, int mask) { + mActionView.setDisplayOptions((mActionView.getDisplayOptions() & ~mask) | newOptions); + } + + @Override + public void setDisplayShowCustomEnabled(boolean showCustom) { + setDisplayOptions(showCustom ? ActionBar.DISPLAY_SHOW_CUSTOM : 0, ActionBar.DISPLAY_SHOW_CUSTOM); + } + + @Override + public void setDisplayShowHomeEnabled(boolean showHome) { + setDisplayOptions(showHome ? ActionBar.DISPLAY_SHOW_HOME : 0, ActionBar.DISPLAY_SHOW_HOME); + } + + @Override + public void setDisplayShowTitleEnabled(boolean showTitle) { + setDisplayOptions(showTitle ? ActionBar.DISPLAY_SHOW_TITLE : 0, ActionBar.DISPLAY_SHOW_TITLE); + } + + @Override + public void setDisplayUseLogoEnabled(boolean useLogo) { + setDisplayOptions(useLogo ? ActionBar.DISPLAY_USE_LOGO : 0, ActionBar.DISPLAY_USE_LOGO); + } + + @Override + public void setListNavigationCallbacks(SpinnerAdapter adapter, ActionBar.OnNavigationListener callback) { + mActionView.setDropdownAdapter(adapter); + mActionView.setCallback(callback); + } + + @Override + public void setNavigationMode(int mode) { + mActionView.setNavigationMode(mode); + } + + @Override + public void setSelectedNavigationItem(int position) { + switch (mActionView.getNavigationMode()) { + default: + case ActionBar.NAVIGATION_MODE_STANDARD: + throw new IllegalStateException(); + + case ActionBar.NAVIGATION_MODE_TABS: + mActionView.getTabAt(position).select(); + break; + + case ActionBar.NAVIGATION_MODE_LIST: + mActionView.setDropdownSelectedPosition(position); + break; + } + } + + @Override + public void selectTab(ActionBar.Tab tab) { + mActionView.selectTab(tab); + } + + @Override + public void setSubtitle(CharSequence subtitle) { + mActionView.setSubtitle(subtitle); + } + + @Override + public void setSubtitle(int resId) { + mActionView.setSubtitle(resId); + } + + @Override + public void setTitle(CharSequence title) { + mActionView.setTitle(title); + } + @Override + public void setTitle(int resId) { + mActionView.setTitle(resId); + } + + @Override + public void show() { + //TODO: animate + mContainerView.setVisibility(View.VISIBLE); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/app/ActionBarWrapper.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/app/ActionBarWrapper.java new file mode 100644 index 00000000..75d58286 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/app/ActionBarWrapper.java @@ -0,0 +1,581 @@ +/* + * Copyright 2011 Jake Wharton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.actionbarsherlock.internal.app; + +import java.util.HashMap; +import com.actionbarsherlock.internal.view.menu.MenuItemWrapper; +import com.actionbarsherlock.internal.view.menu.MenuWrapper; +import android.app.Activity; +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.support.v4.app.ActionBar; +import android.support.v4.app.SupportActivity; +import android.support.v4.view.ActionMode; +import android.support.v4.view.Menu; +import android.support.v4.view.MenuInflater; +import android.view.View; +import android.widget.SpinnerAdapter; + +public final class ActionBarWrapper { + //No instances + private ActionBarWrapper() {} + + /** + * Abstraction to get an instance of our implementing class. + * + * @param activity Parent activity. + * @return {@code ActionBar} instance. + */ + public static ActionBar createFor(T activity) { + return new ActionBarWrapper.Impl(activity); + } + + /** + *

Handler for Android's native {@link android.app.ActionBar}.

+ */ + public static final class Impl extends ActionBar implements android.app.ActionBar.TabListener { + /** Mapping between support listeners and native listeners. */ + private final HashMap mMenuListenerMap = new HashMap(); + + + private Impl(T activity) { + super(activity); + } + + + /** + * Get the native {@link ActionBar} instance. + * + * @return The action bar. + */ + private android.app.ActionBar getActionBar() { + return mActivity.asActivity().getActionBar(); + } + + @Override + protected ActionBar getPublicInstance() { + return (getActionBar() != null) ? this : null; + } + + /** + * Converts our Tab wrapper to a native version containing the wrapper + * instance as its tag. + * + * @param tab Tab wrapper instance. + * @return Native tab. + */ + private android.app.ActionBar.Tab convertTabToNative(ActionBar.Tab tab) { + return getActionBar().newTab() + .setCustomView(tab.getCustomView()) + .setIcon(tab.getIcon()) + .setTabListener(this) + .setTag(tab) + .setText(tab.getText()); + } + + @Override + public void onTabReselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) { + ActionBar.TabListener listener = ((ActionBar.Tab)tab.getTag()).getTabListener(); + if (listener != null) { + listener.onTabReselected((ActionBar.Tab)tab.getTag(), null); + } + } + + @Override + public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) { + ActionBar.TabListener listener = ((ActionBar.Tab)tab.getTag()).getTabListener(); + if (listener != null) { + listener.onTabSelected((ActionBar.Tab)tab.getTag(), null); + } + } + + @Override + public void onTabUnselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) { + ActionBar.TabListener listener = ((ActionBar.Tab)tab.getTag()).getTabListener(); + if (listener != null) { + listener.onTabUnselected((ActionBar.Tab)tab.getTag(), null); + } + } + + // --------------------------------------------------------------------- + // ACTION MODE SUPPORT + // --------------------------------------------------------------------- + + @Override + protected ActionMode startActionMode(final ActionMode.Callback callback) { + //We have to re-wrap the instances in every callback since the + //wrapped instance is needed before we could have a change to + //properly store it. + return new ActionModeWrapper(mContext, + mActivity.asActivity().startActionMode(new android.view.ActionMode.Callback() { + @Override + public boolean onPrepareActionMode(android.view.ActionMode mode, android.view.Menu menu) { + return callback.onPrepareActionMode(new ActionModeWrapper(mContext, mode), new MenuWrapper(menu)); + } + + @Override + public void onDestroyActionMode(android.view.ActionMode mode) { + final ActionMode actionMode = new ActionModeWrapper(mContext, mode); + callback.onDestroyActionMode(actionMode); + + //Send the activity callback once the action mode callback has run. + //This type-check has already occurred in the action bar constructor. + ((SupportActivity)mActivity).onActionModeFinished(actionMode); + } + + @Override + public boolean onCreateActionMode(android.view.ActionMode mode, android.view.Menu menu) { + return callback.onCreateActionMode(new ActionModeWrapper(mContext, mode), new MenuWrapper(menu)); + } + + @Override + public boolean onActionItemClicked(android.view.ActionMode mode, android.view.MenuItem item) { + return callback.onActionItemClicked(new ActionModeWrapper(mContext, mode), new MenuItemWrapper(item)); + } + }) + ); + } + + private static class ActionModeWrapper extends ActionMode { + private final Context mContext; + private final android.view.ActionMode mActionMode; + + ActionModeWrapper(Context context, android.view.ActionMode actionMode) { + mContext = context; + mActionMode = actionMode; + } + + @Override + public void finish() { + mActionMode.finish(); + } + + @Override + public View getCustomView() { + return mActionMode.getCustomView(); + } + + @Override + public Menu getMenu() { + return new MenuWrapper(mActionMode.getMenu()); + } + + @Override + public MenuInflater getMenuInflater() { + return new MenuInflater(mContext, null); + } + + @Override + public CharSequence getSubtitle() { + return mActionMode.getSubtitle(); + } + + @Override + public CharSequence getTitle() { + return mActionMode.getTitle(); + } + + @Override + public void invalidate() { + mActionMode.invalidate(); + } + + @Override + public void setCustomView(View view) { + mActionMode.setCustomView(view); + } + + @Override + public void setSubtitle(int resId) { + mActionMode.setSubtitle(resId); + } + + @Override + public void setSubtitle(CharSequence subtitle) { + mActionMode.setSubtitle(subtitle); + } + + @Override + public void setTitle(int resId) { + mActionMode.setTitle(resId); + } + + @Override + public void setTitle(CharSequence title) { + mActionMode.setTitle(title); + } + } + + // --------------------------------------------------------------------- + // ACTION BAR SUPPORT + // --------------------------------------------------------------------- + + private static class TabImpl extends ActionBar.Tab { + final ActionBarWrapper.Impl mActionBar; + + View mCustomView; + Drawable mIcon; + ActionBar.TabListener mListener; + Object mTag; + CharSequence mText; + + TabImpl(ActionBarWrapper.Impl actionBar) { + mActionBar = actionBar; + } + + @Override + public View getCustomView() { + return mCustomView; + } + + @Override + public Drawable getIcon() { + return mIcon; + } + + @Override + public int getPosition() { + final int tabCount = mActionBar.getTabCount(); + for (int i = 0; i < tabCount; i++) { + if (mActionBar.getTabAt(i).equals(this)) { + return i; + } + } + return ActionBar.Tab.INVALID_POSITION; + } + + @Override + public ActionBar.TabListener getTabListener() { + return mListener; + } + + @Override + public Object getTag() { + return mTag; + } + + @Override + public CharSequence getText() { + return mText; + } + + @Override + public void select() { + mActionBar.selectTab(this); + } + + @Override + public ActionBar.Tab setCustomView(int layoutResId) { + mCustomView = mActionBar.mActivity.getLayoutInflater().inflate(layoutResId, null); + return this; + } + + @Override + public ActionBar.Tab setCustomView(View view) { + mCustomView = view; + return this; + } + + @Override + public ActionBar.Tab setIcon(Drawable icon) { + mIcon = icon; + return this; + } + + @Override + public ActionBar.Tab setIcon(int resId) { + mIcon = mActionBar.mActivity.getResources().getDrawable(resId); + return this; + } + + @Override + public ActionBar.Tab setTabListener(TabListener listener) { + mListener = listener; + return this; + } + + @Override + public ActionBar.Tab setTag(Object obj) { + mTag = obj; + return this; + } + + @Override + public ActionBar.Tab setText(int resId) { + mText = mActionBar.mActivity.getResources().getString(resId); + return this; + } + + @Override + public ActionBar.Tab setText(CharSequence text) { + mText = text; + return this; + } + } + + @Override + public void addOnMenuVisibilityListener(final OnMenuVisibilityListener listener) { + if ((listener != null) && !mMenuListenerMap.containsKey(listener)) { + android.app.ActionBar.OnMenuVisibilityListener nativeListener = new android.app.ActionBar.OnMenuVisibilityListener() { + @Override + public void onMenuVisibilityChanged(boolean isVisible) { + listener.onMenuVisibilityChanged(isVisible); + } + }; + mMenuListenerMap.put(listener, nativeListener); + + getActionBar().addOnMenuVisibilityListener(nativeListener); + } + } + + @Override + public void addTab(Tab tab) { + getActionBar().addTab(convertTabToNative(tab)); + } + + @Override + public void addTab(Tab tab, boolean setSelected) { + getActionBar().addTab(convertTabToNative(tab), setSelected); + } + + @Override + public void addTab(Tab tab, int position) { + getActionBar().addTab(convertTabToNative(tab), position); + } + + @Override + public void addTab(ActionBar.Tab tab, int position, boolean setSelected) { + getActionBar().addTab(convertTabToNative(tab), position, setSelected); + } + + @Override + public View getCustomView() { + return getActionBar().getCustomView(); + } + + @Override + public int getDisplayOptions() { + return getActionBar().getDisplayOptions(); + } + + @Override + public int getHeight() { + return getActionBar().getHeight(); + } + + @Override + public int getNavigationItemCount() { + return getActionBar().getNavigationItemCount(); + } + + @Override + public int getNavigationMode() { + return getActionBar().getNavigationMode(); + } + + @Override + public int getSelectedNavigationIndex() { + return getActionBar().getSelectedNavigationIndex(); + } + + @Override + public Tab getSelectedTab() { + return (ActionBar.Tab)getActionBar().getSelectedTab().getTag(); + } + + @Override + public CharSequence getSubtitle() { + return getActionBar().getSubtitle(); + } + + @Override + public ActionBar.Tab getTabAt(int index) { + return (Tab)getActionBar().getTabAt(index).getTag(); + } + + @Override + public int getTabCount() { + return getActionBar().getTabCount(); + } + + @Override + public CharSequence getTitle() { + return getActionBar().getTitle(); + } + + @Override + public void hide() { + getActionBar().hide(); + } + + @Override + public boolean isShowing() { + return getActionBar().isShowing(); + } + + @Override + public ActionBar.Tab newTab() { + return new TabImpl(this); + } + + @Override + public void removeAllTabs() { + getActionBar().removeAllTabs(); + } + + @Override + public void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener) { + if ((listener != null) && mMenuListenerMap.containsKey(listener)) { + getActionBar().removeOnMenuVisibilityListener( + mMenuListenerMap.remove(listener) + ); + } + } + + @Override + public void removeTab(Tab tab) { + final int tabCount = getActionBar().getTabCount(); + for (int i = 0; i < tabCount; i++) { + if (getActionBar().getTabAt(i).getTag().equals(tab)) { + getActionBar().removeTabAt(i); + break; + } + } + } + + @Override + public void removeTabAt(int position) { + getActionBar().removeTabAt(position); + } + + @Override + public void selectTab(ActionBar.Tab tab) { + final int tabCount = getActionBar().getTabCount(); + for (int i = 0; i < tabCount; i++) { + if (getActionBar().getTabAt(i).getTag().equals(tab)) { + getActionBar().setSelectedNavigationItem(i); + break; + } + } + } + + @Override + public void setBackgroundDrawable(Drawable d) { + getActionBar().setBackgroundDrawable(d); + } + + @Override + public void setCustomView(int resId) { + getActionBar().setCustomView(resId); + } + + @Override + public void setCustomView(View view) { + getActionBar().setCustomView(view); + } + + @Override + public void setCustomView(View view, LayoutParams layoutParams) { + android.app.ActionBar.LayoutParams nativeLayoutParams = new android.app.ActionBar.LayoutParams(layoutParams); + nativeLayoutParams.gravity = layoutParams.gravity; + getActionBar().setCustomView(view, nativeLayoutParams); + } + + @Override + public void setDisplayHomeAsUpEnabled(boolean showHomeAsUp) { + getActionBar().setDisplayHomeAsUpEnabled(showHomeAsUp); + } + + @Override + public void setDisplayOptions(int options, int mask) { + getActionBar().setDisplayOptions(options, mask); + } + + @Override + public void setDisplayOptions(int options) { + getActionBar().setDisplayOptions(options); + } + + @Override + public void setDisplayShowCustomEnabled(boolean showCustom) { + getActionBar().setDisplayShowCustomEnabled(showCustom); + } + + @Override + public void setDisplayShowHomeEnabled(boolean showHome) { + getActionBar().setDisplayShowHomeEnabled(showHome); + } + + @Override + public void setDisplayShowTitleEnabled(boolean showTitle) { + getActionBar().setDisplayShowTitleEnabled(showTitle); + } + + @Override + public void setDisplayUseLogoEnabled(boolean useLogo) { + getActionBar().setDisplayUseLogoEnabled(useLogo); + } + + @Override + public void setListNavigationCallbacks(SpinnerAdapter adapter, final OnNavigationListener callback) { + getActionBar().setListNavigationCallbacks(adapter, new android.app.ActionBar.OnNavigationListener() { + @Override + public boolean onNavigationItemSelected(int itemPosition, long itemId) { + if (callback != null) { + return callback.onNavigationItemSelected(itemPosition, itemId); + } + return false; + } + }); + } + + @Override + public void setNavigationMode(int mode) { + getActionBar().setNavigationMode(mode); + } + + @Override + public void setSelectedNavigationItem(int position) { + getActionBar().setSelectedNavigationItem(position); + } + + @Override + public void setSubtitle(CharSequence subtitle) { + getActionBar().setSubtitle(subtitle); + } + + @Override + public void setSubtitle(int resId) { + getActionBar().setSubtitle(resId); + } + + @Override + public void setTitle(CharSequence title) { + getActionBar().setTitle(title); + } + + @Override + public void setTitle(int resId) { + getActionBar().setTitle(resId); + } + + @Override + public void show() { + getActionBar().show(); + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/ActionMenuItem.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/ActionMenuItem.java new file mode 100644 index 00000000..6c32fed3 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/ActionMenuItem.java @@ -0,0 +1,255 @@ +package com.actionbarsherlock.internal.view.menu; + +import android.content.Context; +import android.content.Intent; +import android.graphics.drawable.Drawable; +import android.support.v4.view.MenuItem; +import android.support.v4.view.SubMenu; +import android.view.ContextMenu; +import android.view.View; + +public class ActionMenuItem implements MenuItem { + private static final int CHECKABLE = MenuItemImpl.CHECKABLE; + private static final int CHECKED = MenuItemImpl.CHECKED; + private static final int ENABLED = MenuItemImpl.ENABLED; + private static final int EXCLUSIVE = MenuItemImpl.EXCLUSIVE; + private static final int HIDDEN = MenuItemImpl.HIDDEN; + private static final int NO_ICON = 0; + + //XXX UNUSED: private final int mCategoryOrder; + private MenuItem.OnMenuItemClickListener mClickListener; + private Context mContext; + private int mFlags = ENABLED; + private final int mGroup; + private Drawable mIconDrawable; + private int mIconResId = NO_ICON; + private final int mId; + private Intent mIntent; + private final int mOrdering; + private char mShortcutAlphabeticChar; + private char mShortcutNumericChar; + private CharSequence mTitle; + private CharSequence mTitleCondensed; + + public ActionMenuItem(Context context, int group, int id, int categoryOrder, int ordering, CharSequence title) { + mContext = context; + mId = id; + mGroup = group; + //XXX UNUSED mCategoryOrder = categoryOrder; + mOrdering = ordering; + mTitle = title; + } + + @Override + public View getActionView() { + return null; + } + + @Override + public char getAlphabeticShortcut() { + return mShortcutAlphabeticChar; + } + + @Override + public int getGroupId() { + return mGroup; + } + + @Override + public Drawable getIcon() { + return mIconDrawable; + } + + @Override + public Intent getIntent() { + return mIntent; + } + + @Override + public int getItemId() { + return mId; + } + + @Override + public ContextMenu.ContextMenuInfo getMenuInfo() { + return null; + } + + @Override + public char getNumericShortcut() { + return mShortcutNumericChar; + } + + @Override + public int getOrder() { + return mOrdering; + } + + @Override + public SubMenu getSubMenu() { + return null; + } + + @Override + public CharSequence getTitle() { + return mTitle; + } + + @Override + public CharSequence getTitleCondensed() { + return mTitleCondensed; + } + + @Override + public boolean hasSubMenu() { + return false; + } + + public boolean invoke() { + if ((mClickListener != null) && mClickListener.onMenuItemClick(this)) { + return true; + } else if (mIntent != null) { + mContext.startActivity(mIntent); + return true; + } + return false; + } + + @Override + public boolean isCheckable() { + return (mFlags & CHECKABLE) != 0; + } + + @Override + public boolean isChecked() { + return (mFlags & CHECKED) != 0; + } + + @Override + public boolean isEnabled() { + return (mFlags & ENABLED) != 0; + } + + @Override + public boolean isVisible() { + return (mFlags & HIDDEN) == 0; + } + + @Override + public MenuItem setActionView(int layoutResId) { + throw new UnsupportedOperationException(); + } + + @Override + public MenuItem setActionView(View view) { + throw new UnsupportedOperationException(); + } + + @Override + public MenuItem setAlphabeticShortcut(char shortcut) { + mShortcutAlphabeticChar = shortcut; + return this; + } + + @Override + public MenuItem setCheckable(boolean checkable) { + mFlags = (mFlags & ~CHECKABLE) | (checkable ? CHECKABLE : 0); + return this; + } + + @Override + public MenuItem setChecked(boolean checked) { + mFlags = (mFlags & ~CHECKED) | (checked ? CHECKED : 0); + return this; + } + + @Override + public MenuItem setEnabled(boolean enabled) { + mFlags = (mFlags & ~ENABLED) | (enabled ? ENABLED : 0); + return this; + } + + public ActionMenuItem setExclusiveCheckable(boolean exclusive) { + mFlags = (mFlags & ~EXCLUSIVE) | (exclusive ? EXCLUSIVE : 0); + return this; + } + + @Override + public MenuItem setIcon(int resId) { + mIconResId = resId; + mIconDrawable = mContext.getResources().getDrawable(mIconResId); + return this; + } + + @Override + public MenuItem setIcon(Drawable icon) { + mIconDrawable = icon; + mIconResId = NO_ICON; + return this; + } + + @Override + public MenuItem setIntent(Intent intent) { + mIntent = intent; + return this; + } + + @Override + public MenuItem setNumericShortcut(char shortcut) { + mShortcutNumericChar = shortcut; + return this; + } + + @Override + public MenuItem setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener listener) { + mClickListener = listener; + return this; + } + + @Override + public android.view.MenuItem setOnMenuItemClickListener(final android.view.MenuItem.OnMenuItemClickListener listener) { + mClickListener = new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + return listener.onMenuItemClick(item); + } + }; + return null; + } + + @Override + public MenuItem setShortcut(char numericShortcut, char alphabeticShortcut) { + mShortcutNumericChar = numericShortcut; + mShortcutAlphabeticChar = alphabeticShortcut; + return this; + } + + @Override + public void setShowAsAction(int layoutResId) { + //No op + } + + @Override + public MenuItem setTitle(int resId) { + this.mTitle = mContext.getResources().getString(resId); + return this; + } + + @Override + public MenuItem setTitle(CharSequence title) { + mTitle = title; + return this; + } + + @Override + public MenuItem setTitleCondensed(CharSequence title) { + mTitleCondensed = title; + return this; + } + + @Override + public MenuItem setVisible(boolean visible) { + mFlags = (mFlags & HIDDEN) | (visible ? 0 : HIDDEN); + return this; + } +} \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/ActionMenuItemView.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/ActionMenuItemView.java new file mode 100644 index 00000000..110c957c --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/ActionMenuItemView.java @@ -0,0 +1,149 @@ +package com.actionbarsherlock.internal.view.menu; + +import java.lang.ref.WeakReference; +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; +import com.actionbarsherlock.R; + +public class ActionMenuItemView extends RelativeLayout implements MenuView.ItemView, View.OnClickListener { + private ImageView mImageButton; + private TextView mTextButton; + private FrameLayout mCustomView; + private MenuItemImpl mMenuItem; + private WeakReference mDivider; + + public ActionMenuItemView(Context context) { + this(context, null); + } + public ActionMenuItemView(Context context, AttributeSet attrs) { + this(context, attrs, R.attr.actionButtonStyle); + } + public ActionMenuItemView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + setOnClickListener(this); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + + mImageButton = (ImageView) findViewById(R.id.abs__item_icon); + mImageButton.setOnClickListener(this); + mTextButton = (TextView) findViewById(R.id.abs__item_text); + mTextButton.setOnClickListener(this); + mCustomView = (FrameLayout) findViewById(R.id.abs__item_custom); + mCustomView.setOnClickListener(this); + } + + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + mImageButton.setEnabled(enabled); + mTextButton.setEnabled(enabled); + mCustomView.setEnabled(enabled); + } + + public void setDivider(ImageView divider) { + mDivider = new WeakReference(divider); + //Ensure we are not displaying the divider when we are not visible + setDividerVisibility(getVisibility()); + } + + public void setVisible(boolean visible) { + final int visibility = visible ? View.VISIBLE : View.GONE; + setDividerVisibility(visibility); + setVisibility(visibility); + } + + private void setDividerVisibility(int visibility) { + if ((mDivider != null) && (mDivider.get() != null)) { + mDivider.get().setVisibility(visibility); + } + } + + public void reloadDisplay() { + final boolean hasCustomView = mCustomView.getChildCount() > 0; + final boolean hasText = mMenuItem.showsActionItemText() && !"".equals(mTextButton.getText()); + + if (hasCustomView) { + mCustomView.setVisibility(View.VISIBLE); + mImageButton.setVisibility(View.GONE); + mTextButton.setVisibility(View.GONE); + } else { + mCustomView.setVisibility(View.GONE); + mImageButton.setVisibility(View.VISIBLE); + mTextButton.setVisibility(hasText ? View.VISIBLE : View.GONE); + } + } + + public void setIcon(Drawable icon) { + mImageButton.setImageDrawable(icon); + } + + public void setTitle(CharSequence title) { + mTextButton.setText(title); + reloadDisplay(); + } + + @Override + public void initialize(MenuItemImpl itemData, int menuType) { + mMenuItem = itemData; + setId(itemData.getItemId()); + setIcon(itemData.getIcon()); + setTitle(itemData.getTitle()); + setEnabled(itemData.isEnabled()); + setActionView(itemData.getActionView()); + setVisible(itemData.isVisible()); + } + + @Override + public MenuItemImpl getItemData() { + return mMenuItem; + } + + @Override + public void setCheckable(boolean checkable) { + // No-op + } + + @Override + public void setChecked(boolean checked) { + // No-op + } + + @Override + public void setShortcut(boolean showShortcut, char shortcutKey) { + // No-op + } + + @Override + public void setActionView(View actionView) { + mCustomView.removeAllViews(); + if (actionView != null) { + mCustomView.addView(actionView); + } + reloadDisplay(); + } + + @Override + public boolean prefersCondensedTitle() { + return true; + } + + @Override + public boolean showsIcon() { + return true; + } + + @Override + public void onClick(View v) { + if (mMenuItem != null) { + mMenuItem.invoke(); + } + } +} \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuBuilder.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuBuilder.java new file mode 100644 index 00000000..41661ece --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuBuilder.java @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * Copyright (C) 2011 Jake Wharton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.actionbarsherlock.internal.view.menu; + +import java.util.ArrayList; +import java.util.List; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.support.v4.view.Menu; +import android.support.v4.view.MenuItem; +import android.view.KeyEvent; + +/** + * An implementation of the {@link android.view.Menu} interface for use in + * inflating menu XML resources to be added to a third-party action bar. + * + * @author Jake Wharton + * @see com.android.internal.view.menu.MenuBuilder + */ +public class MenuBuilder implements Menu { + private static final int DEFAULT_ITEM_ID = 0; + private static final int DEFAULT_GROUP_ID = 0; + private static final int DEFAULT_ORDER = 0; + + public static final int NUM_TYPES = 2; + public static final int TYPE_ACTION_BAR = 0; + public static final int TYPE_NATIVE = 1; + + /** + * This is the part of an order integer that the user can provide. + * @hide + */ + static final int USER_MASK = 0x0000ffff; + + /** + * Bit shift of the user portion of the order integer. + * @hide + */ + static final int USER_SHIFT = 0; + + /** + * This is the part of an order integer that supplies the category of the + * item. + * @hide + */ + + static final int CATEGORY_MASK = 0xffff0000; + + /** + * Bit shift of the category portion of the order integer. + * @hide + */ + static final int CATEGORY_SHIFT = 16; + + private static final int[] CATEGORY_TO_ORDER = new int[] { + 1, /* No category */ + 4, /* CONTAINER */ + 5, /* SYSTEM */ + 3, /* SECONDARY */ + 2, /* ALTERNATIVE */ + 0, /* SELECTED_ALTERNATIVE */ + }; + + + + public interface Callback { + public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item); + } + + + + /** Context used for resolving any resources. */ + private final Context mContext; + + /** Child {@link ActionBarMenuItem} items. */ + private final ArrayList mItems; + + /** Menu callback that will receive various events. */ + private Callback mCallback; + + private boolean mShowsActionItemText; + + + + /** + * Create a new action bar menu. + * + * @param context Context used if resource resolution is required. + */ + public MenuBuilder(Context context) { + this.mContext = context; + this.mItems = new ArrayList(); + } + + + /** + * Adds an item to the menu. The other add methods funnel to this. + * + * @param itemId Unique item ID. + * @param groupId Group ID. + * @param order Order. + * @param title Item title. + * @return MenuItem instance. + */ + private MenuItem addInternal(int itemId, int groupId, int order, CharSequence title) { + final int ordering = getOrdering(order); + final MenuItemImpl item = new MenuItemImpl(this, groupId, itemId, order, ordering, title, MenuItem.SHOW_AS_ACTION_NEVER); + + mItems.add(findInsertIndex(mItems, ordering), item); + return item; + } + + private static int findInsertIndex(ArrayList items, int ordering) { + for (int i = items.size() - 1; i >= 0; i--) { + MenuItemImpl item = items.get(i); + if (item.getOrdering() <= ordering) { + return i + 1; + } + } + + return 0; + } + + /** + * Returns the ordering across all items. This will grab the category from + * the upper bits, find out how to order the category with respect to other + * categories, and combine it with the lower bits. + * + * @param categoryOrder The category order for a particular item (if it has + * not been or/add with a category, the default category is + * assumed). + * @return An ordering integer that can be used to order this item across + * all the items (even from other categories). + */ + private static int getOrdering(int categoryOrder) { + final int index = (categoryOrder & CATEGORY_MASK) >> CATEGORY_SHIFT; + + if (index < 0 || index >= CATEGORY_TO_ORDER.length) { + throw new IllegalArgumentException("order does not contain a valid category."); + } + + return (CATEGORY_TO_ORDER[index] << CATEGORY_SHIFT) | (categoryOrder & USER_MASK); + } + + public void setCallback(Callback callback) { + mCallback = callback; + } + + public Callback getCallback() { + return mCallback; + } + + public boolean getShowsActionItemText() { + return mShowsActionItemText; + } + + public void setShowsActionItemText(boolean showsActionItemText) { + mShowsActionItemText = showsActionItemText; + } + + /** + * Gets the root menu (if this is a submenu, find its root menu). + * + * @return The root menu. + */ + public MenuBuilder getRootMenu() { + return this; + } + + /** + * Get a list of the items contained in this menu. + * + * @return List of {@link MenuItemImpl}s. + */ + public final List getItems() { + return this.mItems; + } + + final MenuItemImpl remove(int index) { + return this.mItems.remove(index); + } + + final Context getContext() { + return this.mContext; + } + + void setExclusiveItemChecked(MenuItem item) { + final int group = item.getGroupId(); + + final int N = mItems.size(); + for (int i = 0; i < N; i++) { + MenuItemImpl curItem = mItems.get(i); + if (curItem.getGroupId() == group) { + if (!curItem.isExclusiveCheckable()) continue; + if (!curItem.isCheckable()) continue; + + // Check the item meant to be checked, uncheck the others (that are in the group) + curItem.setCheckedInt(curItem == item); + } + } + } + + // ** Menu Methods ** \\ + + @Override + public MenuItem add(int titleResourceId) { + return addInternal(0, 0, 0, mContext.getResources().getString(titleResourceId)); + } + + @Override + public MenuItem add(int groupId, int itemId, int order, int titleResourceId) { + return addInternal(itemId, groupId, order, mContext.getResources().getString(titleResourceId)); + } + + @Override + public MenuItem add(int groupId, int itemId, int order, CharSequence title) { + return addInternal(itemId, groupId, order, title); + } + + @Override + public MenuItem add(CharSequence title) { + return addInternal(0, 0, 0, title); + } + + @Override + public SubMenuBuilder addSubMenu(CharSequence title) { + return this.addSubMenu(DEFAULT_GROUP_ID, DEFAULT_ITEM_ID, DEFAULT_ORDER, title); + } + + @Override + public SubMenuBuilder addSubMenu(int titleResourceId) { + return this.addSubMenu(DEFAULT_GROUP_ID, DEFAULT_ITEM_ID, DEFAULT_ORDER, titleResourceId); + } + + @Override + public SubMenuBuilder addSubMenu(int groupId, int itemId, int order, int titleResourceId) { + String title = this.mContext.getResources().getString(titleResourceId); + return this.addSubMenu(groupId, itemId, order, title); + } + + @Override + public SubMenuBuilder addSubMenu(int groupId, int itemId, int order, CharSequence title) { + MenuItemImpl item = (MenuItemImpl)this.add(groupId, itemId, order, title); + SubMenuBuilder subMenu = new SubMenuBuilder(this.mContext, this, item); + item.setSubMenu(subMenu); + return subMenu; + } + + @Override + public void clear() { + this.mItems.clear(); + } + + @Override + public void close() {} + + @Override + public MenuItemImpl findItem(int itemId) { + for (MenuItemImpl item : this.mItems) { + if (item.getItemId() == itemId) { + return item; + } + } + return null; + } + + @Override + public MenuItemImpl getItem(int index) { + return this.mItems.get(index); + } + + @Override + public boolean hasVisibleItems() { + for (MenuItem item : this.mItems) { + if (item.isVisible()) { + return true; + } + } + return false; + } + + @Override + public void removeItem(int itemId) { + final int size = this.mItems.size(); + for (int i = 0; i < size; i++) { + if (this.mItems.get(i).getItemId() == itemId) { + this.mItems.remove(i); + return; + } + } + } + + @Override + public int size() { + return this.mItems.size(); + } + + @Override + public int addIntentOptions(int groupId, int itemId, int order, ComponentName caller, Intent[] specifics, Intent intent, int flags, android.view.MenuItem[] outSpecificItems) { + PackageManager pm = mContext.getPackageManager(); + final List lri = + pm.queryIntentActivityOptions(caller, specifics, intent, 0); + final int N = lri != null ? lri.size() : 0; + + if ((flags & FLAG_APPEND_TO_GROUP) == 0) { + removeGroup(groupId); + } + + for (int i=0; i= 0) { + outSpecificItems[ri.specificIndex] = item; + } + } + + return N; + } + + @Override + public boolean isShortcutKey(int keyCode, KeyEvent event) { + return false; + } + + @Override + public boolean performIdentifierAction(int id, int flags) { + throw new RuntimeException("Method not supported."); + } + + @Override + public boolean performShortcut(int keyCode, KeyEvent event, int flags) { + return false; + } + + @Override + public void removeGroup(int groupId) { + final int size = this.mItems.size(); + for (int i = 0; i < size; i++) { + if (this.mItems.get(i).getGroupId() == groupId) { + this.mItems.remove(i); + } + } + } + + @Override + public void setGroupCheckable(int groupId, boolean checkable, boolean exclusive) { + final int N = mItems.size(); + for (int i = 0; i < N; i++) { + MenuItemImpl item = mItems.get(i); + if (item.getGroupId() == groupId) { + item.setExclusiveCheckable(exclusive); + item.setCheckable(checkable); + } + } + } + + @Override + public void setGroupEnabled(int groupId, boolean enabled) { + final int size = this.mItems.size(); + for (int i = 0; i < size; i++) { + MenuItemImpl item = mItems.get(i); + if (item.getGroupId() == groupId) { + item.setEnabled(enabled); + } + } + } + + @Override + public void setGroupVisible(int groupId, boolean visible) { + final int size = this.mItems.size(); + for (int i = 0; i < size; i++) { + MenuItemImpl item = mItems.get(i); + if (item.getGroupId() == groupId) { + item.setVisible(visible); + } + } + } + + @Override + public void setQwertyMode(boolean isQwerty) { + throw new RuntimeException("Method not supported."); + } +} \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuInflaterWrapper.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuInflaterWrapper.java new file mode 100644 index 00000000..29040bab --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuInflaterWrapper.java @@ -0,0 +1,21 @@ +package com.actionbarsherlock.internal.view.menu; + +import android.content.Context; + +public final class MenuInflaterWrapper extends android.view.MenuInflater { + private final android.view.MenuInflater mMenuInflater; + + public MenuInflaterWrapper(Context context, android.view.MenuInflater menuInflater) { + super(context); + mMenuInflater = menuInflater; + } + + @Override + public void inflate(int menuRes, android.view.Menu menu) { + if (menu instanceof MenuWrapper) { + mMenuInflater.inflate(menuRes, ((MenuWrapper)menu).unwrap()); + } else { + mMenuInflater.inflate(menuRes, menu); + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuItemImpl.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuItemImpl.java new file mode 100644 index 00000000..0970d7ed --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuItemImpl.java @@ -0,0 +1,663 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * 2011 Jake Wharton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.actionbarsherlock.internal.view.menu; + +import java.lang.ref.WeakReference; +import android.app.AlertDialog; +import android.content.ActivityNotFoundException; +import android.content.DialogInterface; +import android.content.Intent; +import android.graphics.drawable.Drawable; +import android.support.v4.view.MenuItem; +import android.util.Log; +import android.view.ContextMenu.ContextMenuInfo; +import android.view.LayoutInflater; +import android.view.View; + +/** + * An implementation of the {@link android.view.MenuItem} interface for use in + * inflating menu XML resources to be added to a third-party action bar. + * + * @author Jake Wharton + * @see com.android.internal.view.menu.MenuItemImpl + */ +public final class MenuItemImpl implements MenuItem { + private static final String TAG = "MenuItemImpl"; + + private final MenuBuilder mMenu; + + private final int mItemId; + private final int mGroupId; + private final int mCategoryOrder; + private final int mOrdering; + + private Intent mIntent; + private CharSequence mTitle; + private CharSequence mTitleCondensed; + private char mNumericalShortcut; + private char mAlphabeticalShortcut; + private int mShowAsAction; + private SubMenuBuilder mSubMenu; + private Runnable mItemCallback; + private OnMenuItemClickListener mClickListener; + private Drawable mIcon; + private int mIconRes = View.NO_ID; + private View mActionView; + private int mActionViewRes = View.NO_ID; + + int mFlags = ENABLED; + static final int CHECKABLE = 0x01; + static final int CHECKED = 0x02; + static final int EXCLUSIVE = 0x04; + static final int HIDDEN = 0x08; + static final int ENABLED = 0x10; + static final int IS_ACTION = 0x20; + + private final WeakReference[] mItemViews; + + private final DialogInterface.OnClickListener subMenuClick = new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int index) { + dialog.dismiss(); + mSubMenu.getItem(index).invoke(); + } + }; + private final DialogInterface.OnMultiChoiceClickListener subMenuMultiClick = new DialogInterface.OnMultiChoiceClickListener() { + @Override + public void onClick(DialogInterface dialog, int index, boolean isChecked) { + dialog.dismiss(); + mSubMenu.getItem(index).setChecked(isChecked); + } + }; + + + /** + * Create a new action bar menu item. + * + * @param context Context used if resource resolution is required. + * @param itemId A unique ID. Used in the activity callback. + * @param groupId Group ID. Currently unused. + * @param order Item order. Currently unused. + * @param title Title of the item. + */ + @SuppressWarnings("unchecked") + public MenuItemImpl(MenuBuilder menu, int groupId, int itemId, int order, int ordering, CharSequence title, int showAsAction) { + mMenu = menu; + + mItemId = itemId; + mGroupId = groupId; + mCategoryOrder = order; + mOrdering = ordering; + mTitle = title; + mShowAsAction = showAsAction; + + mItemViews = new WeakReference[MenuBuilder.NUM_TYPES]; + } + + + + public boolean invoke() { + if (hasSubMenu()) { + AlertDialog.Builder builder = new AlertDialog.Builder(mMenu.getContext()); + builder.setTitle(getTitle()); + + final boolean isExclusive = mSubMenu.getItem(0).isExclusiveCheckable(); + final boolean isCheckable = mSubMenu.getItem(0).isCheckable(); + final CharSequence[] titles = getSubMenuTitles(); + if (isExclusive) { + builder.setSingleChoiceItems(titles, getSubMenuSelected(), subMenuClick); + } else if (isCheckable) { + builder.setMultiChoiceItems(titles, getSubMenuChecked(), subMenuMultiClick); + } else { + builder.setItems(titles, subMenuClick); + } + + builder.show(); + return true; + } + + if (mClickListener != null && + mClickListener.onMenuItemClick(this)) { + return true; + } + + MenuBuilder.Callback callback = mMenu.getRootMenu().getCallback(); + if (callback != null && + callback.onMenuItemSelected(mMenu.getRootMenu(), this)) { + return true; + } + + if (mItemCallback != null) { + mItemCallback.run(); + return true; + } + + if (mIntent != null) { + try { + mMenu.getContext().startActivity(mIntent); + return true; + } catch (ActivityNotFoundException e) { + Log.e(TAG, "Can't find activity to handle intent; ignoring", e); + } + } + + return false; + } + + private CharSequence[] getSubMenuTitles() { + final int count = mSubMenu.size(); + CharSequence[] list = new CharSequence[count]; + for (int i = 0; i < count; i++) { + list[i] = mSubMenu.getItem(i).getTitle(); + } + return list; + } + + private int getSubMenuSelected() { + final int count = mSubMenu.size(); + for (int i = 0; i < count; i++) { + if (mSubMenu.getItem(i).isChecked()) { + return i; + } + } + return -1; + } + + private boolean[] getSubMenuChecked() { + final int count = mSubMenu.size(); + boolean[] checked = new boolean[count]; + for (int i = 0; i < count; i++) { + checked[i] = mSubMenu.getItem(i).isChecked(); + } + return checked; + } + + private boolean hasItemView(int menuType) { + return mItemViews[menuType] != null && mItemViews[menuType].get() != null; + } + + public void setItemView(int type, MenuView.ItemView itemView) { + mItemViews[type] = new WeakReference(itemView); + } + + + public void addTo(android.view.Menu menu) { + if (hasSubMenu()) { + android.view.SubMenu subMenu = menu.addSubMenu(mGroupId, mItemId, mCategoryOrder, mTitle); + if (mIconRes != View.NO_ID) { + subMenu.setIcon(mIconRes); + } else { + subMenu.setIcon(mIcon); + } + for (MenuItemImpl item : mSubMenu.getItems()) { + item.addTo(subMenu); + } + + if (mSubMenu.getItem(0).isExclusiveCheckable()) { + int checked = getSubMenuSelected(); + if (checked != -1) { + subMenu.getItem(checked).setChecked(true); + } + } + } else { + android.view.MenuItem item = menu.add(mGroupId, mItemId, mCategoryOrder, mTitle) + .setAlphabeticShortcut(mAlphabeticalShortcut) + .setNumericShortcut(mNumericalShortcut) + .setVisible(isVisible()) + .setIntent(mIntent) + .setCheckable(isCheckable()) + .setChecked(isChecked()) + .setOnMenuItemClickListener(mClickListener); + + if (isExclusiveCheckable()) { + menu.setGroupCheckable(mGroupId, true, true); + } + + //Create and initialize a native itemview wrapper + NativeMenuItemView nativeWrapper = new NativeMenuItemView(item); + nativeWrapper.initialize(this, MenuBuilder.TYPE_NATIVE); + + //Associate the itemview to this so changes will be reflected + setItemView(MenuBuilder.TYPE_NATIVE, nativeWrapper); + } + } + + /** + * Get whether or not this item is being shown on the action bar. + * + * @return {@code true} if shown, {@code false} otherwise. + */ + public boolean isShownOnActionBar() { + return (mFlags & IS_ACTION) == IS_ACTION; + } + + /** + * Denote whether or not this menu item is being shown on the action bar. + * + * @param isShownOnActionBar {@code true} if shown or {@code false}. + */ + public void setIsShownOnActionBar(boolean isShownOnActionBar) { + mFlags = (mFlags & ~IS_ACTION) | (isShownOnActionBar ? IS_ACTION : 0); + } + + @Override + public Intent getIntent() { + return this.mIntent; + } + + @Override + public int getItemId() { + return this.mItemId; + } + + @Override + public CharSequence getTitle() { + return this.mTitle; + } + + @Override + public boolean isEnabled() { + return (mFlags & ENABLED) != 0; + } + + @Override + public boolean isVisible() { + return (mFlags & HIDDEN) == 0; + } + + @Override + public MenuItem setEnabled(boolean enabled) { + final boolean oldValue = isEnabled(); + mFlags = (mFlags & ~ENABLED) | (enabled ? ENABLED : 0); + + if (oldValue != enabled) { + for (int i = MenuBuilder.NUM_TYPES - 1; i >= 0; i--) { + if (hasItemView(i)) { + mItemViews[i].get().setEnabled(enabled); + } + } + } + + return this; + } + + @Override + public MenuItem setIcon(int iconResourceId) { + mIcon = null; + mIconRes = iconResourceId; + + if (mIconRes != View.NO_ID) { + setIconOnViews(mMenu.getContext().getResources().getDrawable(mIconRes)); + } + + return this; + } + + @Override + public MenuItem setIntent(Intent intent) { + mIntent = intent; + return this; + } + + @Override + public MenuItem setTitle(CharSequence title) { + mTitle = title; + return this; + } + + @Override + public MenuItem setTitle(int titleResourceId) { + mTitle = mMenu.getContext().getResources().getString(titleResourceId); + return this; + } + + @Override + public MenuItem setVisible(boolean visible) { + final boolean oldValue = isVisible(); + mFlags = (mFlags & ~HIDDEN) | (visible ? 0 : HIDDEN); + if (oldValue != visible) { + for (int i = MenuBuilder.NUM_TYPES - 1; i >= 0; i--) { + if (hasItemView(i)) { + mItemViews[i].get().setVisible(visible); + } + } + } + return this; + } + + @Override + public boolean isChecked() { + return (mFlags & CHECKED) == CHECKED; + } + + @Override + public MenuItem setChecked(boolean checked) { + if ((mFlags & EXCLUSIVE) == EXCLUSIVE) { + // Call the method on the Menu since it knows about the others in this + // exclusive checkable group + mMenu.setExclusiveItemChecked(this); + } else { + setCheckedInt(checked); + } + + return this; + } + + void setCheckedInt(boolean checked) { + final boolean oldValue = isChecked(); + mFlags = (mFlags & ~CHECKED) | (checked ? CHECKED : 0); + if (oldValue != checked) { + for (int i = MenuBuilder.NUM_TYPES - 1; i >= 0; i--) { + if (hasItemView(i)) { + mItemViews[i].get().setChecked(checked); + } + } + } + } + + @Override + public boolean isCheckable() { + return (mFlags & CHECKABLE) == CHECKABLE; + } + + @Override + public MenuItem setCheckable(boolean checkable) { + final boolean oldValue = isCheckable(); + mFlags = (mFlags & ~CHECKABLE) | (checkable ? CHECKABLE : 0); + if (oldValue != checkable) { + for (int i = MenuBuilder.NUM_TYPES - 1; i >= 0; i--) { + if (hasItemView(i)) { + mItemViews[i].get().setCheckable(checkable); + } + } + } + + return this; + } + + public void setExclusiveCheckable(boolean exclusive) { + mFlags = (mFlags & ~EXCLUSIVE) | (exclusive ? EXCLUSIVE : 0); + } + + public boolean isExclusiveCheckable() { + return (mFlags & EXCLUSIVE) == EXCLUSIVE; + } + + @Override + public CharSequence getTitleCondensed() { + return mTitleCondensed; + } + + @Override + public MenuItem setTitleCondensed(CharSequence title) { + mTitleCondensed = title; + return this; + } + + @Override + public int getGroupId() { + return mGroupId; + } + + @Override + public int getOrder() { + return mCategoryOrder; + } + + public int getOrdering() { + return mOrdering; + } + + @Override + public SubMenuBuilder getSubMenu() { + return mSubMenu; + } + + /** + * Set the sub-menu of this item. + * + * @param subMenu Sub-menu instance. + * @return This Item so additional setters can be called. + */ + MenuItem setSubMenu(SubMenuBuilder subMenu) { + mSubMenu = subMenu; + return this; + } + + @Override + public boolean hasSubMenu() { + return (mSubMenu != null) && (mSubMenu.size() > 0); + } + + @Override + public char getAlphabeticShortcut() { + return mAlphabeticalShortcut; + } + + @Override + public char getNumericShortcut() { + return mNumericalShortcut; + } + + @Override + public MenuItem setAlphabeticShortcut(char alphaChar) { + mAlphabeticalShortcut = Character.toLowerCase(alphaChar); + return this; + } + + @Override + public MenuItem setNumericShortcut(char numericChar) { + mNumericalShortcut = numericChar; + return this; + } + + @Override + public MenuItem setShortcut(char numericChar, char alphaChar) { + setNumericShortcut(numericChar); + setAlphabeticShortcut(alphaChar); + return this; + } + + @Override + public void setShowAsAction(int actionEnum) { + mShowAsAction = actionEnum; + } + + public int getShowAsAction() { + return mShowAsAction; + } + + public boolean showsActionItemText() { + return mMenu.getShowsActionItemText(); + } + + @Override + public View getActionView() { + if (mActionView != null) { + return mActionView; + } + if (mActionViewRes != View.NO_ID) { + return LayoutInflater.from(mMenu.getContext()).inflate(mActionViewRes, null, false); + } + return null; + } + + @Override + public Drawable getIcon() { + if (mIcon != null) { + return mIcon; + } + if (mIconRes != View.NO_ID) { + return mMenu.getContext().getResources().getDrawable(mIconRes); + } + return null; + } + + @Override + public ContextMenuInfo getMenuInfo() { + return null; + } + + @Override + public MenuItem setActionView(View view) { + mActionView = view; + mActionViewRes = View.NO_ID; + setActionViewOnViews(mActionView); + return this; + } + + @Override + public MenuItem setActionView(int resId) { + mActionView = null; + mActionViewRes = resId; + + if (mActionViewRes != View.NO_ID) { + setActionViewOnViews(LayoutInflater.from(mMenu.getContext()).inflate(mActionViewRes, null, false)); + } + + return this; + } + + void setActionViewOnViews(View view) { + for (int i = MenuBuilder.NUM_TYPES - 1; i >= 0; i--) { + if (hasItemView(i)) { + mItemViews[i].get().setActionView(view); + } + } + } + + @Override + public MenuItem setIcon(Drawable icon) { + mIcon = icon; + mIconRes = View.NO_ID; + setIconOnViews(icon); + return this; + } + + void setIconOnViews(Drawable icon) { + for (int i = MenuBuilder.NUM_TYPES - 1; i >= 0; i--) { + if (hasItemView(i)) { + mItemViews[i].get().setIcon(icon); + } + } + } + + @Override + public android.view.MenuItem setOnMenuItemClickListener(final android.view.MenuItem.OnMenuItemClickListener menuItemClickListener) { + return this.setOnMenuItemClickListener(new OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + return menuItemClickListener.onMenuItemClick(new MenuItemWrapper(item)); + } + }); + } + + @Override + public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener menuItemClickListener) { + mClickListener = menuItemClickListener; + return this; + } + + /** + * Returns the currently set menu click listener for this item. + * + * @return Click listener or {@code null}. + */ + public OnMenuItemClickListener getOnMenuItemClickListener() { + return mClickListener; + } + + + + + public static final class NativeMenuItemView implements MenuView.ItemView { + private final android.view.MenuItem mItem; + + + public NativeMenuItemView(android.view.MenuItem item) { + mItem = item; + } + + + @Override + public MenuItemImpl getItemData() { + return null; + } + + @Override + public void initialize(MenuItemImpl itemData, int menuType) { + setIcon(itemData.getIcon()); + setTitle(itemData.getTitle()); + setEnabled(itemData.isEnabled()); + setCheckable(itemData.isCheckable()); + setChecked(itemData.isChecked()); + setActionView(itemData.getActionView()); + setVisible(itemData.isVisible()); + } + + @Override + public boolean prefersCondensedTitle() { + return true; + } + + @Override + public void setCheckable(boolean checkable) { + mItem.setCheckable(checkable); + } + + @Override + public void setChecked(boolean checked) { + mItem.setChecked(checked); + } + + @Override + public void setEnabled(boolean enabled) { + mItem.setEnabled(enabled); + } + + @Override + public void setIcon(Drawable icon) { + mItem.setIcon(icon); + } + + @Override + public void setShortcut(boolean showShortcut, char shortcutKey) { + //Not supported + } + + @Override + public void setTitle(CharSequence title) { + mItem.setTitle(title); + } + + @Override + public boolean showsIcon() { + return true; + } + + @Override + public void setActionView(View actionView) { + //Not supported + } + + @Override + public void setVisible(boolean visible) { + mItem.setVisible(visible); + } + } +} \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.java new file mode 100644 index 00000000..2ed1e548 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.java @@ -0,0 +1,315 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * Copyright (C) 2011 Jake Wharton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.actionbarsherlock.internal.view.menu; + +import android.content.Intent; +import android.graphics.drawable.Drawable; +import android.support.v4.view.MenuItem; +import android.support.v4.view.SubMenu; +import android.view.View; +import android.view.ContextMenu.ContextMenuInfo; + +/** + *

Interface for direct access to a previously created menu item.

+ * + *

An Item is returned by calling one of the {@link Menu#add(int)} + * methods.

+ * + *

For a feature set of specific menu types, see {@link Menu}.

+ */ +public final class MenuItemWrapper implements MenuItem { + private static final class HoneycombMenuItem { + static View getActionView(android.view.MenuItem item) { + return item.getActionView(); + } + + static void setActionView(android.view.MenuItem item, int resId) { + item.setActionView(resId); + } + + static void setActionView(android.view.MenuItem item, View view) { + item.setActionView(view); + } + + static void setShowAsAction(android.view.MenuItem item, int actionEnum) { + item.setShowAsAction(actionEnum); + } + } + + /** Native {@link android.view.MenuItem} whose methods are wrapped. */ + private final android.view.MenuItem mMenuItem; + + /** + * Constructor used to create a wrapper to a native + * {@link android.view.MenuItem} so we can return the same type for native + * and {@link MenuItemImpl} instances, the latter of which will override + * all the methods defined in this base class. + * + * @param menuItem Native instance. + */ + public MenuItemWrapper(android.view.MenuItem menuItem) { + mMenuItem = menuItem; + } + + + /** + * Returns the currently set action view for this menu item. + * + * @return The item's action view + * @see #setActionView(int) + * @see #setActionView(View) + * @see #setShowAsAction(int) + */ + public View getActionView() { + if (mMenuItem != null) { + return HoneycombMenuItem.getActionView(mMenuItem); + } + return null; + } + + /** + * Set an action view for this menu item. An action view will be displayed + * in place of an automatically generated menu item element in the UI when + * this item is shown as an action within a parent. + * + * @param resId Layout resource to use for presenting this item to the user. + * @return This Item so additional setters can be called. + * @see #setActionView(View) + */ + public MenuItem setActionView(int resId) { + if (mMenuItem != null) { + HoneycombMenuItem.setActionView(mMenuItem, resId); + } + return this; + } + + /** + * Set an action view for this menu item. An action view will be displayed + * in place of an automatically generated menu item element in the UI when + * this item is shown as an action within a parent. + * + * @param view View to use for presenting this item to the user. + * @return This Item so additional setters can be called. + * @see #setActionView(int) + */ + public MenuItem setActionView(View view) { + if (mMenuItem != null) { + HoneycombMenuItem.setActionView(mMenuItem, view); + } + return this; + } + + /** + * Sets how this item should display in the presence of an Action Bar. The + * parameter actionEnum is a flag set. One of + * {@link #SHOW_AS_ACTION_ALWAYS}, {@link #SHOW_AS_ACTION_IF_ROOM}, or + * {@link #SHOW_AS_ACTION_NEVER} should be used, and you may optionally OR + * the value with {@link #SHOW_AS_ACTION_WITH_TEXT}. + * {@link #SHOW_AS_ACTION_WITH_TEXT} requests that when the item is shown as + * an action, it should be shown with a text label. + * + * @param actionEnum How the item should display. One of + * {@link #SHOW_AS_ACTION_ALWAYS}, {@link #SHOW_AS_ACTION_IF_ROOM}, or + * {@link #SHOW_AS_ACTION_NEVER}. {@link #SHOW_AS_ACTION_NEVER} is the + * default. + */ + public void setShowAsAction(int actionEnum) { + if (mMenuItem != null) { + HoneycombMenuItem.setShowAsAction(mMenuItem, actionEnum); + } + } + + // --------------------------------------------------------------------- + // MENU ITEM SUPPORT + // --------------------------------------------------------------------- + + @Override + public char getAlphabeticShortcut() { + return mMenuItem.getAlphabeticShortcut(); + } + + @Override + public int getGroupId() { + return mMenuItem.getGroupId(); + } + + @Override + public Drawable getIcon() { + return mMenuItem.getIcon(); + } + + @Override + public Intent getIntent() { + return mMenuItem.getIntent(); + } + + @Override + public int getItemId() { + return mMenuItem.getItemId(); + } + + @Override + public ContextMenuInfo getMenuInfo() { + return mMenuItem.getMenuInfo(); + } + + @Override + public char getNumericShortcut() { + return mMenuItem.getNumericShortcut(); + } + + @Override + public int getOrder() { + return mMenuItem.getOrder(); + } + + @Override + public SubMenu getSubMenu() { + return new SubMenuWrapper(mMenuItem.getSubMenu()); + } + + @Override + public CharSequence getTitle() { + return mMenuItem.getTitle(); + } + + @Override + public CharSequence getTitleCondensed() { + return mMenuItem.getTitleCondensed(); + } + + @Override + public boolean hasSubMenu() { + return mMenuItem.hasSubMenu(); + } + + @Override + public boolean isCheckable() { + return mMenuItem.isCheckable(); + } + + @Override + public boolean isChecked() { + return mMenuItem.isChecked(); + } + + @Override + public boolean isEnabled() { + return mMenuItem.isEnabled(); + } + + @Override + public boolean isVisible() { + return mMenuItem.isVisible(); + } + + @Override + public MenuItem setAlphabeticShortcut(char alphaChar) { + mMenuItem.setAlphabeticShortcut(alphaChar); + return this; + } + + @Override + public MenuItem setCheckable(boolean checkable) { + mMenuItem.setCheckable(checkable); + return this; + } + + @Override + public MenuItem setChecked(boolean checked) { + mMenuItem.setChecked(checked); + return this; + } + + @Override + public MenuItem setEnabled(boolean enabled) { + mMenuItem.setEnabled(enabled); + return this; + } + + @Override + public MenuItem setIcon(Drawable icon) { + mMenuItem.setIcon(icon); + return this; + } + + @Override + public MenuItem setIcon(int iconRes) { + mMenuItem.setIcon(iconRes); + return this; + } + + @Override + public MenuItem setIntent(Intent intent) { + mMenuItem.setIntent(intent); + return this; + } + + @Override + public MenuItem setNumericShortcut(char numericChar) { + mMenuItem.setNumericShortcut(numericChar); + return this; + } + + @Override + public MenuItem setOnMenuItemClickListener(android.view.MenuItem.OnMenuItemClickListener menuItemClickListener) { + mMenuItem.setOnMenuItemClickListener(menuItemClickListener); + return this; + } + + /** + * Set a custom listener for invocation of this menu item. + * + * @param menuItemClickListener The object to receive invokations. + * @return This Item so additional setters can be called. + */ + public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener menuItemClickListener) { + mMenuItem.setOnMenuItemClickListener(menuItemClickListener); + return this; + } + + @Override + public MenuItem setShortcut(char numericChar, char alphaChar) { + mMenuItem.setShortcut(numericChar, alphaChar); + return this; + } + + @Override + public MenuItem setTitle(CharSequence title) { + mMenuItem.setTitle(title); + return this; + } + + @Override + public MenuItem setTitle(int title) { + mMenuItem.setTitle(title); + return this; + } + + @Override + public MenuItem setTitleCondensed(CharSequence title) { + mMenuItem.setTitleCondensed(title); + return this; + } + + @Override + public MenuItem setVisible(boolean visible) { + mMenuItem.setVisible(visible); + return this; + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuView.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuView.java new file mode 100644 index 00000000..daae3fe8 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuView.java @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2006 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.internal.view.menu; + +import android.graphics.drawable.Drawable; +import android.view.View; + +/** + * Minimal interface for a menu view. {@link #initialize(MenuBuilder, int)} must be called for the + * menu to be functional. + * + * @hide + */ +public interface MenuView { + /** + * Initializes the menu to the given menu. This should be called after the + * view is inflated. + * + * @param menu The menu that this MenuView should display. + * @param menuType The type of this menu, one of + * {@link MenuBuilder#TYPE_ICON}, {@link MenuBuilder#TYPE_EXPANDED}, + * {@link MenuBuilder#TYPE_DIALOG}). + */ + public void initialize(MenuBuilder menu, int menuType); + + /** + * Forces the menu view to update its view to reflect the new state of the menu. + * + * @param cleared Whether the menu was cleared or just modified. + */ + public void updateChildren(boolean cleared); + + /** + * Returns the default animations to be used for this menu when entering/exiting. + * @return A resource ID for the default animations to be used for this menu. + */ + public int getWindowAnimations(); + + /** + * Minimal interface for a menu item view. {@link #initialize(MenuItemImpl, int)} must be called + * for the item to be functional. + */ + public interface ItemView { + /** + * Initializes with the provided MenuItemData. This should be called after the view is + * inflated. + * @param itemData The item that this ItemView should display. + * @param menuType The type of this menu, one of + * {@link MenuBuilder#TYPE_ICON}, {@link MenuBuilder#TYPE_EXPANDED}, + * {@link MenuBuilder#TYPE_DIALOG}). + */ + public void initialize(MenuItemImpl itemData, int menuType); + + /** + * Gets the item data that this view is displaying. + * @return the item data, or null if there is not one + */ + public MenuItemImpl getItemData(); + + /** + * Sets the title of the item view. + * @param title The title to set. + */ + public void setTitle(CharSequence title); + + /** + * Sets the enabled state of the item view. + * @param enabled Whether the item view should be enabled. + */ + public void setEnabled(boolean enabled); + + /** + * Displays the checkbox for the item view. This does not ensure the item view will be + * checked, for that use {@link #setChecked}. + * @param checkable Whether to display the checkbox or to hide it + */ + public void setCheckable(boolean checkable); + + /** + * Checks the checkbox for the item view. If the checkbox is hidden, it will NOT be + * made visible, call {@link #setCheckable(boolean)} for that. + * @param checked Whether the checkbox should be checked + */ + public void setChecked(boolean checked); + + /** + * Sets the visibility for the item view. + * @param visible Whether the item is visible + */ + public void setVisible(boolean visible); + + /** + * Sets the shortcut for the item. + * @param showShortcut Whether a shortcut should be shown(if false, the value of + * shortcutKey should be ignored). + * @param shortcutKey The shortcut key that should be shown on the ItemView. + */ + public void setShortcut(boolean showShortcut, char shortcutKey); + + /** + * Set the icon of this item view. + * @param icon The icon of this item. null to hide the icon. + */ + public void setIcon(Drawable icon); + + /** + * Set the action view of this item view. + * @param actionView Action view. + */ + public void setActionView(View actionView); + + /** + * Whether this item view prefers displaying the condensed title rather + * than the normal title. If a condensed title is not available, the + * normal title will be used. + * + * @return Whether this item view prefers displaying the condensed + * title. + */ + public boolean prefersCondensedTitle(); + + /** + * Whether this item view shows an icon. + * + * @return Whether this item view shows an icon. + */ + public boolean showsIcon(); + } +} \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuWrapper.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuWrapper.java new file mode 100644 index 00000000..4e499930 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/MenuWrapper.java @@ -0,0 +1,156 @@ +package com.actionbarsherlock.internal.view.menu; + +import android.content.ComponentName; +import android.content.Intent; +import android.support.v4.view.Menu; +import android.support.v4.view.MenuItem; +import android.support.v4.view.SubMenu; +import android.view.KeyEvent; + +/** + * Wrapper around a native Menu instance which implements our version of the + * Menu interface. + */ +public class MenuWrapper implements Menu { + /** Native menu. */ + private final android.view.Menu mMenu; + + /** + * Create a new wrapped instance. + * + * @param menu Native menu. + */ + public MenuWrapper(android.view.Menu menu) { + this.mMenu = menu; + } + + /** + * Get the native menu instance we are wrapping. + * + * @return Native menu. + */ + android.view.Menu unwrap() { + return mMenu; + } + + @Override + public MenuItem add(CharSequence title) { + return new MenuItemWrapper(mMenu.add(title)); + } + + @Override + public MenuItem add(int groupId, int itemId, int order, int titleRes) { + return new MenuItemWrapper(mMenu.add(groupId, itemId, order, titleRes)); + } + + @Override + public MenuItem add(int titleRes) { + return new MenuItemWrapper(mMenu.add(titleRes)); + } + + @Override + public MenuItem add(int groupId, int itemId, int order, CharSequence title) { + return new MenuItemWrapper(mMenu.add(groupId, itemId, order, title)); + } + + @Override + public int addIntentOptions(int groupId, int itemId, int order, ComponentName caller, Intent[] specifics, Intent intent, int flags, android.view.MenuItem[] outSpecificItems) { + return mMenu.addIntentOptions(groupId, itemId, order, caller, specifics, intent, flags, outSpecificItems); + } + + @Override + public SubMenu addSubMenu(CharSequence title) { + return new SubMenuWrapper(mMenu.addSubMenu(title)); + } + + @Override + public SubMenu addSubMenu(int titleRes) { + return new SubMenuWrapper(mMenu.addSubMenu(titleRes)); + } + + @Override + public SubMenu addSubMenu(int groupId, int itemId, int order, CharSequence title) { + return new SubMenuWrapper(mMenu.addSubMenu(groupId, itemId, order, title)); + } + + @Override + public SubMenu addSubMenu(int groupId, int itemId, int order, int titleRes) { + return new SubMenuWrapper(mMenu.addSubMenu(groupId, itemId, order, titleRes)); + } + + @Override + public void clear() { + mMenu.clear(); + } + + @Override + public void close() { + mMenu.close(); + } + + @Override + public MenuItem findItem(int id) { + android.view.MenuItem item = mMenu.findItem(id); + return (item != null) ? new MenuItemWrapper(item) : null; + } + + @Override + public MenuItem getItem(int index) { + return new MenuItemWrapper(mMenu.getItem(index)); + } + + @Override + public boolean hasVisibleItems() { + return mMenu.hasVisibleItems(); + } + + @Override + public boolean isShortcutKey(int keyCode, KeyEvent event) { + return mMenu.isShortcutKey(keyCode, event); + } + + @Override + public boolean performIdentifierAction(int id, int flags) { + return mMenu.performIdentifierAction(id, flags); + } + + @Override + public boolean performShortcut(int keyCode, KeyEvent event, int flags) { + return mMenu.performShortcut(keyCode, event, flags); + } + + @Override + public void removeGroup(int groupId) { + mMenu.removeGroup(groupId); + } + + @Override + public void removeItem(int id) { + mMenu.removeItem(id); + } + + @Override + public void setGroupCheckable(int group, boolean checkable, boolean exclusive) { + mMenu.setGroupCheckable(group, checkable, exclusive); + } + + @Override + public void setGroupEnabled(int group, boolean enabled) { + mMenu.setGroupEnabled(group, enabled); + } + + @Override + public void setGroupVisible(int group, boolean visible) { + mMenu.setGroupVisible(group, visible); + } + + @Override + public void setQwertyMode(boolean isQwerty) { + mMenu.setQwertyMode(isQwerty); + } + + @Override + public int size() { + return mMenu.size(); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/SubMenuBuilder.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/SubMenuBuilder.java new file mode 100644 index 00000000..dac262d5 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/SubMenuBuilder.java @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * Copyright (C) 2011 Jake Wharton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.actionbarsherlock.internal.view.menu; + +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.support.v4.view.SubMenu; +import android.view.View; + +/** + * The model for a sub menu, which is an extension of the menu. Most methods + * are proxied to the parent menu. + */ +public final class SubMenuBuilder extends MenuBuilder implements SubMenu { + private MenuBuilder mParentMenu; + private MenuItemImpl mItem; + + public SubMenuBuilder(Context context, MenuBuilder parentMenu, MenuItemImpl item) { + super(context); + + mParentMenu = parentMenu; + mItem = item; + } + + @Override + public void setQwertyMode(boolean isQwerty) { + mParentMenu.setQwertyMode(isQwerty); + } + + //@Override + //public boolean isQwertyMode() { + // return mParentMenu.isQwertyMode(); + //} + + //@Override + //public void setShortcutsVisible(boolean shortcutsVisible) { + // mParentMenu.setShortcutsVisible(shortcutsVisible); + //} + + //@Override + //public boolean isShortcutsVisible() { + // return mParentMenu.isShortcutsVisible(); + //} + + MenuBuilder getParentMenu() { + return mParentMenu; + } + + @Override + public MenuItemImpl getItem() { + return mItem; + } + + //@Override + //public Callback getCallback() { + // return mParentMenu.getCallback(); + //} + + //@Override + //public void setCallback(Callback callback) { + // mParentMenu.setCallback(callback); + //} + + @Override + public MenuBuilder getRootMenu() { + return mParentMenu; + } + + public SubMenuBuilder setIcon(Drawable icon) { + mItem.setIcon(icon); + return this; + } + + public SubMenuBuilder setIcon(int iconRes) { + mItem.setIcon(iconRes); + return this; + } + + public SubMenuBuilder setHeaderIcon(Drawable icon) { + throw new RuntimeException("Method not supported."); + } + + public SubMenuBuilder setHeaderIcon(int iconRes) { + throw new RuntimeException("Method not supported."); + } + + public SubMenuBuilder setHeaderTitle(CharSequence title) { + throw new RuntimeException("Method not supported."); + } + + public SubMenuBuilder setHeaderTitle(int titleRes) { + throw new RuntimeException("Method not supported."); + } + + @Override + public SubMenuBuilder setHeaderView(View view) { + throw new RuntimeException("Method not supported."); + } + + @Override + public void clearHeader() { + throw new RuntimeException("Method not supported."); + } +} \ No newline at end of file diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/SubMenuWrapper.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/SubMenuWrapper.java new file mode 100644 index 00000000..60e81ea7 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/SubMenuWrapper.java @@ -0,0 +1,82 @@ +package com.actionbarsherlock.internal.view.menu; + +import android.graphics.drawable.Drawable; +import android.support.v4.view.MenuItem; +import android.support.v4.view.SubMenu; +import android.view.View; + +public class SubMenuWrapper extends MenuWrapper implements SubMenu { + /** Native sub-menu. */ + private final android.view.SubMenu mSubMenu; + + /** + * Create a new wrapped instance. + * + * @param subMenu Native sub-menu. + */ + public SubMenuWrapper(android.view.SubMenu subMenu) { + super(subMenu); + mSubMenu = subMenu; + } + + /** + * Get the native sub-menu instance we are wrapping. + * + * @return Native sub-menu. + */ + android.view.SubMenu unwrap() { + return mSubMenu; + } + + @Override + public void clearHeader() { + mSubMenu.clearHeader(); + } + + @Override + public MenuItem getItem() { + return new MenuItemWrapper(mSubMenu.getItem()); + } + + @Override + public SubMenu setHeaderIcon(Drawable icon) { + mSubMenu.setHeaderIcon(icon); + return this; + } + + @Override + public SubMenu setHeaderIcon(int iconRes) { + mSubMenu.setHeaderIcon(iconRes); + return this; + } + + @Override + public SubMenu setHeaderTitle(CharSequence title) { + mSubMenu.setHeaderTitle(title); + return this; + } + + @Override + public SubMenu setHeaderTitle(int titleRes) { + mSubMenu.setHeaderTitle(titleRes); + return this; + } + + @Override + public SubMenu setHeaderView(View view) { + mSubMenu.setHeaderView(view); + return this; + } + + @Override + public SubMenu setIcon(Drawable icon) { + mSubMenu.setIcon(icon); + return this; + } + + @Override + public SubMenu setIcon(int iconRes) { + mSubMenu.setIcon(iconRes); + return this; + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/widget/ActionBarContainer.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/widget/ActionBarContainer.java new file mode 100644 index 00000000..6f5a5992 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/widget/ActionBarContainer.java @@ -0,0 +1,35 @@ +package com.actionbarsherlock.internal.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +public class ActionBarContainer extends FrameLayout { + private boolean mIsTransitioning; + + public ActionBarContainer(Context context) { + this(context, null); + } + + public ActionBarContainer(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + return mIsTransitioning || super.onInterceptTouchEvent(ev); + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + super.onTouchEvent(event); + return true; + } + + public void setTransitioning(boolean transitioning) { + mIsTransitioning = transitioning; + setDescendantFocusability(transitioning ? ViewGroup.FOCUS_BLOCK_DESCENDANTS : ViewGroup.FOCUS_AFTER_DESCENDANTS); + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/widget/ActionBarView.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/widget/ActionBarView.java new file mode 100644 index 00000000..d51046eb --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/widget/ActionBarView.java @@ -0,0 +1,690 @@ +package com.actionbarsherlock.internal.widget; + +import android.app.Activity; +import android.content.Context; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; +import android.support.v4.app.ActionBar; +import android.support.v4.view.Window; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.AdapterView; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.RelativeLayout; +import android.widget.Spinner; +import android.widget.SpinnerAdapter; +import android.widget.TextView; +import com.actionbarsherlock.R; +import com.actionbarsherlock.internal.view.menu.ActionMenuItem; +import com.actionbarsherlock.internal.view.menu.ActionMenuItemView; + +public final class ActionBarView extends RelativeLayout { + /** Default display options if none are defined in the theme. */ + private static final int DEFAULT_DISPLAY_OPTIONS = ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME; + + /** Default navigation mode if one is not defined in the theme. */ + private static final int DEFAULT_NAVIGATION_MODE = ActionBar.NAVIGATION_MODE_STANDARD; + + + + private final View mHomeAsUpView; + private final View mHomeLayout; + private final ActionMenuItem mLogoNavItem; + + private final CharSequence mTitle; + private final TextView mTitleLayout; + + private final CharSequence mSubtitle; + private final TextView mSubtitleLayout; + + /** Indeterminate progress bar. */ + private final ProgressBar mIndeterminateProgress; + + /** List view. */ + private final Spinner mSpinner; + private SpinnerAdapter mSpinnerAdapter; + private final AdapterView.OnItemSelectedListener mNavItemSelectedListener; + private ActionBar.OnNavigationListener mCallback; + + /** Custom view parent. */ + private final FrameLayout mCustomView; + private View mCustomNavView; + + private ImageView mIconView; + private Drawable mLogo; + private Drawable mIcon; + private final Drawable mDivider; + + /** Container for all action items. */ + private final LinearLayout mActionsView; + + /** Container for all tab items. */ + private final LinearLayout mTabsView; + + /** + * Display state flags. + * + * @see #getDisplayOptions() + * @see #getDisplayOptionValue(int) + * @see #setDisplayOptions(int) + * @see #setDisplayOptions(int, int) + * @see #setDisplayOption(int, boolean) + * @see #reloadDisplay() + */ + private int mDisplayOptions; + + /** + * Current navigation mode + * + * @see #getNavigationMode() + * @see #setNavigationMode(int) + */ + private int mNavigationMode = -1; + + private boolean mIsConstructing; + + + + public ActionBarView(Context context) { + this(context, null); + } + + public ActionBarView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public ActionBarView(final Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + mIsConstructing = true; + LayoutInflater.from(context).inflate(R.layout.abs__action_bar, this, true); + + mNavItemSelectedListener = new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView arg0, View arg1, int arg2, long arg3) { + if (mCallback != null) { + mCallback.onNavigationItemSelected(arg2, arg3); + } + } + + @Override + public void onNothingSelected(AdapterView arg0) { + //No op + } + }; + + setBackgroundResource(0); + + final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SherlockTheme, defStyle, 0); + final ApplicationInfo appInfo = context.getApplicationInfo(); + final PackageManager pm = context.getPackageManager(); + + + //// TITLE //// + + mTitleLayout = (TextView)findViewById(R.id.abs__action_bar_title); + + //Try to load title style from the theme + final int titleTextStyle = a.getResourceId(R.styleable.SherlockTheme_abTitleTextStyle, 0); + if (titleTextStyle != 0) { + mTitleLayout.setTextAppearance(context, titleTextStyle); + } + + //Try to load title from the theme + mTitle = a.getString(R.styleable.SherlockTheme_abTitle); + if (mTitle != null) { + setTitle(mTitle); + } + + + //// SUBTITLE //// + + mSubtitleLayout = (TextView)findViewById(R.id.abs__action_bar_subtitle); + + //Try to load subtitle style from the theme + final int subtitleTextStyle = a.getResourceId(R.styleable.SherlockTheme_abSubtitleTextStyle, 0); + if (subtitleTextStyle != 0) { + mSubtitleLayout.setTextAppearance(context, subtitleTextStyle); + } + + //Try to load subtitle from theme + mSubtitle = a.getString(R.styleable.SherlockTheme_abSubtitle); + if (mSubtitle != null) { + setSubtitle(mSubtitle); + } + + + /// HOME //// + + //TODO load optional home layout from theme + mHomeLayout = findViewById(R.id.abs__home_wrapper); + + //Try to load the logo from the theme + mLogo = a.getDrawable(R.styleable.SherlockTheme_abLogo); + /* + if ((mLogo == null) && (context instanceof Activity)) { + //LOGO LOADING DOES NOT WORK + //SEE: http://stackoverflow.com/questions/6105504/load-activity-and-or-application-logo-programmatically-from-manifest + //SEE: https://groups.google.com/forum/#!topic/android-developers/UFR4l0ZwJWc + } + */ + + //Try to load the icon from the theme + mIcon = a.getDrawable(R.styleable.SherlockTheme_abIcon); + if ((mIcon == null) && (context instanceof Activity)) { + mIcon = appInfo.loadIcon(pm); + } + + mHomeAsUpView = findViewById(R.id.abs__up); + mIconView = (ImageView)findViewById(R.id.abs__home); + + + //// NAVIGATION //// + + mSpinner = (Spinner)findViewById(R.id.abs__nav_list); + mSpinner.setOnItemSelectedListener(mNavItemSelectedListener); + + mTabsView = (LinearLayout)findViewById(R.id.abs__nav_tabs); + + + //// CUSTOM VIEW //// + + mCustomView = (FrameLayout)findViewById(R.id.abs__custom); + + //Try to load a custom view from the theme. This will NOT automatically + //trigger the visibility of the custom layout, however. + final int customViewResourceId = a.getResourceId(R.styleable.SherlockTheme_abCustomNavigationLayout, 0); + if (customViewResourceId != 0) { + mCustomNavView = LayoutInflater.from(context).inflate(customViewResourceId, mCustomView, true); + mNavigationMode = ActionBar.NAVIGATION_MODE_STANDARD; + setDisplayOptions(mDisplayOptions | ActionBar.DISPLAY_SHOW_CUSTOM); + } + + + + + mActionsView = (LinearLayout)findViewById(R.id.abs__actions); + mDivider = a.getDrawable(R.styleable.SherlockTheme_abDivider); + + mIndeterminateProgress = (ProgressBar)findViewById(R.id.abs__iprogress); + + //Try to get the display options defined in the theme, or fall back to + //displaying the title and home icon + setDisplayOptions(a.getInteger(R.styleable.SherlockTheme_abDisplayOptions, DEFAULT_DISPLAY_OPTIONS)); + + //Try to get the navigation defined in the theme, or, fall back to + //use standard navigation by default + setNavigationMode(a.getInteger(R.styleable.SherlockTheme_abNavigationMode, DEFAULT_NAVIGATION_MODE)); + + + //Reduce, Reuse, Recycle! + a.recycle(); + mIsConstructing = false; + + mLogoNavItem = new ActionMenuItem(context, 0, android.R.id.home, 0, 0, mTitle); + mHomeLayout.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (context instanceof Activity) { + ((Activity)context).onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, mLogoNavItem); + } + } + }); + mHomeLayout.setClickable(true); + mHomeLayout.setFocusable(true); + + reloadDisplay(); + } + + + + // ------------------------------------------------------------------------ + // HELPER METHODS + // ------------------------------------------------------------------------ + + /** + * Helper to get a boolean value for a specific flag. + * + * @param flag Target flag. + * @return Value. + */ + private boolean getDisplayOptionValue(int flag) { + return (mDisplayOptions & flag) == flag; + } + + /** + * Reload the current action bar display state. + */ + private void reloadDisplay() { + if (mIsConstructing) { + return; //Do not run if we are in the constructor + } + + final boolean isStandard = mNavigationMode == ActionBar.NAVIGATION_MODE_STANDARD; + final boolean isList = mNavigationMode == ActionBar.NAVIGATION_MODE_LIST; + final boolean isTab = mNavigationMode == ActionBar.NAVIGATION_MODE_TABS; + final boolean isTabUnderAb = isTab && getContext().getString(R.string.abs__tab_under_ab_tag).equals(mTabsView.getTag()); + final boolean hasSubtitle = (mSubtitleLayout.getText() != null) && !mSubtitleLayout.getText().equals(""); + final boolean displayHome = getDisplayOptionValue(ActionBar.DISPLAY_SHOW_HOME); + final boolean displayHomeAsUp = getDisplayOptionValue(ActionBar.DISPLAY_HOME_AS_UP); + final boolean displayTitle = getDisplayOptionValue(ActionBar.DISPLAY_SHOW_TITLE); + final boolean displayCustom = getDisplayOptionValue(ActionBar.DISPLAY_SHOW_CUSTOM); + final boolean displayLogo = getDisplayOptionValue(ActionBar.DISPLAY_USE_LOGO) && (mLogo != null); + + mHomeLayout.setVisibility(displayHome ? View.VISIBLE : View.GONE); + if (displayHome) { + mHomeAsUpView.setVisibility(displayHomeAsUp ? View.VISIBLE : View.GONE); + mIconView.setImageDrawable(displayLogo ? mLogo : mIcon); + } + + //Only show list if we are in list navigation and there are list items + mSpinner.setVisibility(isList ? View.VISIBLE : View.GONE); + + // Show tabs if in tabs navigation mode. + mTabsView.setVisibility(isTab ? View.VISIBLE : View.GONE); + + //Show title view if we are not in list navigation, not showing custom + //view, and the show title flag is true + mTitleLayout.setVisibility((isStandard || isTabUnderAb) && !displayCustom && displayTitle ? View.VISIBLE : View.GONE); + //Show subtitle view if we are not in list navigation, not showing + //custom view, show title flag is true, and a subtitle is set + mSubtitleLayout.setVisibility((isStandard || isTabUnderAb) && !displayCustom && displayTitle && hasSubtitle ? View.VISIBLE : View.GONE); + //Show custom view if we are not in list navigation and showing custom + //flag is set + mCustomView.setVisibility(isStandard && displayCustom ? View.VISIBLE : View.GONE); + } + + // ------------------------------------------------------------------------ + // ACTION BAR API + // ------------------------------------------------------------------------ + + public void addTab(ActionBar.Tab tab) { + final int tabCount = getTabCount(); + addTab(tab, tabCount, tabCount == 0); + } + + public void addTab(ActionBar.Tab tab, boolean setSelected) { + addTab(tab, getTabCount(), setSelected); + } + + public void addTab(ActionBar.Tab tab, int position) { + addTab(tab, position, getTabCount() == 0); + } + + public void addTab(ActionBar.Tab tab, int position, boolean setSelected) { + mTabsView.addView(((TabImpl)tab).mView, position); + if (setSelected) { + tab.select(); + } + } + + public View getCustomView() { + return mCustomNavView; + } + + public int getDisplayOptions() { + return mDisplayOptions; + } + + public SpinnerAdapter getDropdownAdapter() { + return this.mSpinnerAdapter; + } + + public int getDropdownSelectedPosition() { + return this.mSpinner.getSelectedItemPosition(); + } + + public int getNavigationMode() { + return mNavigationMode; + } + + public ActionBar.Tab getSelectedTab() { + final int count = mTabsView.getChildCount(); + for (int i = 0; i < count; i++) { + TabImpl tab = (TabImpl)mTabsView.getChildAt(i).getTag(); + if (tab.mView.isSelected()) { + return tab; + } + } + return null; + } + + public CharSequence getSubtitle() { + if ((mNavigationMode == ActionBar.NAVIGATION_MODE_STANDARD) && !mSubtitleLayout.getText().equals("")) { + return mSubtitleLayout.getText(); + } else { + return null; + } + } + + public ActionBar.Tab getTabAt(int index) { + View view = mTabsView.getChildAt(index); + return (view != null) ? (TabImpl)view.getTag() : null; + } + + public int getTabCount() { + return mTabsView.getChildCount(); + } + + public CharSequence getTitle() { + if ((mNavigationMode == ActionBar.NAVIGATION_MODE_STANDARD) && !mTitleLayout.getText().equals("")) { + return mTitleLayout.getText(); + } else { + return null; + } + } + + public TabImpl newTab() { + return new TabImpl(this); + } + + public void removeAllTabs() { + TabImpl selected = (TabImpl)getSelectedTab(); + if (selected != null) { + selected.unselect(); + } + mTabsView.removeAllViews(); + } + + public void removeTab(ActionBar.Tab tab) { + final int count = mTabsView.getChildCount(); + for (int i = 0; i < count; i++) { + TabImpl existingTab = (TabImpl)mTabsView.getChildAt(i).getTag(); + if (existingTab.equals(tab)) { + removeTabAt(i); + break; + } + } + } + + public void removeTabAt(int position) { + TabImpl tab = (TabImpl)getTabAt(position); + if (tab != null) { + tab.unselect(); + mTabsView.removeViewAt(position); + + if (position > 0) { + //Select previous tab + ((TabImpl)mTabsView.getChildAt(position - 1).getTag()).select(); + } else if (mTabsView.getChildCount() > 0) { + //Select first tab + ((TabImpl)mTabsView.getChildAt(0).getTag()).select(); + } + } + } + + public void setCallback(ActionBar.OnNavigationListener callback) { + mCallback = callback; + } + + public void setCustomNavigationView(View view) { + mCustomNavView = view; + mCustomView.removeAllViews(); + mCustomView.addView(view); + } + + public void setDisplayOptions(int options) { + mDisplayOptions = options; + reloadDisplay(); + } + + public void setDropdownAdapter(SpinnerAdapter spinnerAdapter) { + mSpinnerAdapter = spinnerAdapter; + if (mSpinner != null) { + mSpinner.setAdapter(mSpinnerAdapter); + } + } + + public void setDropdownSelectedPosition(int position) { + mSpinner.setSelection(position); + } + + public void setProgressBarIndeterminateVisibility(boolean visible) { + mIndeterminateProgress.setVisibility(visible ? View.VISIBLE : View.GONE); + } + + public void setNavigationMode(int mode) { + if ((mode != ActionBar.NAVIGATION_MODE_STANDARD) && (mode != ActionBar.NAVIGATION_MODE_LIST) + && (mode != ActionBar.NAVIGATION_MODE_TABS)) { + throw new IllegalArgumentException("Unknown navigation mode value " + Integer.toString(mode)); + } + + if (mode != mNavigationMode) { + mNavigationMode = mode; + reloadDisplay(); + } + } + + public void selectTab(ActionBar.Tab tab) { + final int count = mTabsView.getChildCount(); + for (int i = 0; i < count; i++) { + TabImpl existingTab = (TabImpl)mTabsView.getChildAt(i).getTag(); + if (existingTab.equals(tab)) { + existingTab.select(); + break; + } + } + } + + public void setSubtitle(CharSequence subtitle) { + mSubtitleLayout.setText((subtitle == null) ? "" : subtitle); + reloadDisplay(); + } + + public void setSubtitle(int resId) { + mSubtitleLayout.setText(resId); + reloadDisplay(); + } + + public void setTitle(CharSequence title) { + mTitleLayout.setText((title == null) ? "" : title); + } + + public void setTitle(int resId) { + mTitleLayout.setText(resId); + } + + // ------------------------------------------------------------------------ + // ACTION ITEMS SUPPORT + // ------------------------------------------------------------------------ + + public ActionMenuItemView newItem() { + ActionMenuItemView item = (ActionMenuItemView)LayoutInflater.from(getContext()).inflate(R.layout.abs__action_bar_item_layout, mActionsView, false); + return item; + } + + public void addItem(ActionMenuItemView item) { + if (mDivider != null) { + ImageView divider = new ImageView(getContext()); + divider.setImageDrawable(mDivider); + divider.setScaleType(ImageView.ScaleType.FIT_XY); + + LinearLayout.LayoutParams dividerParams = new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.FILL_PARENT + ); + + mActionsView.addView(divider, dividerParams); + item.setDivider(divider); + } + + mActionsView.addView(item); + } + + public void removeAllItems() { + mActionsView.removeAllViews(); + } + + // ------------------------------------------------------------------------ + // HELPER INTERFACES AND HELPER CLASSES + // ------------------------------------------------------------------------ + + private static class TabImpl extends ActionBar.Tab { + private static final View.OnClickListener clickListener = new View.OnClickListener() { + @Override + public void onClick(View v) { + ((TabImpl)v.getTag()).select(); + } + }; + + final ActionBarView mActionBar; + final View mView; + final ImageView mIconView; + final TextView mTextView; + final FrameLayout mCustomView; + + ActionBar.TabListener mListener; + Object mTag; + + + TabImpl(ActionBarView actionBar) { + mActionBar = actionBar; + mView = LayoutInflater.from(mActionBar.getContext()).inflate(R.layout.abs__action_bar_tab_layout, actionBar.mTabsView, false); + mView.setTag(this); + mView.setOnClickListener(clickListener); + + mIconView = (ImageView)mView.findViewById(R.id.abs__tab_icon); + mTextView = (TextView)mView.findViewById(R.id.abs__tab); + mCustomView = (FrameLayout)mView.findViewById(R.id.abs__tab_custom); + } + + /** + * Update display to reflect current property state. + */ + void reloadDisplay() { + boolean hasCustom = mCustomView.getChildCount() > 0; + mIconView.setVisibility(hasCustom ? View.GONE : View.VISIBLE); + mTextView.setVisibility(hasCustom ? View.GONE : View.VISIBLE); + mCustomView.setVisibility(hasCustom ? View.VISIBLE : View.GONE); + } + + @Override + public View getCustomView() { + return mCustomView.getChildAt(0); + } + + @Override + public Drawable getIcon() { + return mIconView.getDrawable(); + } + + @Override + public int getPosition() { + final int count = mActionBar.mTabsView.getChildCount(); + for (int i = 0; i < count; i++) { + if (mActionBar.mTabsView.getChildAt(i).getTag().equals(this)) { + return i; + } + } + return -1; + } + + @Override + public ActionBar.TabListener getTabListener() { + return mListener; + } + + @Override + public Object getTag() { + return mTag; + } + + @Override + public CharSequence getText() { + return mTextView.getText(); + } + + @Override + public TabImpl setCustomView(int layoutResId) { + mCustomView.removeAllViews(); + LayoutInflater.from(mActionBar.getContext()).inflate(layoutResId, mCustomView, true); + reloadDisplay(); + return this; + } + + @Override + public TabImpl setCustomView(View view) { + mCustomView.removeAllViews(); + if (view != null) { + mCustomView.addView(view); + } + reloadDisplay(); + return this; + } + + @Override + public TabImpl setIcon(Drawable icon) { + mIconView.setImageDrawable(icon); + return this; + } + + @Override + public TabImpl setIcon(int resId) { + mIconView.setImageResource(resId); + return this; + } + + @Override + public TabImpl setTabListener(ActionBar.TabListener listener) { + mListener = listener; + return this; + } + + @Override + public TabImpl setTag(Object obj) { + mTag = obj; + return this; + } + + @Override + public TabImpl setText(int resId) { + mTextView.setText(resId); + return this; + } + + @Override + public TabImpl setText(CharSequence text) { + mTextView.setText(text); + return this; + } + + @Override + public void select() { + if (mView.isSelected()) { + if (mListener != null) { + mListener.onTabReselected(this, null); + } + return; + } + + TabImpl current = (TabImpl)mActionBar.getSelectedTab(); + if (current != null) { + current.unselect(); + } + + mView.setSelected(true); + if (mListener != null) { + mListener.onTabSelected(this, null); + } + } + + /** + * Unselect this tab. Only valid if the tab has been added to the + * action bar and was previously selected. + */ + void unselect() { + if (mView.isSelected()) { + mView.setSelected(false); + + if (mListener != null) { + mListener.onTabUnselected(this, null); + } + } + } + } +} diff --git a/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/widget/ScrollingTextView.java b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/widget/ScrollingTextView.java new file mode 100644 index 00000000..edd5ec0a --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/library/src/com/actionbarsherlock/internal/widget/ScrollingTextView.java @@ -0,0 +1,51 @@ +package com.actionbarsherlock.internal.widget; + +import android.content.Context; +import android.graphics.Rect; +import android.util.AttributeSet; +import android.widget.TextView; + +/** + * @author marco + * Workaround to be able to scroll text inside a TextView without it required + * to be focused. For some strange reason there isn't an easy way to do this + * natively. + * + * Original code written by Evan Cummings: + * http://androidbears.stellarpc.net/?p=185 + */ +public final class ScrollingTextView extends TextView { + + public ScrollingTextView(Context context, AttributeSet attrs, + int defStyle) { + super(context, attrs, defStyle); + } + + public ScrollingTextView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public ScrollingTextView(Context context) { + super(context); + } + + @Override + protected void onFocusChanged(boolean focused, int direction, + Rect previouslyFocusedRect) { + if (focused) { + super.onFocusChanged(focused, direction, previouslyFocusedRect); + } + } + + @Override + public void onWindowFocusChanged(boolean focused) { + if (focused) { + super.onWindowFocusChanged(focused); + } + } + + @Override + public boolean isFocused() { + return true; + } +} diff --git a/external/JakeWharton-ActionBarSherlock/pom.xml b/external/JakeWharton-ActionBarSherlock/pom.xml new file mode 100644 index 00000000..ee3d1521 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/pom.xml @@ -0,0 +1,213 @@ + + + + 4.0.0 + + com.actionbarsherlock + parent + pom + 3.3.0 + + ActionBarSherlock (Parent) + Android library for implementing the action bar design pattern using the native ActionBar on 3.0+ and a custom implementation on pre-3.0 all through the same API. + https://github.com/JakeWharton/ActionBarSherlock + 2011 + + + library + plugins + samples + test + + + + http://github.com/JakeWharton/ActionBarSherlock/ + scm:git:git://github.com/JakeWharton/ActionBarSherlock.git + scm:git:git@github.com:JakeWharton/ActionBarSherlock.git + + + + + Jake Wharton + jakewharton@gmail.com + jakewharton + http://jakewharton.com + -5 + + developer + + + + + + + Apache License Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + personal-repository + JakeWharton.com Maven Repository + scp://r.jakewharton.com/home/jakewharton_repository/r.jakewharton.com/maven/release/ + + + personal-repository + JakeWharton.com Maven Repository + scp://r.jakewharton.com/home/jakewharton_repository/r.jakewharton.com/maven/snapshot/ + + + github-project-site + GitHub Project Pages + gitsite:git@github.com/JakeWharton/ActionBarSherlock + + + + + + Jake Wharton + http://jakewharton.com + + + + GitHub Issues + https://github.com/JakeWharton/ActionBarSherlock/issues + + + + UTF-8 + UTF-8 + + actionbarsherlock + + 1.6 + 3.2_r1 + 13 + 13_r1 + + + + + + android + android + ${android.version} + + + + com.google.android.maps + maps + ${android.maps.version} + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + ${java.version} + ${java.version} + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + + + com.jayway.maven.plugins.android.generation2 + maven-android-plugin + 2.9.0-beta-5 + + + ${android.platform} + + true + + true + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.6 + + true + + + + + + + + org.apache.maven.plugins + maven-release-plugin + 2.1 + + true + + + + + org.apache.maven.plugins + maven-site-plugin + 2.2 + false + + false + false + ${basedir}/website + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.6 + + + org.apache.maven.wagon + wagon-ssh + 1.0-beta-7 + + + + + + + + org.apache.maven.scm + maven-scm-provider-gitexe + 1.4 + + + org.apache.maven.scm + maven-scm-manager-plexus + 1.4 + + + org.kathrynhuxtable.maven.wagon + wagon-gitsite + 0.3.1 + + + + diff --git a/external/JakeWharton-ActionBarSherlock/update-version.py b/external/JakeWharton-ActionBarSherlock/update-version.py new file mode 100755 index 00000000..a80af157 --- /dev/null +++ b/external/JakeWharton-ActionBarSherlock/update-version.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +import os +import re +from datetime import date + +repo = os.path.dirname(os.path.realpath(__file__)) +changelog = os.path.join(repo, 'CHANGELOG.md') + +code = 'android:versionCode="%s"' +name = 'android:versionName="%s"' +in_code = code % r'(\d+)' +in_name = name % r'([^"]+)' +new_code = None +new_name = None + +# Update manifest files +for dirpath, dirnames, filenames in os.walk(repo): + for filename in filenames: + if filename == 'AndroidManifest.xml': + filepath = os.path.join(dirpath, filename) + with open(filepath) as f: + contents = f.read() + if new_code is None: + print('Current version code: ' + re.search(in_code, contents).group(1)) + new_code = raw_input('New version code: ') + print('Current version name: ' + re.search(in_name, contents).group(1)) + new_name = raw_input('New version name: ') + contents = re.sub(in_code, code % new_code, contents) + contents = re.sub(in_name, name % new_name, contents) + with open(filepath, 'w') as f: + f.write(contents) + +# Update change log +with open(changelog) as f: + contents = f.read() +if 'In Development' in contents: + contents = contents.replace('In Development', date.today().strftime('%Y-%m-%d')) + with open(changelog, 'w') as f: + f.write(contents)