History log of /frameworks/base/core/java/android/widget/GridLayout.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
b65408fc0fefa82161475de7f7f32284f6f60a56 21-May-2012 Philip Milne <pmilne@google.com> Doc changes for GridLayout.

Add some javadoc to explain orientation property properly.

Change-Id: I1e2092f32fe2f524eda7d1c46c6daad571733c1f
/frameworks/base/core/java/android/widget/GridLayout.java
0f57cea8989cc03bcae19b621096e50b035b7308 12-May-2012 Philip Milne <pmilne@google.com> Add validation code for GridLayout.LayoutParams

Bug 6404882.

The supplied code in this bug sets up a table with 2 columns and then
tries to add a component in column 5. Earlier attempts to fix this
by 'doing what the user meeant' had unwanted side-effects. This CL is
intended to defend against all ways to register invalid LayoutParams
and throw IllegalArgumentExcpetion when any column index falls outside the
range [0 .. N] where N is the number of columns. It also includes the
symmetrical check for rows.

Change-Id: I958a6d16035889cd954b78108773426e8b6b6d95
/frameworks/base/core/java/android/widget/GridLayout.java
782c04b864dc5f71f7ec0c8e36cbaf5b838dc69c 03-May-2012 Jim Miller <jaggies@google.com> Revert "Fix for layout parameter validation bug in GridLayout."

This reverts commit 8a36e05443f13edde1eae0cf6ea01b3b2da6e637 which was causing
keyguard_screen_tab_unlock.xml to have a bad layout.

Change-Id: I50bdc6dbdf8d7b98ef77eae532860d375574213e
/frameworks/base/core/java/android/widget/GridLayout.java
8a36e05443f13edde1eae0cf6ea01b3b2da6e637 01-May-2012 Philip Milne <pmilne@google.com> Fix for layout parameter validation bug in GridLayout.

Bug 6404882.

When a cell has an unspecified row and a column that is specified as greater
than the specified number of columns, GridLayout fails to report or correct
the error and loops indefinitely searching for a valid row to place the cell.

There is a cyclic dependency between the validation of layout parameters
(and allocation of undefined cell indexes) and the maximum column/row counts.
A performance optimization in layout paramter allocation caused this dependency
to be handled in correctly. The problem is fixed in this CL for this bug and
the symmetric problem for rows.

Change-Id: I0392343bc8a721a0ca7163f58f233ba8046c22e2
/frameworks/base/core/java/android/widget/GridLayout.java
7a23b49a8ceb07d3fa12c45fd42cd16131fd746a 25-Apr-2012 Philip Milne <pmilne@google.com> Fixes for optical bounds feature.

1. Make the feature opt-in (ViewGroup::layoutMode defaults to CLIP_BOUNDS) without inheritance.
2. Rename COMPONENT_BOUNDS to CLIP_BOUNDS.
3. Rename LAYOUT_BOUNDS to OPTICAL_BOUNDS.
4. Complete GridLayout implementation.
5. Change the default_gap between components to 8dp, to align with the Style Guide.

Change-Id: I8d40dfc5f4ca469f6424eb3ff60d07bec56e3a9f
/frameworks/base/core/java/android/widget/GridLayout.java
10ca24a97cefc14fca1b26f59e627f487b3b108b 24-Apr-2012 Philip Milne <pmilne@google.com> Promote layout debugging code from GridLayout to ViewGroup.

Layout debugging code draws rectangles around:

1. Layout insets (red)
2. Bounds (blue)
3. Margins (magenta)

Layout debug mode is enabled with:

adb shell setprop debug.layout true

Change-Id: Ia155a2d0fbf33693a1e3c040f627ea3a534e1aff
/frameworks/base/core/java/android/widget/GridLayout.java
1557fd7809078e421f751efc7d2539b3efdc54b2 05-Apr-2012 Philip Milne <pmilne@google.com> Fix for bug 6110465.

Add layout bound metadata to 9-patch files and make layouts take them into account.

This CL contains a proposed API for dealing with layout bounds.

This solution exposes:

