Skip to content
Browse files

crlf

  • Loading branch information...
1 parent e8377ea commit 37b33c86877092ae76b9a70923d1d3c1b09fac25 @yanchenko committed Sep 21, 2012
Showing with 2,645 additions and 2,645 deletions.
  1. +24 −24 README.md
  2. +33 −33 base/.project
  3. +3 −3 base/.settings/org.eclipse.core.resources.prefs
  4. +3 −3 base/.settings/org.eclipse.core.runtime.prefs
  5. +57 −57 base/.settings/org.eclipse.jdt.ui.prefs
  6. +4 −4 base/build.xml
  7. +37 −37 base/src/org/droidparts/activity/ListActivity.java
  8. +35 −35 base/src/org/droidparts/adapter/cursor/CursorAdapter.java
  9. +82 −82 base/src/org/droidparts/adapter/cursor/EntityCursorAdapter.java
  10. +39 −39 base/src/org/droidparts/contract/Constants.java
  11. +32 −32 base/src/org/droidparts/contract/DB.java
  12. +110 −110 base/src/org/droidparts/persist/AbstractPrefsManager.java
  13. +25 −25 base/src/org/droidparts/task/listener/SimpleAsyncTaskProgressListener.java
  14. +33 −33 extra/.project
  15. +3 −3 extra/.settings/org.eclipse.core.resources.prefs
  16. +3 −3 extra/.settings/org.eclipse.core.runtime.prefs
  17. +57 −57 extra/.settings/org.eclipse.jdt.ui.prefs
  18. +4 −4 extra/build.xml
  19. +33 −33 extra/src/org/droidparts/adapter/tag/IconText2Tag.java
  20. +32 −32 extra/src/org/droidparts/adapter/tag/Text1Tag.java
  21. +32 −32 extra/src/org/droidparts/adapter/tag/Text2Tag.java
  22. +35 −35 extra/src/org/droidparts/adapter/ui/OnItemSelectedAdapter.java
  23. +39 −39 extra/src/org/droidparts/adapter/ui/TextWatcherAdapter.java
  24. +57 −57 extra/src/org/droidparts/http/HTTPException.java
  25. +215 −215 extra/src/org/droidparts/http/RESTClient.java
  26. +118 −118 extra/src/org/droidparts/util/AppUtils.java
  27. +85 −85 extra/src/org/droidparts/util/AppUtils2.java
  28. +117 −117 extra/src/org/droidparts/util/crypto/Crypter.java
  29. +104 −104 extra/src/org/droidparts/util/io/IOUtils.java
  30. +47 −47 extra/src/org/droidparts/util/net/ConnectivityUtils.java
  31. +103 −103 extra/src/org/droidparts/util/ui/ViewUtils.java
  32. +33 −33 legacy/.project
  33. +3 −3 legacy/.settings/org.eclipse.core.resources.prefs
  34. +3 −3 legacy/.settings/org.eclipse.core.runtime.prefs
  35. +57 −57 legacy/.settings/org.eclipse.jdt.ui.prefs
  36. +4 −4 legacy/build.xml
  37. +71 −71 legacy/src/org/droidparts/activity/AsyncListActivity.java
  38. +33 −33 modern/.project
  39. +3 −3 modern/.settings/org.eclipse.core.resources.prefs
  40. +3 −3 modern/.settings/org.eclipse.core.runtime.prefs
  41. +57 −57 modern/.settings/org.eclipse.jdt.ui.prefs
  42. +4 −4 modern/build.xml
  43. +8 −8 sample/legacy/.classpath
  44. +33 −33 sample/legacy/.project
  45. +55 −55 sample/legacy/.settings/org.eclipse.jdt.ui.prefs
  46. +30 −30 sample/legacy/AndroidManifest.xml
  47. +30 −30 sample/legacy/res/layout/activity_entry_list.xml
  48. +21 −21 sample/legacy/res/layout/activity_entry_list_as_json.xml
  49. +9 −9 sample/legacy/res/values/strings.xml
  50. +37 −37 sample/legacy/src/org/droidparts/sample/DependencyProvider.java
  51. +79 −79 sample/legacy/src/org/droidparts/sample/activity/EntryListAsJSONActivity.java
  52. +36 −36 sample/legacy/src/org/droidparts/sample/adapter/EntryListAdapter.java
  53. +32 −32 sample/legacy/src/org/droidparts/sample/db/DBOpenHelper.java
  54. +20 −20 sample/legacy/src/org/droidparts/sample/db/EntryManager.java
  55. +12 −12 sample/legacy/src/org/droidparts/sample/json/EntrySerializer.java
  56. +22 −22 sample/legacy/src/org/droidparts/sample/model/Entry.java
  57. +70 −70 sample/modern/src/org/droidparts/gram/activity/SettingsActivity.java
  58. +43 −43 sample/modern/src/org/droidparts/gram/contract/DB.java
  59. +53 −53 sample/modern/src/org/droidparts/gram/persist/PrefsManager.java
  60. +13 −13 test/res/layout/activity_test.xml
  61. +9 −9 test/res/raw/albums.json
  62. +4 −4 test/res/raw/nested.json
  63. +11 −11 test/res/raw/primitives.json
  64. +23 −23 test/src/org/droidparts/test/activity/TestActivity.java
  65. +26 −26 test/src/org/droidparts/test/model/AlbumToTag.java
  66. +14 −14 test/src/org/droidparts/test/model/Nested.java
  67. +21 −21 test/src/org/droidparts/test/model/Track.java
  68. +26 −26 test/src/org/droidparts/test/persist/DB.java
  69. +36 −36 test/src/org/droidparts/test/testcase/TestActivityTestCase.java
