summaryrefslogtreecommitdiff
path: root/core/java/android/widget/LinearLayout.java
Commit message (Collapse)AuthorAgeFilesLines
* Fixed divider rendering in RTL languagesAlex Stetson2022-08-031-1/+63
| | | | | | | | | | | | | | | In horizontal layouts, when elements are rendered from LTR, the definition of "before" and "after" gets flipped, causing the divider spacing to be allocated to the wrong locations. By flipping the check in RTL layouts, the dividers can be placed correctly. Additionally, it is necessary to add divider measurements to all layout width measurements to allow for dividers in right gravity to layout properly. Bug: 208927871 Test: atest android.widget.cts.LinearLayoutTest Change-Id: If6e917873571484a6fb1dfc28b356289e2cc1ffa
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-2/+2
| | | | | | | | | | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. This is a resubmit of ag/12929664 with some APIs excluded that caused test failures; see bugs 171886397, 171888296, 171864568. APIs excluded: Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord; Landroid/os/Process;->myPpid()I Landroid/os/SharedMemory;->getFd()I Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I Bug: 170729553 Test: Treehugger Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
* Revert "Add maxTargetSdk restriction to unused APIs."Hongwei Wang2020-10-281-2/+2
| | | | | | | | | This reverts commit 72f07d6a8a32db4a0dedd7682a0b3385be2b9cd6. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397 Bug: 171886397 Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-271-2/+2
| | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-061-1/+1
| | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I41e12e425284e74561c6b61663241df364ae54a1
* Rename @EnumEntry and @FlagEntryAshley Rose2019-03-181-2/+2
| | | | | | | Test: atest CtsViewInspectorAnnotationProcessorTestCases Bug: 127531820 Exempt-From-Owner-Approval: Annotation-only change Change-Id: Id293e2b2ac9cf7bf2aaeb28645471ea227bb587b
* Add @InspectableProperty annotations to LayoutParamsAshley Rose2019-03-041-0/+4
| | | | | | Change-Id: I69eb71bec8bbf36564e178a3ddf4be9e00e2d531 Fix: 126913705 Test: m framework
* Update core widgets to save attribute source info.Aurimas Liutikas2019-02-071-0/+2
| | | | | | Bug: 111439551 Test: make -j Change-Id: I72997a87122f38b32e38e42a690385acc7d0e521
* @InspectableProperty coverage for android.widgetAshley Rose2019-02-041-0/+11
| | | | | | | | | A few getters for view properties have been added where they were missing. CTS tests for the new APIs are pending in b/123894719. Test: m framework Bug: 120492712 Change-Id: I743ce693d384eaf749ced3db7f81bda7d19ed275
* Restrict unsupported usage of Linear/RelativeLayout APIsClara Bayarri2018-11-221-1/+1
| | | | | | | | These internal accesses can be done by existing public API Bug: 117521217, 117521667 Test: make Change-Id: I31116551f6e5a4f8c84a811f62419302fee91c2c
* docs: fixed instances of typo in 'overridden'kopriva2018-09-131-2/+2
|\ | | | | | | | | | | am: debd4ee72d Change-Id: Idde6240486463dee51cdc27b8cd066a80fb869e0
| * docs: fixed instances of typo in 'overridden'kopriva2018-09-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This affects several files beyond those mentioned in the bug. I didn't fix some instances because the files had code problems that blocked presubmit checks. Test: make ds-docs Bug: 37094741 Change-Id: I642f0384fef2b267ebc970bae1b4fb90bae667e7 Exempt-From-Owner-Approval: Docs-only change
* | Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-211-0/+10
|/ | | | | | | | | | | | | | | | | For packages: android.widget This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Idf7ccc7a850fa984ea16f91cdd70159087274e5c Merged-In: Ic61019b1df85448a158fc2ba55c326353222c6b9
* Add targetSdk check around new LinearLayout weighted measure behaviorChet Haase2018-04-111-2/+24
| | | | | | | Bug: 73827180 Test: Existing CTS tests in LinearLayoutTest Change-Id: I88dfde3743d0f954cd275be6a0032fe30ef55c03 (cherry picked from commit 28230e5efa86aa324fef3e95395d61a4518fa804)
* Always remeasure weighted children, even if there's no excess spaceAlan Viverette2018-02-161-2/+2
| | | | | | Bug: 72630654 Test: atest LinearLayoutTest Change-Id: Ie9637950aef32f080b8284a63003eb61c0a88841
* Add more IntDef prefixes for auto-documenting.Jeff Sharkey2017-12-131-7/+6
| | | | | | | Test: builds, boots Bug: 70177949 Exempt-From-Owner-Approval: annotation-only changes Change-Id: I76dde6054e06f52240bd4b1a0f196dcb74623608
* Fix broken javadocs.Jeff Sharkey2017-08-061-1/+1
| | | | | | Bug: 64337634 Test: make -j32 doc-comment-check-docs Change-Id: I20fdd3dcddef09111d35946c41c596c7689effa6
* Merge "Tweak initialization order of LinearLayout's dividers" into oc-devKirill Grouchnikov2017-04-281-1/+1
|\
| * Tweak initialization order of LinearLayout's dividersKirill Grouchnikov2017-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In ag/969570 we've unified the treatment of divider logic in LinearLayout. However, setDividerDrawable logic that was calling setWillNotDraw added condition that the divider position is not NONE. That made the initial flow effectively not calling setWillNotDraw(false). Changing the order to call setDividerDrawable() at the end invokes the right logic. Test: adb shell am instrument -e class 'android.widget.cts.LinearLayoutTest' -w 'android.widget.cts/android.support.test.runner.AndroidJUnitRunner' Bug: 37698004 Change-Id: I8d95770b9f48277c402708fbc5279ba2ec56719f
* | docs: Update LinearLayout JavaDoc commentsJoe Fernandez2017-04-251-12/+35
|/ | | | | | | | | | | | | | | Updated top-level description to: - favor explanations of using XML for setting attributes (instead of using methods like setGravity() - add code example - clarify what "child view" means - add context around cross-link to layout params - add context around cross-link Linear Layout guide (this guide focuses on layout_weight) Test: docs change only. Tested with doc build Change-Id: Ifc1fa4cf24e2afa229f1c20b3f725073aff162d7
* Fix import statements in android.widget package.Aurimas Liutikas2016-10-111-47/+47
| | | | | | | Additionally this CL removes spaces at the end of the line. Test: code still compiles. Change-Id: I1ce98b4e70aa3ae614f87966c3bc6181fa4389a4
* Various doc cleanupsChet Haase2016-08-261-2/+2
| | | | | | | | | Issue #6439958 More R.attr breakage Issue #918412 android.graphics.Paint.FontMetricsInt fields & methods need doc Issue #917387 javadoc bug: Canvas.EdgeType has minimal documentation Issue #18948460 [DAC-bug] LinearLayout xml layout_weight parameter is missing description Change-Id: Idb289ca778b3f316923757405460031ce7a5e1e9
* Target API check for margin params fix am: 2dd20a61e9 am: 6efd207022Yigit Boyar2016-08-031-6/+7
|\ | | | | | | | | | | am: 5eede8910b Change-Id: I748d223c4dcec4f0234b0e4e808ae982efbd0bd5
| * Target API check for margin params fixYigit Boyar2016-08-021-6/+7
| | | | | | | | | | | | | | | | | | | | | | Prior to N, our widgets were not converting MarginLayoutParams properly between ViewGroups. The fix intrudced some issues in older apps as the broken conversion code would hide developer errors. This CL guards the change with a target API check so that we don't affect older apps. Bug: 30378230 Change-Id: I215281d261b553c3b4cedcd29ea0a861df809471
* | Merge \\\"Exclude children from excess space distribution when using largest ↵Alan Viverette2016-06-301-2/+6
|\| | | | | | | | | | | | | | | child\\\" into nyc-dev am: 7705d5fd6e am: 650cc68f10 am: 0c359bad53 Change-Id: I116d4bd532751159c59f8178dead7503e562af85
| * Exclude children from excess space distribution when using largest childAlan Viverette2016-06-301-2/+6
| | | | | | | | | | | | | | Preserves API 23 behavior. Bug: 29872769 Change-Id: I514cde81dcca4d78238f407251805cced4c0bea1
* | Merge "Revert "Always assign leftover pixels to last weighted child"" into ↵Alan Viverette2016-05-051-24/+6
|\| | | | | | | | | | | | | | | | | | | | | nyc-dev am: 3a3fb73c75 am: ff71f781a3 am: 91aefd574c * commit '91aefd574c24ac84f77319163249156baa2fab2b': Revert "Always assign leftover pixels to last weighted child" Change-Id: I020369fa95fc497d3551678b815dba50d64085a6
| * Revert "Always assign leftover pixels to last weighted child"Alan Viverette2016-05-051-24/+6
| | | | | | | | | | | | | | This reverts commit cc26636f08da89f9750f550d66aa213f1ae24f7f. Bug: 27690033 Change-Id: Ib7084dd8961cd486de4e6b13e36da7be887b1835
* | Merge "Always assign leftover pixels to last weighted child" into nyc-dev ↵Alan Viverette2016-05-051-6/+24
|\| | | | | | | | | | | | | | | | | | | | | am: a11c21b412 am: 9204810e66 am: 8902b96225 * commit '8902b962250439c5a0f80b3cca4c39bc9ee0fa73': Always assign leftover pixels to last weighted child Change-Id: Ib229a7cc5550942eb094c8d549711129af8594a0
| * Always assign leftover pixels to last weighted childAlan Viverette2016-05-041-6/+24
| | | | | | | | | | Bug: 27690033 Change-Id: Ibee51d49d3f7aa923750ce330df2e1aa2156f2bd
* | Aligning behavior of LinearLayout divider APIsKirill Grouchnikov2016-04-281-9/+36
|/ | | | | | | | | | | | | | | Consistency for: * Early return on calling setter with the current state * Calling setWillNotDraw when divider is configured with drawable and visible * Calling requestLayout to trigger a relayout pass Also fix a bug that wouldn't show end divider when all non-GONE children have 0 width/height. Bug: 28398719 Bug: 28404367 Change-Id: I16796c74a52ac4c3041390c75add2ec3c33bea8b
* Fix generate layout params to preserve marginsYigit Boyar2016-03-221-2/+8
| | | | | | | | | | | This CL fixes a common bug in framework's widgets where they were not converting a child's margin layout params properly. The CL fixes, FrameLayout, RelativeLayout, GridLayout and LinearLayout. Bug: 27785449 Change-Id: Icecd9181ff82107e412174fe152f35d32d36b2e6
* Revert linear layout weight distribution algorithmAlan Viverette2016-03-181-12/+18
| | | | | | | | Ensures that weight is fully (though not necessarily evenly) distributed. Previously, we could end up with extra undistributed pixels at the end. Bug: 27690033 Change-Id: If3db83f33145500fa8be006f373c54297733e76f
* Add LinearLayout#getGravityJason Monk2016-01-201-0/+10
| | | | Change-Id: I290790b8e84e14f2702c6fc9c679b1c435cc13a8
* Handle null result from getVirtualChildAt()Alan Viverette2015-12-171-15/+7
| | | | | | | | Also adds final where the method was being called, adds Nullable annotation to method, and updates docs. Bug: 25985497 Change-Id: I847a8507f2e3970f1340cddf4abf8650dda22b35
* Revert "Add support for partial view layouts"Chet Haase2015-12-081-57/+0
| | | | | | | | | | | | This reverts commit c55d5072ac52cee1811b52406419228fa81119ce. There were several bugs related to incorrect handling of various layout issues (layout not being run on containers/views that needed it), reverting to take another run at it outside of master. Issue #25980198 requestLayout() sometimes doesn't result in measure/layout for view Change-Id: Ic0e159cbcf6171652d8fd1bee9ae44a3977cea04
* Fix requestLayout() optimizationsChet Haase2015-12-071-1/+1
| | | | | | | | | | | A bug in recent layout optimizations was causing the framework to avoid laying out containers with WRAP_CONTENT in one axis or the other. This fix updates the logic in the code that finds dependent layout axes to correctly account for this case. Issue #25980198 requestLayout() sometimes doesn't result in measure/layout for view Change-Id: Ie5f678beef5d8c4ba25291ffdcd59797d4697acc
* Add support for partial view layoutsAdam Powell2015-11-191-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Traditionally, when a view called requestLayout it would force recursive requestLayout calls for all parent views up the hierarchy. This meant that there was no way to determine at traversal time whether a parent view itself needed layout, or if just one of its descendants did. Add a ViewParent method requestPartialLayoutForChild(View). This lets a caller state that a particular child of a given parent needs a remeasure and relayout at its current measured size and position within that parent. This can help prevent the full-tree relayout often caused by otherwise trivial changes. Partial layouts are processed after any pending "full" relayout during ViewRoot traversals, but before drawing. Add a ViewGroup method requestLayoutForChild(View). This lets a ViewGroup decide whether it is more appropriate to request a traditional relayout or a partial layout for itself or just the child that changed. Add a ViewParent method findDependentLayoutAxes. This allows a caller to check if the ViewParent's layout is dependent on a specific direct child view along one or both axes. Called recursively, this can be used to determine if a change in a child view can be isolated to a partial layout, even if its direct parent's own layout is tied to its other ancestors. (e.g. MATCH_PARENT, LinearLayout weights) Implement ViewGroup#requestPartialLayoutForChild to call new ViewParent method findDependentLayoutAxes and based on the result, either request a full layout for itself or a partial layout for the child in question. Implement findDependentLayoutAxes for common framework ViewGroups. A private implementation in ViewGroup is available for use by framework classes that will deal with basic LayoutParams. These implementations specifically check for derived LayoutParams classes and abort the optimization if they find something beyond their expected parameter types. Change-Id: I0a1a9b79293d17d4fae8d9892b96d3586f9401ae
* Correctly distribute weight to pre-measured zero-dimension viewsAlan Viverette2015-08-251-111/+107
| | | | | | | | | | | | | | | | | | | Previously, the measurements obtained from LinearLayout when using EXACTLY and AT_MOST modes would be different even if the resulting height was the same. This was the result of non-EXACTLY measurement accounting for the size of zero-dimension views and then redistrib- uting space as though they had initally been set as AT_MOST, whereas EXACTLY would always redistribute space as though they had initially been set as zero-dimension. Makes perfect sense, right? This CL updates non-EXACTLY measurement to always calculate the minimum dimensions requested by zero-dimension views, but then to redistribute the space according to weight. Bug: 22810327 Change-Id: Iba8a3d26f2724e5fa9a30457119b4564eb285edb
* Revert two changes to LinearLayout measurementAlan Viverette2015-07-311-52/+81
| | | | | | | | | | | | | "Include non-zero dimension views in excess space calculation" and "Always distribute excess space in LinearLayout measurement" changed LinearLayout behavior significantly in a way that wasn't covered by CTS tests. This reverts commits da2f3044092318d44173bdb9918f31c592b86a73 and 4fabc021583cfd5cc551eda7d7b9809683a6ca9a. Bug: 22862047 Change-Id: I8d37a525ccf295445d3239b80e5cacb10bf3c947
* Include non-zero dimension views in excess space calculationAlan Viverette2015-07-301-18/+30
| | | | | Bug: 22840778 Change-Id: Iba44c59bbaa48f63b26f342e0510b4c421e8748b
* Always distribute excess space in LinearLayout measurementAlan Viverette2015-07-291-73/+32
| | | | | | | | | | | | | Previously, excess space was added to existing measured dimensions. This consistently resulted in incorrect allocation of excess space, since the delta already included the height of any measured children rather than just the excess space itself. This CL ensures that excess space is always distributed according to the layout weights. Bug: 22810327 Change-Id: I482a553c469169769cc40ab3d88b4a44023f3eb5
* Allow null child view when checking whether divider should drawDoris Liu2015-06-301-1/+2
| | | | | | | | | | | | The beginning divider should draw before the first child that is not set to GONE. Incidentally, there needs to be a check for such a child, which involves checking the visibility of all the children with lower indices. This CL takes into account the scenarios where children with lower indices could be null, in which case we'll treat them as if they were GONE. Bug: 22199594 Change-Id: Iefc73ef87beec219898c967b9a3ccebd1e3b5b4c
* Fix logic for whether beginning/end divider should be drawnDoris Liu2015-06-251-14/+36
| | | | | Bug: 18945384 Change-Id: Ib8e785cb97d288e39a39b968bcb9c05410acbe34
* Check targetSdkVersion when passing size hints for UNSPECIFIED specsAdam Powell2015-06-111-2/+2
| | | | | | | | | | | | | | As of MNC stock widgets will pass a size in UNSPECIFIED MeasureSpec values as a hint of the container size. This lets things like list items size themselves at 1/3 the size of their container. This breaks assumptions in a few existing applications, so maintain the old expectation of 0 size in UNSPECIFIED MeasureSpecs for apps targeting older SDK versions. Bug 20975083 Change-Id: Ic7318e88854e00d96852dde2c0e10376b42bf77f
* Fixed a RTL layouting bug with LinearLayoutSelim Cinek2015-06-091-0/+13
| | | | | | | | | | | When the RTL properties of a horizontal LinearLayout changed, nobody enforced the view to be layouted anew, even though its layout is dependent on the layout direction. This could lead to stale layouts being temporarily layouted the wrong way. Bug: 20495301 Change-Id: I979c8d86ee711626b2901b65ebdf007c1eb1c0fa
* Use new hierarchy viewer protocol in all View subclassesSiva Velusamy2015-05-071-0/+25
| | | | | | | | | A previous CL introduced a new way of encoding view properties for use by heirarchy viewer. This CL updates all views using the old @ExportedProperty annotation to use this new method. The older mechanism will be removed in a subsequent CL. Change-Id: I6cc23b90cd9da1c6ce89b4caffe54874db203452
* Make UNSPECIFIED measure spec include size hint.Filip Gruszczynski2015-04-161-2/+5
| | | | Change-Id: I6c4f193d0590824c644e20e8af16d055a04ac9c9
* Merge "Allow attrs to be @Nullable in TextView and LinearLayout"Scott Kennedy2015-03-061-2/+3
|\
| * Allow attrs to be @Nullable in TextView and LinearLayoutScott Kennedy2015-03-051-2/+3
| | | | | | | | Change-Id: I46ac6cddf010e7ce59de6272c30e824104e28acb