History log of /sdk/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/DialerFilterRule.java
Revision Date Author Comments
12d4581faa6438941e65a9dc83213be34c6ca970 13-Sep-2012 Tor Norbye <tnorbye@google.com> Constants refactoring.

This changeset moves most constants into the SdkConstants
class, and gets rid of AndroidConstants and LintConstants.
It also migrates all non-ADT specific constants from
AdtConstants into SdkConstants. It furthermore moves various
other constants (such as those in XmlUtils and ValuesDescriptors)
into the constants class. It also fixes the modifier order
to be the canonical modifier order (JLS 8.x).

Finally, it removes redundancy and combines various constant
aliases such that we don't have both NAME_ATTR and ATTR_NAME
pointing to "name", etc.

Change-Id: Ifd1755016f62ce2dd80e5c76130d6de4b0e32161
85e4a1a9dd133abb879ec211ce8dd385004edf22 08-Aug-2012 Xavier Ducrohet <xav@android.com> Refactor common.jar

Move resources and com.android.util.Pair into layoutlib_api
where they belong since layoutlib depends on them and we need
to control the API.

Made a copy of Pair to stay in common.jar but moved it to
com.android.utils.Pair (the one in com.android.util.Pair is
marked as deprecated to prevent usage where applicable).

Also moved XmlUtil and PositionXmlParser to com.android.utils
to match Pair.

Change-Id: I21d7057d3f2ce604f86a3bb1fa3c130948c93b89
7e4b8e9d595e45baa9d87cdb8282f02759e73abc 30-May-2012 Tor Norbye <tnorbye@google.com> Fix nullness annotations

Eclipse 4.2 includes analysis support for @Nullable and @NonNull
annotations. However, it requires these annotations to be *repeated*
on every single method implementing or overriding a superclass or
interface method (!).

This changeset basically applies the quickfixes to inline these
annotations. It also changes the retention of our nullness
annotations from source to class, since without this Eclipse believes
that a @NonNull annotation downstream is a redefinition of a @Nullable
annotation.

Finally, the null analysis revealed a dozen or so places where the
nullness annotation was either wrong, or some null checking on
parameters or return values needed to be done.

Change-Id: I43b4e56e2d025a8a4c92a8873f55c13cdbc4c1cb
a881b0b34678ad76c9f5eba62fac7a00a22ac606 20-May-2012 Tor Norbye <tnorbye@google.com> Move XML code to the common library

The ManifestMerger library needs to look up the prefix to use for the
Android namespace, and the Document.lookupPrefix method is not
implemented by the Eclipse DOM implementation (which throws an
exception). However, we have an implementation of this in the ADT
plugin.

This changeset creates a new XmlUtils class in the common/ library
(which is accessible by both ADT and the manifest merger, and the
anttasks where the manifest merger is used), and moves the namespace
prefix lookup code in there. It also moves the XML escape methods
into that class. It also adds a new method to the ManifestMerger for
merging directly from documents (rather than files), and makes sure
that all the merging code goes via the prefix utility method rather
than calling the document.lookupPrefix method.

Finally, it moves the various string constants associated with XML
namespaces into the single XmlUtils class, since these were spread
across several different classes before (and many of them are needed
in the XmlUtils class).

The vast majority of the diffs in this changeset are related to simple
import statement changes to reflect the new locations of these
constants.

Change-Id: Ib8f3d0e5c89e47e61ea509a23925af7b6580abee
adee9788a5ac646a39b516abe4cdd1022911a3f5 09-Mar-2011 Tor Norbye <tnorbye@google.com> Add drop-support for include tags

Add the include tag back into the palette, and add special drop
support for it such that when it is drop, a resource chooser pops up
and asks you which layout to include. A new validator prevents any
layouts from being chosen that would result in a cyclic
dependency.

This requires some infrastructure changes: First, drop handlers must
distinguish between a view getting created as part of a previewing
operation and getting created interactively. Second, in order to
support cancel removing an inserted include if the user decides not to
set an include, the node wrappers need to support removing an element.
Also, use the metadata originally intended for the preview icon
factory to also bypass palette drag previews for widgets that don't
have UI.

Change-Id: I1bdd1766ca4cfa2fdbca25b77c50c74e9c332cbd
fe3eebe57ba2925642cc1b257cb03ba617d298af 09-Dec-2010 Tor Norbye <tnorbye@google.com> Issue 13051: Use match_parent or fill_parent based on API level

Fixes issue 13051: New layout editor always insert "match_parent",
even on older platform.

View rules can now look up the API level of the current project, and
based on that choose to use match_parent or fill_parent when they need
to manipulate the layout attributes.

Change-Id: I861e1f7f7409c40c05b1472268f120806667025c
dc040487da0fed1b5f366c5435bdff3638bc37b6 30-Nov-2010 Tor Norbye <tnorbye@google.com> Rename some layout editor classes

This changeset contains only renaming of some classes (and a couple
of >100 column adjustments), no semantic changes.

The name changes are:

BaseView => BaseViewRule
BaseLayout => BaseLayoutRule
ScaleInfo => CanvasTransform
CanvasSelection => SelectionItem
PropertySheetPage2 => PropertySheetPage
OutlinePage2 => OutlinePage

Change-Id: I14d8c711b12154f4fcb2169129fd553e31fdab84
bfcbad18934be1f51ae03d4b6255cfe2d7239aaf 24-Nov-2010 Tor Norbye <tnorbye@google.com> Extract layout constants into a separate constants class

Combine the constants in BaseView and a LayoutConstants class over in
the internal packages into a new LayoutConstants class, and reference
these constants elsewhere (statically imported). This was suggested by
in the feedback to review #18971.

Change-Id: I40b76f8f6045c34a98f7a2363f96d2942360d1f3
a2d7874ed23bfc2fa7665cc84901e0f4781b4e51 16-Nov-2010 Tor Norbye <tnorbye@google.com> Add per-view custom initialization logic

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