View
48 README.md
@@ -1,25 +1,25 @@
-DroidParts
-----------
-is a carefully crafted Android framework that includes:
-* *DI* - dependency injection for Views, resources, etc.
-* *SQLite* object-relational mapping.
-* *JSON* (de)serialization.
-* Improved *AsyncTasks* with Exceptions, progress & result reporting.
-* Better *logger* (log any object without a tag).
-* *RESTClient* for GETting, PUTting, POSTing, DELETing & InputStream-getting, also speaks JSON.
-* *ImageAttacher* to asynchronously attach images to ImageViews, cross fade support.
-* Numerous *Utils*.
-* Support for *Fragments* in cooperation with [ActionBarSherlock][1].
-
-Getting Started
----------------
-User Guide is available at http://droidparts.org.
-Please check out a couple of sample apps under /sample.
-
-Contributing
-------------
-* Pull Requests are preferred over Issues.
-* Please use http://stackoverflow.com/tags/droidparts for questions.
-
-
+DroidParts
+----------
+is a carefully crafted Android framework that includes:
+* *DI* - dependency injection for Views, resources, etc.
+* *SQLite* object-relational mapping.
+* *JSON* (de)serialization.
+* Improved *AsyncTasks* with Exceptions, progress & result reporting.
+* Better *logger* (log any object without a tag).
+* *RESTClient* for GETting, PUTting, POSTing, DELETing & InputStream-getting, also speaks JSON.
+* *ImageAttacher* to asynchronously attach images to ImageViews, cross fade support.
+* Numerous *Utils*.
+* Support for *Fragments* in cooperation with [ActionBarSherlock][1].
+
+Getting Started
+---------------
+User Guide is available at http://droidparts.org.
+Please check out a couple of sample apps under /sample.
+
+Contributing
+------------
+* Pull Requests are preferred over Issues.
+* Please use http://stackoverflow.com/tags/droidparts for questions.
+
+
[1]: https://github.com/JakeWharton/ActionBarSherlock
View
66 base/.project
@@ -1,33 +1,33 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>droidparts-base</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ApkBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>droidparts-base</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
6 base/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Thu Sep 15 19:02:18 EEST 2011
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+#Thu Sep 15 19:02:18 EEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
View
6 base/.settings/org.eclipse.core.runtime.prefs
@@ -1,3 +1,3 @@
-#Thu Sep 15 19:02:28 EEST 2011
-eclipse.preferences.version=1
-line.separator=\n
+#Thu Sep 15 19:02:28 EEST 2011
+eclipse.preferences.version=1
+line.separator=\n
View
114 base/.settings/org.eclipse.jdt.ui.prefs
@@ -1,57 +1,57 @@
-#Thu Sep 15 19:01:57 EEST 2011
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-org.eclipse.jdt.ui.javadoc=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * Copyright 2012 Alex Yanchenko\r\n * \r\n * Licensed under the Apache License, Version 2.0 (the "License");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an "AS IS" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License. \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=true
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=false
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=false
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+#Thu Sep 15 19:01:57 EEST 2011
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * Copyright 2012 Alex Yanchenko\r\n * \r\n * Licensed under the Apache License, Version 2.0 (the "License");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an "AS IS" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License. \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
View
8 base/build.xml
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project name="droidparts-base">
- <loadproperties srcFile="project.properties" />
- <import file="${sdk.dir}/tools/ant/build.xml" />
+<?xml version="1.0" encoding="utf-8"?>
+<project name="droidparts-base">
+ <loadproperties srcFile="project.properties" />
+ <import file="${sdk.dir}/tools/ant/build.xml" />
</project>
View
74 base/src/org/droidparts/activity/ListActivity.java
@@ -1,37 +1,37 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.activity;
-
-import org.droidparts.inject.Injectable;
-import org.droidparts.inject.Injector;
-
-import android.os.Bundle;
-
-public abstract class ListActivity extends android.app.ListActivity implements
- Injectable {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- onPreInject();
- Injector.get().inject(this);
- }
-
- @Override
- public void onPreInject() {
- }
-
-}
+/**
+ * Copyright 2012 Alex Yanchenko
+ *
+ * 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 org.droidparts.activity;
+
+import org.droidparts.inject.Injectable;
+import org.droidparts.inject.Injector;
+
+import android.os.Bundle;
+
+public abstract class ListActivity extends android.app.ListActivity implements
+ Injectable {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ onPreInject();
+ Injector.get().inject(this);
+ }
+
+ @Override
+ public void onPreInject() {
+ }
+
+}
View
70 base/src/org/droidparts/adapter/cursor/CursorAdapter.java
@@ -1,35 +1,35 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.adapter.cursor;
-
-import org.droidparts.annotation.inject.InjectSystemService;
-import org.droidparts.inject.Injector;
-
-import android.app.Activity;
-import android.database.Cursor;
-import android.view.LayoutInflater;
-
-public abstract class CursorAdapter extends android.widget.CursorAdapter {
-
- @InjectSystemService
- protected LayoutInflater layoutInflater;
-
- public CursorAdapter(Activity activity, Cursor cursor) {
- super(activity, cursor);
- Injector.get().inject(activity, this);
- }
-
-}
+/**
+ * Copyright 2012 Alex Yanchenko
+ *
+ * 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 org.droidparts.adapter.cursor;
+
+import org.droidparts.annotation.inject.InjectSystemService;
+import org.droidparts.inject.Injector;
+
+import android.app.Activity;
+import android.database.Cursor;
+import android.view.LayoutInflater;
+
+public abstract class CursorAdapter extends android.widget.CursorAdapter {
+
+ @InjectSystemService
+ protected LayoutInflater layoutInflater;
+
+ public CursorAdapter(Activity activity, Cursor cursor) {
+ super(activity, cursor);
+ Injector.get().inject(activity, this);
+ }
+
+}
View
164 base/src/org/droidparts/adapter/cursor/EntityCursorAdapter.java
@@ -1,82 +1,82 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.adapter.cursor;
-
-import org.droidparts.model.Entity;
-import org.droidparts.persist.sql.EntityManager;
-import org.droidparts.persist.sql.stmt.SelectBuilder;
-
-import android.app.Activity;
-import android.content.Context;
-import android.database.Cursor;
-import android.view.View;
-
-public abstract class EntityCursorAdapter<EntityType extends Entity> extends
- CursorAdapter {
-
- protected final EntityManager<EntityType> entityManager;
-
- public EntityCursorAdapter(Activity activity,
- EntityManager<EntityType> entityManager,
- SelectBuilder<EntityType> selectBuilder) {
- this(activity, entityManager, selectBuilder.execute());
- }
-
- // @Deprecated
- public EntityCursorAdapter(Activity activity,
- EntityManager<EntityType> entityManager, Cursor cursor) {
- super(activity, cursor);
- this.entityManager = entityManager;
- }
-
- @Override
- public void bindView(View view, Context context, Cursor cursor) {
- bindView(context, view, entityManager.readRow(cursor));
- }
-
- public abstract void bindView(Context context, View view, EntityType item);
-
- public boolean create(EntityType item) {
- boolean success = entityManager.create(item);
- return requeryOnSuccess(success);
- }
-
- public EntityType read(int position) {
- long id = getItemId(position);
- EntityType item = entityManager.read(id);
- entityManager.fillEagerForeignKeys(item);
- return item;
- }
-
- public boolean update(EntityType item) {
- boolean success = entityManager.update(item);
- return requeryOnSuccess(success);
- }
-
- public boolean delete(int position) {
- long id = getItemId(position);
- boolean success = entityManager.delete(id);
- return requeryOnSuccess(success);
- }
-
- private boolean requeryOnSuccess(boolean success) {
- if (success) {
- getCursor().requery();
- }
- return success;
- }
-
-}
+/**
+ * Copyright 2012 Alex Yanchenko
+ *
+ * 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 org.droidparts.adapter.cursor;
+
+import org.droidparts.model.Entity;
+import org.droidparts.persist.sql.EntityManager;
+import org.droidparts.persist.sql.stmt.SelectBuilder;
+
+import android.app.Activity;
+import android.content.Context;
+import android.database.Cursor;
+import android.view.View;
+
+public abstract class EntityCursorAdapter<EntityType extends Entity> extends
+ CursorAdapter {
+
+ protected final EntityManager<EntityType> entityManager;
+
+ public EntityCursorAdapter(Activity activity,
+ EntityManager<EntityType> entityManager,
+ SelectBuilder<EntityType> selectBuilder) {
+ this(activity, entityManager, selectBuilder.execute());
+ }
+
+ // @Deprecated
+ public EntityCursorAdapter(Activity activity,
+ EntityManager<EntityType> entityManager, Cursor cursor) {
+ super(activity, cursor);
+ this.entityManager = entityManager;
+ }
+
+ @Override
+ public void bindView(View view, Context context, Cursor cursor) {
+ bindView(context, view, entityManager.readRow(cursor));
+ }
+
+ public abstract void bindView(Context context, View view, EntityType item);
+
+ public boolean create(EntityType item) {
+ boolean success = entityManager.create(item);
+ return requeryOnSuccess(success);
+ }
+
+ public EntityType read(int position) {
+ long id = getItemId(position);
+ EntityType item = entityManager.read(id);
+ entityManager.fillEagerForeignKeys(item);
+ return item;
+ }
+
+ public boolean update(EntityType item) {
+ boolean success = entityManager.update(item);
+ return requeryOnSuccess(success);
+ }
+
+ public boolean delete(int position) {
+ long id = getItemId(position);
+ boolean success = entityManager.delete(id);
+ return requeryOnSuccess(success);
+ }
+
+ private boolean requeryOnSuccess(boolean success) {
+ if (success) {
+ getCursor().requery();
+ }
+ return success;
+ }
+
+}
View
78 base/src/org/droidparts/contract/Constants.java
@@ -1,39 +1,39 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.contract;
-
-public interface Constants {
-
- String UTF8 = "utf-8";
- int BUFFER_SIZE = 8 * 1024;
-
- static interface ManifestMeta {
-
- String DEPENDENCY_PROVIDER = "droidparts_dependency_provider";
-
- String LOG_LEVEL = "droidparts_log_level";
-
- String DISABLE = "disable";
- String VERBOSE = "verbose";
- String DEBUG = "debug";
- String INFO = "info";
- String WARN = "warn";
- String ERROR = "error";
- String ASSERT = "assert";
-
- }
-
-}
+/**
+ * Copyright 2012 Alex Yanchenko
+ *
+ * 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 org.droidparts.contract;
+
+public interface Constants {
+
+ String UTF8 = "utf-8";
+ int BUFFER_SIZE = 8 * 1024;
+
+ static interface ManifestMeta {
+
+ String DEPENDENCY_PROVIDER = "droidparts_dependency_provider";
+
+ String LOG_LEVEL = "droidparts_log_level";
+
+ String DISABLE = "disable";
+ String VERBOSE = "verbose";
+ String DEBUG = "debug";
+ String INFO = "info";
+ String WARN = "warn";
+ String ERROR = "error";
+ String ASSERT = "assert";
+
+ }
+
+}
View
64 base/src/org/droidparts/contract/DB.java
@@ -1,32 +1,32 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.contract;
-
-import android.provider.BaseColumns;
-
-public interface DB {
-
- public interface Table {
-
- }
-
- public interface Column extends BaseColumns {
-
- String ID = _ID;
-
- }
-
-}
+/**
+ * Copyright 2012 Alex Yanchenko
+ *
+ * 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 org.droidparts.contract;
+
+import android.provider.BaseColumns;
+
+public interface DB {
+
+ public interface Table {
+
+ }
+
+ public interface Column extends BaseColumns {
+
+ String ID = _ID;
+
+ }
+
+}
View
220 base/src/org/droidparts/persist/AbstractPrefsManager.java
@@ -1,110 +1,110 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.persist;
-
-import static android.content.Context.MODE_PRIVATE;
-import static org.droidparts.util.Strings.isEmpty;
-
-import org.droidparts.inject.Injector;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.res.Resources;
-import android.preference.PreferenceManager;
-
-public abstract class AbstractPrefsManager {
-
- private static final String VERSION = "__prefs_version__";
-
- protected final Context ctx;
- protected final Resources res;
- protected final SharedPreferences prefs;
-
- public AbstractPrefsManager(Context ctx, int version) {
- this(ctx, null, version);
- }
-
- public AbstractPrefsManager(Context ctx, String prefsName, int version) {
- Injector.get().inject(ctx, this);
- this.ctx = ctx.getApplicationContext();
- res = ctx.getResources();
- if (isEmpty(prefsName)) {
- prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
- } else {
- prefs = ctx.getSharedPreferences(prefsName, MODE_PRIVATE);
- }
- init(version);
- }
-
- public SharedPreferences getPrefs() {
- return prefs;
- }
-
- private void init(int newVersion) {
- int oldVersion = prefs.getInt(VERSION, -1);
- if (oldVersion != newVersion) {
- onUpgrade(prefs, oldVersion, newVersion);
- saveInt(VERSION, newVersion);
- }
- }
-
- protected void onUpgrade(SharedPreferences prefs, int oldVersion,
- int newVersion) {
- prefs.edit().clear().commit();
- }
-
- // shortcuts
-
- protected boolean readBoolean(int keyResId, int defValueResId) {
- return prefs.getBoolean(res.getString(keyResId),
- res.getBoolean(defValueResId));
- }
-
- protected int readInt(int keyResId, int defValueResId) {
- return prefs.getInt(res.getString(keyResId),
- res.getInteger(defValueResId));
- }
-
- protected String readString(int keyResId, int defValueResId) {
- return prefs.getString(ctx.getString(keyResId),
- ctx.getString(defValueResId));
- }
-
- protected boolean saveBoolean(String key, boolean val) {
- return prefs.edit().putBoolean(key, val).commit();
- }
-
- protected boolean saveInt(String key, int val) {
- return prefs.edit().putInt(key, val).commit();
- }
-
- protected boolean saveString(String key, String val) {
- return prefs.edit().putString(key, val).commit();
- }
-
- //
-
- @Deprecated
- protected boolean getBoolean(int keyResId, int defValueResId) {
- return readBoolean(keyResId, defValueResId);
- }
-
- @Deprecated
- protected String getString(int keyResId, int defValueResId) {
- return readString(keyResId, defValueResId);
- }
-
-}
+/**
+ * Copyright 2012 Alex Yanchenko
+ *
+ * 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 org.droidparts.persist;
+
+import static android.content.Context.MODE_PRIVATE;
+import static org.droidparts.util.Strings.isEmpty;
+
+import org.droidparts.inject.Injector;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.res.Resources;
+import android.preference.PreferenceManager;
+
+public abstract class AbstractPrefsManager {
+
+ private static final String VERSION = "__prefs_version__";
+
+ protected final Context ctx;
+ protected final Resources res;
+ protected final SharedPreferences prefs;
+
+ public AbstractPrefsManager(Context ctx, int version) {
+ this(ctx, null, version);
+ }
+
+ public AbstractPrefsManager(Context ctx, String prefsName, int version) {
+ Injector.get().inject(ctx, this);
+ this.ctx = ctx.getApplicationContext();
+ res = ctx.getResources();
+ if (isEmpty(prefsName)) {
+ prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
+ } else {
+ prefs = ctx.getSharedPreferences(prefsName, MODE_PRIVATE);
+ }
+ init(version);
+ }
+
+ public SharedPreferences getPrefs() {
+ return prefs;
+ }
+
+ private void init(int newVersion) {
+ int oldVersion = prefs.getInt(VERSION, -1);
+ if (oldVersion != newVersion) {
+ onUpgrade(prefs, oldVersion, newVersion);
+ saveInt(VERSION, newVersion);
+ }
+ }
+
+ protected void onUpgrade(SharedPreferences prefs, int oldVersion,
+ int newVersion) {
+ prefs.edit().clear().commit();
+ }
+
+ // shortcuts
+
+ protected boolean readBoolean(int keyResId, int defValueResId) {
+ return prefs.getBoolean(res.getString(keyResId),
+ res.getBoolean(defValueResId));
+ }
+
+ protected int readInt(int keyResId, int defValueResId) {
+ return prefs.getInt(res.getString(keyResId),
+ res.getInteger(defValueResId));
+ }
+
+ protected String readString(int keyResId, int defValueResId) {
+ return prefs.getString(ctx.getString(keyResId),
+ ctx.getString(defValueResId));
+ }
+
+ protected boolean saveBoolean(String key, boolean val) {
+ return prefs.edit().putBoolean(key, val).commit();
+ }
+
+ protected boolean saveInt(String key, int val) {
+ return prefs.edit().putInt(key, val).commit();
+ }
+
+ protected boolean saveString(String key, String val) {
+ return prefs.edit().putString(key, val).commit();
+ }
+
+ //
+
+ @Deprecated
+ protected boolean getBoolean(int keyResId, int defValueResId) {
+ return readBoolean(keyResId, defValueResId);
+ }
+
+ @Deprecated
+ protected String getString(int keyResId, int defValueResId) {
+ return readString(keyResId, defValueResId);
+ }
+
+}
View
50 base/src/org/droidparts/task/listener/SimpleAsyncTaskProgressListener.java
@@ -1,25 +1,25 @@
-package org.droidparts.task.listener;
-
-import org.droidparts.inject.Injector;
-
-import android.content.Context;
-
-public abstract class SimpleAsyncTaskProgressListener implements
- AsyncTaskProgressListener {
-
- protected final Context ctx;
-
- public SimpleAsyncTaskProgressListener(Context ctx) {
- Injector.get().inject(ctx, this);
- this.ctx = ctx;
- }
-
- public void setTitle(int titleResId) {
- setTitle(ctx.getString(titleResId));
- }
-
- public void setMessage(int messageResId) {
- setTitle(ctx.getString(messageResId));
- }
-
-}
+package org.droidparts.task.listener;
+
+import org.droidparts.inject.Injector;
+
+import android.content.Context;
+
+public abstract class SimpleAsyncTaskProgressListener implements
+ AsyncTaskProgressListener {
+
+ protected final Context ctx;
+
+ public SimpleAsyncTaskProgressListener(Context ctx) {
+ Injector.get().inject(ctx, this);
+ this.ctx = ctx;
+ }
+
+ public void setTitle(int titleResId) {
+ setTitle(ctx.getString(titleResId));
+ }
+
+ public void setMessage(int messageResId) {
+ setTitle(ctx.getString(messageResId));
+ }
+
+}
View
66 extra/.project
@@ -1,33 +1,33 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>droidparts-extra</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ApkBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>droidparts-extra</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
6 extra/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Thu Sep 15 19:02:18 EEST 2011
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+#Thu Sep 15 19:02:18 EEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
View
6 extra/.settings/org.eclipse.core.runtime.prefs
@@ -1,3 +1,3 @@
-#Thu Sep 15 19:02:28 EEST 2011
-eclipse.preferences.version=1
-line.separator=\n
+#Thu Sep 15 19:02:28 EEST 2011
+eclipse.preferences.version=1
+line.separator=\n
View
114 extra/.settings/org.eclipse.jdt.ui.prefs
@@ -1,57 +1,57 @@
-#Thu Sep 15 19:01:57 EEST 2011
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-org.eclipse.jdt.ui.javadoc=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * Copyright 2012 Alex Yanchenko\r\n * \r\n * Licensed under the Apache License, Version 2.0 (the "License");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an "AS IS" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License. \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=true
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=false
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=false
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+#Thu Sep 15 19:01:57 EEST 2011
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * Copyright 2012 Alex Yanchenko\r\n * \r\n * Licensed under the Apache License, Version 2.0 (the "License");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an "AS IS" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License. \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
View
8 extra/build.xml
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project name="droidparts-extra">
- <loadproperties srcFile="project.properties" />
- <import file="${sdk.dir}/tools/ant/build.xml" />
+<?xml version="1.0" encoding="utf-8"?>
+<project name="droidparts-extra">
+ <loadproperties srcFile="project.properties" />
+ <import file="${sdk.dir}/tools/ant/build.xml" />
</project>
View
66 extra/src/org/droidparts/adapter/tag/IconText2Tag.java
@@ -1,33 +1,33 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.adapter.tag;
-
-import org.droidparts.annotation.inject.InjectView;
-
-import android.R;
-import android.view.View;
-import android.widget.ImageView;
-
-public class IconText2Tag extends Text2Tag {
-
- @InjectView(R.id.icon)
- public ImageView icon;
-
- public IconText2Tag(View view) {
- super(view);
- }
-
-}
+/**
+ * Copyright 2012 Alex Yanchenko
+ *
+ * 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 org.droidparts.adapter.tag;
+
+import org.droidparts.annotation.inject.InjectView;
+
+import android.R;
+import android.view.View;
+import android.widget.ImageView;
+
+public class IconText2Tag extends Text2Tag {
+
+ @InjectView(R.id.icon)
+ public ImageView icon;
+
+ public IconText2Tag(View view) {
+ super(view);
+ }
+
+}
View
64 extra/src/org/droidparts/adapter/tag/Text1Tag.java
@@ -1,33 +1,33 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.adapter.tag;
-
-import org.droidparts.annotation.inject.InjectView;
-
-import android.R;
-import android.view.View;
-import android.widget.TextView;
-
-public class Text1Tag extends AdapterTag {
-
- @InjectView(R.id.text1)
- public TextView text1;
-
- public Text1Tag(View view) {
- super(view);
- }
-
+/**
+ * Copyright 2012 Alex Yanchenko
+ *
+ * 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 org.droidparts.adapter.tag;
+
+import org.droidparts.annotation.inject.InjectView;
+
+import android.R;
+import android.view.View;
+import android.widget.TextView;
+
+public class Text1Tag extends AdapterTag {
+
+ @InjectView(R.id.text1)
+ public TextView text1;
+
+ public Text1Tag(View view) {
+ super(view);
+ }
+
}
View
64 extra/src/org/droidparts/adapter/tag/Text2Tag.java
@@ -1,33 +1,33 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.adapter.tag;
-
-import org.droidparts.annotation.inject.InjectView;
-
-import android.R;
-import android.view.View;
-import android.widget.TextView;
-
-public class Text2Tag extends Text1Tag {
-
- @InjectView(R.id.text2)
- public TextView text2;
-
- public Text2Tag(View view) {
- super(view);
- }
-
+/**
+ * Copyright 2012 Alex Yanchenko
+ *
+ * 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 org.droidparts.adapter.tag;
+
+import org.droidparts.annotation.inject.InjectView;
+
+import android.R;
+import android.view.View;
+import android.widget.TextView;
+
+public class Text2Tag extends Text1Tag {
+
+ @InjectView(R.id.text2)
+ public TextView text2;
+
+ public Text2Tag(View view) {
+ super(view);
+ }
+
}
View
70 extra/src/org/droidparts/adapter/ui/OnItemSelectedAdapter.java
@@ -1,35 +1,35 @@
-package org.droidparts.adapter.ui;
-
-import android.view.View;
-import android.widget.AdapterView;
-
-public class OnItemSelectedAdapter implements
- android.widget.AdapterView.OnItemSelectedListener {
-
- public interface OnItemSelectedListener {
-
- void onItemSelected(AdapterView<?> view, int position);
-
- }
-
- private final AdapterView<?> view;
- private final OnItemSelectedListener listener;
-
- public OnItemSelectedAdapter(AdapterView<?> view,
- OnItemSelectedListener listener) {
- this.view = view;
- this.listener = listener;
- }
-
- @Override
- public void onItemSelected(AdapterView<?> parent, View view, int position,
- long id) {
- listener.onItemSelected(this.view, position);
- }
-
- @Override
- public void onNothingSelected(AdapterView<?> parent) {
- // pass
- }
-
-}
+package org.droidparts.adapter.ui;
+
+import android.view.View;
+import android.widget.AdapterView;
+
+public class OnItemSelectedAdapter implements
+ android.widget.AdapterView.OnItemSelectedListener {
+
+ public interface OnItemSelectedListener {
+
+ void onItemSelected(AdapterView<?> view, int position);
+
+ }
+
+ private final AdapterView<?> view;
+ private final OnItemSelectedListener listener;
+
+ public OnItemSelectedAdapter(AdapterView<?> view,
+ OnItemSelectedListener listener) {
+ this.view = view;
+ this.listener = listener;
+ }
+
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int position,
+ long id) {
+ listener.onItemSelected(this.view, position);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {
+ // pass
+ }
+
+}
View
78 extra/src/org/droidparts/adapter/ui/TextWatcherAdapter.java
@@ -1,39 +1,39 @@
-package org.droidparts.adapter.ui;
-
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.widget.EditText;
-
-public class TextWatcherAdapter implements TextWatcher {
-
- public interface TextWatcherListener {
-
- void onTextChanged(EditText view, String text);
-
- }
-
- private final EditText view;
- private final TextWatcherListener listener;
-
- public TextWatcherAdapter(EditText editText, TextWatcherListener listener) {
- this.view = editText;
- this.listener = listener;
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- listener.onTextChanged(view, s.toString());
- }
-
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count,
- int after) {
- // pass
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- // pass
- }
-
-}
+package org.droidparts.adapter.ui;
+
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.widget.EditText;
+
+public class TextWatcherAdapter implements TextWatcher {
+
+ public interface TextWatcherListener {
+
+ void onTextChanged(EditText view, String text);
+
+ }
+
+ private final EditText view;
+ private final TextWatcherListener listener;
+
+ public TextWatcherAdapter(EditText editText, TextWatcherListener listener) {
+ this.view = editText;
+ this.listener = listener;
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ listener.onTextChanged(view, s.toString());
+ }
+
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count,
+ int after) {
+ // pass
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ // pass
+ }
+
+}
View
114 extra/src/org/droidparts/http/HTTPException.java
@@ -1,57 +1,57 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.http;
-
-import org.apache.http.HttpStatus;
-
-public class HTTPException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- private int respCode = -1;
-
- public HTTPException(Throwable cause) {
- super(cause);
- }
-
- public HTTPException(int respCode, String respBody) {
- super(respBody);
- this.respCode = respCode;
- }
-
- /**
- * @see HttpStatus
- */
- public int getResponseCode() {
- return respCode;
- }
-
- @Override
- public String toString() {
- if (respCode != -1) {
- StringBuilder sb = new StringBuilder();
- sb.append("Response code: ");
- sb.append(respCode);
- sb.append(", body: ");
- sb.append(getMessage());
- return sb.toString();
- } else {
- return super.toString();
- }
- }
-
-}
+/**
+ * Copyright 2012 Alex Yanchenko
+ *
+ * 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 org.droidparts.http;
+
+import org.apache.http.HttpStatus;
+
+public class HTTPException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private int respCode = -1;
+
+ public HTTPException(Throwable cause) {
+ super(cause);
+ }
+
+ public HTTPException(int respCode, String respBody) {
+ super(respBody);
+ this.respCode = respCode;
+ }
+
+ /**
+ * @see HttpStatus
+ */
+ public int getResponseCode() {
+ return respCode;
+ }
+
+ @Override
+ public String toString() {
+ if (respCode != -1) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Response code: ");
+ sb.append(respCode);
+ sb.append(", body: ");
+ sb.append(getMessage());
+ return sb.toString();
+ } else {
+ return super.toString();
+ }
+ }
+
+}
View
430 extra/src/org/droidparts/http/RESTClient.java
@@ -1,215 +1,215 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.http;
-
-import static android.text.TextUtils.isEmpty;
-import static org.droidparts.contract.Constants.UTF8;
-import static org.droidparts.http.wrapper.HttpClientWrapper.useHttpURLConnection;
-import static org.droidparts.http.wrapper.HttpURLConnectionWrapper.GET;
-
-import java.io.BufferedInputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.util.HashMap;
-
-import org.apache.http.Header;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.entity.StringEntity;
-import org.droidparts.http.wrapper.ConsumingInputStream;
-import org.droidparts.http.wrapper.DefaultHttpClientWrapper;
-import org.droidparts.http.wrapper.HttpClientWrapper;
-import org.droidparts.http.wrapper.HttpURLConnectionWrapper;
-import org.droidparts.util.L;
-
-import android.content.Context;
-import android.os.Build;
-import android.util.Pair;
-
-public class RESTClient {
-
- private final Context ctx;
-
- private final String userAgent;
- private final HashMap<String, String> headers = new HashMap<String, String>();
-
- private String authUser, authPassword;
- private String proxyUrl, proxyUser, proxyPassword;
-
- public RESTClient(Context ctx, String userAgent) {
- this.ctx = ctx.getApplicationContext();
- this.userAgent = userAgent;
- if (Build.VERSION.SDK_INT >= 14) {
- setHttpResponseCacheEnabled(true);
- }
- }
-
- public void setHttpResponseCacheEnabled(boolean enabled) {
- HttpURLConnectionWrapper.setHttpResponseCacheEnabled(ctx, enabled);
- }
-
- public void setHeader(String key, String value) {
- if (isEmpty(key) || isEmpty(value)) {
- throw new IllegalArgumentException("Key: " + key + ", value: "
- + value + " should be non-null.");
- } else {
- headers.put(key, value);
- }
- }
-
- public void setProxy(String proxy, String username, String password) {
- this.proxyUrl = proxy;
- this.proxyUser = username;
- this.proxyPassword = password;
- }
-
- public void authenticateBasic(String username, String password) {
- this.authUser = username;
- this.authPassword = password;
- }
-
- //
-
- public String get(String uri) throws HTTPException {
- L.d("GET on " + uri);
- String respStr;
- if (useHttpURLConnection()) {
- HttpURLConnectionWrapper wrapper = getModern();
- HttpURLConnection conn = wrapper.getConnectedHttpURLConnection(uri,
- GET);
- respStr = HttpURLConnectionWrapper
- .getResponseBodyAndDisconnect(conn);
- } else {
- DefaultHttpClientWrapper wrapper = getLegacy();
- HttpGet req = new HttpGet(uri);
- HttpResponse resp = wrapper.getResponse(req);
- respStr = DefaultHttpClientWrapper.getResponseBody(resp);
- DefaultHttpClientWrapper.consumeResponse(resp);
- }
- return respStr;
- }
-
- public String post(String uri, String contentEncoding, String data)
- throws HTTPException {
- L.d("POST on " + uri + ", data: " + data);
- // TODO useHttpURLConnection()
- HttpPost req = new HttpPost(uri);
- try {
- StringEntity entity = new StringEntity(data, UTF8);
- entity.setContentType(contentEncoding);
- req.setEntity(entity);
- } catch (UnsupportedEncodingException e) {
- L.e(e);
- throw new HTTPException(e);
- }
- DefaultHttpClientWrapper wrapper = getLegacy();
- HttpResponse resp = wrapper.getResponse(req);
- String respStr = DefaultHttpClientWrapper.getResponseBody(resp);
- DefaultHttpClientWrapper.consumeResponse(resp);
- return respStr;
- }
-
- public String put(String uri, String contentEncoding, String data)
- throws HTTPException {
- L.d("PUT on " + uri + ", data: " + data);
- // TODO useHttpURLConnection()
- HttpPut req = new HttpPut(uri);
- try {
- StringEntity entity = new StringEntity(data, UTF8);
- entity.setContentType(contentEncoding);
- req.setEntity(entity);
- } catch (UnsupportedEncodingException e) {
- throw new HTTPException(e);
- }
- DefaultHttpClientWrapper wrapper = getLegacy();
- HttpResponse resp = wrapper.getResponse(req);
- Header loc = resp.getLastHeader("Location");
- DefaultHttpClientWrapper.consumeResponse(resp);
- if (loc != null) {
- String[] parts = loc.getValue().split("/");
- String location = parts[parts.length - 1];
- L.d("location: " + location);
- return location;
- } else {
- return null;
- }
- }
-
- public void delete(String uri) throws HTTPException {
- L.d("DELETE on " + uri);
- // TODO useHttpURLConnection()
- DefaultHttpClientWrapper wrapper = getLegacy();
- HttpDelete req = new HttpDelete(uri);
- HttpResponse resp = wrapper.getResponse(req);
- DefaultHttpClientWrapper.consumeResponse(resp);
- }
-
- public Pair<Integer, BufferedInputStream> getInputStream(String uri)
- throws HTTPException {
- L.d("InputStream on " + uri);
- int contentLength = -1;
- ConsumingInputStream cis = null;
- if (useHttpURLConnection()) {
- HttpURLConnectionWrapper wrapper = getModern();
- HttpURLConnection conn = wrapper.getConnectedHttpURLConnection(uri,
- GET);
- contentLength = conn.getContentLength();
- cis = new ConsumingInputStream(
- HttpURLConnectionWrapper.getUnpackedInputStream(conn), conn);
- } else {
- DefaultHttpClientWrapper wrapper = getLegacy();
- HttpGet req = new HttpGet(uri);
- HttpResponse resp = wrapper.getResponse(req);
- HttpEntity entity = resp.getEntity();
- // 2G limit
- contentLength = (int) entity.getContentLength();
- cis = new ConsumingInputStream(
- DefaultHttpClientWrapper.getUnpackedInputStream(entity),
- entity);
- }
- return new Pair<Integer, BufferedInputStream>(contentLength, cis);
- }
-
- //
-
- private DefaultHttpClientWrapper getLegacy() {
- DefaultHttpClientWrapper wrapper = new DefaultHttpClientWrapper(
- userAgent);
- initWrapper(wrapper);
- return wrapper;
- }
-
- private HttpURLConnectionWrapper getModern() {
- HttpURLConnectionWrapper wrapper = new HttpURLConnectionWrapper(
- userAgent);
- initWrapper(wrapper);
- return wrapper;
- }
-
- private void initWrapper(HttpClientWrapper wrapper) {
- wrapper.setHeaders(headers);
- if (proxyUrl != null) {
- wrapper.setProxy(proxyUrl, proxyUser, proxyPassword);
- }
- if (authUser != null && authPassword != null) {
- wrapper.authenticateBasic(authUser, authPassword);
- }
- }
-}
+/**
+ * Copyright 2012 Alex Yanchenko
+ *
+ * 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 org.droidparts.http;
+
+import static android.text.TextUtils.isEmpty;
+import static org.droidparts.contract.Constants.UTF8;
+import static org.droidparts.http.wrapper.HttpClientWrapper.useHttpURLConnection;
+import static org.droidparts.http.wrapper.HttpURLConnectionWrapper.GET;
+
+import java.io.BufferedInputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.util.HashMap;
+
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.entity.StringEntity;
+import org.droidparts.http.wrapper.ConsumingInputStream;
+import org.droidparts.http.wrapper.DefaultHttpClientWrapper;
+import org.droidparts.http.wrapper.HttpClientWrapper;
+import org.droidparts.http.wrapper.HttpURLConnectionWrapper;
+import org.droidparts.util.L;
+
+import android.content.Context;
+import android.os.Build;
+import android.util.Pair;
+
+public class RESTClient {
+
+ private final Context ctx;
+
+ private final String userAgent;
+ private final HashMap<String, String> headers = new HashMap<String, String>();
+
+ private String authUser, authPassword;
+ private String proxyUrl, proxyUser, proxyPassword;
+
+ public RESTClient(Context ctx, String userAgent) {
+ this.ctx = ctx.getApplicationContext();
+ this.userAgent = userAgent;
+ if (Build.VERSION.SDK_INT >= 14) {
+ setHttpResponseCacheEnabled(true);
+ }
+ }
+
+ public void setHttpResponseCacheEnabled(boolean enabled) {
+ HttpURLConnectionWrapper.setHttpResponseCacheEnabled(ctx, enabled);
+ }
+
+ public void setHeader(String key, String value) {
+ if (isEmpty(key) || isEmpty(value)) {
+ throw new IllegalArgumentException("Key: " + key + ", value: "
+ + value + " should be non-null.");
+ } else {
+ headers.put(key, value);
+ }
+ }
+
+ public void setProxy(String proxy, String username, String password) {
+ this.proxyUrl = proxy;
+ this.proxyUser = username;
+ this.proxyPassword = password;
+ }
+
+ public void authenticateBasic(String username, String password) {
+ this.authUser = username;
+ this.authPassword = password;
+ }
+
+ //
+
+ public String get(String uri) throws HTTPException {
+ L.d("GET on " + uri);
+ String respStr;
+ if (useHttpURLConnection()) {
+ HttpURLConnectionWrapper wrapper = getModern();
+ HttpURLConnection conn = wrapper.getConnectedHttpURLConnection(uri,
+ GET);
+ respStr = HttpURLConnectionWrapper
+ .getResponseBodyAndDisconnect(conn);
+ } else {
+ DefaultHttpClientWrapper wrapper = getLegacy();
+ HttpGet req = new HttpGet(uri);
+ HttpResponse resp = wrapper.getResponse(req);
+ respStr = DefaultHttpClientWrapper.getResponseBody(resp);
+ DefaultHttpClientWrapper.consumeResponse(resp);
+ }
+ return respStr;
+ }
+
+ public String post(String uri, String contentEncoding, String data)
+ throws HTTPException {
+ L.d("POST on " + uri + ", data: " + data);
+ // TODO useHttpURLConnection()
+ HttpPost req = new HttpPost(uri);
+ try {
+ StringEntity entity = new StringEntity(data, UTF8);
+ entity.setContentType(contentEncoding);
+ req.setEntity(entity);
+ } catch (UnsupportedEncodingException e) {
+ L.e(e);
+ throw new HTTPException(e);
+ }
+ DefaultHttpClientWrapper wrapper = getLegacy();
+ HttpResponse resp = wrapper.getResponse(req);
+ String respStr = DefaultHttpClientWrapper.getResponseBody(resp);
+ DefaultHttpClientWrapper.consumeResponse(resp);
+ return respStr;
+ }
+
+ public String put(String uri, String contentEncoding, String data)
+ throws HTTPException {
+ L.d("PUT on " + uri + ", data: " + data);
+ // TODO useHttpURLConnection()
+ HttpPut req = new HttpPut(uri);
+ try {
+ StringEntity entity = new StringEntity(data, UTF8);
+ entity.setContentType(contentEncoding);
+ req.setEntity(entity);
+ } catch (UnsupportedEncodingException e) {
+ throw new HTTPException(e);
+ }
+ DefaultHttpClientWrapper wrapper = getLegacy();
+ HttpResponse resp = wrapper.getResponse(req);
+ Header loc = resp.getLastHeader("Location");
+ DefaultHttpClientWrapper.consumeResponse(resp);
+ if (loc != null) {
+ String[] parts = loc.getValue().split("/");
+ String location = parts[parts.length - 1];
+ L.d("location: " + location);
+ return location;
+ } else {
+ return null;
+ }
+ }
+
+ public void delete(String uri) throws HTTPException {
+ L.d("DELETE on " + uri);
+ // TODO useHttpURLConnection()
+ DefaultHttpClientWrapper wrapper = getLegacy();
+ HttpDelete req = new HttpDelete(uri);
+ HttpResponse resp = wrapper.getResponse(req);
+ DefaultHttpClientWrapper.consumeResponse(resp);
+ }
+
+ public Pair<Integer, BufferedInputStream> getInputStream(String uri)
+ throws HTTPException {
+ L.d("InputStream on " + uri);
+ int contentLength = -1;
+ ConsumingInputStream cis = null;
+ if (useHttpURLConnection()) {
+ HttpURLConnectionWrapper wrapper = getModern();
+ HttpURLConnection conn = wrapper.getConnectedHttpURLConnection(uri,
+ GET);
+ contentLength = conn.getContentLength();
+ cis = new ConsumingInputStream(
+ HttpURLConnectionWrapper.getUnpackedInputStream(conn), conn);
+ } else {
+ DefaultHttpClientWrapper wrapper = getLegacy();
+ HttpGet req = new HttpGet(uri);
+ HttpResponse resp = wrapper.getResponse(req);
+ HttpEntity entity = resp.getEntity();
+ // 2G limit
+ contentLength = (int) entity.getContentLength();
+ cis = new ConsumingInputStream(
+ DefaultHttpClientWrapper.getUnpackedInputStream(entity),
+ entity);
+ }
+ return new Pair<Integer, BufferedInputStream>(contentLength, cis);
+ }
+
+ //
+
+ private DefaultHttpClientWrapper getLegacy() {
+ DefaultHttpClientWrapper wrapper = new DefaultHttpClientWrapper(
+ userAgent);
+ initWrapper(wrapper);
+ return wrapper;
+ }
+
+ private HttpURLConnectionWrapper getModern() {
+ HttpURLConnectionWrapper wrapper = new HttpURLConnectionWrapper(
+ userAgent);
+ initWrapper(wrapper);
+ return wrapper;
+ }
+
+ private void initWrapper(HttpClientWrapper wrapper) {
+ wrapper.setHeaders(headers);
+ if (proxyUrl != null) {
+ wrapper.setProxy(proxyUrl, proxyUser, proxyPassword);
+ }
+ if (authUser != null && authPassword != null) {
+ wrapper.authenticateBasic(authUser, authPassword);
+ }
+ }
+}
View
236 extra/src/org/droidparts/util/AppUtils.java
@@ -1,118 +1,118 @@
-/**
- * Copyright 2012 Alex Yanchenko
- *
- * 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 org.droidparts.util;
-
-import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
-import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
-import static android.content.pm.PackageManager.DONT_KILL_APP;
-import static android.content.pm.PackageManager.GET_META_DATA;
-import static android.provider.Settings.Secure.ANDROID_ID;
-import static org.droidparts.contract.Constants.BUFFER_SIZE;
-import static org.droidparts.util.io.IOUtils.silentlyClose;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.os.Build;
-import android.os.Environment;
-import android.provider.Settings.Secure;
-
-public class AppUtils {
-
- protected final Context ctx;
-
- public AppUtils(Context ctx) {
- this.ctx = ctx;
- }
-
- public String getDeviceId() {
- return Secure.getString(ctx.getContentResolver(), ANDROID_ID);
- }
-
- public String getVersionName() {
- String verName = "?";
- try {
- verName = ctx.getPackageManager().getPackageInfo(
- ctx.getPackageName(), 0).versionName;
- } catch (NameNotFoundException e) {
- L.e(e);
- }
- return verName;
- }
-
- public File getExternalCacheDir() {
- if (Build.VERSION.SDK_INT > 7) {
- File dir = ctx.getExternalCacheDir();
- return dir;
- } else {
- File esd = Environment.getExternalStorageDirectory();
- if (esd != null) {
- return new File(esd, "/Android/data/" + ctx.getPackageName()
- + "/cache");
- } else {
- return null;
- }
- }
- }
-
- public boolean gotActivityForIntent(Intent intent) {
- return ctx.getPackageManager().resolveActivity(intent, 0) != null;
- }
-
- public boolean isInstalled(String pkgName) {
- try {
- ctx.getPackageManager().getApplicationInfo(pkgName, GET_META_DATA);
- return true;
- } catch (NameNotFoundException e) {
- return false;
- }
- }
-
- public void setComponentEnabled(Class<? extends Context> component,
- boolean visible) {
- PackageManager pm = ctx.getPackageManager();
- ComponentName componentName = new ComponentName(ctx, component);
- int state = visible ? COMPONENT_ENABLED_STATE_ENABLED
- : COMPONENT_ENABLED_STATE_DISABLED;
- pm.setComponentEnabledSetting(componentName, state, DONT_KILL_APP);
- }
-
- public String readStringResource(int resId) throws IOException {
- InputStream is = null;
- BufferedReader reader = null;
- try {
- is = ctx.getResources().openRawResource(resId);
- reader = new BufferedReader(new InputStreamReader(is), BUFFER_SIZE);
- StringBuilder sb = new StringBuilder();
- String line;
- while ((line = reader.readLine()) != null) {
- sb.append(line);
- }
- return sb.toString();
- } finally {
- silentlyClose(reader, is);
- }
- }
-
-}
+/**
+ * Copyright 2012 Alex Yanchenko