aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/api/RectTest.java
Commit message (Collapse)AuthorAgeFilesLines
* Improvements to the multi-configuration layoutTor Norbye2012-10-121-1/+30
| | | | | | | | | | | | | | | | | | This adds a new layout algorithm which tries to do a more optimal fit if all the configuration previews can fit on the current screen without scrolling. (However, it still doesn't scale up these previews to fit all available space, that's coming in a later CL). It also delays rendering previews and performing layout until the layout is actually painted, and improves the error rendering a bit. It's also more deliberate in how preview renderings are scheduled, performing them in visual order etc. There's a new brief animation when you switch to a preview. Finally, there are some preview zoom controls now. Change-Id: Iea503a3fd57dfcaea7656e47b946bfcfea3eecb1
* Resize & Guideline SupportTor Norbye2011-06-011-1/+15
| | | | | | | | | | | | | | | RelativeLayout now has both drop/move and resize guidelines, and existing constraints are visualized for the selection. LinearLayout resizing now uses weights to change the size of nodes rather than setting width/height. All resize operations offer guidelines to snap to their "wrap_content" size. Various bug fixes in related areas as well. Change-Id: I817e34c6e67ce61cfb137eb067076d91f69f99e9
* Add per-view custom initialization logicTor Norbye2010-11-191-28/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Port layout rules to JavaTor Norbye2010-10-221-0/+286
We had a number of layout implementations in the tool written in Groovy; these were hard to deal with because of lack of good tool support (debugging didn't work, refactoring didn't work, code completion didn't (always) work, go to declaration didn't work, semantic checks like unused code didn't work, etc. etc.) Since these layout helpers are only getting larger, replace them by equivalent Java code to make development easier. This checkin also moves the API classes formerly used by Groovy scripts into a new package (next to the Java layout rules) under com.android.ide.common (api and layout) since this code isn't Eclipse specific and could be used by other IDE vendors. These interfaces were left identical (only the package statements and directory location changed), with two exceptions: I added a new method called "in" to IAttributeInfo.java, and I added a parameter to IViewRule's onInitialize method. The Groovy code was kept as close to the original as possible; I copied in the Groovy code, and then replaced the Groovy-specific constructs (closure-iteration on collections, literal map syntax, etc) with equivalent Java code. The only tricky part was ensuring that Groovy's handling of the == and != operators were translated into .equals calls. Change-Id: Idf7660ddea3766eac0a4a65ce6524d3f5119f7b2