aboutsummaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a few misc Lint issuesTor Norbye2012-01-261-51/+61
| | | | | | | | | | | | | | | | | | | | First, stop reporting Java-related parser errors as lint errors. Lombok fails to parse a few files (see http://code.google.com/p/projectlombok/issues/detail?id=311) and even when it fails, the error messages aren't useful (see http://code.google.com/p/projectlombok/issues/detail?id=313). Second, the XML parser could throw an exception in some circumstances, because it passes invalid column numbers at the end of the file. This CL guards against that (and against any other potential errors by wrapping all exceptions during parsing as a SAXEception). Finally, fix the positions reported in text nodes for the ExtraText check such that it points to the line containing the extra text, not the beginning of the text node (which is frequently the previous line). Change-Id: I9630ea49d30d8afdc8bd9cf2c87ca0a0306b8ec5
* Replace unit test unicode chars with unicode escape charsTor Norbye2012-01-201-1/+2
| | | | Change-Id: I37a4f3a9d9d8fd7870f08e56a595b52d7ff89add
* Tweak encoding sniffer to look for \r to avoid looking at whole docTor Norbye2012-01-062-40/+62
| | | | Change-Id: I189118b8612661e3c9aef4aaca0feeb7ac522f5b
* Merge "Extract positional XML parser into common and fix encoding issues"Tor Norbye2012-01-0619-0/+1090
|\
| * Extract positional XML parser into common and fix encoding issuesTor Norbye2012-01-0519-0/+1090
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The XML DOM parser used by the lint CLI driver (which tracks positions) is needed outside of lint, so pull it out of the lint/cli project, and refactor it such that it does not directly reference the lint Position APIs (but can utilize them when subclassed in lint). In addition, handle non-UTF-8 file encodings. XML files can be encoded in other character sets, and can specify this via the encoding attribute in the XML prologue. Until now, the CLI lint runner would just read the XML file contents in using the default encoding and parse this. Now there's a new utility method which takes a byte[] and infers the desired encoding and uses that to convert the byte[] into a string using the correct encoding. (We can't just pass an InputStream and let the SAX parser handle this on its own because the XML parser needs to access the character stream in order to assign correct node offsets.) This code now also handles the byte order mark more cleanly. There are some new unit tests too to check the new encoding, BOM and offset handling. Change-Id: Ib0badbbe72172e3408c6d5af2413be51280a7724
* | Fix a couple of incorrect license headersTor Norbye2012-01-054-10/+10
|/ | | | Change-Id: I42bfb03bace8a96ad0af75106facd2bbb7d54894
* Add @NonNull annotation and configure Eclipse settingsTor Norbye2011-12-223-4/+103
| | | | | | | | | | | | | | This changeset adds a new @NonNull annotation, to match our existing @Nullable annotation, and it adds configuration settings for Eclipse 3.8 / Eclipse 4.2 which configures the new null analysis there to use our own annotations. Note that the annotations only have source retention so there is no extra size or class-loading overhead. (To use findbugs you'll need to temporarily change retention to class-level.) In upcoming CL's I'll use these annotations to clarify the Lint API and other APIs. Change-Id: I99096d8b8a7e25ef002624d592da7700195a5872
* Rename default.prop/build.prop to project.prop/ant.propXavier Ducrohet2011-08-231-0/+5
| | | | | | | Opening projects in Eclipse will rename the file and "android update project" will do the same. Change-Id: I251881897c251eb07c9704eb9c2448cab47e5b83
* ADT Resource Repo stores IDs and Called OnceJosiah Gaskin2011-08-011-0/+2
| | | | | | | | | | | | | | | | | | This change makes ADT parse out @+id declarations from layout and menu files and store them in its ResourceRepository. This eliminates the need to merge in IDs from the generated R.java in order to have a complete repository of resources. In order to do this, a new type of ResourceFile is created: IdGeneratingResourceFile which is used for xml files in menu/ and layout/. Also includes an IdResourceParser which finds all the declared IDs in an XML. This change also includes a change to the ResourceMananger to process raw deltas that can be provided either from the PreCompilerBuilder or from the GlobalProjectManager. This is to avoid duplicate deltas being passed to ResourceManager when autobuilding. Change-Id: I1c705a5f5a01ce7daa3eb76f14bd6cb9e11b5248
* Revert ScreenLayoutSize to ScreenSize.Xavier Ducrohet2011-06-091-8/+8
| | | | | | | | | | | | I hadn't noticed that LayoutLib actually uses ScrenSize through the tools-common-prebuilt.jar, so this API is (somewhat*) frozen. * Somewhat because LayoutLib.jar actually only uses Density and ScreenSize but not the other enums (yet?) so the rename of DockMode is not a problem. Change-Id: Ida3360b0111abd96d2a27c16833b282706774fb6
* Renamed some resource enum/qualifiers to be more consistent with the platform.Xavier Ducrohet2011-06-092-20/+20
| | | | Change-Id: I9c5ea5183e115582e0b805ca3ec75aad70e4a65c
* Add support for the new width/height resource qualifiers.Xavier Ducrohet2011-06-091-1/+2
| | | | | | Also add Television to the dock mode (which is really UI Mode). Change-Id: I97e3fbea1806a32d8267d8e462211add2b122ed0
* Add support for the TV dpi.Xavier Ducrohet2011-06-031-0/+1
| | | | Change-Id: I97fedc69644d83801b50d7882bb759db7089d8f0
* Pick layout themes from manifest registrations and target SDKTor Norbye2011-04-042-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset changes the way the layout editor picks themes when a layout is opened. It used to just pick the first available theme in the theme chooser. Now it performs the following checks, in order: * Does this layout have a persisted theme setting from a previous run of the tool? If yes, use it. * Can the activity for this layout be determined? If so, look at the manifest registration for the corresponding activity, and if it specifies a theme, use it. * If not, does the manifest specify a default theme for the project? If so, use it. * If not, is the target SDK version (or the minimum SDK version, if the target is not specified) at least API level 11 or higher? If so, the default theme is "Theme.Holo" * If not, the default theme is "Theme". * If the file to be opened is included from some other layout, use the no-decorations versions of the default layouts, e.g. Theme.NoTitleBar or Theme.Holo.NoActionBar. * At the end of this resolution, the computed theme is stored as the persisted theme setting for this layout, so the above algorithm will only be computed once. We might want to tweak this such that it distinguishes between a default computation of a theme and a manual user choice of a theme. * If the file is opened as "Show Included In" (e.g. rendered within an outer file) then the theme chosen is the one for the outer file. During startup, this information will be asked for each and every layout being reopened, so there is now a "ManifestInfo" class attached to the project which keeps manifest information around. It checks the timestamp of the AndroidManifest.xml file and refreshes its information lazily if necessary. All themes mentioned in the manifest are listed in a special section at the top of the theme chooser (below the entry for the default computed described above). The code to look up the associated Activity of a layout is using a simple heuristic: it looks for usages of the corresponding R.layout field, and prefers references from methods called onCreate or in classes whose superclass name ends with Activity. I tried a different approach where I searched for usages of Activity.setContentView(int) but this failed to identify a number of cases where the activity was doing some simple logic and didn't pass the layout id directly as a parameter in setContentView, so I went back to the basic approach. Change-Id: Ibd3c0f089fefe38e6e6c607d65524990699c86d3
* Add missing notice files.Xavier Ducrohet2011-03-151-0/+190
| | | | | | | | | | Also fix some makefiles to make sure the notices are picked up. - move the makefile outside of the source folder. - resources are now in the source folder directly instead of being inside src/resources. It's much simpler. Change-Id: Ica8ee4c2bc8a9b035d23fc914d4137cdca7e567d
* Move FolderTypeRelationship to common.jarXavier Ducrohet2011-02-256-0/+263
| | | | Change-Id: I3a151d2fadd1c1e34177cb729fe5545fa754849a
* Move ResourceFolderType into common.Xavier Ducrohet2011-02-243-2/+130
| | | | | | | Moved some constants from sdklib (which is not a dependency of common but instead depends on common) into common. Change-Id: I6fdfbad4e77813a9f2a2ca9ea0d740692d8bce5b
* Move the sdk io classes to common.jarXavier Ducrohet2011-02-246-0/+504
| | | | Change-Id: I59a7b770071707ed058aa104bab8a16aa8950d56
* Add MipMap to the resource type list.Xavier Ducrohet2011-01-281-0/+1
| | | | Change-Id: I1f56ab470874e39dad8659d15a3699b83f1ac658
* Move Pair and annoatations into resources.jar now renamed as common.jarXavier Ducrohet2011-01-2821-0/+1530
Move all the resource query methods that returned an array of 2 Strings to return a pair of ResourceType and String. Change-Id: I6b8447aa27005de786e2defef81ad88a72363523