[go: nahoru, domu]

blob: c2fe4922d5db0d763a527dfe81429508c063b2b9 [file] [log] [blame]
Andrey Kulikov839b35c2020-07-08 18:55:13 +01001/*
2 * Copyright 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package androidx.ui.core
18
19/**
20 * A [Modifier.Element] that provides a [Remeasurement] object associated with the layout node
21 * the modifier is applied to.
22 */
23interface RemeasurementModifier : Modifier.Element {
24 /**
25 * This method is executed when the modifier is attached to the layout node.
26 *
27 * @param remeasurement [Remeasurement] object associated with the layout node the modifier is
28 * applied to.
29 */
30 fun onRemeasurementAvailable(remeasurement: Remeasurement)
31}
32
33/**
34 * This object is associated with a layout node and allows to execute some extra measure/layout
35 * actions which are needed for some complex layouts. In most cases you don't need it as
36 * measuring and layout should be correctly working automatically for most cases.
37 */
38interface Remeasurement {
39 /**
40 * Performs the node remeasuring synchronously even if the node was not marked as needs
41 * remeasure before. Useful for cases like when during scrolling you need to re-execute the
42 * measure block to consume the scroll offset and remeasure your children in a blocking way.
43 */
44 fun forceRemeasure()
45}