aboutsummaryrefslogtreecommitdiffstats
path: root/templates/activities
Commit message (Collapse)AuthorAgeFilesLines
* Update template location for SDK buildJosiah Gaskin2013-07-3179-3244/+0
| | | | | | | | This change removes templates from the SDK source tree (from sdk/templates) and points the build/tools.atree build location file to their new location in tools/base/templates Change-Id: Id37b24eceaae6dcc0b3bf5078a759a337cb13467
* Increments revisions on templates used by Android StudioScott Barta2013-07-095-5/+5
| | | | | | | | When we bundle templates with Android Studio 0.2.0, this will let it pick up copies from the bundled folder instead of the older versions with the SDK. Change-Id: I503d062dd4dc2ccfadac4af5901f8a779fe8e7ec
* Escaping for pathnames in template XML filesScott Barta2013-07-015-57/+57
| | | | | | | | Does proper XML escaping in Freemarker XML templates to avoid problems with pathnames that contain XML-sensitive characters. Change-Id: I1f191ccabd0c81af821c7bbdf88bbb23ba42ff9c
* Merge "Fullscreen Activity Template nav hiding fix for Honeycomb"Xavier Ducrohet2013-04-301-1/+1
|\
| * Fullscreen Activity Template nav hiding fix for HoneycombBrad Parks2013-04-161-1/+1
| | | | | | | | | | | | | | Fixes the Full Screen Activity template to properly hide controls and navigation on Honeycomb Change-Id: I85b69c2fc084805fb371df97aedfce94a5145e97
* | Modified templates for Gradle projectsScott Barta2013-04-2611-42/+79
|/ | | | | | | | | | | | | | | | | | | | | | | | Modifies the existing templates to output Gradle build files with a new multi-level directory structure. The templates continue to work the old way that Eclipse expects, and the new behavior is only enabled if the "isGradle" global is set to "true". Files to configure the Gradle wrapper are placed in the SDK at tools/templates/gradle/wrapper. This CL changes all file copies and merges to go to fully-qualified directories set up via global variables. Things go to the old locations for non-Gradle builds based on how the globals are set up, but Gradle builds can override output directory variables to reflect the new directory structure. This CL also adds NewAndroidLibrary and NewJavaLibrary project templates, which will be used in the future. The current NewAndroidApplication template also can output a library, which is redundant and confusing; this will likely be fixed somehow in the future. Change-Id: Ieb830bdfba1797d87a218326ebd37c99d254758e
* ADT templates: BlankActivity and LoginActivity cleanup.Roman Nurik2013-01-2215-22/+76
| | | | | | | | | | | | | | - BlankActivity: fix a bug where 'none' navtype + minApi < 11 didn't check for API 11 before using ActionBar APIs - BlankActivity: add horizontal and vertical padding, customized for sw720dp-land - BlankActivity: remove navtype that allowed tabs without swipe - change naming convention R.menu.activity_foo to R.menu.foo - change naming convention R.id.menu_foo to R.id.action_foo - add simple XXHDPI icon (scaled up from XHDPI... to be replaced in a future update) Change-Id: Ic5bf3dcfb13e714df505dcbf7c1227b610f0a36e
* 41681: "class|unique|nonempty" contraint doesn't check uniquenessTor Norbye2012-12-204-4/+4
| | | | | | Also added unique constraint on some of the activity templates. Change-Id: I2af181d9d2d716505c80bb4f487920166594625f
* Fix SettingActivity ADT template.John Spurlock2012-12-142-1/+4
| | | | | | | | pref_headers.xml now goes through variable substitution. Prior to this fix, the generated activity crashes on tablets. Change-Id: Iddff16c5f58ae2414620800fb4f1c34e0e4bb9f5
* Update application template display names and descriptions.Roman Nurik2012-12-135-11/+11
| | | | Change-Id: Id785c8527eb1602b2b6f29e09fb13f628abaf652
* Make inefficient weight detector identify more candidatesTor Norbye2012-11-292-0/+2
| | | | | | | | | | | | | | | | | The inefficient weight detector looks for horizontal layouts with weights where all the children are layouts. It didn't have a very good heuristic for finding out whether all children are layouts; it just looked for whether the tag name contains "Layout". This changeset generalizes this a bit, adding other layouts, as well as <fragment> tags to the lint check. It also updates the Master/Detail template to set the baseline alignment attribute to false (to avoid triggering the updated lint check), as well as android:textIsSelectable to clear another recent new lint rule. Change-Id: I887962b5e29a9ad0c5b5c01970b0c66f884125d8
* 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-253-5/+4
| | | | | | | - 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-189-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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
* 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
* 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
* | 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
* Activity templates cleanup.Roman Nurik2012-07-1927-189/+398
| | | | | | | | | | | | | | | | | 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-027-16/+7
| | | | | | | | | | | | | | | | | | | | 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
* More template tweaksTor Norbye2012-06-211-1/+2
| | | | | | | | | | | | | | 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-206-16/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* 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-144-8/+2
| | | | Change-Id: Id6b0e5f65fc3a50b352423623332c47f7ab5085d
* Add format handling to the template wizardsTor Norbye2012-06-142-1/+5
| | | | | | | | | | | | | | | | 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-0440-0/+975
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