1. Class: Insets - for storing layout Insets (and later possibly padding).
2. Methods: View:(get/set)LayoutInsets() - for storing layoutBounds.
3. Methods: ViewGroup:(get/set)LayoutMode() - for controlling layoutMode.

It also iuncudes the changes to GridLayout to support layout bounds.

Change-Id: I60c836b6530b61c5abf37f93ee9c44aad73573f1
/frameworks/base/core/java/android/widget/GridLayout.java
edd69518ffec87fb7b1931e708678ef441152cde 15-Mar-2012 Philip Milne <pmilne@google.com> Fix for bug 6170890.

Also fix logic for consistency checking. Prior to this CL
GridLayout was causing Launcher to issue warnings to the logs
incorrectly.

Change-Id: I9d4017388e7c80c8bc5fa6cab97970835ff261fe
/frameworks/base/core/java/android/widget/GridLayout.java
6216e87fe8ad3273855233965b34049d22763e94 17-Feb-2012 Philip Milne <pmilne@google.com> Fix remaining issue with bug #5904777

LEFT alignment in an RTL environment had the wrong 'gravity'.

This was due to a modelling error in GridLayout which is fixed in this CL.

Also apply some very minor simplifications and refactorings following the
addition of RTL support.

Change-Id: I153bc06d3c22dcb9954e4cbdfa89625823239b89
/frameworks/base/core/java/android/widget/GridLayout.java
d7dd89095ff2041f0793317c4ee8e8be49388148 27-Jan-2012 Philip Milne <pmilne@google.com> New hooks to allow layouts to improve their performance by doing more caching

This change allows layouts to be notified of changes to LayoutParameters that have occurred
between layout operations.

If an assignment is made to the fields of LayoutParams instances that are already in use,
cachced data may become inconsistent with the new values. For complex layouts, like
GridLayout, in which the layout parameters define the structure of the layout, caching
could have caused ArrayOutOfBoundsException to be raised without this change. This case is
rare in normal code as initialisation is typically performed once. Its nevertheless possible
and much more likely in environments like design tools where layout parametrs may be being
edited on the fly.

Prevent errors as follows (belt and braces):

1. Change javadoc to request that changes to the fields of LayoutParams be accompanied with
a call to View.setLayoutParams(). (This calls requestLayout() which was what the previous
javadoc advised.) Provide a (for now, private) hook for layouts with caches to receive notification
of such calls so they can invalidate any relevant internal state.

2. For GridLayout, we cannot clone layout parameters as traditional Java grids do without retaining
two complete copies because of the public getLayoutParameters() method on View. Retaining two
copies is wasteful on constrainted devices. Instead, we keep just one copy and compute a hashCode
for the critical fields of a GridLayout's layoutParams. The hashChode is checked it prior to all
layout operations; clearing the cache and logging a warning when changes are detected, so that
developers can fix their code to provide the call to setLayoutParams() as above.

Change-Id: I819ea65ec0ab82202e2f94fd5cd3ae2723c1a9a0
/frameworks/base/core/java/android/widget/GridLayout.java
47d248eb438674ab0ca10154f3ff5e88f4ed70b7 09-Feb-2012 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #5904777 GridLayout should be RTL aware

- update also DEBUG mode for taking care about RTL
- one minor issue remaining: left alignment is not properly honored in RTL

Change-Id: I9a4c8413cb1189a032649472016994642418637b
/frameworks/base/core/java/android/widget/GridLayout.java
0d29936ec3b5545a415e8d032150ea987aab36e3 26-Jan-2012 Chet Haase <chet@google.com> Fix bug in LayoutTransition for INVISIBLE views

When a view is becoming VISIBLE or INVISIBLE in a container with a
LayoutTransition, animations run to fade the view in and out and also
to run 'changing' animations on the view's other siblings. This logic
also cancels any running 'changin' animations to account for new ones
running.

However, in the specific case of INVISIBLE changes, there will be no
layout changes in the container - layout has already accounted for that
view (unlike in the case of GONE views); the visibility is just a matter of
drawing the view (or not). Therefore, we're canceling 'changing' animations
that should continue running and not replacing them with any other animations,
since new animations would only be started on layout chnages which are not
forthcoming.

