OSDN Git Service

Cluster of improvements for merge tag views
authorTor Norbye <tnorbye@google.com>
Mon, 24 Jan 2011 17:12:47 +0000 (09:12 -0800)
committerTor Norbye <tnorbye@google.com>
Mon, 31 Jan 2011 02:38:21 +0000 (18:38 -0800)
commit9155df4effaf2079215d5f77dc2e70dd145a6fdf
treeb28e8da332ade0c9804fcb587b652d30996e47c7
parentee0afac0a60af6f3f186e5bbb3f773b4c0eb56a4
Cluster of improvements for merge tag views

This changeset contains various improvements around usage of the
<merge> tag. Some of these fixes require layoutlib 5.

* Use the new layoutlib support for rendering multiple children at the
  root level - they now show up in the Outline (provided you are
  running layoutlib 5), can be selected in the layout editor, etc.

* Add a drop handler such that you can drag into the <merge> view and
  get drop feedback (similar to the FrameLayout)

* If the <merge> is empty, we don't get any ViewInfos, so in that case
  manufacture a dummy view sized to the screen. Similarly, if we get
  back ViewInfos that are children of a <merge> tag in the UI model,
  create a <merge> view initialized to the bounding rectangle of these
  views and reparent the views to it.

* Support highlighting multiple views simultaneously when you select
  an include tag that renders into multiple views (because the root of
  the included layout was a <merge> tag).  Similarly, make "Show
  Included In" work properly for <merge> views, and make the overlay
  mask used to hide all included content also reveal only the primary
  selected views (when a view is included more than once.) (Also tweak
  the visual appearance of the mask, and use better icon for the view
  root in the included-root scenario.)

* Improve the algorithm which deals with render results with null
  keys. Use adjacent children that -do- have keys as constraints when
  attempting to match up views without keys and unreferenced model
  nodes. This fixes issue
      http://code.google.com/p/android/issues/detail?id=14188

* Improve the way we pick views under the mouse. This used to search
  down the view hierarchy in sibling order. Instead, search in reverse
  sibling order since this will match what is drawn in the layout. For
  views like FrameLayout and <merge> views, the children are painted
  on top of ech other, so clicking on whatever is on top should choose
  that view, not some earlier sibling below it.

* Fix such that when you drag into the canvas, we *always* target the
  root node, even if it is not under the mouse. This is particularly
  important with <merge> tags, but this also helps if you for example
  have a LinearLayout as the root element, and the layout_height
  property is wrap_content instead of match_parent. In that case, the
  LinearLayout will *only* cover its children, so if you drag over the
  visual screen, it looks like you should be able to drop into the
  layout, but you cannot since it only covers its children. With this
  fix, all positions outside the root element's actual bounds are also
  considered targetting the root.

* Fix broken unit test, add new unit tests.

Change-Id: Id96a06a8763d02845af4531a47fe32afe703df2f
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/MergeRule.java [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfo.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeOverlay.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/MoveGesture.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionOverlay.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ViewHierarchy.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/RulesEngine.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasViewInfoTest.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeFactoryTest.java