aboutsummaryrefslogtreecommitdiffstats
path: root/ide_common
Commit message (Collapse)AuthorAgeFilesLines
* Fix NPE in ResourceFolder when deleting foldersTor Norbye2011-09-011-4/+6
| | | | | | | | | | | | 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
* Precompilation only executes AAPT when necessaryJosiah Gaskin2011-08-184-10/+94
| | | | | | | | | | | | | | | | | | | 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
* Fix NPETor Norbye2011-08-041-3/+5
| | | | Change-Id: I044342e5aa6b3aaa87efdcc79bbcb3db93190252
* ADT Resource Repo stores IDs and Called OnceJosiah Gaskin2011-08-013-1/+276
| | | | | | | | | | | | | | | | | | 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
* merge from tools_r12The Android Open-Source Project2011-06-281-2/+4
|\ | | | | | | Change-Id: I83911d9ee56e5d44045a5ecbd28647a551f8ea79
| * Guard against a possible NPE when the rendering fails.Xavier Ducrohet2011-06-281-2/+4
| | | | | | | | Change-Id: I8b0a0c65f2b0d7b7faf10224ac2945081605c5c4
| * Merge df07f53c from master to r12. do not merge.Xavier Ducrohet2011-06-141-1/+3
| | | | | | | | | | | | | | | | Fix parsing of the styleable enum/flag attribute values. Better handling for hexa value > 0x7FFFFFFF Change-Id: I1cbbed8f9d3ce9f1b7396e2d34c7bd33dc18e70f
| * Merge 9d342967 from master to r12. do not merge.Xavier Ducrohet2011-06-143-9/+28
| | | | | | | | | | | | Fix broken equals() in new qualifiers. Change-Id: Id083d11a2941d120ca6fd9438a5a12ed7502ab92
* | Fix value parser to handle attr values not in declare-styleable.Xavier Ducrohet2011-06-243-43/+68
| | | | | | | | | | | | | | Also change the layoutlib sample code to properly get the list of framework attr flag/enum values. Change-Id: Ie0bf126a0fab574d94d0f86b7b2f8581cf4eaae3
* | Sample code to use the layout rendering library.Xavier Ducrohet2011-06-231-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Fix parsing of the styleable enum/flag attribute values."Xavier Ducrohet2011-06-141-1/+3
|\ \
| * | Fix parsing of the styleable enum/flag attribute values.Xavier Ducrohet2011-06-141-1/+3
| |/ | | | | | | | | | | Better handling for hexa value > 0x7FFFFFFF Change-Id: If0c2ed23847a720431bceee95f8b264ceb967e3e
* | Fix broken equals() in new qualifiers.Xavier Ducrohet2011-06-143-9/+28
|/ | | | Change-Id: Ide197a390c3d9de8d4e30a8f99f0a32a6ad2191d
* Revert ScreenLayoutSize to ScreenSize.Xavier Ducrohet2011-06-093-29/+29
| | | | | | | | | | | | 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-098-95/+95
| | | | Change-Id: I9c5ea5183e115582e0b805ca3ec75aad70e4a65c
* Merge "Add support for the new width/height resource qualifiers."Xavier Ducrohet2011-06-096-20/+655
|\
| * Add support for the new width/height resource qualifiers.Xavier Ducrohet2011-06-096-20/+655
| | | | | | | | | | | | Also add Television to the dock mode (which is really UI Mode). Change-Id: I97e3fbea1806a32d8267d8e462211add2b122ed0
* | Fix various warningsTor Norbye2011-06-091-1/+8
|/ | | | | | | | | | | | | 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
* Add proper styleable support.Xavier Ducrohet2011-06-072-24/+55
| | | | Change-Id: I2dc79e71521f93d798fd4a9b33aa59979bef379d
* Improve error message when ADT is older than layoutlib.Xavier Ducrohet2011-06-031-2/+3
| | | | Change-Id: I1d52201c58f9fb92a87fd42585b653bf37730032
* Detect and add special warning for wrong themesTor Norbye2011-05-231-5/+14
| | | | | | | | | | | | | | | | | | | 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
* Fix issue with resource repository when using librariesXavier Ducrohet2011-05-201-1/+2
| | | | Change-Id: I1a3e5ba9ac6e930d4be2daedff9691862f975408
* Add method to LayoutLibrary to query layoutlib api level and rev.Xavier Ducrohet2011-05-191-0/+27
| | | | Change-Id: Ib70e560e7d0be88305383aac18726858d91990ae
* Add baseline/margins to ViewInfo.Xavier Ducrohet2011-05-161-25/+160
| | | | | | | Also make it so that older layoutlib that are using API5 return the value through reflection (done in LayoutLibrary.) Change-Id: I3a32666e525f0f1d37a13e670d1d1c659b8e2027
* Add getViewBaseline to the LayoutLibrary class.Xavier Ducrohet2011-04-181-0/+17
| | | | Change-Id: I29caadc8cb31c4a3aab0863a4fec16534b9bc900
* Move getViewParent/Index from RenderSession to Bridge.Xavier Ducrohet2011-04-061-1/+35
| | | | | | Also update the IProjectCallback to handle expandableListView. Change-Id: I36ca8733182bbd9d169fee3e709ebc532fef7b1e
* Pick layout themes from manifest registrations and target SDKTor Norbye2011-04-041-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Extract Style RefactoringTor Norbye2011-03-311-1/+1
| | | | | | | | | | | | | | | 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
* Add go to declaration support for styles and embedded textTor Norbye2011-03-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Merge "Fix unit tests from the previous refactor."Xavier Ducrohet2011-03-1817-0/+960
|\
| * Fix unit tests from the previous refactor.Xavier Ducrohet2011-03-1817-0/+960
| | | | | | | | Change-Id: I464fe3f94e701e619b474f82aaf84ee04d158e71
* | Merge "Move classes to ide-common"Xavier Ducrohet2011-03-1832-0/+4718
|\ \ | |/
| * Move classes to ide-commonXavier Ducrohet2011-03-1732-0/+4718
| | | | | | | | | | | | | | | | | | 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
* | Merge "Add missing notice files."Xavier Ducrohet2011-03-171-0/+190
|\ \ | |/ |/|
| * 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
* | Disable the "unecessary else" warning.Raphael Moll2011-03-171-1/+1
|/ | | | | | | | 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
* Add specifc warnings config for most sdk eclipse projects.Xavier Ducrohet2011-03-141-0/+64
| | | | Change-Id: I9837714c5673d43fa7108b16ab264f1017c4bd3d
* Resource management refactoring and clean-up.Xavier Ducrohet2011-03-081-47/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - (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
* Remove some non needed asserts.Xavier Ducrohet2011-02-221-1/+0
| | | | Change-Id: Ib12b25d7c7a6630075cfe4f5e757a10673305220
* Fix possible NPE in legacy callback support.Xavier Ducrohet2011-02-061-1/+5
| | | | Change-Id: I5faa155393466e1bc4b2fc1e9417cde91a8be456
* Add to layoutlib the ability to simply render a Drawable.Xavier Ducrohet2011-02-041-7/+23
| | | | | | | | | | | 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
* Add app name/icon and current render locale to the LayoutLib API.Xavier Ducrohet2011-02-041-8/+8
| | | | | | | | | | | | This allows the layoutlib to render system/title/action bars as a window decor like it would look on the device. This can be disabled with RenderParams.setForceNoDecor(). (BTW, Params was renamed RenderParams too) Also minor update to the API by replacing an int with Density since the enum is now accessible to the API and layoutlib. Change-Id: Ic37770a9276d12af90c60199a84b04cb64e7c3a1
* Add MipMap to the resource type list.Xavier Ducrohet2011-01-281-1/+1
| | | | Change-Id: I1f56ab470874e39dad8659d15a3699b83f1ac658
* Move Pair and annoatations into resources.jar now renamed as common.jarXavier Ducrohet2011-01-284-6/+27
| | | | | | | Move all the resource query methods that returned an array of 2 Strings to return a pair of ResourceType and String. Change-Id: I6b8447aa27005de786e2defef81ad88a72363523
* Change APIs using String instead of ResourceType.Xavier Ducrohet2011-01-285-44/+70
| | | | | | | | | 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
* Add more theme query APIs to RenderResourcesXavier Ducrohet2011-01-261-1/+36
| | | | Change-Id: Iebde7536a0007898387dc7bb5d943e3767140a3c
* LayoutLib API update: build properties and multi ViewInfo results.Xavier Ducrohet2011-01-252-5/+10
| | | | | | | | | The build properties are needed to populate android.os.Build The multi ViewInfo results are needed to access all the top level children of a merge layout. Change-Id: I49638ae76aaf9e83dc4a0a73c3e7966d7b0a14a3
* Move the resource resolution code into ide-common.Xavier Ducrohet2011-01-172-7/+518
| | | | | | | | | | | 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
* Move ValueResourceParser into a better package.Xavier Ducrohet2011-01-161-1/+1
| | | | Change-Id: I15ae7efd2d482bd5bc368983a1745d9026f964b2
* Fix build by updating ide-common to the new LayoutLog.Xavier Ducrohet2011-01-141-3/+3
| | | | Change-Id: If1a01daa87561f474b4c43d6c404a3c42e98d485