aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/IViewMetadata.java
Commit message (Collapse)AuthorAgeFilesLines
* Pull View Rules API into a separate libraryTor Norbye2011-08-151-102/+0
| | | | | | | | | | | | 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
* Simple insets supportTor Norbye2011-07-081-0/+7
| | | | | | | | | | | | | | | This changeset adds the basic plumbing for supporting insets, such that selection handles can reflect the true bounds of a widget, and such that guidelines which show adjacent matches can show and measure the correct visual distance between the widgets. The actual insets data is not available (though there are some commented out measurements for some of the most important widgets, like buttons), so the purpose of this changeset is to put the APIs in place such that the various view rules can correctly account for these deltas when they become available. Change-Id: I326bfa22f0d239d76685b371d38bb8eac594a53b
* Add palette category metadataTor Norbye2011-01-201-14/+0
| | | | | | | | | | | | | | | | | | | | | | This changeset contains some background work for the palette preview work, separated out to make that changeset smaller. First, it creates a new metadata XML file, which augments the metadata provided by the platform, defining things like palette categories, a natural order for the views within each category. The older code-based metadata for fill preferences (used to decide how to set the width and height attributes on drop) are also moved into this XML file. There will be more metadata added to this file in the next changeset, where for example XML fragments defining how to render a view for preview purposes will be defined there. Second, change the signature on the view and layout descriptor lists passed around such that we don't have to do instanceof ViewElementDescriptor in various places. Fix sentence capitalization for a couple of undo label strings. Change-Id: I66191ccf4cc0f4105c2331d496f3674ac1ad8b9d
* Add per-view custom initialization logicTor Norbye2010-11-191-0/+109
This changeset adds support for adding custom-logic to initialize views, both to add children and default attributes and to customize layout attributes when added to a new parent. First, there is a new "onCreate" hook which is called to notify a view rule that an instance of its corresponding view has been created. This lets the ViewRule perform custom initialization of the object. The ViewRule is told what type of insertion occurred, such that it can distinguish between a newly created view, a view that is the result of a copy/paste, and a view that is part of a move operation. The changeset adds a number of new ViewRules which take advantage of this: - A TabHost rule creates the various skeleton children that are required, such as a TabWidget child with id @android:id/tabs and a FrameLayout child with id @android:id/tabcontent - A DialerFilter rule creates the mandatory EditText children ("hint" and "primary") - The HorizontalScrollView rule creates a horizontal LinearLayout child - The ImageButton and ImageViewButtons initialize the "src" attribute to a sample image - The MapViewRule initializes the apiKey attribute In addition, views are also notified when a new view is added as a child, such that they can perform additional customizations, in the form of an "onInsert" event. The most important application of this is LinearLayoutRule, which uses this to set reasonable defaults for the layout_width and layout_height parameters. It uses metadata (which is currently built into ADT but would ideally migrate into our XML config files) to determine whether a given child prefers to grow horizontally, grow vertically, both, or neither, depending on the surrounding parent context. For example, an EditText will default to filling the parent width if it is in a vertical LinearLayout, but it will not grow vertically in a horizontal linear layout. And so on. Various other rules also use the onInsert event to tweak children attributes. A ScrollView will for example always initialize its single child to match parent. Views can now also add plain menu items into the context menu, and the TableViewRule adds one such action: "Add Row", which appends a new row into the table. The Palette Preview code also invokes these creation hooks, such that if you for example drag a DialerFilter it can properly render since the mandatory children are created up front. This required various changes to the preview code to be able to handle XML edits by the rules. Finally, this changeset includes various other misc changes that I performed at the same time: - Removed SWT dependency from the ViewRule classes (SWT Rectangle use in Rect) - Fixed AbsoluteLayout unit test (issue 3203560) - Fixed positioning of the preview outline in LinearLayout when only one of the dimensions are clipped due to a smaller target layout Change-Id: I5956fe4e7a31a20b8dd2f9d9b0c1f90e2f75d68a