| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
Change-Id: Ia7ceed6297048779b9d591a518c2ae3c8cbfe60c
|
|
|
|
| |
This reverts commit a7621238bf0202419677380ee3a268142358df83.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The WindowBuilder propertysheet has been extracted and added as a
library in external/eclipse-windowbuilder/.
This changeset removes the old propertysheet code (which used the
builtin Eclipse property sheet page), and replaces it with the
WindowBuilder one, along with new code to aggregate the properties
into some categories, as well as tagging some of the properties as
advanced. (This was computed by running the same analysis scripts used
to produce the most-frequent attributes (sdk/attribute_stats) and
instead computing which attributes are used very infrequently or not
at all in some representative sample code.)
The WindowBuilder propertysheet gives us the following new features:
- Highlighting (bold) of important attributes
- Masking (and when included, shown in gray italic) of advanced
attributes
- "Complex" attributes with nesting, used to for example aggregate all
the layout parameters into a single node, and the margin layout
attributes within those
- Tooltips over the attribute names, not values, so they never obscure
content
In addition, this changeset adds custom implementations of properties,
property editors and property dialogs for the core Android property
types (XML strings, flags and booleans), which adds the following new
features:
- Preview rendering of color and image resources inline
- Display of -default- attributes (those not specified in XML) using
the layoutlib facility getDefaultProperties() to render the implied
attributes. For example, if you look at a Button, it will show you
that the implied value of "Text Color Link" is
"@android:color/holo_blue_light" even though it is not set.
NOTE: This only happens for attributes that were actually queried by
the widget during rendering. Attributes that are not used by the
widget have no (displayed) value. Thus, EditText-specific attributes
in a TextView are not shown when a non-EditText TextView is
selected.
- Evaluation of the attributes. In the above example, in addition to
showing @android:color/holo_blue_light, it will chase down the value
of this to for example render a blue square next to the value. For
drawables it will render a thumbnail, and for String resources it
will display the actual value in parentheses.
- Field completion in text fields, completing all resource strings
(@string, @android:string, etc), as well as flag values. Enum values
are chosen in a dropdown.
- Checkbox support for boolean values, allowing you to click through
the three values true, false and null.
- Our custom version of the Property Sheet Page allows you to
expand/collapse all properties, and it also has an option letting
you switch between Alphabetical Sort (where all attributes are in a
flat table, sorted alphabetically by property value), or
hierarchical sorted "by category". Currently the categories are
simply the defining views, plus 2 more (layout parameters and
deprecated attributes). When we get more metadata, it would be nice
to switch these to more logical categories, such as "text",
"scrolling", "focus", etc. (There is some preliminary support for
this in the code, but since the defining-view categories seem to
work better those are used instead right now.)
Change-Id: Ie4959a3a2c36c083dcc1ba19a70f24b33739fe2f
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a plugin that is contains libraries and other utilities
common to both ADT/Eclipse plugins and RCP applications like
monitor.
Currently, it contains:
- libraries: common, sdkstats, androidprefs & sdklib.
- prebuilts: guava
Change-Id: I982a6897fa73c5ba8c282bc2fba4b1e66b4e2ecd
|
|
|
|
| |
Change-Id: I3906416a7b5a4bf7b7e2f86ee3155c22d93a3c2b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset changes the signature of AttributeInfo.getFormats()
from returning a Format[] to returning an EnumSet<Format>.
Furthermore, it defines a number of constants for the various common
format sets such that they can be reused.
Nearly all uses of the getFormats() method was really just trying to
see "is format X among the formats", so using enumsets is more natural
since it has a contains method. This also lets us replace some
attribute init code which was building up a set from the array for
this exact same purpose just reuse the format set directly.
In the attribute parser, rather than computing the uppercase version
of each format string ("dimension"=>"DIMENSION") and then doing a
Format.valueOf("DIMENSION"), we now compute a map for all the format
constants as lowercase to the corresponding format instance, and use
that map when parsing the attrs.xml file.
Note that there is a small semantic change from having an array of
formats to using an enumset: The format specified an
ordering. However, it does not look like any code depended on this,
and it's also not clear that the ordering in attrs.xml is
intentional. For example, it contains both "color|reference" and
"reference|color", and in both cases the intent is that the attribute
can specify an actual color or a reference to a color. Now with an
enum set, the order used when traversing the formats will always be in
their natural order, and for this purpose the REFERENCE type is moved
to the end since it's the least specific.
Change-Id: I1170cff48086f5cc13e4b70a35deea1f9979c883
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset optimizes the handling of AttributeDescriptors during
the SDK target loading phase. From some simple benchmarks, this
speeds up target loading about 40%. (On an low-load machine, loading
two targets took on average 9.11s with standard deviation 1.86 for 13
runs; after the fix the same target loading took on average 6.359s
with standard deviation 0.944s for 17 runs -- so the speedup is 1.43).
The most important fix is to make the computation of the tooltip text
and the UI name (which performs various lowercase to uppercase
conversions, in some cases involving regular expressions, and many
string concatentations) be evaluated lazily. This is a big win since
most attributes never have their UI names or tooltips displayed, and
when they are, usually just a small number.
Since tooltips and UI names are now computed lazily from the
AttributeInfo, the constructor for the TextAttributeDescriptor and its
subclasses no longer take a UI name or tooltip; instead, there is an
explicit setter for the cases where you have a specific tooltip you
want to hardcode (as with the builtin descriptors such as the ones for
drawables).
The actual formatting method for UI names was also optimized a bit,
such as avoiding regexp replacements except for cases where they are
likely needed, preallocating a larger character buffer, etc.
Change-Id: I7004e403fcf696e18bd89a29c6cfd27b61c1e9f8
|
|
|
|
| |
Change-Id: I837371e862c596e1b9afc16ddfcac638bc92232a
|
|
|
|
|
|
|
|
| |
This is a first step where we setup the info. Next step
is to actually use the info when calling
ResourceRepository.getConfiguredResources
Change-Id: I03c20ad0ec7a53ec8219316cc4af7a59155ef34a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset contains fixes for several unrelated reported lint
bugs:
26505: Default disabled rules that are explicitly enabled do not
activate
26467: Lint says ByteBuffer.array is API 9+ but it's really API 1+
26501: Warning "This tag and its children can be replaced by one
<TextView/> and a compound drawable" is not always correct
(Partially fixed)
It also fixes the following bugs:
- The quickfix for the typography detector did not work for the
fraction warning (replacing 1/2 with the half unicode symbol etc)
- A couple of XML detectors did not check for SuppressLint on the
associated root node
- Add a --exitcode flag, and only set the exit code to non-zero if
that flag is specified. Also fix the code such that non-fatal errors
also contribute to the exit code.
- Make the HTML reporter classes public to help Maven integration.
Change-Id: I60f5fdcb2a465d51fa58bb918a195b373096d54b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes one more bug related to lint configurations and
library projects (see issue 26029).
Some lint checks, such as the MergeRootFrameLayoutDetector, computes
the warnings at the end of processing all files. At that point, the
context points to the master project, so any errors which were
actually found in a library project will instead be using the master
project's configuration. That means that any suppress rules applies to
the lint.xml in the library project will be ignored.
This changeset fixes this by moving the logic which looks up the
severity for a warning out of the lint clients and into the
context. Now it checks the current projects being scanned and looks up
the corresponding project for each file (based on the file prefix),
and retrieves the configuration that way.
This changeset also makes one more fix: It now consults *both* the
library project *and* the master project to see if a rule should be
ignored. This means that if you turn off a given check in your master
project, you will no longer see those warnings from library projects
either, which seems desirable.
Change-Id: Icb5cdf7696b4908b0553f86896793515cb06f29c
|
|
|
|
|
|
|
| |
This changeset makes lint properly handle the jar dependency scope for
issues. It also tweaks the API in a few minor ways.
Change-Id: Ibd7b943c9d3ce361e091af8f1e990709bb94d183
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds support for suppressing in XML files:
(1) Lint will ignore errors found in attributes and elements if the
element (or any surrounding parent elements) specifies a
tools:ignore="id-list" attribute where the id-list matches the id
of the reported issue (or "all"). The "tools" prefix can be any
prefix bound to the namespace "http://schemas.android.com/tools"
(2) There's a new quickfix shown for XML lint warnings which offers to
add a lint suppress attribute for a given lint warning (setting
the id to the id of the warning, and adding the tools namespace
binding if necessary).
(3) The XML formatter now handles namespaces a bit better: after the
preferred attributes (id, name, style, layout params, etc) have
been handled, attributes are sorted by namespace prefix before
they are sorted by local name -- which effectively will sort any
new tools:ignore attributes to the end.
Change-Id: Id7474cde5665d9bd29bdd4e0d0cc89ed4d422aea
|
|
|
|
| |
Change-Id: I4989ce98d4c6a600ca075ee919e5a0e1a40a4497
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset adds a quickfix for the "Use Compound Drawable" lint
warning. That warning identifies a LinearLayout which contains exactly
one TextView and one ImageView (in either order, and the linear layout
can be in either orientation), and suggests replacing it by just the
single TextView along with a drawable attribute. The description alone
wasn't clear, so the quickfix performs the conversion automatically.
In addition to the conversion it also needs to transfer any layout
param references from the old LinearLayout to the TextView (and assign
it an id if necessary), so the quickfix is implemented as a visual
refactoring. It's also made available from the Visual Refactoring
menu.
This changeset also updates a couple of unrelated golden files in the
refactoring unit tests to track a message change a few months back.
Change-Id: Iecb544d196fdd4bcabf13a3fdb82ef1ea063f4c2
|
| |
| |
| |
| | |
Change-Id: I033f2d298f418c3588a31946691312e48934e565
|
| |
| |
| |
| | |
Change-Id: I0ee61ade9ea15335268fa313b74d9a949ecb189f
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
This renames:
- xml.XmlEditor to otherxml.OtherXmlEditor,
- resources.ResourcesEditor to values.ValuesEditor
The change to rename Resources to Values matches
the folder name being /res/values.
That's just a trivial refactoring with no logic change.
Change-Id: I68bfa760f254fbbd3f2d5e3801a5092308e92f7f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Note that this changes the "default editor" id associated
by a file but not actually close an existing editor (trying
to do so from the editor fails.) Also, unless the editor
is put in focus, it is not initialized and thus will not
change.
To compensate, when opening a project we'll visit all the
XML files from the /res folder and associate them to our
new editor ID.
On top of that, we'll try to find existing open editors
using a legacy id and close/reopen them using the new
common editor id. We only do that when upgrading a project
via fixEditorAssiociations, which means if the user then
manually forces a file to open using a legacy editor
by using the Open With > Other, it will keep using the
old editor id and we won't open/close it a second time.
Change-Id: Ia5f7e960515500a0ad07d401124578477ed70859
|
|
|
|
| |
Change-Id: I5624d8f5c393a74a808d98e465f0ebc6db91d741
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This re-architecture the way the various XML editors are
handled by ADT.
Before, we had various classes all deriving from AndroidXmlEditor,
all listed in the plugin.xml as handled the "xml" extension. The
right one was set by AdtPlugin when monitoring changed resources.
The new structure is to have a single AndroidXmlCommonEditor.
This derives from AndroidXmlEditor right now, but in phase 2 will
merge them back in a single class.
Each XML editor implements an XmlEditDelegate. The
delegator iterates through the delegates to find the correct
one that can handle a given file and then uses it.
After this CL, we'll need a few extra passes:
- Understand what all editors delegates are doing
and merge it in the base class. There's currently a bit
of code duplicationg we could avoid.
- Change the ManifestEditor to the new structure.
- Change LayoutEditor to the new structure (already prepared
but in a different CL)
Change-Id: I6cb045a8fa39386fcc0ce854b45fa8580fae411e
|
|
|
|
| |
Change-Id: I2b4d5394ec888e280604ba44e039a90e11f8d320
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds Java AST support to Lint. There are new interfaces
for Java parser and specialized Java detectors. Java detectors can
either visit a full parse tree, or they can register interest in
specific methods, or Android resource references, or specific AST node
types -- or a combination of these. They will then be invoked during
an AST visit with the relevant info.
This changeset also rewrites the existing detectors that were using
String-based pattern checking on Java files to using real AST
traversal instead (and it removes the custom Eclipse-specific unused
resource detector since the plain one now does the same AST-based
analysis that the Eclipse one did.)
Change-Id: I4d85f8b785bf41a88dbb29e7017b9c0f588880bc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds support for library projects to lint. Lint now
checks all the library projects for errors as well, and projects that
depend on global analysis (such as the unused resource detector) will
properly handle resource declarations and references across projects.
This changeset also cleans up the multi-project handling for the Lint
window in Eclipse. The "Run Lint" toolbar action, in addition to
operating on multiple selection, now has a dropdown menu for choosing
which projects to check (and there are also actions for checking all
projects, the current file, and clearing markers). Running lint on a
project will also automatically include dependent library projects.
Finally, some misc UI improvements: The Lint preference dialog
includes buttons for quickly enabling and disabling all the checks;
the Lint View includes a Project column which is shown when more than
one project is checked, and the file and linenumber columns are now
blank when the location does not correspond to a specific file.
Change-Id: I733f5258102dfb0aebbc2b75cb02b9ba6ef974e8
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This CL fixes
23940: ADT setting Format XML with Android XML Style can corrupt
string resources.
There was a bug in the code which attempts to delete leading and
trailing spaces in text nodes. It could end up deleting the first
character in the string. There's a new unit test covering this
scenario now.
Change-Id: I59b26563391a2020adae51dd2f42e869afbb9f2c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset makes the SDK codebase compile with source=1.6 (which
means it also requires JDK 6). This means that methods implementing an
interface requires @Override's. It also means we can start using APIs
like the ArrayDeque class and methods like String#isEmpty().
This changeset looks big but the change is trivial: it's basically
adding @Override in all the places that need it, along with some other
automatic Eclipse cleanup in certain files (such as reordering imports
where they were incorrectly ordered (because older versions of Eclipse
didn't always handle inner classes right)), as well as cleaning up
trailing whitespace and removing some $NON-NLS-1$ markers on lines
where there aren't any string literals anymore.
This changeset also sets the source and target JDK level to 6 in the
Eclipse compiler .settings file, and synchronizes this file to all the
other Eclipse SDK projects.
Change-Id: I6a9585aa44c3dee9a5c00739ab22fbdbcb9f8275
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset makes the layout editor no longer assign default id's
to all newly dropped widgets. In particular, it no longer assigns id's
to *Layout widgets, such as LinearLayout and RelativeLayout. These
id's are typically unused, and in the case where you do want an id to
manipulate the widget you probably want to change it to some more
logical name than "linearLayout1" anyway. (It also stops assigning
id's to <include> tags, <merge> tags and <Space> widgets.)
It also changes the label of the "Edit ID..." context menu action to
"Assign ID..." for widgets that do not currently have an id.
Change-Id: Ibf0ec25a6a687e34d3eebf828251d196cadb9d54
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes the handling of resource references inside items,
such as creating a layout alias like this:
<item type="layout" name="foo">@layout/bar</item>
This was not working correctly for code completion (no resource
completion inside the text node area of the item, and it was not
working correctly for the unused resource detector.
Change-Id: I844bf9be4802a0d246accd47b83514ebf0ae6d53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds a new layout rule which finds cases where
you have RelativeLayout attributes pointing to id names that do
not exist, such as
layout_alignLeft="@+id/navbar"
The +id/ syntax here creates the id on the fly, so aapt does not
complain, but the new lint rule makes sure that at least one layout
actually defines this id as its id.
If no match is found, it looks for spelling mistakes and suggests
other similar ids in the error message.
This condition is flagged as an error. The detector also issues a
related warning if it finds an id reference that is not defined in the
same layout. This is sometimes okay (where you have deliberately
referred to an element which will be included into this layout, or is
in a layout including this one), but it's usually an accident.
Change-Id: I7f3fa6f4cb5cef6dcd307256050fb9580887addd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes a bunch of issues in the infrastructure:
(1) It cleans up the Context class quite a bit. It had some hardcoded
XML stuff in it, which is now in a separate XmlContext class (and
there will be a JavaContext class in the Java support CL).
It also hides a bunch of public fields, cleans up some unused
stuff, and introduces a couple of wrapper methods to make detector
code cleaner; in particular, rather than calling
context.client.report(context, ...
you can now just call
context.report(...
and similarly there are wrappers for logging and checking for
disabled issues.
(2) The IParser interface is renamed to IDomParser since in the next
CL there will also be an IJavaParser. Some other related cleanup.
(3) There is now a "Location.Handle" interface. This allows detectors
to create light-weight location holders, and later on call
handle.resolve() to create a full-fledged Location. This is useful
when detectors don't yet know whether they'll need a location for
a node, but want to store it for later in case they do. As an
example, the unused resource detector creates location handles for
declaration and only resolves full locations for those that are
found to be unused.
Locations can now carry custom messages. For example, for a
duplicate id error, the secondary location now contains a
"original declaration here" message. And the CLI and HTML reports
now include alternate locations in the output.
Some other location cleanup too; using factory methods to make the
code cleaner, some default implementations that can be shared,
etc.
(4) There's a new SDK info class intended to provide SDK information
from a tool client (such as resource resolution). It currently
just contains parent-view information, used for the
ObsoleteLayoutParams detector and an upcoming CL for a
ViewTypeDetector.
(5) The Detector class now provides dummy implementations for the
inner-interfaces, so we no longer need the adapter classes. This
makes it easy to implement the XmlScanner or JavaScanner
interfaces without needing to also stub out a bunch of methods.
Change-Id: I4b3aaabe51febb25b000f9086703653bea6cf7c9
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes the auto-indent handling for a specific scenario:
pressing newline within a text node, when the next non-text region is
an element end tag, and the caret is not on the same line as the end
tag. This scenario is covered by the new unit tests testIssue22332a
and testIssue22332b.
Change-Id: I238423ddf25864746a941d6ac8c1fb6a41e37601
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When writing custom view rules, and custom detectors, you may need
access to the package name of the application (in order to produce the
right namespace to look up custom attributes for).
This changeset adds new methods to the two APIs such that clients can
look up the application package. For lint, it also changes things
such that the manifest file is always processed and information
stashed in the Project object. This meant I could also remove the icon
detector code to look up the manifest info directly.
Change-Id: Id8eec96e2788f6d27481d7dcab0c544ea6e0a06d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes
21837: Layout Editor XML Formatting Creates Newlines When It
Encounters Invalid Characters
The bug report talks about invalid characters in the XML, but when you
format a document with invalid characters the invalid characters are
converted to text. And the real bug here is that text nodes containing
newlines could result in additional newlines being inserted on every
formatting operation.
The fix is simple: strip prefix and suffix newlines from text nodes
before they are printed.
Change-Id: I4cc925288f56530a898dac34377cee2e7020a51a
|
|
|
|
|
|
|
|
|
| |
The "name" attribute should always sort to the front, just like the id
attribute does. This comes up in an attrs.xml file where you define a
format; you don't want the format attribute to sort in front of the
name attribute.
Change-Id: Icdf92dc96896b929f67c5884c3137af3654c6e1c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset makes various architectural changes to lint:
(1) Add configurations, which are basically user preferences for lint
in a given project, such as providing a custom severity for an
issue, or disabling a specific warning in a specific file.
In Eclipse, there is a project configuration (stored in lint.xml
in each project), as well as a global configuration (stored using
Eclipse preference data). Project configurations inherit from the
global configuration.
The options dialog now shows up both as a project property page
(showing the issue state for the project configuration), as well
as a normal preference page (showing the global or "fallback"
configuraiton). I also changed the Options UI for issues from a
Table to a TreeViewer to add in category nodes, and changed the
checkbox UI to have a custom severity toggle instead.
The lint quickfixes also now have 3 suppression options:
* Ignore in this file
* Ignore in this project
* Disable check
(2) Change detectors to be registered by class and instantiated for
each lint run rather than having a fixed list of detectors get
reused over and over. Turns out that since some detectors store
state, this prevented lints from running concurrently since the
two runs could stomp each other's state.
To do this effectively I've also switched from a DetectorRegistry
to an IssueRegistry, which contains the global list of available
issues and each issue can point to the class detecting the issue
(and these are created on the fly based on parameters like scope.)
(3) Explicit Categories. Categories used to just be a string property
on issues; now it's an explicit class with both a name and an
explanation, with parents to allow nesting (such that for example
the Usability category has an Icons sub category), and finally the
category class provides sorting. Categories also show up in the
HTML Report now as separate sections.
(4) Other API changes:
* I changed the package containing APIs for lint clients to an
explicit "client" package
* Moved the LintConstants class up from lint-checks to lint-api
and added a LintUtils class which contains many generic methods
that were spread around in specific detectors.
* The detectors are now talking to a wrapper client rather than
directly to lint clients, such that the wrapper client can
filter out results on disabled checks etc, which means that
tools can assume they always get correct reports and don't have
to worry about improperly written detectors.
* I renamed ToolContext to LintClient.
* I got rid of the "isEnabled" state, which was a bit redundant
with the severity since severity has a Severity.IGNORE value.
* I added a LintListener interface, which notifies about progress
(and the CLI tool will print "."'s for each processed file
unless suppressed with -q).
* A new dispose method on the parser interface to for example
allow IDEs to lock/unlock read models on underlying data.
(5) I added a toolbar action for running Lint on the currently
selected project. I also added an --xml export option intended
for use with CI plugins.
Change-Id: Icadd9b2d14d075234d97b31398806111af747b7b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset makes some further improvements to the XML file
formatting:
(1) Create a new formatting style, XmlFormatStyle.FILE, which replaces
XmlFormatStyle.LAYOUT as the "default" formatting style to use for
file-based resources. The difference between this style and layout
files is that there is no blank line after the opening parent
element. In a menu file for example, a <menu> element should appear
directly above its <item> children.
(2) Improve the style-guessing algorithm (this is the code which
figures out what type of XmlFormatStyle to apply to an XML editor
based on the corresponding resource type, the filename, etc). This
had some hardcoded checks to see if the file was under values/,
but it's now made more generic to handle any ResourceType, and the
mapping from resource type to XmlFormatStyle was updated a bit as
well.
In addition, the formatting unittests now use the style guessing
algorithm as well instead of having styles such that we have some
coverage of this part of the code.
(3) Don't add a space before an opening element's closing > if there
are no attributes. In other words, the opening tag will be
"<menu>", not "<menu >". (The presence of a space here is already
controlled by an option, but now the option only applies when
there are attributes.
Change-Id: I0d75488b830cdb3a1242b07b243aaa800cdd7ea9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes #21383, #21346 and #21227 which are all related
to the fact that the formatter had assumed that the <item> tag will
only appear in resource files where it should appear on a single
line. However, <item> also appears in menu files and drawable-lists as
shown by these bugs.
This changeset just ensures that the <item>-special case is only
performed when using the resource file formatting style. It also adds
a regression test for this.
These testcases also reveal some other (lower priority) issues which
I'll fix in a follow-up CL.
Change-Id: I3194bbf4f556853eaf7a14c515ab3feb52177212
|
|\ |
|
| |
| |
| |
| | |
Change-Id: I79ae1bff5086146cc60b4496f4b0464ffd642651
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds a HTML report option for the lint command line
driver, and cleans up the code a bit. It also fixes the feature where
the line containing the error is shown along with each error, and
turns it on by default.
This was previously turned off because the position information for
XML nodes was fairly inaccurate (no column information, and the
element offset was the end of the opening tag rather than the
beginning).
With the HTML report, where not just the error line but the window of
code around the error is shown, having accurate offset information
even in the CLI driver was important. Therefore, this changeset also
rewrites the PositionXmlParser. The old approach used XML
transformers; now we instead use a SAX parser to incrementally build
up the DOM, and marking node offsets as we go along. SAX still only
gives element-end offsets, line+column instead of offsets, and no
information for individual attributes, so the builder also scans the
source in order to build up accurate information.
Results are now accumulated during the error reporting phase, then
sorted in priority, category and finally file+line number order before
being shown as HTML or text.
Finally, the code to escape code to attribute values was missing that
< is an invalid attribute character, so this CL fixes that issue as
well. Also fix some incorrect copyrights.
Change-Id: I652a1545b92865a88ecb4e6526616ba4cd75b512
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes some miscellaneous in the GridLayout support.
The gravity handling code (which creates a bitmask for gravity from
XML attribute values) was pulled out of the change layout refactoring
such that it can also be used by the GridLayout. This is done to
figure out where cells are not bound to the top or left corners, in
which case they should not be considered when computing a suitable
right or bottom edge for splitting a cell.
There's also fixes for a problem where certain negative constraints
would be offered, there were tooltips when only one of the two
dimensions produced suggestions (and you can only drop when both are
valid).
When removing children back to a blank layout, reset the columCount
to 2.
And finally there were some problems where the columnCount was larger
than the number of actual used columns in the table, where dragging
near top/left corner would use some of the later columns rather than
the first available one.
Change-Id: Ice22754fb14659812b54019452aeca6daaeede10
|
|\ |
|
| |
| |
| |
| | |
Change-Id: I9b3fa070e051bd16a9b9e81ffaaa1799594b62ab
|
|/
|
|
| |
Change-Id: I23cea24d7363597968d6602b5a056a59085b9c6c
|
|
|
|
| |
Change-Id: Id41a5543b4e4639eb8c9943463587168c90f9ff4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes issue 20452 related to XML comment
handling. There are several changes.
First it fixes a truncation bug where the last character in a comment
could get erased.
Second it makes sure we don't end up with double blank lines, since
there were cases where the comment formatter would insert a newline
(to preserve newlines after comments in the original document) and a
subsequent element or close tag would also insert a newline (which is
where the normal blank lines are added). Now the code will peek at the
write buffer to make sure we haven't already added a blank line.
Third, it attempts to handle multiline comments a bit better such that
the code which preserves indentation of the first comment line will
dedent down to the minimum indentation level of the block comment.
This means that we will format
<!-- First
Second -->
into
<!--
First
Second
-->
instead of
<!--
First
Second
-->
as the code did up until now. (The current handling was there to make
<!-- This is
a comment -->
format into
<!--
This is
a comment
-->
)
Unit tests.
Change-Id: Id98faadf3731b82880b37ff852c7c0787bb196f8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset changes the logic in the refactoring quickfix (which
adds the Android refactorings based on the current caret position,
lexical context and selection).
It now allows some of the refactorings to be run when there is a
selection (this fixes "20393: Extract string functionality in Android
XML files"), and it makes other refactorings work when there is no
selection (it implicitly selects the surrounding element).
It also ensures that the Extract Style refactoring won't be listed at
the top if the attribute under the cursor is not a stylable attribute,
and it makes some other adjustments to the proposal order.
Change-Id: I0714bb652032aa19e6c2502dc1af7bb5e4adf308
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
First, some improvements to Grid Layout handling:
(1) When dropping a new widget, look up the sizing metadata and use it
to determine what fill gravity to set. For example, a button will
use gravity left, and a text field will use gravity
fill_horizontal.
(2) Don't warn about reflection problems when failing to find
GridLayout layout data; this probably means the layout is being
attempted opened in an unsupporting SDK. There's a fallback case
to compute the data instead already.
Second, improvements to the conversion to GridLayout handling:
(1) It now looks at the layout_gravity values to see whether each row
and column is flexible, and if there's no flexible column in each
of the horizontal and vertical dimensions, it will insert a
special <Space> element to absorb any available extra space. This
avoids constraints warnings from GridLayout.
(2) It treats layout_width or layout_height attributes of match_parent
or fill_parent as the same as a fill gravity (and removes it) and
uses this in the flexibility computation above.
(3) It removes unsupported layout params for all children (earlier
this would only remove unsupported layout params on the direct
children of the layout, which isn't enough when a hierarchy is
being flattened.)
(4) It's smarter about computing implicit rows and columns, so it
avoids writing out redundant layout_row and layout_column
attributes in some cases.
(5) It avoids throwing refactoring errors in cases where an attribute
is removed twice
(6) Fixes a bug where the root layout was included when computing the
set of used x and y coordinates, which means you'd often end up
with a blank row and column 0.
(7) Various refactoring to make the code cleaner.
(8) More unit tests and updates to existing unit tests to reflect the
new behavior such as an absorbing spacer and removal of redundant
attributes.
Change-Id: Iee44c3ca749eefc107b83545669cc9d7f84615b1
|