aboutsummaryrefslogtreecommitdiffstats
path: root/templates
Commit message (Collapse)AuthorAgeFilesLines
* Template unit testsTor Norbye2012-10-292-5/+8
| | | | | | | | | | | | | | | | | | | | | | This adds a plugin test which runs through project creation for all project+activity combinations, across a series of minSdkVersion, targetSdkVersion and build targets, and also varies all the enum and boolean properties (such as the theme setting, the navigation type, etc). For each created project, it runs both ant (to verify that there are no build errors), as well as lint, to verify that there are no lint warnings, except a few allowed ones (such as the is-using-latest-targetSdkVersion, since we are deliberately testing older targetSdkVersions, and the icon checks (disabled because something about the image loading from unit tests hangs Eclipse). It also tests creating all non-activity templates into an existing project. Also fixes a few template issues found by the unit test. Change-Id: Ibe61c47053a7c3ad17e7e1bbb31f9ae3b49c143a
* Lint fixes for FullscreenActivity and NewAndroidApplication templates.Roman Nurik2012-10-254-6/+6
| | | | | | | - Remove extraneous string in FullscreenActivity - Add allowBackup=true to NewAndroidApplication Change-Id: I12706cff2ab7b73f04634f47fea4eb14b0ed4e2a
* Merge "38920: Fix dropdown navigation template"Tor Norbye2012-10-251-4/+4
|\
| * 38920: Fix dropdown navigation templateTor Norbye2012-10-251-4/+4
| | | | | | | | Change-Id: I24760a17de7ec5278a922c109e8ab1fbe7123bfd
* | Remove extraneous '=' from template.Siva Velusamy2012-10-251-1/+1
|/ | | | Change-Id: I5008ceca85a13b6b9a0c92e0ca5089249b033e1a
* Ensure ADT app templates' activity onCreate is protected.Roman Nurik2012-10-017-8/+9
| | | | | | | | It's considered a best practice for activity onCreate overrides to maintain the original visibility of the method, which is protected. Implement this for all activity templates. Change-Id: Ia501628a3f330f671398935103fafc1834f8e78e
* 37497: Templates should escape string literals in resource filesTor Norbye2012-09-1811-14/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the user enters an activity title like "Android's Tools" in the new template wizard, an invalid strings.xml file is generated, since the apostrophe is not properly escaped. To fix this, there's a new string conversion method in the template engine, "escapeXmlString", which will perform all the necessary conversions. It also adds two other XML escaping functions: one to escape text to be suitable for XML attribute values, and one to be suitable for XML text values. Finally, when verifying this, I discovered that if I inserted ampersands in the MasterDetail template, I ended up with errors in various places there a filename was derived from the input string. To help make this work better, there's also a new "extractLetters" method which pulls all the characters out of a string (effectively stripping whitespace and punctuation). In addition to the above 4 new string conversion methods, the templates have been updated to use them, and the template format documentation updated. Change-Id: I4d4e854ab78d63bc86b8eb0fb9d92246534615e7
* Update ADT template format docs to include additional built-in functions.Roman Nurik2012-09-121-2/+48
| | | | | | | | | Specifically, add docs for: - camelCaseToUnderscore - classToResource (new) - underscoreToCamelCase Change-Id: I2d13ea69828f8002cd236054d32888cc7361260e
* Add HTML documentation for ADT templates.Roman Nurik2012-08-307-0/+936
| | | | Change-Id: I7e565ebec48a489f880f556c5f990ff0d0380334
* Don't create a new title string for first activity in prjTor Norbye2012-08-2315-13/+43
| | | | | | | | | | | | | | When an activity is created as part of the New Project wizard, don't ask the user for an activity title; instead, use the project's name (@string/app_name). Since I had to rev the format (to pass the is-new-project context I also cleaned up the compatibility to-string handling of booleans that should no longer be necessary.) This fixes issue 36624: App name issue Change-Id: I6b88b850e0147307db8a9e1585d670e31c261b4c
* Merge "Minor app template bug fixes for LoginActivity and FullscreenActivity"Roman Nurik2012-08-217-9/+34
|\
| * Minor app template bug fixes for LoginActivity and FullscreenActivityRoman Nurik2012-08-107-9/+34
| | | | | | | | | | | | | | | | | | - Fix maxLines=2 for input fields in LoginActivity - Use proper, backward-compatible button bar styles in FullScreenActivity. Change-Id: I20ce76ff5abd8be949644050ad99e2043abf1e5b Bug: 6948808
* | Add Ant support for UI automation test.Xavier Ducrohet2012-08-151-0/+92
|/ | | | | | | Also fix a bug in a custom ant task where minSdkVersion and targetApi were swapped. Change-Id: Id9bac802377a04270e76def42eaf6a8fb4b3f874
* Fix fragment handling in templatesTor Norbye2012-08-082-2/+4
| | | | | | | | First, pre-configure the layouts to use with fragments in the MasterDetailFlow templates. Second, add some fixes to correctly handle activities that use an @android:layout rather than a @layout/. Change-Id: Ib10e5a4bd645970a196d0afc57cee4663c4da895
* Merge "Login activity template."Roman Nurik2012-08-0611-0/+490
|\
| * Login activity template.Roman Nurik2012-08-0611-0/+490
| | | | | | | | | | | | | | | | | | This adds an activity template for Login/Registration. The template sets up a login form that looks good on phones and tablets, and that also accepts registrations using the same form, for an optimized and quick mobile UX. Change-Id: I16f4e7915d88b0b72175fea212faedcd7142ad03
* | Merge "Minor app template fixes."Roman Nurik2012-08-063-4/+4
|\ \
| * | Minor app template fixes.Roman Nurik2012-08-033-4/+4
| |/ | | | | | | | | | | | | - Fix isLauncher check by casting to string. - Move tools:context to root element in one of the XML files. Change-Id: I568f82f8589479a54aceedabe97afffbef6bf510
* | Fullscreen activity template.Roman Nurik2012-08-0614-0/+767
|/ | | | | | | | | | | | | This adds an activity template for a fullscreen activity, such as a video player. The content itself is placeholder content, but this handles the important bits like showing and hiding system navigation and handling orientation changes manually (correctly, as of Android 3.2 with the screenSize config flag). This adds quite a bit of utility code (SystemUiHider). In the future we should move this out of the template and into the support library. Change-Id: I9c9c4c4699a3cec9659171d84bdbd23a5bd41178
* Merge "New activity template parameter making CATEGORY_LAUNCHER optional."Tor Norbye2012-07-274-27/+43
|\
| * New activity template parameter making CATEGORY_LAUNCHER optional.Roman Nurik2012-07-264-27/+43
| | | | | | | | | | | | | | | | | | | | | | - Adds a new template parameter isLauncher to both current activity templates that determines whether or not the activities will have CATEGORY_LAUNCHER intent filters. - Re-arranges some of the template parameters for better consistency and logical ordering. Change-Id: I2dd11776a838e727ad7f74dc0014fde235cfc8cb
* | Merge "Settings activity template."Roman Nurik2012-07-2711-0/+538
|\ \
| * | Settings activity template.Roman Nurik2012-07-2711-0/+538
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds an activity template for Settings. The template comes with a bunch of example preferences for common things like notifications and sync frequency, while highlighting design best practices such as binding summaries to setting values, hiding extraneous buttons in dialog preferences, and even showing a two-pane UI on tablet devices. Future work should further improve on this by using the modern fragment-based PreferenceActivity APIs on all API 11+ devices, not just tablets. With this change, template code would become pretty complex, so I punted on it for now. Change-Id: I8f18fce4a00193c2878d5a94c12f5ad4ee81ce8d
* | Add theme selection to New Android App template.Roman Nurik2012-07-279-17/+65
|/ | | | | | | | - Add a parameter to allow selecting the application theme. Includes backward-compatibility support using resource directory qualifiers. Default theme is Holo.Light.DarkActionBar. Change-Id: Id046a2806fba9ea8ae296859b6d76af18a312b9f
* Activity templates cleanup.Roman Nurik2012-07-1931-191/+400
| | | | | | | | | | | | | | | | | This change cleans up the BlankActivity and MasterDetailFlow activity templates in the following ways: - Unused search icons are removed. - Many comments are added for a better explanation of what's going on. See http://code.google.com/p/android/issues/detail?id=34463 - Code and comments are in better alignment with Android code style and import order (per http://source.android.com/source/code-style.html) - Non-trivial BlankActivity templates now require API 11 instead of 14. More work TBD here. - Templates are more lint-friendly. - android:parentActivityName is added when building against API 16. Change-Id: Iba7b807c7567b161b0e50fb39306209172627c35
* Reference android.R in template rather than importing itTor Norbye2012-07-142-3/+4
| | | | Change-Id: I84ffc48d8c57ac3f46ab28b62be4785135f2878d
* Project template tweaksTor Norbye2012-07-0214-20/+11
| | | | | | | | | | | | | | | | | | | | Fix code which derives a project name from an application name such that it skips invalid project name characters. For example, the application name can be "I/O", but the project name should default to just "IO". Second, fix the validator code such that when it is validating a template parameter constraint of "class", it validates it as a class name, not a package name (so you cannot enter dots for example). Third, replace the default project template icons with the standard app icons (for when you disable Create Custom Launcher Icons). Fourth, tweak the templates such that you don't have unused imports when you create an activity without navigation, and remove unused padding dimension resources. Change-Id: I524608bb6347b4275338ec935e8de56bf3184c23
* Fix bug in BroadcastReceiver templateTor Norbye2012-06-241-4/+4
| | | | Change-Id: Ic7ff88331557e23aa9effef6532bb9d86a848a34
* More template tweaksTor Norbye2012-06-2116-1/+253
| | | | | | | | | | | | | | Generalize the Add Activity wizard into an Add Android Object wizard and move Custom View in there, such that it's no longer a top level wizard. Also place service, content provider and broadcast receivers there. Fix indentation in simple activity template, and fix template wizard such that it doesn't reset all the values when you leave the page (to preview page or previous selector page) and come back - unless the template has changed. Change-Id: Idc1e7f76255d8f0010ccc09fbfc79915cc58690d
* Miscellaneous wizard fixesTor Norbye2012-06-208-16/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add minSdk requirements on templates, and attempting to pick a template with a higher minimum SDK than the one used by the current project will result in a validation error message (and the Next button is disabled). Similarly, add a minSdk requirement on options, such as the BlankActivity's navigation type. This is used to block all navigation types except for "none", unless minSdkVersion >= 14. * Add a buildApi property, which the templates use to only conditionally write contents which requires a higher compilation target. For example, the values-v11 and values-v14 folders specifying Theme.Holo.Light and Theme.Holo.Light.DarkActionBar are only written if the build target is at least 11 and 14 respectively. * Fix some other minor issues which prevented the projects from compiling with low minSdkVersions and low build targets. * Replace the default simple activity's layout (which was just a <TextView> with a center gravity, with a <RelativeLayout> containing the <TextView> with center constraints * Make the code which combines the list of templates from extras/ and tools/ smarter; instead of just concatenating the two lists, it now compares them, and when they have the same names (same templates, different versions), it now chooses which one to use based on the template revision number in the metadata file. Moved some code out of TemplateHandler and into a new TemplateManager class, such that I could add metadata caching (since the code to merge templates in multiple files would repeatedly read and parse the metadata for each pair comparison.) Change-Id: I94fc4f754dd7125b5be5c78e61efcfc268f73af5
* Wizard tweaksTor Norbye2012-06-196-13/+9
| | | | | | | | | | | | | | | | | | | | Validate target location such that if the target directory exists, the wizard complains. Fix the icons for custom views and unit test projects such that they have the "+" icon badge indicating that something will be created. Update labels. Replace the single theme defintion which references DarkActionBar such that we have 3 styles, one for pre-11, one for 11-13 and one for 14+ which define the relevant light themes. Remove the unused dimensions in blank projects. Remove the (unused) "Include compatibility code" toggle. Change-Id: I3d42c9544170c7a33754b0e410e9f1421d5c323b
* Rename template file from _ prefixTor Norbye2012-06-186-4/+9
| | | | | | | | | | One of the template files ended up not getting packaged, probably because it started with a "_". Also, add @Override to some methods overriding a superclass method (onCreate(Bundle)) and fix an NPE. Change-Id: Ic2f15d968cca156704146bdc4ec501d1359a7620
* Dependency support for the templatesTor Norbye2012-06-146-8/+3
| | | | Change-Id: Id6b0e5f65fc3a50b352423623332c47f7ab5085d
* Add format handling to the template wizardsTor Norbye2012-06-144-2/+10
| | | | | | | | | | | | | | | | This changeset adds a format attribute to the templates. When the ADT plugin reads a template file, and the format version is a higher number than one it knows about, it rejects the templates and informs the user to upgrade the plugin. This allows us to change the format of the templates incompatibly in the future without worrying about users with older versions of the plugin running into problems (because they upgraded the tools but not ADT). It also adds a revision number to each template which is used for the opposite purpose: we can tell if a template is a slightly older revision and then do some conditional handling. Change-Id: If6c49012a1beca44c3a05b3e880ffde70294a57e
* Update templatesTor Norbye2012-06-1418-23/+112
| | | | | | | | | | This changeset updates the activity templates with new versions from Roman. Also fixes a couple of bugs he ran into: the camel case to underscore conversion methods were reversed, and the template test wizard didn't reset the activity template once the second page was shown. Change-Id: I353af646f92f37bf2a9827d0dc68a409dd9358bc
* Allow project templates to be bundled separatelyTor Norbye2012-06-0462-0/+1335
| | | | | | | | | | | | | | | | | | This changeset moves the various FreeMarker templates out of the ADT plugin and over into the tools install area. The code to instantiate templates is simplified a bit now that it no longer needs to both handle files on disk and files read out of the .jar. There's a new first page to the various template wizards which is shown if the tools are not up to date (specifically, if the $SDK/tools/templates/ directory does not exist). This page explains that the tools have to be updated, and the Next button is disabled until they are up to date. This CL also contains some other tweaks suggested by Roman to the activity-to-layout name mapping and misc code changes. Change-Id: I3bc65f54a6b79bbeedfb917a9d34ec0d312f3526
* Use aapt output to feed proguard's keep list.Xavier Ducrohet2012-05-291-7/+9
| | | | | | | | | | | This allows us to only keep classes that are really used either through code or through XML. Also tweak the default rules for better control of animated properties. Added a test of a custom property animation and fixed some other misc test files. Change-Id: I7cc5839a764881d8d3c7bfce0a3f12ea7cba660e
* Fix "ant test" + misc clean up / reorganization of build.xmlXavier Ducrohet2012-04-161-1/+8
| | | | | | | | | | | | | | | | - Split NewSetupTask in several tasks to make things more flexible. Particularly this allows more targets to get access to the project type (app, lib, test, ...) as it's not so computive intensive. - Fix test project to give them access to the full tested project's classpath. - Fix support for projects that test themselves. - Make sure library projects are instrumented when using the emma target. Change-Id: Ia0c9564eacee2521e7cbd5154b8a85ea287ad4fd
* Merge "Update default project icons, and add an xhdpi version"Tor Norbye2012-02-064-0/+0
|\
| * Update default project icons, and add an xhdpi versionTor Norbye2011-12-164-0/+0
| | | | | | | | Change-Id: I1c8a8ee2e470a30bc9df76b694e9b68fe09d5712
* | Add post package and post build Ant hooks.Xavier Ducrohet2012-01-301-15/+13
|/ | | | Change-Id: I3bae567328e1ba615df478cacca72667ef3e6359
* Misc Ant build fixesXavier Ducrohet2011-11-231-2/+2
| | | | | | | | | | | | - project name on standard build rules - allow override out.final.file - allow passing custom javac parameters - allow note having local.properties as long as sdk.dir is present anyway - -pre-clean target allows custom clean build Bug 21023, 21267, 21465, 21525 Change-Id: I4bee2f8c15fab664b1f4ff54d754920d2487f6c7
* Change default launcher icon name in new Android projectsTor Norbye2011-09-063-0/+0
| | | | | | | | | | | | | | | | | When creating a new project, the default project template includes a launcher icon named "icon.png". This changeset changes the name of this default icon to "ic_launcher.png", in accordance with the recommended naming convention listed in http://developer.android.com/guide/practices/ui_guidelines/icon_design.html (The secondary motivation for this is that the Icon Set Wizard will suggest ic_launcher as a default launcher name, and it would be nice if going through the wizard with the default settings would replace the current project's launcher icon. Given the guidelines above I'd rather not change the wizard default name to "icon") Change-Id: I9f516c769019c2635edad4e1e6f01a5110d156fe
* Move ant project templates files to development.gitRaphael Moll2011-09-018-117/+0
| | | | Change-Id: I5b066d7944d04673d47fa5b9f9cba5b2077a91ad
* Rename default.prop/build.prop to project.prop/ant.propXavier Ducrohet2011-08-231-12/+19
| | | | | | | Opening projects in Eclipse will rename the file and "android update project" will do the same. Change-Id: I251881897c251eb07c9704eb9c2448cab47e5b83
* Modify android create/update project to deal with new build.xmlXavier Ducrohet2011-08-221-3/+3
| | | | | | | | | | | New mechanism to embed a build version into build.xml to figure out whether the build.xml file is obsolete or not. Use the version-tag: custom case to prevent erase user modifications. Fixed some issues with the name of the project (put in build.xml) for test projects which don't have any activity. Change-Id: Ib0333d15ca9558fffe24a718e704fcf4176c9014
* Remove obsolete code.Xavier Ducrohet2011-08-171-54/+0
| | | | Change-Id: I2881d7b5f01229b9da81c6134fc5dfdfb4aacff8
* New library project mechanism.Xavier Ducrohet2011-08-171-21/+20
| | | | | | | | | | | | | | | | Libraries now generate a jar file that is used by the projects referencing them, instead of having the main projects compile the library source code themselves. This means we can remove the link mechanism that created linked folder in ADT and instead use a container that is lazily initalized to be all the jar files of the libraries. Also merged all 3 Ant build files (main_rules, lib_rules, test_rules) into a single build.xml that can build any kind of projects. Lot's of improvement in there too. Much cleaner. Change-Id: I98307e25cd76722e8595938528e6ef57a7e226ad
* Ant tasks and dependency clean up.Xavier Ducrohet2011-02-081-14/+9
| | | | | | | | | | | Give anttasks.jar a proper manifest with jar dependencies. Update the manifest of sdklib.jar with the common.jar dependency. The pre-setup section of build.xml has changed over time and really we should be able to control it so move it in $SDK/tools/ant/pre_setup.xml and import it into build.xml Change-Id: Iab707deccc0cdbe8d1a9db052ee6fb0762853394
* New test projects.Xavier Ducrohet2010-09-023-5/+5
| | | | | | | Also fixed some trailing space in templates and automatically generated files. Change-Id: I2ed5f0067dff4c62b53857b7e0a2dea5dd9a101c