One artifact seen from this bug is that the navigation bar buttons sometimes
disappear when changing orientation. This is because the menu button may
toggle between VISIBLE and INVISIBLE, causing animations on the other
buttons to get canceled, which leaves those views in a completely wrong
state.

The right thing to do is to avoid canceling in-process 'changing' animations
and to skip the logic of setting up new 'changing' animations which won't fire
anyway.

There is some minor API work in here because we did not previously have the
necessary information in LayoutTransition to know whether a view was being
hidden or shown to/from the INVISIBLE state.

Issue #5911213: LayoutTransitions ending in an odd state

Change-Id: I5c60c8583c8ea08965727b4ef17b550c40a3882c
/frameworks/base/core/java/android/widget/GridLayout.java
8a78fd4d9572dff95432fcc4ba0e87563415b728 17-Jan-2012 Svetoslav Ganov <svetoslavganov@google.com> AccessibilityEvent/AccessibilityNodeInfo class name property should be set to only framework classes.

AccessibilityEvent and AccessibilityNodeInfo have a property className which is set to the source
Java class. This is problematic since leads to leaking private classes which would allow an
accessibility service to load classes from other packages. This is strongly undesirable since
not trusted code can be loaded, and hence executed, in the accessibility service. To address
that the class name is set to the most concrete framework class extended by the info/event
source.

bug:5878943

Change-Id: I7b3114ece8772ea2773f5151e21b8a6f2006882a
/frameworks/base/core/java/android/widget/GridLayout.java
ecab1178648670f2c72b47faf250040fcded3d13 26-Oct-2011 Philip Milne <pmilne@google.com> Update to fix for bug 5393156

Tweak to the logic to take account of margins when gravity = FILL is used and
there is a measurement dependency between the axes (as in mulit-line text).

Change-Id: I91b9143c2d5db41cb67dd641d5c7ea0b56cae7ff
/frameworks/base/core/java/android/widget/GridLayout.java
4a145d72622772b920f60195e80942058984259c 29-Sep-2011 Philip Milne <pmilne@google.com> Fix for 5393156

. Fix for the above.
. Make instances of Space invisible by default.
. Correctly accomodate parental constraints when row/col order is undefined.

This fix allows GridLayout to accomodate simple dependencies between
its axes. In the example given in bug 5393156, the presence of a
multi-line TextView means that GridLayout can only compute its height
after it has computed its width. This fix adds a second measurement pass
to GridLayout that passes infomation betwen the axes, using the GridLayout's
orientation property to indicate which axis should be examined first.

Change-Id: I90761c6fcfe8edc7ef6d9a89076fd5cda3adc0a4
/frameworks/base/core/java/android/widget/GridLayout.java
f6679c88d12e9f7e10e6884d4a8487673e53c097 18-Sep-2011 Philip Milne <pmilne@google.com> Fix for http://b/issue?id=5297155

. Make GridLayout dynamic (see below)
. Change access modifiers from private to package private
(to remove access$XX methods generated by compiler)
. Make private internal classes final (+10% perf)
. Update javadoc and add limitations section
. Improve error diagnostics

The bug above highlights the fact that GridLayout is a static
rather than dynamic layout - i.e. that the structure of the
grid could not be changed once it had been set up. This fix changes
GridLayout to a dynamic layout in which changes to its orientation,
rowCount and columnCount properties may be effected between layout
operations.

This change does not require a change to GridLayout's public API.

Change-Id: If5643574422dcfd3a557ce4db2bb19498dc6ecd8
/frameworks/base/core/java/android/widget/GridLayout.java
b559976a50c34848d602cc7138859507a379893c 05-Aug-2011 Philip Milne <pmilne@google.com> Remove call to setPadding() in setUseDefaultMargins().

It is not possible for teh user to override the assigned padding values
because the XML attributes are processed in the opposite order.

Also, make the XML and Java examples grid3.xml and Activity2.java
consistent in preparation for a move to API demos.

