aboutsummaryrefslogtreecommitdiffstats
path: root/rule_api
Commit message (Collapse)AuthorAgeFilesLines
* Add @Nullable/@NonNull annotations to the Rule APITor Norbye2012-01-0420-126/+366
| | | | Change-Id: If7b6d7b505476676c5683ab4966fa5f587b15d1e
* Add @NonNull annotation and configure Eclipse settingsTor Norbye2011-12-221-1/+13
| | | | | | | | | | | | | | 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
* Update SDK codebase to JDK 6Tor Norbye2011-12-213-1/+30
| | | | | | | | | | | | | | | | | | | | | 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
* Add the Guava library to the toolsTor Norbye2011-12-0525-3/+95
| | | | | | | | | | | | This changeset adds the Guava library to ADT and lint. (It is also a prerequisite for the Lombok AST library which is added by a later CL.) This changeset also uses the library in a few simple ways: It replaces some custom I/O and collections code with calls into the equivalent Guava methods, and it also adds the @Beta annotation on the various "API" classes which are not yet stable. Change-Id: I2f50febfa075c32818404e888578a2e1e447d408
* Add package support for Rules API and Detector APITor Norbye2011-11-231-0/+7
| | | | | | | | | | | | | | 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
* Support for custom view rule jarsTor Norbye2011-11-151-0/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | The layout editor already supports providing a classpath of jar files to check for custom views (via the layoutrules.jars property in project.properties). However, once a view rule has been initialized it is never updated. This changeset makes the view rule loader more dynamic, such that it checks the file timestamps of the jar files, and when the jar files are changed it unloads the old rule instances and creates new instances. This makes it a lot easier to develop view rules since you can just update the .jar file and the layout editor automatically picks up the changes (within a couple of seconds; for performance reasons it checks the filestamps at most every couple of seconds (and this is only done lazily of course, so there isn't a file change listener; it just makes sure that if rule loading requests come in more frequently than that it just uses the current class loader). This changeset also adds an AbstractViewRule which implements the IViewRule interface. Without this, implementing a custom view rule will require dozens of methods to be stubbed out (and for the developer to figure out what the methods are and what to do with them). Change-Id: I5f2b84e32e47611fff2d4211411f3039d16eb815
* Use GridLayout state to determine exact row and column boundariesTor Norbye2011-08-231-15/+53
| | | | | | | | | | | | | | This changeset updates the GridLayout support to consider the state of a rendered GridLayout when deciding where the rows and columns are. This information is already available in the GridLayout object, so if one is provided use that data rather than inferring it from the bounds of the views in each row and column. This required changing the view rules API a bit to pass the view objects in to the key entry points (drawing selection, drag & drop and resize). Change-Id: If8484f7f7181c65d0a2fdf629ffd515edd05448b
* Layout editor property menu improvementsTor Norbye2011-08-193-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds two forms of view attribute metadata: * First, it records the most commonly used attributes for each view. This was determined by gathering statistics on as many layout files as I could find and then picking those that are used 10% or more. * Second, it records in the attribute metadata which View defines a given attribute. The context menu uses the above information to present the available attributes in several ways: * In the top level menu, where we had "Edit ID", and if applicable "Edit Text", it now lists the top attributes instead. For example, for a RatingBar the first handful of menu options are "Edit ID...", "Edit NumStars...", "Edit StepSize...", "Edit Style..." and "IsIndicator" (a boolean pull-right menu). Incidentally this automatically handles some cases which were manually handled before, so the code in LinearLayoutRule to add an "Orientation" menu is no longer needed; it's just one of the two common attributes handled by the new attribute list. * The "Properties" menu is now called "Other Properties", and instead of showing all properties, it has a new level of menus: * "Recent". This is initially empty, but as you edit other attributes, it gets populated (in most recently used order, kept up to date) with recently edited properties. * One submenu for each defining View super class listing exactly the attributes defined by that view. This is useful for browsing and editing related attributes. If you are looking at a textual view like a Button for example, you can look at the "TextView" menu to find all the text related options (TextColor, TextSize, etc). These menus are listed from the nearest to the further superclass, so for example if you right click on a CalendarView you'll see these menus: Recent > ---------------------------- Defined by CalendarView > Inherited from FrameLayout > Inherited from ViewGroup > Inherited from View > ---------------------------- Layout Parameters > ---------------------------- All By Name > * As you can see from the above, there are two more menus below the inherited menu items. "Layout Parameters" lists all the layout parameters available for the selected nodes (which is defined not by the view itself but the view that it is contained within). And finally there is "All By Name", which is a complete menu containing all available attributes for the view (and this is what the Properties menu used to contain). * The code which computes a display name from an attribute was also tweaked to capitalize not just the first letter but any first word letter, so for example when you look at the possible values for Gravity you now see "Clip Vertical" instead of "Clip vertical". * The edit property dialog for the properties menus now uses @string or @style resource choosers for the text, hint and style attributes (used to just be a plain text box.) Change-Id: I3b30d48b85fd13f0190c760756bf383a47b3f4a5
* Pull View Rules API into a separate libraryTor Norbye2011-08-1530-0/+3610
This changeset pulls out the API classes from the plugin sources and into a separate standalone .jar library. The library depends on the common.jar library. With the separate view API it should be possible to build designtime helpers (view rules) for custom views to improve editing behavior in the layout editor. Change-Id: I20bb511668de2fe52910e5fe0bbd3ec2a18b5a08