aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common
Commit message (Collapse)AuthorAgeFilesLines
...
| * Misc GridLayout interaction fixesTor Norbye2011-09-063-5/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A couple of fixes to the interaction support for GridLayouts. If you resize within a GridLayout and drag only a horizontal or vertical edge, then make the resize message only list the current new size in the resized dimension. In other words, if you drag the right hand side edge, it might say "wrap_content", but if you drag the bottom right corner, it might say "50dp x wrap_content". This is similar to what is done in for example the LinearLayout during resizing. Second, prefer matching with an existing row or column over adding a new row/column adjacent to a right edge. Third, fix drag feedback messages to be more accurate when dealing with adjacent matches. Change-Id: I2e09731712c961dfd8b9c60fb33d37f0bc0a1cc4
* | Change default launcher icon name in new Android projectsTor Norbye2011-09-061-6/+2
|/ | | | | | | | | | | | | | | | | When creating a new project, the default project template includes a launcher icon named "icon.png". This changeset changes the name of this default icon to "ic_launcher.png", in accordance with the recommended naming convention listed in http://developer.android.com/guide/practices/ui_guidelines/icon_design.html (The secondary motivation for this is that the Icon Set Wizard will suggest ic_launcher as a default launcher name, and it would be nice if going through the wizard with the default settings would replace the current project's launcher icon. Given the guidelines above I'd rather not change the wizard default name to "icon") Change-Id: I9f516c769019c2635edad4e1e6f01a5110d156fe
* Add GridLayout support to the ChangeLayout refactoringTor Norbye2011-09-022-8/+14
| | | | | | | | | | | | | This changeset adds a generic-to-GridLayout converter to the "Change Layout" refactoring. The converter arranges the views into a grid based on their bounds, uses the sizes to determine row and column spans, and then writes this out as the resulting grid. Note that it does not yet consider existing layout knowledge to add better constraints, such as gravity, or arranging vertically overlapping views in a horizontal row into a same shared row. Change-Id: I78e5fdf49d9e2a838a7229e2e31aa62e190032ad
* A few warnings fixesTor Norbye2011-09-011-1/+1
| | | | Change-Id: Ie230236444a5e1288d98feea208df5ce6508803d
* Use GridLayout state to determine exact row and column boundariesTor Norbye2011-08-2315-89/+243
| | | | | | | | | | | | | | 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-198-198/+442
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1527-3297/+8
| | | | | | | | | | | | 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
* Action API improvementsTor Norbye2011-08-1515-970/+1093
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset changes the Actions mechanism for view rules to add support for the following: * Delayed computation of submenu contents. Before this, a view rule would have to produce the full tree of actions to be shown in menus and submenus - for example including all the properties, and in turn all the enumerated values for those properties and so on. Now there's a Provider interface which can be used to compute these menu items only when the menu is actually opened. The properties menu now takes advantage of this. This was also necessary to implement the following new feature: * The layout editor context menu now also lists not just the properties for the currently selected views, but also the properties for the parents. For example, if you open the context menu, you'll see the properties for the button you just right clicked on, but there will also be a "frameLayout1" submenu containing the actions for the <FrameLayout> parent of the button, and a "linearLayout1" submenu for the parent linear layout. This is useful when a parent layout doesn't have blank space on its own so it is difficult to target. A future CL will use the lazy initialization to add more options to the properties menu. * Support for arbitrary nesting. Submenus can contain submenus can contain other submenus etc. * Custom ordering. This changeset moves the "sort priority" concept (which was already used for layout actions) up to all actions, which makes it easier for rules to cooperate on ordering because instead of appending or prepending to the superclass' context menu result, actions can now just be initialized with a sorting priority value which makes it trivial to interleave actions regardless of who adds them. This also makes it a lot easier to use custom ordering in choice menus where the ordering used to be alphabetically sorting on keys. * Improved support for multiselection. The callback interface now takes a list of nodes to apply the callback to, and actions can indicate whether they support multiple nodes. This makes it possible for actions to more directly support the case where you apply an action to multiple nodes. As before, the available actions in the context menu is limited such that it only shows the actions common to all. But now those actions can do something specific. For example, if you select "Edit Text..." on many nodes, you will get the input-string dialog once, and then the value is applied to all. Similarly, if you select "Edit Id..." it will ask for a separate id for each value (and you can cancel out of this loop). There are various API changes too. Since the Choices action (which had a map-based set of values) was removed, the OrderedChoices is now renamed Choices. The Actions subclass of MenuAction which all actions also extended has simply been moved up to the top level MenuAction. And MenuAction has been renamed to RuleActions since they are used not just for menus but for toolbars etc and the key thing about this interface is that they are intended for use by rules. Change-Id: If49f75213f2041ebfef7e84254d70d219bb766ab
* Add tooltip drag feedback for relative layoutTor Norbye2011-07-272-11/+34
| | | | | | | | | | | | | | | | This changeset adds tooltip drag feedback for RelativeLayout. During dragging, the matched edge can quickly change from the left side to the right side or the top to the bottom edge, so the tooltip support now allows a client to specify where to align the tooltip not just at creation but also during updates. This is particularly important for RelativeLayout where we need to ensure that the tooltips do not obscure the constraint feedback arrows. And to prevent flicker, it uses a timer to ensure that there is at least 750 ms between the repositioning of the tooltip (but it will apply a side change immediately if it has been 750 ms since the last time the alignment changed). Change-Id: I8817db67844ad13c651d343ad310d8646e34dfca
* Allow GridLayout to exist in project packagesTor Norbye2011-07-271-1/+1
| | | | Change-Id: Ia455a9c9de853dcc0e5152a8b24a09192c39b3b4
* Add new InsertType for widget moves within the same layoutTor Norbye2011-07-142-2/+15
| | | | | | | | | | | | | | | | | | | | For some layouts, such as LinearLayout, when you drag widgets into the layout, we automatically adjust the widths and heights of some widgets, such as text fields (to make them fill the full width in a vertical linear layout, and so on). However, this was also done when dragging a widget from one place to another within that same layout. In that case, we should leave the dimensions and weights alone, since the user may have deliberately changed these. This requires splitting the InsertType.MOVE into two, since we still want to apply default sizing when you move a widget from a different layout into this one. The InsertTypes are now MOVE_INTO and MOVE_WITHIN, and we only apply default size styling if we are not moving within the same layout. Change-Id: I73ace89aff8111417bd6635e13397e7f027bab0a
* Adjust the match position description to be relative to the layoutTor Norbye2011-07-132-10/+19
| | | | | | | | | | | | | | Currently the matches displayed for absolute X and Y locations will list the coordinates relative to the entire screen, not to the surrounding GridLayout. This CL changes the feedback to be relative to the GridLayout bounds. Also fix a bug in updating tooltips/messages which would call tooltip flicker (because the message update method was called too early, before the message object was ready, causing the tooltip to be removed, then reshown.) Change-Id: I665586dbcb1f3f6cdcb3a3f475cf363cd258bf83
* Fix resize feedback for cell spanning modeTor Norbye2011-07-121-20/+27
| | | | | | | | | | | | | | | When resizing in a GridLayout you can toggle whether you are resizing the widget or the cell bounds with the Shift key (and the resize feedback tells you this). However, the drawn resize feedback was always showing the widget bounds. This CL fixes this such that when you are resizing the cell bounds, the current cell bounds are displayed instead. (Also contains a simple fix to ensure feedback is drawn when you click and hold (without dragging yet) on a resize handle.) Change-Id: I7cf24f4508aa5bbafd45f36b13be41e66ecbc6cc
* Describe GridLayout matches in drag tooltipTor Norbye2011-07-122-0/+66
| | | | | | | | This CL adds a description of the current best match (horizontal and vertical) in a drag tooltip, such as "Insert into bottom of row 5" or "Align right at x=120". Change-Id: I08d6b158c5e48d1881ec946037389609d8be9d83
* Grid Layout Support.Tor Norbye2011-07-1120-101/+3719
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds basic support for grid layouts: - Freeform mode where you can drag & drop anywhere in the layout, and guidelines are offered to align with other left boundaries, right boundaries, baseline vertical alignment and center layout horizontal alingment. In addition, it also offers "preferred spacing" positioning, using the recommended distance between widgets. Also, during a drag a regular 16x16 grid is also (faintly) shown and (when there are no alignment matches as explained above) the position snaps to this grid. We also show the grid-structure (rows and columns, not the regular snapping grid) during drags to make it more obvious that behind the scenes there is a grid (because some other operations might shift rows and columns so it's important to present the right user model.) The freeform grid layout editor will automatically create rows and columns and size them using spacers which are hidden from the user, and on deletion these are automatically cleaned up as well. - Grid mode where you can drag to any given cell, or between any two rows or columns. - Some layout actions for manipulating the grid (add/remove row and column, adjust the gravity, toggle modes.) This CL also contains various diagnostics code for the grid mode, and does not yet correctly support dragging multiple views simultaneously. Change-Id: Ie9ec54805039645e3db78d19095da86b04e44ca0
* Fix merge errorTor Norbye2011-07-111-3/+0
| | | | Change-Id: Iac2dcc3a504ab2dbc500bcd882d61b460879c7eb
* Add AdapterView handling for SpinnersTor Norbye2011-07-111-0/+4
| | | | | | | | | | | | This CL adds AdapterView handling similar to what we already provide for ListViews and GridViews for Spinners. This means that it will provide an adapterbinding which provides a layout to use at designtime. It also adds the ability to pick a different layout to use at designtime. More importantly, this fixes rendering of Spinners on Theme.Holo. Change-Id: I30cef98d22ed57b2e698c4590948e25bf3fecedd
* Add resize feedback tooltipTor Norbye2011-07-114-10/+32
| | | | | | | | | | | | | | This changeset adds a "tooltip" during resize operations close to the mouse cursor which displays feedback about the current resize dimensions. The feedback window is similar in appearance to a tooltip, but unlike SWT tooltips it moves with the cursor and updates the text dynamically, and appears immediately rather than being tied to mouse motion timeouts. It is also partially translucent and uses a slightly smaller font. Change-Id: I6b663510f078f325d2f7b168c887aeff14de31b8
* Add support for hidden viewsTor Norbye2011-07-081-0/+4
| | | | | | | | | There are some views which should hide in the UI to avoid clutter, such as <Space> widgets. This changeset adds support for hidden views, such that they don't show up in the outline, don't show up for hovers, aren't included in drag selections and so on. Change-Id: Icb18f4530b8aff584e72280f5bd09e776af9204c
* Simple insets supportTor Norbye2011-07-083-1/+16
| | | | | | | | | | | | | | | 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
* Merge "Add deletion hooks for view rules"Tor Norbye2011-07-083-7/+69
|\
| * Add deletion hooks for view rulesTor Norbye2011-07-073-7/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds a deletion hook to the view rule interface which lets specific layouts perform cleanup when some of its children are removed. This is vital for GridLayout where various rows and columns need to be cleaned up. In this changeset, this is used by RelativeLayout to remove constraint references to widgets that have been deleted. Without this, you could have Button2 reference Button1, then delete Button1, and when you drop a new button, it will be assigned the now available name "Button1" and the old constraint would kick back in! Change-Id: Ic5829228cff38bfdc291988b1a2ef172e9aa4de5
* | Fix locale handling of linear layout weightsTor Norbye2011-07-071-1/+4
|/ | | | | | | Fix 18298: ADT r12 layout editor uses locale specific decimal separator leading to unparsable XML Change-Id: Ideae319e41f8a7e34075065c63247d50cdf830c5
* Handle "ffffffff" in attribute flag valuesTor Norbye2011-06-141-4/+3
| | | | Change-Id: I410fccd9a9970eaa65e114be33a9e576280bb6c9
* Add two more layout actions for linear layoutsTor Norbye2011-06-133-40/+71
| | | | | | | | | | | | Add two more actions: (1) Clear All Weights: This removes all the layout weights in a layout, and converts and 0-sized views to wrap_content. (2) Assign All Weight: This adds all the weight in the layout to the selected view(s) and removes it from the remaining views. Change-Id: Id2a27299d99f77ef4056b7e1745373d52a9331f7
* When distributing linear layout weights, also set size to 0dpTor Norbye2011-06-132-0/+47
| | | | | | | | | | | | | | | | When you use the layout actions bar "Distribute Weights" in a LinearLayout, in addition to setting all the weights to the same nonzero value, also set the size (the height for a vertical linear layout and the width for a horizontal one) to 0dp, to ensure that the widgets are all given the same total size rather than sharing the remaining space evenly. In addition, when adding new widgets to a LinearLayout, see if all elements in the linear layout already have nonzero and equal weights, and if so duplicate this weight value on the new widget as well, and similarly also duplicate 0dp/0dip/0px if used. Change-Id: Iac5284a866b19b27e91666dc62278c63b8dde2bb
* RelativeLayout: Assign ids dynamically, handle multi-drag, bugsTor Norbye2011-06-109-35/+150
| | | | | | | | | | | | | | | | | | | | | | | | | This CL fixes three issues with the new relative layout interaction: (1) Assign ids dynamically. Before this changeset you couldn't attach to a node which does not have an @id attribute, since layout params need to name the constraint by id. This changeset changes this such that you can attach to any arbitrary edge, and when you commit the drag, a unique id is generated on the fly and assigned to the node. (2) Handle dragging multiple nodes at the same time. The new constraints code was unconditionally applying the same constraints to all the dragged nodes, which meant they ended up on top of each other. This fixes things such that the first node is assigned the new constraints, and then all subsequent nodes are attached one next to the other, in a direction depending on which edge you attached to (e.g. attaching on the right will arrange the siblings towards the left out from the edge.) (3) Fix a bug in the code to detect and prevent cycles. Change-Id: I157d45e117d3229f285870517b85ed902607b966
* Fix GestureOverlayView handlingTor Norbye2011-06-101-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL fixes a number of problems related to the GestureOverlayView. The first big problem was that GestureOverlayView lives in the android.gesture package, which is not one of the special builtin packages you can omit when specifying the element in layout XML files. This CL both stores a full path in the descriptor XML name, which fixes tag-to-descriptor lookup (without this we were showing the wrong icon and missing vital attributes in completion), and handles scenarios where the full path has to be used. The second problem was that the descriptor metadata listed GestureOverlayView as a "view" rather than a "layout", which meant that it was missing information about children (which meant you couldn't drop into it), and it was missing layout params (which meant children couldn't be assigned attributes like layout_width and layout_height). Also tweak selection handling for gesture views. There are a number of places where we need to go from a class name to a view descriptor; these are now centralized in a utility method and sped up with a map lookup. (Issues fixed: #17541, #17543) Change-Id: I67c450f28eab07b3575e510420b7faf4410085e3
* Fix various warningsTor Norbye2011-06-093-7/+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
* Merge "Guidelines for match_parent, and linear layout weight fixes"Tor Norbye2011-06-064-156/+358
|\
| * Guidelines for match_parent, and linear layout weight fixesTor Norbye2011-06-064-156/+358
| | | | | | | | | | | | | | | | | | | | | | | | | | | | First, add guidelines to allow snapping to "match_parent" (or fill_parent, depending on the API level). Second, fix the linear layout resizing scheme to handle corner cases a bit better (corner cases such as resizing to a smaller size than the wrap_content bounds, or resizing inside a layout that is "full"). Also split up the resizing code into a compute-method and an apply-method such that we can display feedback for the current weight during the resizing operation. Change-Id: Idd2917230870d26f94473dabc1a2a6becc3ba738
* | Show previews of resources in the resource & reference choosersTor Norbye2011-06-061-0/+3
|/ | | | | | | | | | | | | | | | This is a first cut of previews in the Resource Chooser and the Reference Chooser. When the selected resource is a drawable or a color, then a tray is shown on the right hand side of the dialog with a preview of the given drawable or color. If the color is a state list, then the fallback color is shown. The previews only work for resource/reference choosers associated with a layout editor (because it looks up the associated rendering configuration from that editor). This should be made more generic such that it can work for example when bringing up the resource chooser from a manifest form editor. Change-Id: I9f2896cb7ce1468076a3ca83f820be7e9affcda6
* Simple code cleanupTor Norbye2011-06-022-59/+26
| | | | | | | | | We had a number of constants for attribute values which had the prefix VALUE_ but which were really attributes and should have the prefix ATTR_. We already had the equivalent ATTR_ constants, so get rid of the VALUE_ constants and clean up the usage slightly. Change-Id: Icc0f0ad8910695b4ac4904c620f73d6cf4bcacba
* Resize & Guideline SupportTor Norbye2011-06-0131-711/+4143
| | | | | | | | | | | | | | | 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 Resize Support to the Layout EditorTor Norbye2011-06-017-11/+351
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds "resizing" support to the layout editor. First, the normal selection overlay is replaced with a selection rectangle which also has "selection handles" in the corners and in the middle of each edge. Moving the cursor over one of the selection handle will show a directional resize cursor, and dragging the handle will initiate a new resizing gesture. (This also made it possible to remove the selection fill we've used until now, so the layout editor will "interfere" less with the visual look of the layout.) During the resizing operation, the current size is displayed in the Eclipse status bar. The resizability of widgets is determined by metadata, so for example a ZoomControls widget is not resizable, a rating bar is only horizontally resizable, a TableRow is only vertically resizable, and most widgets are resizable in any direction. The parent layout is involved in the resizing operation. Currently, the resizing gestures will only update the width and height properties (except for absolute layout, which will also set the x and y properties if you are dragging a left or top edge). In a follow up changeset this will be extended to for example make RelativeLayout allow resize dragging to snap to new edges and the resize will be applied as a set of new constraints on the "resized" widget. Thus, you'll be able to drag the right hand side of a widget and drag it over to attach to some other widget or edge, independent of what the left edge or vertical edges are bound to. This changeset also adds the ability for ViewRules to provide a message or error message back to the IDE during a drag or resize operation. For resizing this is used to display the new size. However, it is now also used to display more useful messages in a couple of older scenarios: * Attempting to drag anything into a ListView will display a message that AdapterViews much be configured via Java code * Attempting to drag anything into or within an AbsoluteLayout will warn that AbsoluteLayouts are deprecated. Note that resizing will currently set the size to specific pixel (dip) sizes. In the next changeset I will add guidelines which (in addition to those described for RelativeLayout above) will add guidelines for significant sizes such as the parent size, the preferred (wrap_content) size of the widget, and possibly other hardcoded sizes in the same layout. Change-Id: Ie4f3367e81b24259a106c649c944008f4a3d31ec
* Disable palette preview for some widgets on some platformsTor Norbye2011-05-241-0/+12
| | | | | | | | | | ListView palette preview requires adapterview support in layoutlib, and DatePicker and TimePicker require Holo themes on Honeycomb. This changeset adds some conditional logic to the palette preview code to drop rendering of these widgets based on the current render target, layout library and theme. Change-Id: Ic42a40faf817e60525485e0a46b7ad967ed1c363
* Add preview support for GridViewsTor Norbye2011-05-192-0/+43
| | | | | | | | GridViews are another AdapterView subclass. This changeset adds preview support for GridViews by modifying the ListView preview support to also accommodate GridViews. Change-Id: I5af0a4c7e270cfa23c609be316d01dfb188a051b
* Basic fragment supportTor Norbye2011-05-163-3/+53
| | | | | | | | | | | | | | | | | | | | | | | This changeset adds preliminary support for fragments: * Add <fragment> to the palette, along with a drop handler which pops up a class chooser to pick the Fragment class; all project implementations of android.app.Fragment and android.support.v4.app.Fragment are listed. * Adds a fragment descriptor such that code completion works for <fragment> elements * Fix project callback such that it does not complain about a missing class "fragment". * Fix outline to display the name of the fragment rather than the fragment tag name. * This changeset also centers the label in MockViews since those are still used to render fragments Change-Id: I6e062970b335d9c95870f181ed408960978c423e
* Make Go To Declaration work for <fragment> names.Tor Norbye2011-05-131-0/+4
| | | | Change-Id: Ib2e8d8b93cdb52717719296dec0cbcf9780802ff
* Custom View handling improvementsTor Norbye2011-05-131-1/+1
| | | | | | | | | | | | | | | | | First and foremost, allow custom views to accept children such that you can drag & drop children into the custom view in the outline. Second, prevent an NPE which can occur if you drag into a layout where the root element is a custom view. Third, handle <view> (not <View>) better: provide a custom icon, and inline the view class name in the outline label. Fourth, allow double clicks (in addition to ctrl-click which is already supported) on the custom views in the palette to allow jumping to the custom view code. Change-Id: I13c2bf2f4169185c9fcc893ce487f2abdac46802
* Merge "Add code completion support for drawables, animations and colors"Tor Norbye2011-05-041-3/+3
|\
| * Add code completion support for drawables, animations and colorsTor Norbye2011-04-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds in descriptor metadata and XML editors for: - Drawables (res/drawable/) - Animations (res/anim/) - Animators (res/animator/) - Colors (res/color) These types have also been added to the New XML File wizard. There is some specialized completion support for animators: - Completing on the propertyName property of <objectAnimator> will offer the various integer and float properties in views - Completion for the interpolator property shows the framework interpolators immediately and on top (instead of having to complete the individual resource paths @android: and anim/ first There is also a new quickfix and marker resolution for the AAPT error which complains about an unbound prefix. This will insert a xmlns:android="http://schemas.android.com/apk/res/android" attribute declaration on the root element. This CL also includes a fix to make the New XML File Wizard preselect the current project in more scenarios. NOTE: This changeset adds new XML editors for these resource types. It does not attempt to update previous editor bindings for files of the given type, so to test this you may need to use "Open With" in the package explorer to pick the right file type. A subsequent CL will try to migrate settings over to these editors, but that work will tie into another effort: merging all these different editors into a single editor class that does its own content type switching and different viewparts for the other tabs. Change-Id: I4b12bafd8fd068176c41bac1e345bb74ccdb8b6f
* | Add Request Focus to textfieldsTor Norbye2011-05-022-2/+122
|/ | | | | | | | | | | | | | | | | | This changeset adds a couple of focus related changes: 1) When the first text field is added into a layout, it is automatically requesting focus 2) There is a new context menu item available on textfields to request focus. When invoked on a text field, it will both add <requestFocus> to itself and remove it from any other text fields that have set it in the layout. When invoked on a text field which already has focus, it will offer to clear the focus. 3) The Advanced section of the palette also contains the <requestFocus> tag. Change-Id: I92982b6dfc17315b3d513c304f258b8901a007a4
* Enforce at most one child on ScrollViews, and add LinearLayoutsTor Norbye2011-04-204-1/+70
| | | | | | | | | | | | | | | | | | | This changeset fixes issue 15899: Scroll view can only have one child and editor should enforce this. First, it modifies the view rules for ScrollView and HorizontalView to refuse to add children to the view if there is already a child there. It also updates the drawing code to not offer drop previews other than the target highlighting rectangle. Second, it modifies the New XML File wizard to insert a vertical LinearLayout as the new child when a ScrollView or HorizontalScrollView is created. (This was already done by the view rules when the scroll views were dragged in from the palette.) Change-Id: Ide825cbf28b46177983d6c5f2ea8c2848147c711
* Custom listview layoutsTor Norbye2011-04-205-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds support for user-configured layouts in ListViews and ExpandableListViews. There is a new "Preview List Content" pullright menu when you right click on a ListView in the layout canvas. The menu contains links to configure - the layout to use for list view items - the layout to use as a header - the layout to use as a footer - as well as a number of pre-configured framework layouts for common arrangements like 2-item list, 1-item list, checked list, etc. The selected layout is persisted as an inline comment in the layout XML. (Current bug: When you drag elements around in the layout, comment nodes are not preserved, meaning you will lose your list view render type as well.) This changeset also adds "Clear" to the resource chooser, which makes it possible to clear a previously set value (until this, choosing nothing would simply abort the selection.) This makes it possible to remove a chosen header/footer. Change-Id: I611b00f627c5773f3fe2443a6e16c29388687b36
* Add list view previewTor Norbye2011-04-113-1/+52
| | | | | | | | | | | | | | | | | | | | | Use the new layoutlib facility to specify adapter view bindings to assign default listview item layouts to ListViews and ExpandableListViews. This is also used to provide a preview of ListViews in the palette. Note that the list preview is always showing the default list view items. A later changeset will add the ability to pick a custom layout to be used for listview rendering. This changeset also contains a refactoring which pulls the cyclic dependency validator out into a standalone class; this validator will be used not just for include drop support but also for the layout selector when picking layouts to preview in a listview. Finally, the CalendarView has a new IViewRule which sets its default width and height to fill parent. Change-Id: If4fdec8d5439af69a34b029cb36a940fac953f86
* Usability fix for the layout actions barTor Norbye2011-04-105-10/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The layout actions bar shows actions of two types: * Actions which edit attriubutes of the "current layout"; typically the parent of the currently selected views. For example, the "orientation" or "baseline" attributes of a LinearLayout. * Actions which edit the layout parameters of the selected views. For example, the "weight" attribute of children in a LinearLayout. One thing which was missing is adding in layout actions for views that are children. For example, the TableView now has an "Insert Row" action. If you select the table itself, rather than a child within the table, you would not see the Insert Row action. Similarly, if you drop a new LinearLayout, you cannot toggle its orientation attribute; it won't be shown, or if it is within another LinearLayout, you will see an orientation toggle but it controls the parent, not the newly selected LinearLayout. This changeset addresses this by adding a new section of actions on the right hand side of the actions bar, which contains the layout actions which apply to the selection, regardless of the parent type. For example, if you have a LinearLayout containing a TableLayout, and you have selected the TableLayout, you will first see the LinearLayout actions, then the LinearLayout layoutparams actions (which will be applied to the TableLayout), and finally the TableLayout layout actions (insert and remove row). This changeset also improves the TableLayout insert row action to insert the row before the current selected row (if any) rather than unconditionally appending it to the end. It also selects the table after creation to make it more obvious where it was added. The new ability to select nodes from layout rules is also used in a couple of other places. Change-Id: I7cd8f75e61fc916bc75ed5ad156440f0f8cbd786
* Add Table layout actionsTor Norbye2011-04-084-0/+94
| | | | | | | | | | | | | Add "add row" and "remove row" layout actions to the TableLayout and to the TableRow view rules. Also, add 4 rows into TableView created through the palette. When https://review.source.android.com//#change,22077 is integrated I'll also make it add these TableRows when creating a TableLayout through the New XML File Wizard. Change-Id: I906eb6ab479c3781d3d8eb0a536cec67459ddec2
* Improve painting of combined selection and hoverTor Norbye2011-04-011-0/+6
| | | | | | | | | | | | | | | | | | | | When the mouse is over a rectangle, we highlight this "hover" rectangle by painting a semitranslucent white rectangle on top of it. When a view is selected, we highlight it by painting a semitranslucent blue rectangle over it. This means that if you move the mouse over the selection, you get both of these effects added together, which dilutes the underlying selected widget too much. This changeset tries to improve this situation by defining a different visual style to be used for the combination of hover and selection, where the opacity is much lower for the hover in this case. This changeset also reduces the existing hover by about 30% opacity. Change-Id: I63ffe8a9d756dcae29b2009a1a1cd6b9ffb6fbe7
* Extract Style RefactoringTor Norbye2011-03-311-0/+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