Change-Id: I47334f9f5a46a8a528067d88350dd70eaa38ff33
/frameworks/base/core/java/android/widget/GridLayout.java
4c8cf4c93314722a77ce69396b9cb201ac007a58 03-Aug-2011 Philip Milne <pmilne@google.com> Tidy.

Simplify logic for alignment modes.
Simplify drawing of rectangles.
Remove redundant code that was generating warnings in IDEA.
Remove the flexibility variable from Spec as it always has the value UNDEFINED.
Supress remaining inspection warning for clean (green) inspection status.

Change-Id: I2ddd80c68e7a6db0877648c2fdecefe9dbe7d32f
/frameworks/base/core/java/android/widget/GridLayout.java
899d5922870c78e0e663bc5661849eb468afc984 21-Jul-2011 Philip Milne <pmilne@google.com> Fix for http://b/issue?id=5081478

GridLayout needs to call measure on children after it knows how large children should be

Also:

. Remove deprecated methods and XML attributes.
. Stop Spaces having margins by default.
. Remove getSpacers() and findUsed()
. Change default for row/columnOrderPreserved() from false to true.
. Improve automatic index allocation mechanism to use individual maxima.

Change-Id: Id79fbb2e70a0bf2002191ec2a9746547d896de72
/frameworks/base/core/java/android/widget/GridLayout.java
5125e21bc0bbe5b9718d0f03b26cdafc67a7c726 21-Jul-2011 Philip Milne <pmilne@google.com> Fix for http://b/issue?id=5064532

5064532: GridLayout with initial "stretchy" row and "gone" view in last row doesn't stretch properly

Also:

. Infer stretchibility from whether or not gravity is defined.
. Make algorithms for handling flexibility within cell groups consistent
with those acting between cells groups (via constraint system).
. Hide and deprecate methods taking flexibility argument.
. Hide and deprecate CAN_STRETCH constant.

Both deprecated features will be removed after references are removed from platform.

Change-Id: Iabf2bf19f35cf30b8ec49c99b49a0550fd495125
/frameworks/base/core/java/android/widget/GridLayout.java
83261239b07e1f3d2989bb4957e6a0e97c40a157 21-Jul-2011 Jim Miller <jaggies@google.com> Merge "Fix 5056699: GridLayout should maintain static indices for "gone" views."
6235b47cba0eddd0662eefc5218377c478036279 21-Jul-2011 Jim Miller <jaggies@google.com> Fix 5056699: GridLayout should maintain static indices for "gone" views.

GridLayout currently ignores views with visibility="gone" when accounting for rows/columns.
Instead it should count views with visibility="gone" as rows/columns with row/height equal to 0.

This also makes it consistent with other ViewGroups like LinearLayout where "gone" views
don't change order and are still present (but hidden) within a container.

Change-Id: I289d4ee6275d5b49b1e1d79985484216bbf48089
/frameworks/base/core/java/android/widget/GridLayout.java
350f0a63c9e785304063a95a6df9e128a67ec64f 19-Jul-2011 Philip Milne <pmilne@google.com> Expose to the platform the ability to pick up changes in child visibility.

Also:

. use above, to flsuh GridLayout state when child's GONE state changes.

Change-Id: I8567c24b51b807f0625918d42b6847a5a350311d
/frameworks/base/core/java/android/widget/GridLayout.java
e7dda0bb3d2b097f36b3e59f34fb5ab70e36b555 19-Jul-2011 Philip Milne <pmilne@google.com> Fix build breakage.

Change-Id: Ifdc2c02c8c18d3d372e6d2043c4819a0a7384c97
/frameworks/base/core/java/android/widget/GridLayout.java
f51d91c3ab232154b6c00d7f71377ff2421f79bf 19-Jul-2011 Philip Milne <pmilne@google.com> Gather View's hierarchy notifications into methods that can easily be overidden.

Also:

. Remove backward compatibility Group class now that AppsCustomizePagedView has been updated.

Change-Id: Ie3eabbdf57a539b28cdc3fd6d48cd984a4014960
/frameworks/base/core/java/android/widget/GridLayout.java
b0ce49b5ad53631ff0c3cdd8266e82f3c20c65dc 16-Jul-2011 Philip Milne <pmilne@google.com> Derive GridLayout's 'gap' constants from new "default_gap" entry in dimens.xml.

