| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Change-Id: I1b39ee439a532f3f6758be35b569948e2e906665
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset moves most constants into the SdkConstants
class, and gets rid of AndroidConstants and LintConstants.
It also migrates all non-ADT specific constants from
AdtConstants into SdkConstants. It furthermore moves various
other constants (such as those in XmlUtils and ValuesDescriptors)
into the constants class. It also fixes the modifier order
to be the canonical modifier order (JLS 8.x).
Finally, it removes redundancy and combines various constant
aliases such that we don't have both NAME_ATTR and ATTR_NAME
pointing to "name", etc.
Change-Id: Ifd1755016f62ce2dd80e5c76130d6de4b0e32161
|
|
|
|
|
|
|
|
|
|
| |
This CL adds a dialog to the locale menu in the configuration chooser
which makes it easy to add a new language into the set of languages
used by the project.
Also add some null annotations.
Change-Id: I70ea2f623e6c56684e7b2a51b391f472bf31529b
|
|
|
|
|
|
|
|
|
|
| |
Removed ILogger from ide_common
Removed ISdkLog (and implementations) from sdklib
Moved all existing code to com.android.utils.ILogger
which is located in common.
Change-Id: Icd674d4b8d10f6ae8b60a83acb43cc53c7a52137
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If you create a relative layout where one of the widgets create a new
id such as @+id/button1, and then a later widget references this
widget in a layout constraint using @id instead of @+id, such as
layout_below="@id/button1", then it's possible for the resource
repository to not update itself properly, and a subsequent layout
editor render will generate error messages (can't find @id/button1).
The problem is that the id parser was only looking up the resource
repository for the @id reference, it was not also looking up the
current resource file, to see if an @id reference is valid. This made
it erroneously mark an error, and therefore return false from the
parse method. This then had the cascaded effect of not updating the
repository information from the parse, so the newly added id didn't
get added to the maps.
Change-Id: Iae3d215897525582579faf1c8ba64260215fec9d
|
|
|
|
| |
Change-Id: I4e82e93563529540d31af8809aba79f40610fa2e
|
|
|
|
| |
Change-Id: Iae7b32df991df946bba22aba5ab9b32ed2c094ea
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: I09b9538032dfff71f5e3b09d5271ebb286ed36c7
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There are scenarios where clients call getFile(String name) on a
ResourceFolder before the ResourceFolder is updated after a file
change. For example, creating a new layout file can result in this
scenario, which causes a number of "Current file is not a match for
the given config." error messages in the layout editor.
This changeset fixes this such that if an existing file is not found
for a given name, it also checks the file system to see if the file
really exists, and if so, it processes it and adds it to the list.
It also makes some performance improvements. First, the code which
processes a resource folder would check each added file to see if
already existed in the list of resource files. This resource file list
was just stored as a list, so when adding files from a large folder
(such as the framework drawable-mdpi folder which has 1,200 files,
each successive added file would be compared against the previous n-1
files, O(n^2).) This changeset now stores a separate name map such
that it can quickly determine whether a file is already known.
Second, since some of the folders in the framework are large (and
their sizes are roughly known up front), it creates the data
structures with larger up front sizes (depending on the folder type)
to avoid expensive rehashing and array copying.
Change-Id: Ieaab955d7f165e790e8a8dccebf4d0878fde6fce
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| | |
List changed to map
Change-Id: I8145a2e177937cbeb1f6b06b2e313faf8e3a1176
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
Legacy versions uses the old API that doesn't specify the
namespace of the attribute being queried. The implementation
used the namespace of the style as the namespace of the attribute
but this make little sense.
At better implementation searches in the project's namespace
and, if the attribute is not found, then searches in the
framework namespace.
Change-Id: Ief43ecd45f108162de2b1512027d4eedf2c132db
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This bug fixes some bugs related to resource initialization. Note
that these are probably not fixing the root cause, but they are making
the symptoms less severe. I happened to run into a scenario where I
triggered the problem (the editor came up blank, see issue
http://code.google.com/p/android/issues/detail?id=21935 for example),
and I verified that reopening the editor after these fixes worked.
How the resource repository came to be empty to begin with is not
clear.
In addition to issue 21935 this workaround may also help with issue
http://code.google.com/p/android/issues/detail?id=17522
Change-Id: I0166e8c58c790888d53c46ca03348a0d8edc75b0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 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
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: I2dc79e71521f93d798fd4a9b33aa59979bef379d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- (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
|
|
|
|
|
|
|
|
|
| |
Move ResourceType into resources.jar so that it's accessible
to layoutlib.jar
This is cleaner and allows us to us more efficient EnumMap objects.
Change-Id: If11cbc69ae3ca8bd6c96e6d0ef402570a07af16f
|
|
|
|
| |
Change-Id: Iebde7536a0007898387dc7bb5d943e3767140a3c
|
|
|
|
|
|
|
|
|
|
|
| |
Also move the LayoutLib API to use a new class for all resource
info instead of 2 maps, one string, and a boolean.
The goal is to move resource resolution code into ADT
so that we can use it to better display resource information
in the UI.
Change-Id: Iad1c1719ab0b08d1a7d0987b92d4be1d3a895adf
|
|
Change-Id: I15ae7efd2d482bd5bc368983a1745d9026f964b2
|