| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The FrameworkResources method which loads in the public resources
takes about ~500ms of the target loading time.
This changeset optimizes this down to < 50ms using the following
three optimizations:
1) Precompute a map from names to ResourceItems before processing the
public names. Before this, it would search sequentially through the
name list, which when done n times meant O(n^2); we can construct
the map in O(n) and then perform n lookups in O(1) => O(n).
Also, be smart about which maps we precompute names for: the
ResourceType.PUBLIC and ResourceType.DECLARE_STYLEABLE types have
about 2,000 items, none of which are public, so skip precomputing
maps for these two. (However, keep the linear search around such
that if any are exported in the future the code will work
correctly.
Similarly, we know "roughly" the size of the final public maps, so
initialize them in the right size range such that they don't have
to do any internal resize+copy operations as we insert into them.
2) In android-15 there are 1500 new <java-symbol> elements in the
public xml file, which were being processed, doubling the number of
exported symbols. Limit the processing to only the <public> tags.
3) Switch from DOM parsing to pull parsing. This helps since more than
half the file consists of <java-symbol> elements, and we can ignore
whitespace and id attributes etc, so there is much less object
creation involved.
Change-Id: I4761e1182b9bc0c50fe94aea7dcd9690754c7908
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we just stripped the namespace prefix when reading attribute
names in styles and declare-styleables. This was bad if one created
a declare-styleable mixing platform and app attributes that were
named the same.
This change is Eclipse side only and prevents ADT crashed (due to stack
overflows) but the rendering won't be correct. An updated version of
layoutlib using API 8 is necessary.
Change-Id: I3029f3e06cdd96cd46af511bb029bc5274b935ad
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: I5a42a436dd9d21a632af175a860a85aa1d3b5a1d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes issue
23747: i and İ character problem in turkish operating Systems...
and probably many other bugs in the Turkish locale.
Basically, we had a lot of String.toLowerCase() and
String.toUpperCase() calls. This performs locale sensitive
conversions, which in many cases is NOT what we want; for "machine
readable" conversions we should be using Locale.US which performs no
special cases.
For more, see
http://developer.android.com/reference/java/util/Locale.html#default_locale
Change-Id: I996b0e70fb377e8dae484c5811deb8bc9afb684c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 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 fixes some issues around the new lazy scanning of
layout and menu files.
First, it partly fixes "19657: AAPT errors aren't shown when adding an
error to a valid XML file". With the new optimization of not running
aapt on layout files where no ids have changed, we would no longer
pick up changes where an invalid or nonexistent resource is added. We
now perform some basic validation of resources as well as XML parsing
errors.
Second, it fixes a bug in the id before and after comparison used to
determine if aapt needs to run: The code would call map.keySet()
before and after the ids were added, but this resolved to the same
keyset so the equals comparison was always true regardless of the
content.
Third, it fixes an infinite loop issue with library projects, and
avoids doing unnecessary classpath modifications when there are no
changed projects.
Finally, it changes the "needsId" flag. The state of whether aapt
needs to be run was stored per repository, and there is a bug where it
does not get cleared properly which can yield a compilation loop. This
changeset introduces a new "ScanningContext" object which is passed
down to the various resource file updater methods. This context object
now holds the needsId state object (which is renamed to
"needsFullAapt"), and it is also the object where errors can be
registered.
Change-Id: I5632612c2d93e2f10f0803e9223921adb67602be
|
|
|
|
|
|
|
|
|
|
|
|
| |
This CL fixes an NPE I was hitting when deleting resource folders in
an Android project - looks like the children list is populated lazily
and dispose does not account for this
java.lang.NullPointerException
at ResourceFolder.dispose(ResourceFolder.java:131)
at ResourceRepository.removeFolder(ResourceRepository.java:146)
Change-Id: I96974c68b4ef13e6e348efd6269270d4525322ab
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds resource tracking to the ResourceManager.
Each ResourceRepository now has new methods:
void markForIdRefresh() to set the repository as "dirty"
boolean needsIdRefresh() to check whether the repository is dirty
void setIdsRefreshed() to set the repository as "clean"
During the precompilation step, the PreCompiler will query the
ResourceManager to see if any of the repositories included in the build
are marked as dirty. AAPT will only be run if one or more dirty repositories
are found.
Repositories are marked as clean when R.java is regenerated and IDs are
set in ProjectResources.
Change-Id: I575ab819702508eacd247b282c3de8979f2f0ab9
|
|
|
|
| |
Change-Id: I044342e5aa6b3aaa87efdcc79bbcb3db93190252
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\
| |
| |
| | |
Change-Id: I83911d9ee56e5d44045a5ecbd28647a551f8ea79
|
| |
| |
| |
| | |
Change-Id: I8b0a0c65f2b0d7b7faf10224ac2945081605c5c4
|
| |
| |
| |
| |
| |
| |
| |
| | |
Fix parsing of the styleable enum/flag attribute values.
Better handling for hexa value > 0x7FFFFFFF
Change-Id: I1cbbed8f9d3ce9f1b7396e2d34c7bd33dc18e70f
|
| |
| |
| |
| |
| |
| | |
Fix broken equals() in new qualifiers.
Change-Id: Id083d11a2941d120ca6fd9438a5a12ed7502ab92
|
| |
| |
| |
| |
| |
| |
| | |
Also change the layoutlib sample code to properly get the list
of framework attr flag/enum values.
Change-Id: Ie0bf126a0fab574d94d0f86b7b2f8581cf4eaae3
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is very basic sample code showing how to render
a layout.
This explains how to load the resources, create Folderconfig,
ResourceResolver, and how to call the LayoutLibrary to do an
actual render.
There are some big limitations:
- can't render custom views because there's nothing
compiling them and generating the compiled R.class
file.
- not all features of ADT are present because there
are things that don't make sense outside of an editor
(render in context, expand empty layouts, etc...)
Change-Id: I0c8676ebfbff27f0e9412bb4b13193ce64082372
|
|\ \ |
|
| |/
| |
| |
| |
| |
| | |
Better handling for hexa value > 0x7FFFFFFF
Change-Id: If0c2ed23847a720431bceee95f8b264ceb967e3e
|
|/
|
|
| |
Change-Id: Ide197a390c3d9de8d4e30a8f99f0a32a6ad2191d
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: I9c5ea5183e115582e0b805ca3ec75aad70e4a65c
|
|\ |
|
| |
| |
| |
| |
| |
| | |
Also add Television to the dock mode (which is really UI Mode).
Change-Id: I97e3fbea1806a32d8267d8e462211add2b122ed0
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
I ran the latest version of findbugs on our codebase and fixed some
(not all!) of the warnings.
I also ran with Eclipse 3.7 RC3 and updated our compiler warning
settings for the new warnings that are available.
I also fixed some DOS line endings in some files (formatted with CRLF
instead of LF).
Change-Id: I9a9d34a9b60f2cb609245793815d96a4587007b0
|
|
|
|
| |
Change-Id: I2dc79e71521f93d798fd4a9b33aa59979bef379d
|
|
|
|
| |
Change-Id: I1d52201c58f9fb92a87fd42585b653bf37730032
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If you open a layout designed for a particular theme in another theme,
you can get many confusing error messages. Instead of "attribute
missing" it may tell you that it failed to convert a resource to a
color or drawable, and so on.
To help guide users to the root problem (wrong theme chosen) this
changeset detects the scenario where theme attributes can't be
resolved, and when these are found the top of the error log will start
with a bold message stating that theme resources were not found and to
check whether the correct theme is chosen.
To do this, the resource resolver emits a new sub-type of the resource
missing tag into the error log, which is used in the IDE to prefix the
errors with the special error message.
Change-Id: Ic29c9af37da4b5cc2c9fb1ca5670c8b8f79bf852
|
|
|
|
| |
Change-Id: I1a3e5ba9ac6e930d4be2daedff9691862f975408
|
|
|
|
| |
Change-Id: Ib70e560e7d0be88305383aac18726858d91990ae
|
|
|
|
|
|
|
| |
Also make it so that older layoutlib that are using API5 return the
value through reflection (done in LayoutLibrary.)
Change-Id: I3a32666e525f0f1d37a13e670d1d1c659b8e2027
|
|
|
|
| |
Change-Id: I29caadc8cb31c4a3aab0863a4fec16534b9bc900
|
|
|
|
|
|
| |
Also update the IProjectCallback to handle expandableListView.
Change-Id: I36ca8733182bbd9d169fee3e709ebc532fef7b1e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds a new refactoring, "Extract Style", which will show the user the
attributes for the current selected elements (or if invoked from an
editor context, the attributes overlapping the current caret or editor
selection). The user can select which attributes to extract, and these
are then added as a new style in the styles.xml file in the project
(which is created if necessary). The user can optionally replace the
attributes that were extracted, and the user can also optionally set
the style attribute on the elements to the new style. (Both are on by
default.) This is integrated with the refactoring quick assistant as
well.
Change-Id: I0504e86a824b00730482607150a879ff28233618
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds support to the Go To Declaration code for styles.
Style strings are a bit different from resource URLs - they can have
an @android: prefix, but they don't specify a resource type. For
example, go to declaration can now jump to the value in the parent
attribute:
<style name="BrowserTheme" parent="@android:Theme.Black">
This will show the Theme.Black style definition in the SDK's
styles.xml document.
In addition, the hyperlink resolver can now also link to fragments of
an attribute value. In particular, in the above, if you point anywhere
to the left of the ".", only the @android:Theme range will be
selected. This lets you go to parents, since styles inherit from other
styles by adding to them with dots.
Third, the hyperlink resolver can now link to resource urls that is in
the content part of XML documents (e.g. a text node, not an element
name or attribute value). As an example, you can now jump to the color
defined inside this style element:
<style name="CustomTheme" parent="android:Theme.Light">
<item name="android:bg">@color/custom_theme_color</item>
</style>
Finally, this changeset adds unit/plugin tests for the hyperlink
resolver, which asserts the expected list of matches, and the expected
editor context when the default link is opened.
Change-Id: I73757ec78405f7c711e13387d0bb046f698799f1
|
|\ |
|
| |
| |
| |
| | |
Change-Id: I464fe3f94e701e619b474f82aaf84ee04d158e71
|
|\ \
| |/ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ResourceFolder/File and children classes (single/multi file)
ResourceItem and children classes
ResourceRepository (base and framework, project stays in ADT for now)
All the ResourceQualifiers and FolderConfiguration
Change-Id: I5adc9bdc4886a8fa0ab44860763d594cf7af4bd5
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
|
|
|
|
| |
This can be a matter of personal taste, but I find it a lot
more readable to write an if {} else {} sometimes, and it's
perfectly valid, so really it shouldn't be marked as a warning.
Change-Id: Iac1b9bd5f9602b5018f7432422e0a083f4836490
|
|
|
|
| |
Change-Id: I9837714c5673d43fa7108b16ab264f1017c4bd3d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- (I)ResourceRepository is now a common class instead of an
interface. This contains most of the code to control
a repository (which was extracted from ProjectResources)
ProjectResources extends it adding minor features such as
library support, and inline ID definition.
FrameworkResources extends it adding support for public
resources (which used to be duplicated and dispersed
in weird places).
Changed the way resources are reloaded on resource change event.
Instead of marking the resources as modified (using
Resource.touch()), the resources are now parsed as the files are
processed during the resource delta visitor. This makes more sense
as there are now other listeners to the resource changes (hyperlinks)
that access the resource list in their listeners, which wouldn't work
previously.
This also makes the code cleaner as the previous method had to query
the repo for items and return a list of new ones, which was kinda
crappy. The new code is much simpler, as is the post update process.
- ResourceItem is now the base class for resource items. It includes
all the small methods that were added by all the child classes or
interfaces.
Project/ConfigurableResourceItem are merged into the based class.
IIdResourceItem and IdResourceItem are gone and replaced by a
simpler InlineResourceItem.
FrameworkResourceItem is a simple override for framework resources.
- Also improved the API of a bit for the resource repository, making
more use of unmodifiable lists and emptyList/Map()
Change-Id: Ie3ac1995213fed66153c7e7ecbdd170ec257be62
|
|
|
|
| |
Change-Id: Ib12b25d7c7a6630075cfe4f5e757a10673305220
|
|
|
|
| |
Change-Id: I5faa155393466e1bc4b2fc1e9417cde91a8be456
|
|
|
|
|
|
|
|
|
|
|
| |
RenderParams is now a base class. SessionParams extends it
(and contains the layout and the rendering mode which are not
part of the base class).
DrawableParams is used for the new action and adds a reference
to a ResourceValue.
Change-Id: Ieacf4da91fda95df1d25a32ae0953bd9d8028113
|