Also:

. removed static import of R.styleable - this is non-standard
. removed final modifier from DEBUG flag,
this prevents the compiler from excluding the debugging code but
allows debugging code to be enabled externally
. added override to removeAllViews() as GridLayout needs to be notified whever hiearchy changes.

Change-Id: I2409289bce7c6638eff320ffd48a6c0704e77fa8
/frameworks/base/core/java/android/widget/GridLayout.java
93cd6a6c78683643de51f9e698b38847bd1f1155 12-Jul-2011 Philip Milne <pmilne@google.com> Rationalize API after adding maximum size feature.

. Change name of Group to Spec
(with the addition of the fglexibility field, this class no longer represents a group)

. Replace overloaded Group/Spec constructors with factory method

. Bugfix for measure() when alignmentMode == ALIGN_BOUNDS

. Bury as much Java API as possible, to minimize restrictions on future API enhancements

- make all field access in Group package private
- use factory methods in place of field assignment

Change-Id: I46a5027a013bf7c3110b77108b8fd0427165cd18
/frameworks/base/core/java/android/widget/GridLayout.java
5d1a9840aaf57ae90716f0ac34abdcd09f7f4ed6 07-Jul-2011 Philip Milne <pmilne@google.com> Simplify and tidy the API for maximum value support.

Also:

. Remove CAN_SHRINK, FIXED from public view. These can be added later.

Change-Id: I63a64ac4748605da60373c8e3c2109178b5260c2
/frameworks/base/core/java/android/widget/GridLayout.java
48b55244d286b6d4e3699a5d9e938a9c87aaae75 29-Jun-2011 Philip Milne <pmilne@google.com> Support for maximum values in layout GridLayout.

A cell's ability to shrink or stretch is now integrated with the
constraints system, which is now supplied with both upper and lower
bounds.

Also:

. Remove package private access (pseudo) annotation
. Remove rowWeight and columnWeight attributes and fields
. Remove code to handle weights

Change-Id: I9e2432101d15466c621f51ae362435051fab5764
/frameworks/base/core/java/android/widget/GridLayout.java
a1f7b10f7299b40ee3a4e5e309882ea1a931cd5e 23-Jun-2011 Philip Milne <pmilne@google.com> Handle baseline aligned rows in which some components define baseline and some don't.

Also:

. Make all of the methods in Alignment package private.
. Inlucde Tor's test case

Change-Id: If78a6a3b653723d9e12d6b162fd0c86b11a82dff
/frameworks/base/core/java/android/widget/GridLayout.java
1fd16378812792913a6aa6923acbec20037e09ff 21-Jun-2011 Philip Milne <pmilne@google.com> Minor tweaks to GridLayout for KeyGuardScreenUnlock.

Also:

. Swapped order of args in internal getMargins() methods.
. Stopped implying row/col weight = 1 when size = MATCH_PARENT.

Change-Id: I657fb3e54867eb9735f9509878968941bf6a6a49
/frameworks/base/core/java/android/widget/GridLayout.java
b3a8c54389c9be2b37c5524ad8eb3112054221a7 21-Jun-2011 Philip Milne <pmilne@google.com> Accomodate margins in child measurements.

Also:

. Cater for components that are GONE.
. Include code to draw component bounds and margins when in DEBUG mode.

Change-Id: I688f8b638469eb11987ebb207b7db1dc953e84e7
/frameworks/base/core/java/android/widget/GridLayout.java
09e2d4d0d5101e2fc44909b83965465a7b90afab 20-Jun-2011 Philip Milne <pmilne@google.com> Ensure measuredWidth > getSuggestedMinimumWidth(), same for height.

Change-Id: I7f2dc2e874d8aacf961e98fe41139ada7a992449
/frameworks/base/core/java/android/widget/GridLayout.java
a789cafb066fd98e0e7f7ce506e3defa8104ba80 17-Jun-2011 Philip Milne <pmilne@google.com> Pass width/height specs in the standard way when measuring children.

