Permalink
Browse files

initial commit

  • Loading branch information...
1 parent 4e501bb commit 8268fbfb575de3c2fc79c7f062e986b631eb59c2 @a-thomas a-thomas committed Oct 11, 2012
Showing with 5,147 additions and 1 deletion.
  1. +6 −0 .gitignore
  2. +33 −0 LICENCE.txt
  3. +24 −1 README.md
  4. +47 −0 androidkickstartr-core/pom.xml
  5. +62 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/CanonicalNameConsts.java
  6. +164 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/Kickstartr.java
  7. +61 −0 ...ckstartr-core/src/main/java/com/athomas/androidkickstartr/generator/AcraApplicationGenerator.java
  8. +11 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/generator/Generator.java
  9. +334 −0 ...dkickstartr-core/src/main/java/com/athomas/androidkickstartr/generator/MainActivityGenerator.java
  10. +59 −0 ...oidkickstartr-core/src/main/java/com/athomas/androidkickstartr/generator/RestClientGenerator.java
  11. +47 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/generator/ViewPagerGenerator.java
  12. +139 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/model/Application.java
  13. +170 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/model/State.java
  14. +154 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/util/FileHelper.java
  15. +88 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/util/LibraryHelper.java
  16. +209 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/util/RefHelper.java
  17. +62 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/util/ResourcesUtils.java
  18. +85 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/util/TemplatesFileHelper.java
  19. +42 −0 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/util/Zipper.java
  20. +6 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/AndroidManifest.xml
  21. +15 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/README.md
  22. BIN androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/libs/android-support-v4.jar
  23. +151 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/pom.xml
  24. +12 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/project.properties
  25. +20 −0 ...n/resources/libs/ActionBarSherlock/library/res/color/abs__primary_text_disable_only_holo_dark.xml
  26. +21 −0 .../resources/libs/ActionBarSherlock/library/res/color/abs__primary_text_disable_only_holo_light.xml
  27. +24 −0 ...-core/src/main/resources/libs/ActionBarSherlock/library/res/color/abs__primary_text_holo_dark.xml
  28. +26 −0 ...core/src/main/resources/libs/ActionBarSherlock/library/res/color/abs__primary_text_holo_light.xml
  29. BIN ...n/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_bottom_solid_dark_holo.9.png
  30. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_bottom_solid_inverse_holo.9.png
  31. BIN .../resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_bottom_solid_light_holo.9.png
  32. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_bottom_transparent_dark_holo.9.png
  33. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_bottom_transparent_light_holo.9.png
  34. BIN ...ain/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_share_pack_holo_dark.9.png
  35. BIN ...in/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_share_pack_holo_light.9.png
  36. BIN ...src/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_solid_dark_holo.9.png
  37. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_solid_light_holo.9.png
  38. BIN ...c/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_solid_shadow_holo.9.png
  39. BIN .../resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_stacked_solid_dark_holo.9.png
  40. BIN ...resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_stacked_solid_light_holo.9.png
  41. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_stacked_transparent_dark_holo.9.png
  42. BIN ...ces/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_stacked_transparent_light_holo.9.png
  43. BIN ...in/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_transparent_dark_holo.9.png
  44. BIN ...n/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ab_transparent_light_holo.9.png
  45. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__btn_cab_done_default_holo_dark.9.png
  46. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__btn_cab_done_default_holo_light.9.png
  47. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__btn_cab_done_focused_holo_dark.9.png
  48. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__btn_cab_done_focused_holo_light.9.png
  49. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__btn_cab_done_pressed_holo_dark.9.png
  50. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__btn_cab_done_pressed_holo_light.9.png
  51. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__cab_background_bottom_holo_dark.9.png
  52. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__cab_background_bottom_holo_light.9.png
  53. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__cab_background_top_holo_dark.9.png
  54. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__cab_background_top_holo_light.9.png
  55. BIN .../main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__dialog_full_holo_dark.9.png
  56. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__dialog_full_holo_light.9.png
  57. BIN ...src/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ic_ab_back_holo_dark.png
  58. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ic_ab_back_holo_light.png
  59. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ic_cab_done_holo_dark.png
  60. BIN ...c/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ic_cab_done_holo_light.png
  61. BIN ...s/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ic_menu_moreoverflow_normal_holo_dark.png
  62. BIN .../libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ic_menu_moreoverflow_normal_holo_light.png
  63. BIN .../main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ic_menu_share_holo_dark.png
  64. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__ic_menu_share_holo_light.png
  65. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__list_activated_holo.9.png
  66. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__list_divider_holo_dark.9.png
  67. BIN ...ain/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__list_divider_holo_light.9.png
  68. BIN .../src/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__list_focused_holo.9.png
  69. BIN .../main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__list_longpressed_holo.9.png
  70. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__list_pressed_holo_dark.9.png
  71. BIN ...ain/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__list_pressed_holo_light.9.png
  72. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__list_selector_disabled_holo_dark.9.png
  73. BIN ...ces/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__list_selector_disabled_holo_light.9.png
  74. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__menu_dropdown_panel_holo_dark.9.png
  75. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__menu_dropdown_panel_holo_light.9.png
  76. BIN .../main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__progress_bg_holo_dark.9.png
  77. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__progress_bg_holo_light.9.png
  78. BIN .../resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__progress_primary_holo_dark.9.png
  79. BIN ...resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__progress_primary_holo_light.9.png
  80. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__progress_secondary_holo_dark.9.png
  81. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__progress_secondary_holo_light.9.png
  82. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_48_inner_holo.png
  83. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_48_outer_holo.png
  84. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_ab_default_holo_dark.9.png
  85. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_ab_default_holo_light.9.png
  86. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_ab_disabled_holo_dark.9.png
  87. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_ab_disabled_holo_light.9.png
  88. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_ab_focused_holo_dark.9.png
  89. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_ab_focused_holo_light.9.png
  90. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_ab_pressed_holo_dark.9.png
  91. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__spinner_ab_pressed_holo_light.9.png
  92. BIN ...n/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_focused_holo.9.png
  93. BIN .../src/main/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_holo.9.png
  94. BIN ...n/resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__tab_selected_pressed_holo.9.png
  95. BIN ...resources/libs/ActionBarSherlock/library/res/drawable-hdpi/abs__tab_unselected_pressed_holo.9.png
  96. BIN ...n/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_bottom_solid_dark_holo.9.png
  97. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_bottom_solid_inverse_holo.9.png
  98. BIN .../resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_bottom_solid_light_holo.9.png
  99. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_bottom_transparent_dark_holo.9.png
  100. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_bottom_transparent_light_holo.9.png
  101. BIN ...ain/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_share_pack_holo_dark.9.png
  102. BIN ...in/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_share_pack_holo_light.9.png
  103. BIN ...src/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_solid_dark_holo.9.png
  104. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_solid_light_holo.9.png
  105. BIN ...c/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_solid_shadow_holo.9.png
  106. BIN .../resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_stacked_solid_dark_holo.9.png
  107. BIN ...resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_stacked_solid_light_holo.9.png
  108. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_stacked_transparent_dark_holo.9.png
  109. BIN ...ces/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_stacked_transparent_light_holo.9.png
  110. BIN ...in/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_transparent_dark_holo.9.png
  111. BIN ...n/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ab_transparent_light_holo.9.png
  112. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__btn_cab_done_default_holo_dark.9.png
  113. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__btn_cab_done_default_holo_light.9.png
  114. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__btn_cab_done_focused_holo_dark.9.png
  115. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__btn_cab_done_focused_holo_light.9.png
  116. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__btn_cab_done_pressed_holo_dark.9.png
  117. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__btn_cab_done_pressed_holo_light.9.png
  118. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__cab_background_bottom_holo_dark.9.png
  119. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__cab_background_bottom_holo_light.9.png
  120. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__cab_background_top_holo_dark.9.png
  121. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__cab_background_top_holo_light.9.png
  122. BIN .../main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__dialog_full_holo_dark.9.png
  123. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__dialog_full_holo_light.9.png
  124. BIN ...src/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ic_ab_back_holo_dark.png
  125. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ic_ab_back_holo_light.png
  126. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ic_cab_done_holo_dark.png
  127. BIN ...c/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ic_cab_done_holo_light.png
  128. BIN ...s/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ic_menu_moreoverflow_normal_holo_dark.png
  129. BIN .../libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ic_menu_moreoverflow_normal_holo_light.png
  130. BIN .../main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ic_menu_share_holo_dark.png
  131. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__ic_menu_share_holo_light.png
  132. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__list_activated_holo.9.png
  133. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__list_divider_holo_dark.9.png
  134. BIN ...ain/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__list_divider_holo_light.9.png
  135. BIN .../src/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__list_focused_holo.9.png
  136. BIN .../main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__list_longpressed_holo.9.png
  137. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__list_pressed_holo_dark.9.png
  138. BIN ...ain/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__list_pressed_holo_light.9.png
  139. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__list_selector_disabled_holo_dark.9.png
  140. BIN ...ces/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__list_selector_disabled_holo_light.9.png
  141. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__menu_dropdown_panel_holo_dark.9.png
  142. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__menu_dropdown_panel_holo_light.9.png
  143. BIN .../main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__progress_bg_holo_dark.9.png
  144. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__progress_bg_holo_light.9.png
  145. BIN .../resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__progress_primary_holo_dark.9.png
  146. BIN ...resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__progress_primary_holo_light.9.png
  147. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__progress_secondary_holo_dark.9.png
  148. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__progress_secondary_holo_light.9.png
  149. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_48_inner_holo.png
  150. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_48_outer_holo.png
  151. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_ab_default_holo_dark.9.png
  152. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_ab_default_holo_light.9.png
  153. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_ab_disabled_holo_dark.9.png
  154. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_ab_disabled_holo_light.9.png
  155. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_ab_focused_holo_dark.9.png
  156. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_ab_focused_holo_light.9.png
  157. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_ab_pressed_holo_dark.9.png
  158. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__spinner_ab_pressed_holo_light.9.png
  159. BIN ...n/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_focused_holo.9.png
  160. BIN .../src/main/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_holo.9.png
  161. BIN ...n/resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__tab_selected_pressed_holo.9.png
  162. BIN ...resources/libs/ActionBarSherlock/library/res/drawable-mdpi/abs__tab_unselected_pressed_holo.9.png
  163. +34 −0 .../src/main/resources/libs/ActionBarSherlock/library/res/drawable-v11/abs__progress_medium_holo.xml
  164. BIN .../resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_bottom_solid_dark_holo.9.png
  165. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_bottom_solid_inverse_holo.9.png
  166. BIN ...resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_bottom_solid_light_holo.9.png
  167. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_bottom_transparent_dark_holo.9.png
  168. BIN ...ces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_bottom_transparent_light_holo.9.png
  169. BIN ...in/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_share_pack_holo_dark.9.png
  170. BIN ...n/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_share_pack_holo_light.9.png
  171. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_solid_dark_holo.9.png
  172. BIN ...c/main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_solid_light_holo.9.png
  173. BIN .../main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_solid_shadow_holo.9.png
  174. BIN ...resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_stacked_solid_dark_holo.9.png
  175. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_stacked_solid_light_holo.9.png
  176. BIN ...ces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_stacked_transparent_dark_holo.9.png
  177. BIN ...es/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_stacked_transparent_light_holo.9.png
  178. BIN ...n/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_transparent_dark_holo.9.png
  179. BIN .../resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ab_transparent_light_holo.9.png
  180. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__btn_cab_done_default_holo_dark.9.png
  181. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__btn_cab_done_default_holo_light.9.png
  182. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__btn_cab_done_focused_holo_dark.9.png
  183. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__btn_cab_done_focused_holo_light.9.png
  184. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__btn_cab_done_pressed_holo_dark.9.png
  185. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__btn_cab_done_pressed_holo_light.9.png
  186. BIN ...rces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__cab_background_bottom_holo_dark.9.png
  187. BIN ...ces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__cab_background_bottom_holo_light.9.png
  188. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__cab_background_top_holo_dark.9.png
  189. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__cab_background_top_holo_light.9.png
  190. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__dialog_full_holo_dark.9.png
  191. BIN ...ain/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__dialog_full_holo_light.9.png
  192. BIN ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ic_ab_back_holo_dark.png
  193. BIN ...c/main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ic_ab_back_holo_light.png
  194. BIN ...c/main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ic_cab_done_holo_dark.png
  195. BIN .../main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ic_cab_done_holo_light.png
  196. BIN .../libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ic_menu_moreoverflow_normal_holo_dark.png
  197. BIN ...libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ic_menu_moreoverflow_normal_holo_light.png
  198. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ic_menu_share_holo_dark.png
  199. BIN ...ain/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__ic_menu_share_holo_light.png
  200. BIN ...c/main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__list_activated_holo.9.png
  201. BIN ...ain/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__list_divider_holo_dark.9.png
  202. BIN ...in/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__list_divider_holo_light.9.png
  203. BIN ...src/main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__list_focused_holo.9.png
  204. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__list_longpressed_holo.9.png
  205. BIN ...ain/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__list_pressed_holo_dark.9.png
  206. BIN ...in/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__list_pressed_holo_light.9.png
  207. BIN ...ces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__list_selector_disabled_holo_dark.9.png
  208. BIN ...es/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__list_selector_disabled_holo_light.9.png
  209. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__menu_dropdown_panel_holo_dark.9.png
  210. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__menu_dropdown_panel_holo_light.9.png
  211. BIN ...main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__progress_bg_holo_dark.9.png
  212. BIN ...ain/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__progress_bg_holo_light.9.png
  213. BIN ...resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__progress_primary_holo_dark.9.png
  214. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__progress_primary_holo_light.9.png
  215. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__progress_secondary_holo_dark.9.png
  216. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__progress_secondary_holo_light.9.png
  217. BIN ...c/main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__spinner_48_inner_holo.png
  218. BIN ...c/main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__spinner_48_outer_holo.png
  219. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__spinner_ab_default_holo_dark.9.png
  220. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__spinner_ab_default_holo_light.9.png
  221. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__spinner_ab_disabled_holo_dark.9.png
  222. BIN ...urces/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__spinner_ab_disabled_holo_light.9.png
  223. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__spinner_ab_focused_holo_dark.9.png
  224. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__spinner_ab_focused_holo_light.9.png
  225. BIN ...sources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__spinner_ab_pressed_holo_dark.9.png
  226. BIN ...ources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__spinner_ab_pressed_holo_light.9.png
  227. BIN .../resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__tab_selected_focused_holo.9.png
  228. BIN ...src/main/resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__tab_selected_holo.9.png
  229. BIN .../resources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__tab_selected_pressed_holo.9.png
  230. BIN ...esources/libs/ActionBarSherlock/library/res/drawable-xhdpi/abs__tab_unselected_pressed_holo.9.png
  231. +20 −0 ...ain/resources/libs/ActionBarSherlock/library/res/drawable/abs__activated_background_holo_dark.xml
  232. +20 −0 ...in/resources/libs/ActionBarSherlock/library/res/drawable/abs__activated_background_holo_light.xml
  233. +24 −0 ...re/src/main/resources/libs/ActionBarSherlock/library/res/drawable/abs__btn_cab_done_holo_dark.xml
  234. +24 −0 ...e/src/main/resources/libs/ActionBarSherlock/library/res/drawable/abs__btn_cab_done_holo_light.xml
  235. +18 −0 ...ain/resources/libs/ActionBarSherlock/library/res/drawable/abs__ic_menu_moreoverflow_holo_dark.xml
  236. +18 −0 ...in/resources/libs/ActionBarSherlock/library/res/drawable/abs__ic_menu_moreoverflow_holo_light.xml
  237. +26 −0 ...src/main/resources/libs/ActionBarSherlock/library/res/drawable/abs__item_background_holo_dark.xml
  238. +26 −0 ...rc/main/resources/libs/ActionBarSherlock/library/res/drawable/abs__item_background_holo_light.xml
  239. +20 −0 ...ibs/ActionBarSherlock/library/res/drawable/abs__list_selector_background_transition_holo_dark.xml
  240. +20 −0 ...bs/ActionBarSherlock/library/res/drawable/abs__list_selector_background_transition_holo_light.xml
  241. +27 −0 ...e/src/main/resources/libs/ActionBarSherlock/library/res/drawable/abs__list_selector_holo_dark.xml
  242. +28 −0 .../src/main/resources/libs/ActionBarSherlock/library/res/drawable/abs__list_selector_holo_light.xml
  243. +32 −0 ...main/resources/libs/ActionBarSherlock/library/res/drawable/abs__progress_horizontal_holo_dark.xml
  244. +32 −0 ...ain/resources/libs/ActionBarSherlock/library/res/drawable/abs__progress_horizontal_holo_light.xml
  245. +34 −0 ...core/src/main/resources/libs/ActionBarSherlock/library/res/drawable/abs__progress_medium_holo.xml
  246. +25 −0 ...core/src/main/resources/libs/ActionBarSherlock/library/res/drawable/abs__spinner_ab_holo_dark.xml
  247. +25 −0 ...ore/src/main/resources/libs/ActionBarSherlock/library/res/drawable/abs__spinner_ab_holo_light.xml
  248. +34 −0 ...ore/src/main/resources/libs/ActionBarSherlock/library/res/drawable/abs__tab_indicator_ab_holo.xml
  249. +40 −0 ...rc/main/resources/libs/ActionBarSherlock/library/res/layout-large/abs__action_mode_close_item.xml
  250. +26 −0 ...c/main/resources/libs/ActionBarSherlock/library/res/layout-v14/sherlock_spinner_dropdown_item.xml
  251. +26 −0 ...r-core/src/main/resources/libs/ActionBarSherlock/library/res/layout-v14/sherlock_spinner_item.xml
  252. +50 −0 ...re/src/main/resources/libs/ActionBarSherlock/library/res/layout-xlarge/abs__screen_action_bar.xml
  253. +49 −0 ...ain/resources/libs/ActionBarSherlock/library/res/layout-xlarge/abs__screen_action_bar_overlay.xml
  254. +38 −0 ...startr-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__action_bar_home.xml
  255. +7 −0 ...kstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__action_bar_tab.xml
  256. +6 −0 ...ore/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__action_bar_tab_bar_view.xml
  257. +50 −0 ...-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__action_bar_title_item.xml
  258. +56 −0 ...ore/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__action_menu_item_layout.xml
  259. +23 −0 ...rtr-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__action_menu_layout.xml
  260. +24 −0 ...startr-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__action_mode_bar.xml
  261. +31 −0 ...core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__action_mode_close_item.xml
  262. +70 −0 ...-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__activity_chooser_view.xml
  263. +53 −0 ...main/resources/libs/ActionBarSherlock/library/res/layout/abs__activity_chooser_view_list_item.xml
  264. +46 −0 ...artr-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__dialog_title_holo.xml
  265. +26 −0 ...ore/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__list_menu_item_checkbox.xml
  266. +28 −0 ...tr-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__list_menu_item_icon.xml
  267. +59 −0 ...-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__list_menu_item_layout.xml
  268. +24 −0 ...r-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__list_menu_item_radio.xml
  269. +60 −0 ...core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__popup_menu_item_layout.xml
  270. +57 −0 ...artr-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__screen_action_bar.xml
  271. +59 −0 ...e/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__screen_action_bar_overlay.xml
  272. +38 −0 ...ckstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/abs__screen_simple.xml
  273. +38 −0 ...in/resources/libs/ActionBarSherlock/library/res/layout/abs__screen_simple_overlay_action_mode.xml
  274. +26 −0 ...e/src/main/resources/libs/ActionBarSherlock/library/res/layout/sherlock_spinner_dropdown_item.xml
  275. +26 −0 ...tartr-core/src/main/resources/libs/ActionBarSherlock/library/res/layout/sherlock_spinner_item.xml
  276. +33 −0 ...kickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-land/abs__dimens.xml
  277. +33 −0 .../src/main/resources/libs/ActionBarSherlock/library/res/values-large-hdpi-1024x600/abs__dimens.xml
  278. +33 −0 ...main/resources/libs/ActionBarSherlock/library/res/values-large-land-hdpi-1024x600/abs__dimens.xml
  279. +33 −0 ...main/resources/libs/ActionBarSherlock/library/res/values-large-land-mdpi-1024x600/abs__dimens.xml
  280. +36 −0 .../src/main/resources/libs/ActionBarSherlock/library/res/values-large-mdpi-1024x600/abs__dimens.xml
  281. +29 −0 ...ickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-large/abs__dimens.xml
  282. +19 −0 ...ckstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-sw600dp/abs__bools.xml
  283. +38 −0 ...kstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-sw600dp/abs__dimens.xml
  284. +12 −0 ...dkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-v11/abs__themes.xml
  285. +118 −0 ...dkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-v14/abs__styles.xml
  286. +32 −0 ...dkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-v14/abs__themes.xml
  287. +22 −0 ...ckstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-w360dp/abs__dimens.xml
  288. +22 −0 ...ickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-w480dp/abs__bools.xml
  289. +29 −0 ...ckstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-w480dp/abs__config.xml
  290. +22 −0 ...ckstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-w500dp/abs__dimens.xml
  291. +22 −0 ...ckstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-w600dp/abs__dimens.xml
  292. +45 −0 ...ckstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values-xlarge/abs__dimens.xml
  293. +380 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values/abs__attrs.xml
  294. +22 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values/abs__bools.xml
  295. +27 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values/abs__colors.xml
  296. +43 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values/abs__config.xml
  297. +50 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values/abs__dimens.xml
  298. +26 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values/abs__ids.xml
  299. +42 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values/abs__strings.xml
  300. +384 −0 androidkickstartr-core/src/main/resources/libs/ActionBarSherlock/library/res/values/abs__styles.xml
