Skip to content

Commit aefb8b5

Browse files
Sally YuenGerrit Code Review
Sally Yuen
authored and
Gerrit Code Review
committed
Merge "Clarify CollectionInfoCompat isHierarchical" into androidx-main
2 parents a069f32 + 418bebb commit aefb8b5

File tree

1 file changed

+49
-7
lines changed

1 file changed

+49
-7
lines changed

core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java

+49-7
Original file line numberDiff line numberDiff line change
@@ -814,13 +814,55 @@ public String toString() {
814814
/**
815815
* Class with information if a node is a collection.
816816
* <p>
817-
* A collection of items has rows and columns and may be hierarchical.
818-
* For example, a horizontal list is a collection with one column, as
819-
* many rows as the list items, and is not hierarchical; A table is a
820-
* collection with several rows, several columns, and is not hierarchical;
821-
* A vertical tree is a hierarchical collection with one column and
822-
* as many rows as the first level children.
823-
* </p>
817+
* A collection of items has rows and columns and may be marked as hierarchical.
818+
*
819+
* <p>
820+
* For example, a list where the items are placed in a vertical layout is a collection with one
821+
* column and as many rows as the list items. This collection has 3 rows and 1 column and should
822+
* not be marked as hierarchical since items do not exist at different levels/ranks and there
823+
* are no nested collections.
824+
* <ul>
825+
* <li>Item 1</li>
826+
* <li>Item 2</li>
827+
* <li>Item 3</li>
828+
* </ul>
829+
*
830+
* <p>
831+
* A table is a collection with several rows and several columns. This collection has 2 rows and
832+
* 3 columns and is not marked as hierarchical:
833+
*<table>
834+
* <tr>
835+
* <td>Item 1</td>
836+
* <td>Item 2</td>
837+
* <td>Item 3</td>
838+
* </tr>
839+
* <tr>
840+
* <td>Item 4</td>
841+
* <td>Item 5</td>
842+
* <td>Item 6</td>
843+
* </tr>
844+
* </table>
845+
*
846+
* <p>
847+
* Nested collections could be marked as hierarchical. To add outer and inner collections to the
848+
* same hierarchy, mark them both as hierarchical.
849+
*
850+
* <p> For example, if you have a collection with two lists - this collection has an outer
851+
* list with 3 rows and 1 column and an inner list within "Item 2" with 2 rows and 1 -
852+
* you can mark both the outer list and the inner list as hierarchical to make them part of
853+
* the same hierarchy. If a collection does not have any ancestor or descendant hierarchical
854+
* collections, it does not need to be marked as hierarchical.
855+
* <ul>
856+
* <li>Item 1</li>
857+
* <li> Item 2
858+
* <ul>
859+
* <li>Item 2A</li>
860+
* <li>Item 2B</li>
861+
* </ul>
862+
* </li>
863+
* <li>Item 3</li>
864+
* </ul>
865+
*
824866
* <p>
825867
* To be a valid list, a collection has 1 row and any number of columns or 1 column and any
826868
* number of rows.

0 commit comments

Comments
 (0)