Change-Id: I127b206cb677f8a09990b6852c98023d6c97112d
/frameworks/base/core/java/android/widget/GridLayout.java
1e54825135a7ccde421aa7fc400ab69e9348b5d6 17-Jun-2011 Philip Milne <pmilne@google.com> Change includeMarginsInAlignment flag to aligmentMode property.

Also:

. Change getInteger() to getInt().
. Conditionally compile, Paint() allocation and initialization.
. Correct spelling mistake in javadoc.

Change-Id: I00438a717e635a3917c5324f56063dce2e6041e8
/frameworks/base/core/java/android/widget/GridLayout.java
452eec33d667f9e705b57e60948b070536fbc1b4 17-Jun-2011 Jim Miller <jaggies@google.com> Merge "Update GridLayout constructors to properly handle DEBUG=true"
c655ba5e467090eb4f839f148ac31b50c389ffb2 17-Jun-2011 Jim Miller <jaggies@google.com> Update GridLayout constructors to properly handle DEBUG=true

This fixes a case where the grid layout debugging wasn't showing.

Change-Id: I28b2754d2d824731e24126300bc501ae2e379ee4
/frameworks/base/core/java/android/widget/GridLayout.java
c9885f6557dc1c96e2cc2c1a86fba359f00f131c 16-Jun-2011 Philip Milne <pmilne@google.com> Future-proofing: change Alignment interface to abstract class and add a parameter for measurementType.

Also included bugfix from Winson: arcs wre not being cleared in invalidateStructure() so
state wasn't properly cleared when children were added after the first layout operation.

Change-Id: I7b46eadd955bd74b7bb3e4dad2f47ed3f092ff63
/frameworks/base/core/java/android/widget/GridLayout.java
51f17d54613c33638c8a2da8affcd9ba35994cb3 13-Jun-2011 Philip Milne <pmilne@google.com> Bugfix for GridLayout assuming that the x value of last column index is maximal. This is not the case when column indexes are defined incorrectly and GridLayout should still work in this case.

Change-Id: I5deb3fb43ed1dd16dd20868854b96ebae4d30623
/frameworks/base/core/java/android/widget/GridLayout.java
f474870fe1189f73cf8ffbaba9e524ef194b5043 10-Jun-2011 Philip Milne <pmilne@google.com> Optimise the way that indices are auto-allocated so that XML files can normally avoid using indices.

Change-Id: Iafb25b17fec9391664c81a7e213eeaa918254912
/frameworks/base/core/java/android/widget/GridLayout.java
7fd948756947506db62a2bafca2ed45ff53ac0a0 08-Jun-2011 Philip Milne <pmilne@google.com> Fix for baseline alignment in LinearLayout compatibiity mode.

Change-Id: Iaa194537c1bc493172fab89624279fe5cbfa1f70
/frameworks/base/core/java/android/widget/GridLayout.java
aa616f31fe7c0c8e3657bb9a5889ec5e56ee5232 28-May-2011 Philip Milne <pmilne@google.com> Response to code review for GridLayout:

. Fixed spelling.
. Added comments on internal methods.
. Adopted the suggested internal name changes to improve clarity.
. Added UNDEFINED constant to public API to avoid making reference to Integer.MAX_VALUE in docs.
. Added final everywhere, then removed it.
. Make the Interval class package private so that it can be put somewhere more general later.
. Tidy code, removing maximize flag throughout.
. Remove last of allocations taking place during layout.
. Implement measureChild() etc.
. Added LinearLayout alignment compatibility mode, and made it the default.

Change-Id: I6a4ffa022d97d68138d1903d3830a20278815435
https://android-git.corp.google.com/g/#change,109891
/frameworks/base/core/java/android/widget/GridLayout.java
3f8956d82bb40b15acee26017db0d13ddf43c80a 13-May-2011 Philip Milne <pmilne@google.com> Introduction of GridLayout.

Change-Id: Ia2ec315e7d29dcc5aa13b080fc6ce00708e9c034
/frameworks/base/core/java/android/widget/GridLayout.java