Sorry, we could not display the entire diff because too many files (452) changed.
View
6 .gitignore
@@ -0,0 +1,6 @@
+.settings
+.classpath
+.project
+
+tmp
+target
View
33 LICENCE.txt
@@ -0,0 +1,33 @@
+************************************
+This project is available under the following license:
+************************************
+Copyright 2012 Alexandre THOMAS
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+
+This project uses CodeModel (http://codemodel.java.net/), which is
+distributed under the GlassFish Dual License, which means CodeModel is
+subject to the terms of either the GNU General Public License Version 2 only
+("GPL") or the Common Development and Distribution License("CDDL").
+
+You may obtain a copy of the "CDDL" License at
+
+http://www.opensource.org/licenses/cddl1.php
+
+As per section 3.6 ("Larger Works") of the "CDDL" License, we may create a
+Larger Work by combining Covered Software with other code not governed by
+the terms of this License and distribute the Larger Work as a single
+product.
+
+We are therefore allowed to distribute CodeModel without Modification as
+part of AndroidKickstartR.
View
25 README.md
@@ -1 +1,24 @@
-[http://androidkickstartr.com](http://androidkickstartr.com)
+#AndroidKickstartR
+
+AndroidKickstartR helps you to quickly create a well configured Android application using the most popular libraries. It creates and configures your project for you. Just focus on code!
+
+**Let's try it ! See [http://androidkickstartr.com](http://androidkickstartr.com).**
+
+
+
+
+## Licence
+
+Copyright 2012 Alexandre THOMAS
+
+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.
View
47 androidkickstartr-core/pom.xml
@@ -0,0 +1,47 @@
+<project
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.athomas.androidkickstartr</groupId>
+ <artifactId>androidkickstartr-parent</artifactId>
+ <version>1.0-BETA</version>
+ </parent>
+ <artifactId>androidkickstartr-core</artifactId>
+ <name>AndroidKickstartR Core</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.freemarker</groupId>
+ <artifactId>freemarker</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.codemodel</groupId>
+ <artifactId>codemodel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
View
62 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/CanonicalNameConsts.java
@@ -0,0 +1,62 @@
+package com.athomas.androidkickstartr;
+
+public final class CanonicalNameConsts {
+
+ private CanonicalNameConsts() {
+
+ }
+
+ /**
+ * Java lang
+ */
+ public static String OVERRIDE = "java.lang.Override";
+ public static String CHARSEQUENCE = "java.lang.CharSequence";
+ public static String STRING = "java.lang.String";
+
+ /**
+ * Android classes
+ */
+ public static String ACTIVITY = "android.app.Activity";
+ public static String APPLICATION = "android.app.Application";
+ public static String TEXT_VIEW = "android.widget.TextView";
+ public static String BUNDLE = "android.os.Bundle";
+ public static String MENU = "android.view.Menu";
+ public static String CONTEXT = "android.content.Context";
+ public static String ARRAY_ADAPTER = "android.widget.ArrayAdapter";
+
+ public static String FRAGMENT_TRANSACTION = "android.support.v4.app.FragmentTransaction";
+ public static String FRAGMENT_ACTIVITY = "android.support.v4.app.FragmentActivity";
+ public static String VIEW_PAGER = "android.support.v4.view.ViewPager";
+ public static String FRAGMENT_PAGER_ADAPTER = "android.support.v4.app.FragmentPagerAdapter";
+
+ /**
+ * ActionBarSherlock classes
+ */
+ public static String SHERLOCK_ACTIVITY = "com.actionbarsherlock.app.SherlockActivity";
+ public static String SHERLOCK_FRAGMENT_ACTIVITY = "com.actionbarsherlock.app.SherlockFragmentActivity";
+ public static String SHERLOCK_MENU = "com.actionbarsherlock.view.Menu";
+ public static String SHERLOCK_NAVIGATION_LISTENER = "com.actionbarsherlock.app.ActionBar.OnNavigationListener";
+ public static String SHERLOCK_ACTION_BAR = "com.actionbarsherlock.app.ActionBar";
+ public static String SHERLOCK_TAB_LISTENER = "com.actionbarsherlock.app.ActionBar.TabListener";
+ public static String SHERLOCK_TAB = "com.actionbarsherlock.app.ActionBar.Tab";
+
+ /**
+ * AndroidAnnotations classes
+ */
+ public static String EACTIVITY = "com.googlecode.androidannotations.annotations.EActivity";
+ public static String VIEW_BY_ID = "com.googlecode.androidannotations.annotations.ViewById";
+ public static String AFTER_VIEWS = "com.googlecode.androidannotations.annotations.AfterViews";
+ public static String BACKGROUND = "com.googlecode.androidannotations.annotations.Background";
+ public static String UITHREAD = "com.googlecode.androidannotations.annotations.UiThread";
+
+ public static String REST = "com.googlecode.androidannotations.annotations.rest.Rest";
+ public static String GET = "com.googlecode.androidannotations.annotations.rest.Get";
+ public static String REST_SERVICE = "com.googlecode.androidannotations.annotations.rest.RestService";
+
+ /**
+ * Acra
+ */
+ public static String REPORTS_CRASHES = "org.acra.annotation.ReportsCrashes";
+ public static String ACRA = "org.acra.ACRA";
+
+}
View
164 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/Kickstartr.java
@@ -0,0 +1,164 @@
+package com.athomas.androidkickstartr;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.athomas.androidkickstartr.generator.AcraApplicationGenerator;
+import com.athomas.androidkickstartr.generator.Generator;
+import com.athomas.androidkickstartr.generator.MainActivityGenerator;
+import com.athomas.androidkickstartr.generator.RestClientGenerator;
+import com.athomas.androidkickstartr.generator.ViewPagerGenerator;
+import com.athomas.androidkickstartr.model.Application;
+import com.athomas.androidkickstartr.model.State;
+import com.athomas.androidkickstartr.util.FileHelper;
+import com.athomas.androidkickstartr.util.LibraryHelper;
+import com.athomas.androidkickstartr.util.ResourcesUtils;
+import com.athomas.androidkickstartr.util.TemplatesFileHelper;
+import com.athomas.androidkickstartr.util.Zipper;
+import com.sun.codemodel.JCodeModel;
+
+import freemarker.template.TemplateException;
+
+public class Kickstartr {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Kickstartr.class);
+ private final static String RESOURCES_DIR_PATH = "tmp/";
+
+ private State state;
+ private Application application;
+ private JCodeModel jCodeModel;
+ private FileHelper fileHelper;
+
+ public Kickstartr(State state, Application application) {
+ this.state = state;
+ this.application = application;
+ jCodeModel = new JCodeModel();
+ extractResources(state, application);
+ }
+
+ private void extractResources(State state, Application application) {
+ try {
+ ResourcesUtils.copyResourcesTo(RESOURCES_DIR_PATH, "org.eclipse.jdt.apt.core.prefs");
+ fileHelper = new FileHelper(application.getName(), RESOURCES_DIR_PATH, state.isMaven());
+ } catch (IOException e) {
+ LOGGER.error("an error occured during the resources extraction", e);
+ }
+ }
+
+ public File start() {
+ LOGGER.info("generation of " + application + " : " + state);
+
+ if (state.isRestTemplate()) {
+ List<String> permissions = application.getPermissions();
+ permissions.add("android.permission.INTERNET");
+ }
+
+ try {
+ generateSourceCode();
+ LOGGER.debug("source code generated from templates.");
+ } catch (IOException e) {
+ LOGGER.error("generated code file not generated", e);
+ return null;
+ }
+
+ try {
+ File androidResDir = fileHelper.getTargetAndroidResDir();
+ File sourceResDir = fileHelper.getResDir();
+ FileUtils.copyDirectory(sourceResDir, androidResDir);
+ LOGGER.debug("res dir copied.");
+ } catch (IOException e) {
+ LOGGER.error("problem occurs during the resources copying", e);
+ return null;
+ }
+
+ if (state.isMaven()) {
+ // create src/text/java - it avoids an error when import to Eclipse
+ File targetTestDir = fileHelper.getTargetTestDir();
+ File removeMe = new File(targetTestDir, "REMOVEME");
+ try {
+ removeMe.createNewFile();
+ } catch (IOException e) {
+ LOGGER.error("an error occured during the REMOVEME file creation", e);
+ }
+ }
+
+ try {
+ TemplatesFileHelper templatesFileHelper = new TemplatesFileHelper(application, state, fileHelper);
+ templatesFileHelper.generate();
+ LOGGER.debug("files generated from templates.");
+ } catch (IOException e) {
+ LOGGER.error("problem during ftl files loading", e);
+ return null;
+ } catch (TemplateException e) {
+ LOGGER.error("problem during template processing", e);
+ return null;
+ }
+
+ try {
+ if (state.isAndroidAnnotations() && state.isEclipse()) {
+ File targetEclipseJdtAptCorePrefsFile = fileHelper.getTargetEclipseJdtAptCorePrefsFile();
+ File eclipseJdtAptCorePrefs = fileHelper.getEclipseJdtAptCorePrefs();
+ FileUtils.copyFile(eclipseJdtAptCorePrefs, targetEclipseJdtAptCorePrefsFile);
+ LOGGER.debug("org.eclipse.jdt.apt.core.prefs copied");
+ }
+ } catch (IOException e) {
+ LOGGER.error("a problem occured during the org.eclipse.jdt.apt.core.prefs copying", e);
+ return null;
+ }
+
+ LibraryHelper libraryManager = new LibraryHelper(state, fileHelper);
+ libraryManager.go();
+ LOGGER.debug("libraries copied");
+
+ File zipFile = null;
+ try {
+ File targetDir = fileHelper.getTargetDir();
+ zipFile = new File(targetDir, application.getName() + "-AndroidKickstartr.zip");
+ Zipper.zip(fileHelper.getFinalDir(), zipFile);
+ LOGGER.debug("application sources zipped");
+ } catch (IOException e) {
+ LOGGER.error("a problem occured during the compression", e);
+ return null;
+ }
+
+ LOGGER.debug("AndroidKickstartR generation done");
+ return zipFile;
+ }
+
+ private void generateSourceCode() throws IOException {
+ List<Generator> generators = new ArrayList<Generator>();
+ generators.add(new MainActivityGenerator(state, application));
+
+ if (state.isViewPager()) {
+ generators.add(new ViewPagerGenerator(application));
+ }
+
+ if (state.isRestTemplate() && state.isAndroidAnnotations()) {
+ generators.add(new RestClientGenerator(application));
+ }
+
+ if (state.isAcra()) {
+ generators.add(new AcraApplicationGenerator(application));
+ }
+
+ for (Generator generator : generators) {
+ generator.generate(jCodeModel);
+ }
+ jCodeModel.build(fileHelper.getTargetSourceDir());
+ }
+
+ public void clean() {
+ File targetDir = fileHelper.getTargetDir();
+ try {
+ FileUtils.cleanDirectory(targetDir);
+ } catch (IOException e) {
+ LOGGER.error("a problem occured during target dir cleaning", e);
+ }
+ }
+}
View
61 ...-core/src/main/java/com/athomas/androidkickstartr/generator/AcraApplicationGenerator.java
@@ -0,0 +1,61 @@
+package com.athomas.androidkickstartr.generator;
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.athomas.androidkickstartr.model.Application;
+import com.athomas.androidkickstartr.util.RefHelper;
+import com.sun.codemodel.JBlock;
+import com.sun.codemodel.JClassAlreadyExistsException;
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.JDefinedClass;
+import com.sun.codemodel.JExpr;
+import com.sun.codemodel.JMethod;
+import com.sun.codemodel.JMod;
+
+public class AcraApplicationGenerator implements Generator {
+
+ private Logger logger;
+ private RefHelper ref;
+ private JDefinedClass jClass;
+ private Application application;
+
+ public AcraApplicationGenerator(Application application) {
+ this.application = application;
+ }
+
+ public JCodeModel generate(JCodeModel jCodeModel) throws IOException {
+
+ logger = LoggerFactory.getLogger(getClass());
+
+ ref = new RefHelper(jCodeModel);
+
+ try {
+ jClass = jCodeModel._class(application.getApplicationPackage());
+
+ // TODO Enhance that
+ ref.r(application.getR()); // must do it at least once
+
+ jClass._extends(ref.application());
+
+ jClass.annotate(ref.reportsCrashes()).param("formKey", "YOUR_FORM_KEY");
+
+ JMethod onCreateMethod = jClass.method(JMod.PUBLIC, jCodeModel.VOID, "onCreate");
+ onCreateMethod.annotate(ref.override());
+
+ JBlock onCreateMethodBody = onCreateMethod.body();
+
+ onCreateMethodBody.staticInvoke(ref.acra(), "init").arg(JExpr._this());
+
+ onCreateMethodBody.invoke(JExpr._super(), "onCreate");
+
+ } catch (JClassAlreadyExistsException e1) {
+ logger.error("Classname already exists", e1);
+ }
+ return jCodeModel;
+
+ }
+
+}
View
11 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/generator/Generator.java
@@ -0,0 +1,11 @@
+package com.athomas.androidkickstartr.generator;
+
+import java.io.IOException;
+
+import com.sun.codemodel.JCodeModel;
+
+public interface Generator {
+
+ public JCodeModel generate(JCodeModel jCodeModel) throws IOException;
+
+}
View
334 ...rtr-core/src/main/java/com/athomas/androidkickstartr/generator/MainActivityGenerator.java
@@ -0,0 +1,334 @@
+package com.athomas.androidkickstartr.generator;
+
+import static com.sun.codemodel.JExpr.TRUE;
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.athomas.androidkickstartr.model.Application;
+import com.athomas.androidkickstartr.model.State;
+import com.athomas.androidkickstartr.util.RefHelper;
+import com.sun.codemodel.JAnnotationUse;
+import com.sun.codemodel.JBlock;
+import com.sun.codemodel.JClass;
+import com.sun.codemodel.JClassAlreadyExistsException;
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.JDefinedClass;
+import com.sun.codemodel.JExpr;
+import com.sun.codemodel.JExpression;
+import com.sun.codemodel.JFieldRef;
+import com.sun.codemodel.JFieldVar;
+import com.sun.codemodel.JForEach;
+import com.sun.codemodel.JInvocation;
+import com.sun.codemodel.JMethod;
+import com.sun.codemodel.JMod;
+import com.sun.codemodel.JVar;
+
+public class MainActivityGenerator implements Generator {
+
+ private JDefinedClass jClass;
+ private RefHelper ref;
+ private JCodeModel jCodeModel;
+ private State state;
+ private Logger LOGGER = LoggerFactory.getLogger(getClass());
+ private Application application;
+
+ public MainActivityGenerator(State state, Application application) {
+ this.state = state;
+ this.application = application;
+ }
+
+ public JCodeModel generate(JCodeModel jCodeModel) throws IOException {
+ this.jCodeModel = jCodeModel;
+
+ ref = new RefHelper(jCodeModel);
+
+ try {
+ jClass = jCodeModel._class(application.getActivityPackage());
+
+ // TODO Enhance that
+ ref.r(application.getR()); // must do it at least once
+
+ createActivity(application.getActivityLayout());
+
+ JFieldVar textViewField = createTextViewField("hello");
+
+ JBlock afterViewsBody = createAfterViewsMethod();
+ doTextViewViewById(afterViewsBody, "hello", textViewField);
+
+ addRestClient(textViewField);
+
+ createOnCreateOptionsMenu();
+
+ createConfigureViewPager(afterViewsBody, application.getViewPagerAdapterPackage());
+
+ createConfigureActionBar(afterViewsBody);
+
+ } catch (JClassAlreadyExistsException e1) {
+ LOGGER.error("Classname already exists", e1);
+ }
+ return jCodeModel;
+ }
+
+ private void createActivity(String layout) {
+ JClass parentActivity;
+
+ if (state.isViewPager()) {
+ parentActivity = state.isViewPager() ? ref.sFragmentActivity() : ref.fragmentActivity();
+ } else {
+ parentActivity = state.isActionBarSherlock() ? ref.sActivity() : ref.activity();
+ }
+
+ jClass._extends(parentActivity);
+
+ // @EActivity
+ if (state.isAndroidAnnotations()) {
+ JAnnotationUse eactivityAnnotation = jClass.annotate(ref.eactivity());
+ JFieldRef field = ref.r().staticRef("layout").ref(layout);
+ eactivityAnnotation.param("value", field);
+ }
+ }
+
+ private JFieldVar createViewField(JClass type, String name) {
+ int mod = state.isAndroidAnnotations() ? JMod.NONE : JMod.PRIVATE;
+ JFieldVar field = jClass.field(mod, type, name);
+ return field;
+ }
+
+ private JFieldVar createTextViewField(String name) {
+ return createViewField(ref.textView(), name);
+ }
+
+ private JFieldVar createViewPagerField(String name) {
+ return createViewField(ref.viewPager(), name);
+ }
+
+ private JBlock createAfterViewsMethod() {
+ JBlock afterViewsBody;
+ if (!state.isAndroidAnnotations()) {
+ JMethod onCreate = jClass.method(JMod.PUBLIC, jCodeModel.VOID, "onCreate");
+ onCreate.annotate(ref.override());
+ JVar params = onCreate.param(ref.bundle(), "savedInstanceState");
+ afterViewsBody = onCreate.body();
+ JExpression _super = JExpr._super();
+ JInvocation onCreateInvocation = _super.invoke("onCreate").arg(params);
+ afterViewsBody.add(onCreateInvocation);
+ } else {
+ JMethod afterViews = jClass.method(JMod.NONE, jCodeModel.VOID, "afterViews");
+ afterViews.annotate(ref.afterViews());
+ afterViewsBody = afterViews.body();
+ }
+ return afterViewsBody;
+ }
+
+ private void doTextViewViewById(JBlock afterViewsBody, String id, JFieldVar field) {
+ doViewById(afterViewsBody, id, field, ref.textView());
+ }
+
+ private void doViewPagerViewById(JBlock afterViewsBody, String id, JFieldVar field) {
+ doViewById(afterViewsBody, id, field, ref.viewPager());
+ }
+
+ private void doViewById(JBlock afterViewsBody, String id, JFieldVar field, JClass type) {
+ if (!state.isAndroidAnnotations()) {
+ doFindViewById(afterViewsBody, id, field, type);
+ } else {
+ field.annotate(ref.viewById());
+ }
+ }
+
+ private void doFindViewById(JBlock afterViewsBody, String id, JFieldVar field, JClass type) {
+ JFieldRef rIdHello = ref.r().staticRef("id").ref(id);
+ JInvocation findViewById = JExpr.invoke("findViewById").arg(rIdHello);
+ JExpression findViewByIdCasted = JExpr.cast(type, findViewById);
+ afterViewsBody.assign(field, findViewByIdCasted);
+ }
+
+ // ACTION BAR SHERLOCK
+
+ private JBlock createOnCreateOptionsMenu() {
+ JMethod onCreateOptionsMenu = null;
+ JClass menu = !state.isActionBarSherlock() ? ref.menu() : ref.sMenu();
+
+ onCreateOptionsMenu = jClass.method(JMod.PUBLIC, jCodeModel.BOOLEAN, "onCreateOptionsMenu");
+ JVar menuVar = onCreateOptionsMenu.param(menu, "menu");
+ onCreateOptionsMenu.annotate(ref.override());
+ JBlock onCreateOptionsMenuBody = onCreateOptionsMenu.body();
+
+ String getMenuInflater = state.isActionBarSherlock() ? "getSupportMenuInflater" : "getMenuInflater";
+
+ JFieldRef rMenuMain = ref.r().staticRef("menu").ref("activity_main");
+ JInvocation inflate = JExpr.invoke(getMenuInflater).//
+ invoke("inflate"). //
+ arg(rMenuMain). //
+ arg(menuVar);
+
+ onCreateOptionsMenuBody.add(inflate);
+ onCreateOptionsMenuBody._return(TRUE);
+
+ return onCreateOptionsMenuBody;
+ }
+
+ private void createConfigureActionBar(JBlock afterViewsBody) {
+ if (state.isActionBarSherlock() && (state.isListNavigation() || state.isTabNavigation())) {
+
+ JMethod configureActionBar = jClass.method(JMod.PRIVATE, jCodeModel.VOID, "configureActionBar");
+ JBlock configureActionBarBody = configureActionBar.body();
+
+ // LIST NAVIGATION
+ if (state.isListNavigation()) {
+ addListNavigationConfiguration(configureActionBarBody);
+ }
+
+ // TAB NAVIGATION
+ if (state.isTabNavigation()) {
+ addTabNavigationConfiguration(configureActionBarBody);
+ }
+ afterViewsBody.invoke(configureActionBar);
+ }
+ }
+
+ private void addTabNavigationConfiguration(JBlock configureActionBarBody) {
+ // implements TabListener
+ jClass._implements(ref.sTabListener());
+
+ JClass sherlockTab = ref.sTab();
+ JClass fragmentTransaction = ref.fragmentTransaction();
+
+ // override TabListener methods
+ JMethod onTabSelected = jClass.method(JMod.PUBLIC, jCodeModel.VOID, "onTabSelected");
+ onTabSelected.param(sherlockTab, "tab");
+ onTabSelected.param(fragmentTransaction, "ft");
+ onTabSelected.annotate(ref.override());
+
+ JMethod onTabUnselected = jClass.method(JMod.PUBLIC, jCodeModel.VOID, "onTabUnselected");
+ onTabUnselected.param(sherlockTab, "tab");
+ onTabUnselected.param(fragmentTransaction, "ft");
+ onTabUnselected.annotate(ref.override());
+
+ JMethod onTabReselected = jClass.method(JMod.PUBLIC, jCodeModel.VOID, "onTabReselected");
+ onTabReselected.param(sherlockTab, "tab");
+ onTabReselected.param(fragmentTransaction, "ft");
+ onTabReselected.annotate(ref.override());
+
+ JInvocation getSupportActionBar = JExpr.invoke("getSupportActionBar");
+
+ JFieldRef navigationModeList = ref.sActionBar().staticRef("NAVIGATION_MODE_TABS");
+ JInvocation setNavigationMode = getSupportActionBar.invoke("setNavigationMode").arg(navigationModeList);
+ configureActionBarBody.add(setNavigationMode);
+
+ JFieldRef rArrayLocations = ref.r().staticRef("array").ref("locations");
+ JInvocation getResources = JExpr.invoke("getResources");
+ JInvocation getStringArray = getResources.invoke("getStringArray").arg(rArrayLocations);
+
+ JClass string = ref.string();
+ JClass stringArray = string.array();
+ JVar locations = configureActionBarBody.decl(stringArray, "locations", getStringArray);
+
+ JForEach forEachLocation = configureActionBarBody.forEach(string, "location", locations);
+ JVar location = forEachLocation.var();
+
+ JBlock forEachLocationBody = forEachLocation.body();
+ JInvocation newTab = getSupportActionBar.invoke("newTab");
+
+ JVar tab = forEachLocationBody.decl(sherlockTab, "tab", newTab);
+ JInvocation setText = tab.invoke("setText").arg(location);
+ JInvocation setTabListener = tab.invoke("setTabListener").arg(JExpr._this());
+ JInvocation addTab = getSupportActionBar.invoke("addTab").arg(tab);
+
+ forEachLocationBody.add(setText);
+ forEachLocationBody.add(setTabListener);
+ forEachLocationBody.add(addTab);
+ }
+
+ private void addListNavigationConfiguration(JBlock configureActionBarBody) {
+ jClass._implements(ref.sNavigationListener());
+
+ JMethod onNavigationItemSelected = jClass.method(JMod.PUBLIC, jCodeModel.BOOLEAN, "onNavigationItemSelected");
+ onNavigationItemSelected.param(jCodeModel.INT, "itemPosition");
+ onNavigationItemSelected.param(jCodeModel.LONG, "itemId");
+ onNavigationItemSelected.annotate(ref.override());
+
+ JBlock body = onNavigationItemSelected.body();
+ body._return(TRUE);
+
+ // configure Tab navigation
+ JInvocation getSupportActionbar = JExpr.invoke("getSupportActionBar");
+ JInvocation getContext = getSupportActionbar.invoke("getThemedContext");
+ JVar contextVar = configureActionBarBody.decl(ref.context(), "context");
+ contextVar.init(getContext);
+
+ JFieldRef rArrayLocations = ref.r().staticRef("array").ref("locations");
+ // NEEDED! CodeModel doesn't manage the case where two
+ // classes have the same name
+ JExpression rLayoutSherlockSpinner = JExpr.direct("android.R.layout.simple_list_item_1");
+
+ JClass arrayAdapter = ref.arrayAdapter();
+ JInvocation createFromResource = arrayAdapter.staticInvoke("createFromResource"). //
+ arg(contextVar). //
+ arg(rArrayLocations). //
+ arg(rLayoutSherlockSpinner);
+
+ JClass listType = arrayAdapter.narrow(ref.charSequence());
+ JVar listVar = configureActionBarBody.decl(listType, "list");
+ listVar.init(createFromResource);
+
+ JFieldRef navigationModeList = ref.sActionBar().staticRef("NAVIGATION_MODE_LIST");
+ JInvocation setNavigationMode = getSupportActionbar.invoke("setNavigationMode").arg(navigationModeList);
+ JInvocation setListNavigationCallbacks = getSupportActionbar.invoke("setListNavigationCallbacks").//
+ arg(listVar).//
+ arg(JExpr._this());
+
+ configureActionBarBody.add(setNavigationMode);
+ configureActionBarBody.add(setListNavigationCallbacks);
+ }
+
+ private void createConfigureViewPager(JBlock afterViewsBody, String viewPagerAdapterName) {
+ if (state.isViewPager()) {
+ JFieldVar pagerField = createViewPagerField("pager");
+ doViewPagerViewById(afterViewsBody, "pager", pagerField);
+
+ afterViewsBody.invoke("configureViewPager");
+
+ JMethod configureViewPager = jClass.method(JMod.PRIVATE, jCodeModel.VOID, "configureViewPager");
+ JBlock configureViewPagerBody = configureViewPager.body();
+
+ JClass viewPagerAdapter = ref.ref(viewPagerAdapterName);
+
+ JInvocation getSupportFragmentManager = JExpr.invoke("getSupportFragmentManager");
+ JInvocation newViewPagerAdapter = JExpr._new(viewPagerAdapter).arg(getSupportFragmentManager);
+
+ JVar pagerAdapter = configureViewPagerBody.decl(viewPagerAdapter, "pagerAdapter", newViewPagerAdapter);
+ pagerField.invoke("setAdapter").arg(pagerAdapter);
+ }
+ }
+
+ private void addRestClient(JFieldVar textViewField) {
+ if (state.isRestTemplate() && state.isAndroidAnnotations()) {
+
+ // add annotated restClient field
+ JFieldVar restClient = jClass.field(JMod.NONE, ref.ref(application.getRestClientPackage()), "restClient");
+ restClient.annotate(ref.restService());
+
+ // add doSomethingElseOnUiThread method
+ JMethod doSomethingElseOnUiThread = jClass.method(JMod.NONE, jCodeModel.VOID, "doSomethingElseOnUiThread");
+ doSomethingElseOnUiThread.annotate(ref.uithread());
+
+ JBlock body = doSomethingElseOnUiThread.body();
+ body.invoke(textViewField, "setText").arg("Hi!");
+
+ // add doSomethingInBackground method
+ JMethod doSomethingInBackground = jClass.method(JMod.NONE, jCodeModel.VOID, "doSomethingInBackground");
+ doSomethingInBackground.annotate(ref.background());
+ JBlock doSomethingInBackgroundBody = doSomethingInBackground.body();
+
+ JInvocation restClientMain = restClient.invoke("main");
+ doSomethingInBackgroundBody.add(restClientMain);
+ doSomethingInBackgroundBody.invoke(doSomethingElseOnUiThread);
+
+ }
+ }
+
+}
View
59 ...tartr-core/src/main/java/com/athomas/androidkickstartr/generator/RestClientGenerator.java
@@ -0,0 +1,59 @@
+package com.athomas.androidkickstartr.generator;
+
+import static com.sun.codemodel.ClassType.INTERFACE;
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.athomas.androidkickstartr.model.Application;
+import com.athomas.androidkickstartr.util.RefHelper;
+import com.sun.codemodel.JAnnotationUse;
+import com.sun.codemodel.JClassAlreadyExistsException;
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.JDefinedClass;
+import com.sun.codemodel.JMethod;
+import com.sun.codemodel.JMod;
+
+/**
+ * Generates a RestClient interface annotated with @Rest annotation.
+ *
+ * @author Alexandre THOMAS
+ *
+ */
+public class RestClientGenerator implements Generator {
+
+ private Logger logger;
+ private RefHelper ref;
+ private JDefinedClass jClass;
+ private Application application;
+
+ public RestClientGenerator(Application application) {
+ this.application = application;
+ }
+
+ public JCodeModel generate(JCodeModel jCodeModel) throws IOException {
+ logger = LoggerFactory.getLogger(getClass());
+
+ ref = new RefHelper(jCodeModel);
+
+ try {
+ ref.r(application.getR()); // must do it at least once
+
+ jClass = jCodeModel._class(application.getRestClientPackage(), INTERFACE);
+
+ JAnnotationUse rest = jClass.annotate(ref.rest());
+ rest.param("value", application.getRestTemplateUrl());
+
+ // TODO search the JMod for interface method
+ JMethod mainMethod = jClass.method(JMod.ABSTRACT | JMod.PUBLIC, jCodeModel.VOID, "main");
+ JAnnotationUse get = mainMethod.annotate(ref.get());
+ get.param("value", "/");
+
+ } catch (JClassAlreadyExistsException e1) {
+ logger.error("Classname already exists", e1);
+ }
+ return jCodeModel;
+ }
+}
View
47 ...startr-core/src/main/java/com/athomas/androidkickstartr/generator/ViewPagerGenerator.java
@@ -0,0 +1,47 @@
+package com.athomas.androidkickstartr.generator;
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.athomas.androidkickstartr.model.Application;
+import com.athomas.androidkickstartr.util.RefHelper;
+import com.sun.codemodel.JClassAlreadyExistsException;
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.JDefinedClass;
+
+public class ViewPagerGenerator implements Generator {
+
+ private final Logger LOGGER = LoggerFactory.getLogger(getClass());
+ private RefHelper ref;
+ private JDefinedClass jClass;
+ private Application application;
+
+ public ViewPagerGenerator(Application application) {
+ this.application = application;
+ }
+
+ public JCodeModel generate(JCodeModel jCodeModel) throws IOException {
+ ref = new RefHelper(jCodeModel);
+
+ try {
+ jClass = jCodeModel._class(application.getViewPagerAdapterPackage());
+
+ // TODO Enhance that
+ ref.r(application.getR()); // must do it at least once
+
+ createViewPagerAdapter();
+
+ } catch (JClassAlreadyExistsException e1) {
+ LOGGER.error("Classname already exists", e1);
+ }
+ return jCodeModel;
+
+ }
+
+ private void createViewPagerAdapter() {
+ jClass._extends(ref.fragmentPagerAdapter());
+ }
+
+}
View
139 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/model/Application.java
@@ -0,0 +1,139 @@
+package com.athomas.androidkickstartr.model;
+
+import java.util.List;
+
+public class Application {
+
+ private String packageName;
+ private String name;
+ private int minSdk;
+ private int targetSdk;
+ private List<String> permissions;
+ private String activity;
+ private String activityLayout;
+
+ public String getPackageName() {
+ return packageName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getMinSdk() {
+ return minSdk;
+ }
+
+ public int getTargetSdk() {
+ return targetSdk;
+ }
+
+ public List<String> getPermissions() {
+ return permissions;
+ }
+
+ public void setActivity(String activity) {
+ this.activity = activity;
+ }
+
+ public String getActivity() {
+ return activity;
+ }
+
+ public String getActivityLayout() {
+ return activityLayout;
+ }
+
+ public String getActivityPackage() {
+ return packageName + "." + activity;
+ }
+
+ public String getRestClientPackage() {
+ return packageName + ".rest.RestClient";
+ }
+
+ public String getRestClientName() {
+ return "RestClient";
+ }
+
+ public String getR() {
+ return packageName + ".R";
+ }
+
+ public String getViewPagerAdapterPackage() {
+ return packageName + ".adapter.ViewPagerAdapter";
+ }
+
+ public String getRestTemplateUrl() {
+ return "http://10.0.0.2";
+ }
+
+ public String getApplicationPackage() {
+ return packageName + "." + getApplicationClassName();
+ }
+
+ public String getApplicationClassName() {
+ return name + "Application";
+ }
+
+ @Override
+ public String toString() {
+ return "Application [packageName=" + packageName + //
+ ", name=" + name + //
+ ", minSdk=" + minSdk + //
+ ", targetSdk=" + targetSdk + //
+ ", permissions=" + permissions + //
+ ", activity=" + activity + //
+ ", activityLayout=" + activityLayout + //
+ "]";
+ }
+
+ public static class Builder {
+
+ private Application application;
+
+ public Builder() {
+ application = new Application();
+ }
+
+ public Builder packageName(String packageName) {
+ application.packageName = packageName;
+ return this;
+ }
+
+ public Builder name(String name) {
+ application.name = name;
+ return this;
+ }
+
+ public Builder minSdk(int minSdk) {
+ application.minSdk = minSdk;
+ return this;
+ }
+
+ public Builder targetSdk(int targetSdk) {
+ application.targetSdk = targetSdk;
+ return this;
+ }
+
+ public Builder permissions(List<String> permissions) {
+ application.permissions = permissions;
+ return this;
+ }
+
+ public Builder activity(String activity) {
+ application.activity = activity;
+ return this;
+ }
+
+ public Builder activityLayout(String activityLayout) {
+ application.activityLayout = activityLayout;
+ return this;
+ }
+
+ public Application build() {
+ return application;
+ }
+ }
+
+}
View
170 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/model/State.java
@@ -0,0 +1,170 @@
+package com.athomas.androidkickstartr.model;
+
+public class State {
+
+ private boolean actionBarSherlock;
+ private boolean listNavigation;
+ private boolean tabNavigation;
+ private boolean viewPager;
+ private boolean viewPagerIndicator;
+ private boolean androidAnnotations;
+ private boolean restTemplate;
+ private boolean maven;
+ private boolean nineOldAndroids;
+ private boolean supportV4;
+ private boolean acra;
+ private boolean eclipse;
+
+ public boolean isActionBarSherlock() {
+ return actionBarSherlock;
+ }
+
+ public boolean isListNavigation() {
+ return listNavigation;
+ }
+
+ public boolean isTabNavigation() {
+ return tabNavigation;
+ }
+
+ public boolean isViewPager() {
+ return viewPager;
+ }
+
+ public boolean isViewPagerIndicator() {
+ return viewPagerIndicator;
+ }
+
+ public boolean isAndroidAnnotations() {
+ return androidAnnotations;
+ }
+
+ public boolean isRestTemplate() {
+ return restTemplate;
+ }
+
+ public boolean isMaven() {
+ return maven;
+ }
+
+ public boolean isNineOldAndroids() {
+ return nineOldAndroids;
+ }
+
+ public boolean isSupportV4() {
+ return supportV4;
+ }
+
+ public boolean isAcra() {
+ return acra;
+ }
+
+ public boolean isEclipse() {
+ return eclipse;
+ }
+
+ @Override
+ public String toString() {
+ return "State [actionBarSherlock=" + actionBarSherlock + //
+ ", listNavigation=" + listNavigation + //
+ ", tabNavigation=" + tabNavigation + //
+ ", viewPager=" + viewPager + //
+ ", viewPagerIndicator=" + viewPagerIndicator + //
+ ", androidAnnotations=" + androidAnnotations + //
+ ", restTemplate=" + restTemplate + //
+ ", maven=" + maven + //
+ ", nineOldAndroids=" + nineOldAndroids + //
+ ", supportV4=" + supportV4 + //
+ ", acra=" + acra + //
+ ", eclipse=" + eclipse + //
+ "]";
+
+ }
+
+ public static class Builder {
+
+ private State state;
+
+ public Builder() {
+ state = new State();
+ }
+
+ public Builder actionBarSherlock(boolean actionBarSherlock) {
+ state.actionBarSherlock = actionBarSherlock;
+ return this;
+ }
+
+ public Builder listNavigation(boolean listNavigation) {
+ state.listNavigation = listNavigation;
+ return this;
+ }
+
+ public Builder tabNavigation(boolean tabNavigation) {
+ state.tabNavigation = tabNavigation;
+ return this;
+ }
+
+ public Builder viewPager(boolean viewPager) {
+ state.viewPager = viewPager;
+ return this;
+ }
+
+ public Builder viewPagerIndicator(boolean viewPagerIndicator) {
+ state.viewPagerIndicator = viewPagerIndicator;
+ return this;
+ }
+
+ public Builder androidAnnotations(boolean androidAnnotations) {
+ state.androidAnnotations = androidAnnotations;
+ return this;
+ }
+
+ public Builder restTemplate(boolean restTemplate) {
+ state.restTemplate = restTemplate;
+ return this;
+ }
+
+ public Builder maven(boolean maven) {
+ state.maven = maven;
+ return this;
+ }
+
+ public Builder nineOldAndroids(boolean nineOldAndroids) {
+ state.nineOldAndroids = nineOldAndroids;
+ return this;
+ }
+
+ public Builder supportV4(boolean supportV4) {
+ state.supportV4 = supportV4;
+ return this;
+ }
+
+ public Builder acra(boolean acra) {
+ state.acra = acra;
+ return this;
+ }
+
+ public Builder eclipse(boolean eclipse) {
+ state.eclipse = eclipse;
+ return this;
+ }
+
+ public State build() {
+
+ if (state.listNavigation && state.tabNavigation) {
+ throw new IllegalArgumentException("list and tab navigations must not be implemented together.");
+ }
+
+ if (!state.actionBarSherlock && (state.listNavigation || state.tabNavigation)) {
+ throw new IllegalArgumentException("using listNavigation or tabNavigation needs actionBarSherlock.");
+ }
+
+ if (state.supportV4 && (state.actionBarSherlock || state.viewPagerIndicator)) {
+ throw new IllegalArgumentException("support V4 is already included.");
+ }
+
+ return state;
+ }
+ }
+
+}
View
154 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/util/FileHelper.java
@@ -0,0 +1,154 @@
+package com.athomas.androidkickstartr.util;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+public class FileHelper {
+
+ private static final String TARGET = "target";
+ private String applicationName;
+ private boolean maven;
+ private String resourcePath;
+
+ public FileHelper(String applicationName, String resourcesPath, boolean maven) {
+ this.applicationName = applicationName;
+ this.resourcePath = resourcesPath;
+ this.maven = maven;
+ }
+
+ public File getTargetSourceDir() {
+ String srcPath = maven ? "/src/main/java" : "/src";
+
+ File dir = new File(getProject() + srcPath);
+ dir.mkdirs();
+ return dir;
+ }
+
+ public File getTargetTestDir() {
+ File dir = new File(getProject() + "/src/test/java");
+ dir.mkdirs();
+ return dir;
+ }
+
+ private String getFinalPath() {
+ return TARGET + "/" + applicationName + "-AndroidKickstartr";
+ }
+
+ private String getProject() {
+ return getFinalPath() + "/" + applicationName;
+ }
+
+ public File getTemplatesDir() throws IOException {
+ return getResource("templates/");
+ }
+
+ private File getDir(String path) {
+ File dir = new File(path);
+ dir.mkdirs();
+ return dir;
+ }
+
+ public File getResDir() throws IOException {
+ return getResource("res/");
+ }
+
+ public File getTargetAndroidResDir() throws IOException {
+ return getDir(getProject() + "/res");
+ }
+
+ public File getTargetProjectDir() {
+ return getDir(getProject());
+ }
+
+ public File getFinalDir() {
+ return getDir(getFinalPath());
+ }
+
+ public File getTargetDir() {
+ return getDir(TARGET);
+ }
+
+ public File getTargetLibsDir() throws IOException {
+ return getDir(getProject() + "/libs");
+ }
+
+ public File getTargetExtLibsDir() throws IOException {
+ return getDir(getProject() + "/ext-libs");
+ }
+
+ public File getTargetAndroidManifestFile() throws IOException {
+ return createFile(getProject() + "/AndroidManifest.xml");
+ }
+
+ private File createFile(String path) throws IOException {
+ File file = new File(path);
+
+ File parent = file.getParentFile();
+ if(!parent.exists() && !parent.mkdirs()){
+ throw new IllegalStateException("Couldn't create dir: " + parent);
+ }
+
+ if (!file.exists()) {
+ file.createNewFile();
+ }
+ return file;
+ }
+
+ private File getFile(String path) throws IOException {
+ File file = new File(path);
+ if (!file.exists()) {
+ throw new FileNotFoundException(path + " doesn't exist");
+ }
+ return file;
+ }
+
+ public File getTargetPomFile() throws IOException {
+ return createFile(getProject() + "/pom.xml");
+ }
+
+ public File getTargetFactoryPathFile() throws IOException {
+ return createFile(getProject() + "/.factorypath");
+ }
+
+ public File getTargetStylesFile() throws IOException {
+ return createFile(getProject() + "/res/values/styles.xml");
+ }
+
+ public File getTargetProjectFile() throws IOException {
+ return createFile(getProject() + "/.project");
+ }
+
+ public File getTargetClasspathFile() throws IOException {
+ return createFile(getProject() + "/.classpath");
+ }
+
+ public File getTargetStringsFile() throws IOException {
+ return createFile(getProject() + "/res/values/strings.xml");
+ }
+
+ public File getTargetEclipseJdtAptCorePrefsFile() throws IOException {
+ return createFile(getProject() + "/.settings/org.eclipse.jdt.apt.core.prefs");
+ }
+
+ public File getEclipseJdtAptCorePrefs() throws IOException {
+ return getResource("org.eclipse.jdt.apt.core.prefs");
+ }
+
+ public File getProjectPropertiesFile() throws IOException {
+ return getResource("project.properties");
+ }
+
+ public File getTargetProjectPropertiesFile() throws IOException {
+ return createFile(getProject() + "/project.properties");
+ }
+
+ public File getLibraryFile(String filename) throws IOException {
+ return getResource("libs/" + filename);
+ }
+
+ public File getResource(String filename) throws IOException {
+ return getFile(resourcePath + filename);
+ }
+
+}
View
88 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/util/LibraryHelper.java
@@ -0,0 +1,88 @@
+package com.athomas.androidkickstartr.util;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.athomas.androidkickstartr.model.State;
+
+public class LibraryHelper {
+
+ private State state;
+ private final static Logger LOGGER = LoggerFactory.getLogger(LibraryHelper.class);
+ private FileHelper fileHelper;
+
+ public LibraryHelper(State state, FileHelper fileHelper) {
+ this.state = state;
+ this.fileHelper = fileHelper;
+ }
+
+ public void go() {
+ if (state.isActionBarSherlock()) {
+ copyLibraryToProject("ActionBarSherlock/library");
+ }
+
+ if (state.isViewPagerIndicator()) {
+ copyLibraryToProject("ViewPagerIndicator");
+ }
+
+ if (!state.isMaven()) {
+ if (state.isAndroidAnnotations()) {
+ copyToLibs("androidannotations-2.6-api.jar");
+ copyToExtLibs("androidannotations-2.6.jar");
+ }
+
+ if (state.isNineOldAndroids()) {
+ copyToLibs("nineoldandroids-2.4.0.jar");
+ }
+
+ if (state.isRestTemplate()) {
+ copyToLibs("spring-android-core-1.0.0.RELEASE.jar");
+ copyToLibs("spring-android-rest-template-1.0.0.RELEASE.jar");
+ }
+
+ if (state.isSupportV4()) {
+ copyToLibs("android-support-v4.jar");
+ }
+
+ if (state.isAcra()) {
+ copyToLibs("acra-4.3.0.jar");
+ }
+ }
+
+ }
+
+ private void copyLibraryToProject(String lib) {
+ try {
+ File library = fileHelper.getLibraryFile(lib);
+ File projectDir = fileHelper.getFinalDir();
+ FileUtils.copyDirectoryToDirectory(library, projectDir);
+ } catch (IOException e) {
+ LOGGER.error("a problem occured during the copy of the library " + lib, e);
+ }
+ }
+
+ private void copyToLibs(String jar) {
+ try {
+ File library = fileHelper.getLibraryFile(jar);
+ File libsDir = fileHelper.getTargetLibsDir();
+ FileUtils.copyFileToDirectory(library, libsDir);
+ } catch (IOException e) {
+ LOGGER.error("a problem occured during the copy of " + jar + " libs", e);
+ }
+ }
+
+ private void copyToExtLibs(String jar) {
+ try {
+ File library = fileHelper.getLibraryFile(jar);
+ File extLibsDir = fileHelper.getTargetExtLibsDir();
+ FileUtils.copyFileToDirectory(library, extLibsDir);
+ } catch (IOException e) {
+ LOGGER.error("a problem occured during the copy of " + jar + " to ext-libs", e);
+ }
+ }
+
+}
View
209 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/util/RefHelper.java
@@ -0,0 +1,209 @@
+package com.athomas.androidkickstartr.util;
+
+import static com.athomas.androidkickstartr.CanonicalNameConsts.ACRA;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.ACTIVITY;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.AFTER_VIEWS;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.APPLICATION;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.ARRAY_ADAPTER;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.BACKGROUND;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.BUNDLE;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.CHARSEQUENCE;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.CONTEXT;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.EACTIVITY;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.FRAGMENT_ACTIVITY;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.FRAGMENT_PAGER_ADAPTER;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.FRAGMENT_TRANSACTION;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.GET;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.MENU;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.OVERRIDE;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.REPORTS_CRASHES;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.REST;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.REST_SERVICE;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.SHERLOCK_ACTION_BAR;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.SHERLOCK_ACTIVITY;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.SHERLOCK_FRAGMENT_ACTIVITY;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.SHERLOCK_MENU;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.SHERLOCK_NAVIGATION_LISTENER;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.SHERLOCK_TAB;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.SHERLOCK_TAB_LISTENER;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.STRING;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.TEXT_VIEW;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.UITHREAD;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.VIEW_BY_ID;
+import static com.athomas.androidkickstartr.CanonicalNameConsts.VIEW_PAGER;
+
+import com.sun.codemodel.JClass;
+import com.sun.codemodel.JCodeModel;
+
+public class RefHelper {
+
+ private final JCodeModel codeModel;
+ private JClass textView;
+ private JClass viewById;
+ private JClass viewPager;
+ private JClass r;
+
+ public RefHelper(JCodeModel codeModel) {
+ this.codeModel = codeModel;
+ }
+
+ public JClass ref(String fullName) {
+ return codeModel.ref(fullName);
+ }
+
+ public JClass override() {
+ return ref(OVERRIDE);
+ }
+
+ public JClass charSequence() {
+ return ref(CHARSEQUENCE);
+ }
+
+ public JClass string() {
+ return ref(STRING);
+ }
+
+ public JClass activity() {
+ return ref(ACTIVITY);
+ }
+
+ public JClass fragmentActivity() {
+ return ref(FRAGMENT_ACTIVITY);
+ }
+
+ public JClass fragmentPagerAdapter() {
+ return ref(FRAGMENT_PAGER_ADAPTER);
+ }
+
+ public JClass textView() {
+ if (textView == null) {
+ textView = ref(TEXT_VIEW);
+ }
+ return textView;
+ }
+
+ public JClass bundle() {
+ return ref(BUNDLE);
+ }
+
+ public JClass menu() {
+ return ref(MENU);
+ }
+
+ public JClass context() {
+ return ref(CONTEXT);
+ }
+
+ public JClass arrayAdapter() {
+ return ref(ARRAY_ADAPTER);
+ }
+
+ public JClass application() {
+ return ref(APPLICATION);
+ }
+
+ public JClass r(String name) {
+ if (r == null) {
+ r = ref(name);
+ }
+ return r;
+ }
+
+ public JClass r() {
+ if (r == null) {
+ throw new NullPointerException("call r(String name) method at least once");
+ }
+ return r;
+ }
+
+ // Android Support v4
+
+ public JClass viewPager() {
+ if (viewPager == null) {
+ viewPager = ref(VIEW_PAGER);
+ }
+ return viewPager;
+ }
+
+ public JClass fragmentTransaction() {
+ return ref(FRAGMENT_TRANSACTION);
+ }
+
+ // AndroidAnnotations
+
+ public JClass eactivity() {
+ return ref(EACTIVITY);
+ }
+
+ public JClass viewById() {
+ if (viewById == null) {
+ viewById = ref(VIEW_BY_ID);
+ }
+ return viewById;
+ }
+
+ public JClass afterViews() {
+ return ref(AFTER_VIEWS);
+ }
+
+ public JClass background() {
+ return ref(BACKGROUND);
+ }
+
+ public JClass uithread() {
+ return ref(UITHREAD);
+ }
+
+ public JClass rest() {
+ return ref(REST);
+ }
+
+ public JClass get() {
+ return ref(GET);
+ }
+
+ public JClass restService() {
+ return ref(REST_SERVICE);
+ }
+
+ // Action bar Sherlock
+
+ public JClass sActivity() {
+ return ref(SHERLOCK_ACTIVITY);
+ }
+
+ public JClass sFragmentActivity() {
+ return ref(SHERLOCK_FRAGMENT_ACTIVITY);
+ }
+
+ public JClass sMenu() {
+ return ref(SHERLOCK_MENU);
+ }
+
+ public JClass sNavigationListener() {
+ return ref(SHERLOCK_NAVIGATION_LISTENER);
+ }
+
+ public JClass sActionBar() {
+ return ref(SHERLOCK_ACTION_BAR);
+ }
+
+ public JClass sTabListener() {
+ return ref(SHERLOCK_TAB_LISTENER);
+ }
+
+ public JClass sTab() {
+ return ref(SHERLOCK_TAB);
+ }
+
+ // Acra
+
+ public JClass reportsCrashes() {
+ return ref(REPORTS_CRASHES);
+ }
+
+ public JClass acra() {
+ return ref(ACRA);
+ }
+
+}
View
62 androidkickstartr-core/src/main/java/com/athomas/androidkickstartr/util/ResourcesUtils.java
@@ -0,0 +1,62 @@
+package com.athomas.androidkickstartr.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import org.apache.commons.io.FileUtils;
+
+/**
+ * Useful utils for extracting resources from a jar
+ *
+ * @author Alexandre THOMAS
+ */
+public class ResourcesUtils {
+
+ public static void copyResourcesTo(String target, String filepathMarker) throws IOException {
+ ClassLoader classLoader = ResourcesUtils.class.getClassLoader();
+ URL url = classLoader.getResource(filepathMarker);
+ String protocol = url.getProtocol();
+
+ if (protocol.equals("file")) {
+ // TODO for development env
+ } else if (protocol.equals("jar")) {
+ copyResourcesToFromJar(target, url);
+ }
+ }
+
+ private static void copyResourcesToFromJar(String target, URL url) throws IOException {
+ JarURLConnection connection = (JarURLConnection) url.openConnection();
+ JarFile jarFile = connection.getJarFile();
+
+ Enumeration<JarEntry> entries = jarFile.entries();
+
+ while (entries.hasMoreElements()) {
+ JarEntry jarEntry = entries.nextElement();
+ InputStream is = jarFile.getInputStream(jarEntry);
+ String entryPath = jarEntry.getName();
+
+ File file = null;
+ String dirs = "";
+ if (entryPath.contains("/")) {
+ int lastIndexOf = entryPath.lastIndexOf("/");
+ dirs = (String) entryPath.subSequence(0, lastIndexOf + 1);
+ }
+
+ File parent = new File(target + dirs);
+ parent.mkdirs();
+
+ if (!jarEntry.isDirectory()) {
+ String[] splitedPath = entryPath.split("/");
+ String fileName = splitedPath[splitedPath.length - 1];
+ file = new File(parent, fileName);
+ FileUtils.copyInputStreamToFile(is, file);
+ }
+ }
+ }
+}
View
85 ...kickstartr-core/src/main/java/com/athomas/androidkickstartr/util/TemplatesFileHelper.java
@@ -0,0 +1,85 @@
+package com.athomas.androidkickstartr.util;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.athomas.androidkickstartr.model.Application;
+import com.athomas.androidkickstartr.model.State;
+
+import freemarker.template.Configuration;
+import freemarker.template.DefaultObjectWrapper;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+public class TemplatesFileHelper {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(TemplatesFileHelper.class);
+
+ private final FileHelper fileHelper;
+ private final Application application;
+ private final State state;
+
+ public TemplatesFileHelper(Application application, State state, FileHelper fileHelper) {