@akylas/nativescript 9.0.25 → 9.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abortcontroller/abortsignal.js.map +1 -1
- package/abortcontroller/index.js.map +1 -1
- package/accessibility/accessibility-common.js.map +1 -1
- package/accessibility/accessibility-css-helper.js.map +1 -1
- package/accessibility/accessibility-properties.js.map +1 -1
- package/accessibility/accessibility-service-common.js.map +1 -1
- package/accessibility/accessibility-service.android.js.map +1 -1
- package/accessibility/accessibility-service.ios.js.map +1 -1
- package/accessibility/accessibility-types.js.map +1 -1
- package/accessibility/font-scale-common.js.map +1 -1
- package/accessibility/font-scale.android.js.map +1 -1
- package/accessibility/font-scale.ios.js.map +1 -1
- package/accessibility/index.android.js.map +1 -1
- package/accessibility/index.ios.js.map +1 -1
- package/animation-frame/animation-native.android.js.map +1 -1
- package/animation-frame/animation-native.ios.js.map +1 -1
- package/animation-frame/index.js.map +1 -1
- package/application/application-common.d.ts +205 -3
- package/application/application-common.js +438 -55
- package/application/application-common.js.map +1 -1
- package/application/application-interfaces.d.ts +67 -1
- package/application/application-interfaces.js.map +1 -1
- package/application/application-shims.js.map +1 -1
- package/application/application.android.d.ts +39 -0
- package/application/application.android.js +239 -18
- package/application/application.android.js.map +1 -1
- package/application/application.d.ts +161 -54
- package/application/application.ios.d.ts +189 -28
- package/application/application.ios.js +892 -390
- package/application/application.ios.js.map +1 -1
- package/application/helpers-common.d.ts +7 -0
- package/application/helpers-common.js +46 -1
- package/application/helpers-common.js.map +1 -1
- package/application/helpers.android.js.map +1 -1
- package/application/helpers.ios.js.map +1 -1
- package/application/index.android.js.map +1 -1
- package/application/index.ios.js.map +1 -1
- package/application/scene-delegate-bridge.d.ts +60 -0
- package/application/scene-delegate-bridge.js +138 -0
- package/application/scene-delegate-bridge.js.map +1 -0
- package/application-settings/application-settings-common.js.map +1 -1
- package/application-settings/index.android.js.map +1 -1
- package/application-settings/index.ios.js.map +1 -1
- package/bundle-entry-points.js.map +1 -1
- package/cli-hooks/before-checkForChanges.mjs +0 -11
- package/color/color-common.js +16 -5
- package/color/color-common.js.map +1 -1
- package/color/color-types.js.map +1 -1
- package/color/color-utils.d.ts +4 -1
- package/color/color-utils.js +14 -9
- package/color/color-utils.js.map +1 -1
- package/color/index.android.js.map +1 -1
- package/color/index.ios.js.map +1 -1
- package/color/known-colors.js.map +1 -1
- package/config/config.interface.d.ts +45 -3
- package/config/config.interface.js.map +1 -1
- package/config/index.js.map +1 -1
- package/connectivity/index.android.js.map +1 -1
- package/connectivity/index.ios.js.map +1 -1
- package/console/index.js.map +1 -1
- package/core-types/animation-types.js.map +1 -1
- package/core-types/index.d.ts +25 -2
- package/core-types/index.js +23 -0
- package/core-types/index.js.map +1 -1
- package/core-types/validators.js.map +1 -1
- package/css/CSS3Parser.js +3 -2
- package/css/CSS3Parser.js.map +1 -1
- package/css/CSSNativeScript.js.map +1 -1
- package/css/css-tree-parser.js +5 -1
- package/css/css-tree-parser.js.map +1 -1
- package/css/lib/parse/index.js +5 -1
- package/css/lib/parse/index.js.map +1 -1
- package/css/parser.js +20 -3
- package/css/parser.js.map +1 -1
- package/css/reworkcss.js.map +1 -1
- package/css/system-classes.d.ts +9 -0
- package/css/system-classes.js +23 -0
- package/css/system-classes.js.map +1 -1
- package/css-mediaquery/index.d.ts +6 -1
- package/css-mediaquery/index.js +35 -6
- package/css-mediaquery/index.js.map +1 -1
- package/css-value/reworkcss-value.js.map +1 -1
- package/data/observable/index.d.ts +23 -0
- package/data/observable/index.js +50 -9
- package/data/observable/index.js.map +1 -1
- package/data/observable-array/index.js.map +1 -1
- package/data/virtual-array/index.js.map +1 -1
- package/debugger/InspectorBackendCommands.js.map +1 -1
- package/debugger/devtools-elements-interfaces.js.map +1 -1
- package/debugger/devtools-elements.common.js.map +1 -1
- package/debugger/devtools-elements.js.map +1 -1
- package/debugger/dom-types.js +31 -1
- package/debugger/dom-types.js.map +1 -1
- package/debugger/index.js.map +1 -1
- package/debugger/webinspector-css.js.map +1 -1
- package/debugger/webinspector-dom.js.map +1 -1
- package/debugger/webinspector-network.android.js.map +1 -1
- package/debugger/webinspector-network.d.ts +29 -0
- package/debugger/webinspector-network.ios.js.map +1 -1
- package/fetch/index.d.ts +79 -0
- package/fetch/index.js +408 -0
- package/fetch/index.js.map +1 -0
- package/file-system/file-system-access.android.d.ts +1 -0
- package/file-system/file-system-access.android.js +18 -21
- package/file-system/file-system-access.android.js.map +1 -1
- package/file-system/file-system-access.ios.js +21 -13
- package/file-system/file-system-access.ios.js.map +1 -1
- package/file-system/index.d.ts +3 -3
- package/file-system/index.js.map +1 -1
- package/fps-meter/fps-native.android.js.map +1 -1
- package/fps-meter/fps-native.ios.js.map +1 -1
- package/fps-meter/index.js.map +1 -1
- package/global-types.d.ts +40 -34
- package/globals/global-utils.d.ts +6 -1
- package/globals/global-utils.js +10 -5
- package/globals/global-utils.js.map +1 -1
- package/globals/index.js +22 -9
- package/globals/index.js.map +1 -1
- package/globals/polyfills/polyfill-xhr.js.map +1 -1
- package/globals/polyfills/utils.js +2 -0
- package/globals/polyfills/utils.js.map +1 -1
- package/http/http-interfaces.js.map +1 -1
- package/http/http-request/http-request-common.js.map +1 -1
- package/http/http-request/index.android.js +5 -1
- package/http/http-request/index.android.js.map +1 -1
- package/http/http-request/index.ios.js.map +1 -1
- package/http/http-request-internal/http-request-internal-common.d.ts +6 -1
- package/http/http-request-internal/http-request-internal-common.js +19 -0
- package/http/http-request-internal/http-request-internal-common.js.map +1 -1
- package/http/http-request-internal/index.android.d.ts +7 -1
- package/http/http-request-internal/index.android.js +8 -6
- package/http/http-request-internal/index.android.js.map +1 -1
- package/http/http-request-internal/index.ios.d.ts +7 -1
- package/http/http-request-internal/index.ios.js +34 -17
- package/http/http-request-internal/index.ios.js.map +1 -1
- package/http/index.js.map +1 -1
- package/image-asset/image-asset-common.js.map +1 -1
- package/image-asset/index.android.js.map +1 -1
- package/image-asset/index.ios.js.map +1 -1
- package/image-source/image-source-common.js.map +1 -1
- package/image-source/index.android.js.map +1 -1
- package/image-source/index.ios.js +7 -6
- package/image-source/index.ios.js.map +1 -1
- package/index.d.ts +3 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/inspector_modules.js +1 -1
- package/inspector_modules.js.map +1 -1
- package/js-libs/easysax/easysax.d.ts +49 -7
- package/js-libs/easysax/easysax.js +631 -747
- package/js-libs/easysax/easysax.js.map +1 -0
- package/matrix/index.js.map +1 -1
- package/media-query-list/index.js +57 -15
- package/media-query-list/index.js.map +1 -1
- package/module-name-resolver/helpers.d.ts +1 -1
- package/module-name-resolver/helpers.js.map +1 -1
- package/module-name-resolver/index.d.ts +2 -2
- package/module-name-resolver/index.js.map +1 -1
- package/module-name-resolver/non-bundle-workflow-compat.js.map +1 -1
- package/module-name-resolver/qualifier-matcher/index.js.map +1 -1
- package/native-window/index.d.ts +426 -0
- package/native-window/index.js +4 -0
- package/native-window/index.js.map +1 -0
- package/native-window/native-window-common.d.ts +153 -0
- package/native-window/native-window-common.js +340 -0
- package/native-window/native-window-common.js.map +1 -0
- package/native-window/native-window-interfaces.d.ts +186 -0
- package/native-window/native-window-interfaces.js +90 -0
- package/native-window/native-window-interfaces.js.map +1 -0
- package/native-window/native-window.android.d.ts +59 -0
- package/native-window/native-window.android.js +175 -0
- package/native-window/native-window.android.js.map +1 -0
- package/native-window/native-window.ios.d.ts +61 -0
- package/native-window/native-window.ios.js +218 -0
- package/native-window/native-window.ios.js.map +1 -0
- package/native-window/window-base.d.ts +111 -0
- package/native-window/window-base.js +91 -0
- package/native-window/window-base.js.map +1 -0
- package/package.json +3 -3
- package/platform/common.js.map +1 -1
- package/platform/device/index.android.js.map +1 -1
- package/platform/device/index.ios.js.map +1 -1
- package/platform/index.js.map +1 -1
- package/platform/screen/index.android.js.map +1 -1
- package/platform/screen/index.ios.d.ts +1 -0
- package/platform/screen/index.ios.js +6 -2
- package/platform/screen/index.ios.js.map +1 -1
- package/platforms/android/java/org/nativescript/widgets/BorderDrawable.java +5 -6
- package/platforms/android/java/org/nativescript/widgets/BoxShadowDrawable.java +0 -6
- package/platforms/android/java/org/nativescript/widgets/CommonLayoutParams.java +56 -0
- package/platforms/android/java/org/nativescript/widgets/ContentLayout.java +20 -4
- package/platforms/android/java/org/nativescript/widgets/CustomTransition.java +26 -9
- package/platforms/android/java/org/nativescript/widgets/FlexLine.java +3 -3
- package/platforms/android/java/org/nativescript/widgets/FlexboxLayout.java +194 -731
- package/platforms/android/java/org/nativescript/widgets/ImageView.java +2 -2
- package/platforms/android/java/org/nativescript/widgets/Utils.java +37 -9
- package/platforms/android/java/org/nativescript/widgets/ViewHelper.java +78 -0
- package/platforms/android/java/org/nativescript/widgets/image/BitmapOwner.java +1 -4
- package/platforms/android/java/org/nativescript/widgets/image/Worker.java +99 -76
- package/platforms/android/native-api-usage.json +11 -0
- package/platforms/ios/src/NativeScriptMainWindow.swift +72 -39
- package/profiling/index.js.map +1 -1
- package/references.d.ts +5 -2
- package/text/formatted-string.js.map +1 -1
- package/text/index.android.js.map +1 -1
- package/text/index.ios.js.map +1 -1
- package/text/span.js.map +1 -1
- package/text/text-common.js +1 -1
- package/text/text-common.js.map +1 -1
- package/timer/index.android.js +2 -1
- package/timer/index.android.js.map +1 -1
- package/timer/index.ios.js.map +1 -1
- package/trace/index.d.ts +2 -2
- package/trace/index.js.map +1 -1
- package/ui/action-bar/action-bar-common.js.map +1 -1
- package/ui/action-bar/index.android.js +7 -11
- package/ui/action-bar/index.android.js.map +1 -1
- package/ui/action-bar/index.d.ts +13 -1
- package/ui/action-bar/index.ios.js +26 -0
- package/ui/action-bar/index.ios.js.map +1 -1
- package/ui/activity-indicator/activity-indicator-common.js.map +1 -1
- package/ui/activity-indicator/index.android.js.map +1 -1
- package/ui/activity-indicator/index.ios.js.map +1 -1
- package/ui/animation/animation-common.js.map +1 -1
- package/ui/animation/animation-interfaces.js.map +1 -1
- package/ui/animation/animation-shared.js.map +1 -1
- package/ui/animation/animation-types.js.map +1 -1
- package/ui/animation/index.android.js.map +1 -1
- package/ui/animation/index.ios.js +6 -1
- package/ui/animation/index.ios.js.map +1 -1
- package/ui/animation/keyframe-animation.d.ts +3 -1
- package/ui/animation/keyframe-animation.js +72 -3
- package/ui/animation/keyframe-animation.js.map +1 -1
- package/ui/builder/binding-builder.d.ts +8 -0
- package/ui/builder/binding-builder.js +12 -0
- package/ui/builder/binding-builder.js.map +1 -1
- package/ui/builder/component-builder/index.d.ts +7 -4
- package/ui/builder/component-builder/index.js +13 -7
- package/ui/builder/component-builder/index.js.map +1 -1
- package/ui/builder/index.d.ts +16 -2
- package/ui/builder/index.js +61 -13
- package/ui/builder/index.js.map +1 -1
- package/ui/button/button-common.js.map +1 -1
- package/ui/button/index.android.js +4 -3
- package/ui/button/index.android.js.map +1 -1
- package/ui/button/index.ios.js.map +1 -1
- package/ui/content-view/index.js +2 -0
- package/ui/content-view/index.js.map +1 -1
- package/ui/core/bindable/bindable-expressions.js.map +1 -1
- package/ui/core/bindable/bindable-resources.js.map +1 -1
- package/ui/core/bindable/bindable-types.d.ts +15 -0
- package/ui/core/bindable/bindable-types.js.map +1 -1
- package/ui/core/bindable/index.d.ts +1 -1
- package/ui/core/bindable/index.js +14 -8
- package/ui/core/bindable/index.js.map +1 -1
- package/ui/core/control-state-change/index.android.js.map +1 -1
- package/ui/core/control-state-change/index.ios.js.map +1 -1
- package/ui/core/properties/index.d.ts +37 -2
- package/ui/core/properties/index.js +205 -29
- package/ui/core/properties/index.js.map +1 -1
- package/ui/core/properties/property-shared.js +11 -2
- package/ui/core/properties/property-shared.js.map +1 -1
- package/ui/core/view/index.android.d.ts +5 -0
- package/ui/core/view/index.android.js +89 -15
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.d.ts +58 -1
- package/ui/core/view/index.ios.d.ts +1 -0
- package/ui/core/view/index.ios.js +48 -11
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.d.ts +37 -0
- package/ui/core/view/view-common.js +81 -0
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.android.d.ts +1 -0
- package/ui/core/view/view-helper/index.android.js +8 -0
- package/ui/core/view/view-helper/index.android.js.map +1 -1
- package/ui/core/view/view-helper/index.d.ts +46 -0
- package/ui/core/view/view-helper/index.ios.d.ts +42 -0
- package/ui/core/view/view-helper/index.ios.js +170 -5
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-common.js +21 -3
- package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-shared.js.map +1 -1
- package/ui/core/view/view-interfaces.js.map +1 -1
- package/ui/core/view-base/index.js +75 -36
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/core/view-base/utils.js.map +1 -1
- package/ui/core/weak-event-listener/index.js.map +1 -1
- package/ui/date-picker/date-picker-common.js.map +1 -1
- package/ui/date-picker/index.android.js +1 -1
- package/ui/date-picker/index.android.js.map +1 -1
- package/ui/date-picker/index.ios.js.map +1 -1
- package/ui/dialogs/dialogs-common.js.map +1 -1
- package/ui/dialogs/index.android.js +5 -5
- package/ui/dialogs/index.android.js.map +1 -1
- package/ui/dialogs/index.ios.js.map +1 -1
- package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
- package/ui/editable-text-base/index.android.d.ts +2 -0
- package/ui/editable-text-base/index.android.js +17 -7
- package/ui/editable-text-base/index.android.js.map +1 -1
- package/ui/editable-text-base/index.d.ts +8 -0
- package/ui/editable-text-base/index.ios.js.map +1 -1
- package/ui/embedding/index.android.js.map +1 -1
- package/ui/embedding/index.ios.js.map +1 -1
- package/ui/enums/enums.js.map +1 -1
- package/ui/enums/index.js.map +1 -1
- package/ui/frame/activity.android.js.map +1 -1
- package/ui/frame/fragment.android.js.map +1 -1
- package/ui/frame/fragment.ios.js.map +1 -1
- package/ui/frame/fragment.transitions.android.d.ts +12 -9
- package/ui/frame/fragment.transitions.android.js +105 -90
- package/ui/frame/fragment.transitions.android.js.map +1 -1
- package/ui/frame/fragment.transitions.types.js.map +1 -1
- package/ui/frame/frame-common.d.ts +14 -2
- package/ui/frame/frame-common.js +51 -24
- package/ui/frame/frame-common.js.map +1 -1
- package/ui/frame/frame-constants.d.ts +9 -0
- package/ui/frame/frame-constants.js +10 -0
- package/ui/frame/frame-constants.js.map +1 -0
- package/ui/frame/frame-helper-for-android.d.ts +2 -2
- package/ui/frame/frame-helper-for-android.js +14 -5
- package/ui/frame/frame-helper-for-android.js.map +1 -1
- package/ui/frame/frame-helpers.js.map +1 -1
- package/ui/frame/frame-interfaces.d.ts +1 -1
- package/ui/frame/frame-interfaces.js.map +1 -1
- package/ui/frame/frame-stack.d.ts +22 -1
- package/ui/frame/frame-stack.js +43 -5
- package/ui/frame/frame-stack.js.map +1 -1
- package/ui/frame/index.android.d.ts +2 -2
- package/ui/frame/index.android.js +161 -56
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.d.ts +15 -5
- package/ui/frame/index.ios.d.ts +1 -1
- package/ui/frame/index.ios.js +86 -26
- package/ui/frame/index.ios.js.map +1 -1
- package/ui/gestures/gestures-common.js.map +1 -1
- package/ui/gestures/gestures-types.d.ts +2 -0
- package/ui/gestures/gestures-types.js.map +1 -1
- package/ui/gestures/index.android.d.ts +1 -1
- package/ui/gestures/index.android.js +177 -133
- package/ui/gestures/index.android.js.map +1 -1
- package/ui/gestures/index.ios.js +36 -7
- package/ui/gestures/index.ios.js.map +1 -1
- package/ui/gestures/touch-manager.d.ts +1 -2
- package/ui/gestures/touch-manager.js +79 -50
- package/ui/gestures/touch-manager.js.map +1 -1
- package/ui/html-view/html-view-common.js.map +1 -1
- package/ui/html-view/index.android.js.map +1 -1
- package/ui/html-view/index.ios.js.map +1 -1
- package/ui/image/image-common.js +1 -1
- package/ui/image/image-common.js.map +1 -1
- package/ui/image/index.android.js +14 -2
- package/ui/image/index.android.js.map +1 -1
- package/ui/image/index.ios.js.map +1 -1
- package/ui/image/symbol-effects-common.js.map +1 -1
- package/ui/image/symbol-effects.android.js.map +1 -1
- package/ui/image/symbol-effects.ios.js.map +1 -1
- package/ui/image-cache/image-cache-common.js.map +1 -1
- package/ui/image-cache/index.android.js +1 -2
- package/ui/image-cache/index.android.js.map +1 -1
- package/ui/image-cache/index.ios.js.map +1 -1
- package/ui/index.d.ts +2 -2
- package/ui/index.js.map +1 -1
- package/ui/label/index.android.js.map +1 -1
- package/ui/label/index.ios.js.map +1 -1
- package/ui/layouts/absolute-layout/absolute-layout-common.js.map +1 -1
- package/ui/layouts/absolute-layout/index.android.js.map +1 -1
- package/ui/layouts/absolute-layout/index.ios.js +3 -0
- package/ui/layouts/absolute-layout/index.ios.js.map +1 -1
- package/ui/layouts/dock-layout/dock-layout-common.js.map +1 -1
- package/ui/layouts/dock-layout/index.android.js.map +1 -1
- package/ui/layouts/dock-layout/index.ios.js +3 -0
- package/ui/layouts/dock-layout/index.ios.js.map +1 -1
- package/ui/layouts/flexbox-layout/flexbox-layout-common.d.ts +7 -0
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js +18 -0
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.android.d.ts +5 -0
- package/ui/layouts/flexbox-layout/index.android.js +15 -0
- package/ui/layouts/flexbox-layout/index.android.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.d.ts +19 -1
- package/ui/layouts/flexbox-layout/index.ios.d.ts +2 -0
- package/ui/layouts/flexbox-layout/index.ios.js +246 -195
- package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
- package/ui/layouts/grid-layout/grid-layout-common.js.map +1 -1
- package/ui/layouts/grid-layout/index.android.js.map +1 -1
- package/ui/layouts/grid-layout/index.ios.js +3 -0
- package/ui/layouts/grid-layout/index.ios.js.map +1 -1
- package/ui/layouts/index.js.map +1 -1
- package/ui/layouts/layout-base-common.d.ts +1 -0
- package/ui/layouts/layout-base-common.js +23 -1
- package/ui/layouts/layout-base-common.js.map +1 -1
- package/ui/layouts/layout-base.android.js.map +1 -1
- package/ui/layouts/layout-base.ios.js.map +1 -1
- package/ui/layouts/liquid-glass/index.android.js.map +1 -1
- package/ui/layouts/liquid-glass/index.ios.d.ts +0 -1
- package/ui/layouts/liquid-glass/index.ios.js +2 -43
- package/ui/layouts/liquid-glass/index.ios.js.map +1 -1
- package/ui/layouts/liquid-glass/liquid-glass-common.js.map +1 -1
- package/ui/layouts/liquid-glass-container/index.android.js.map +1 -1
- package/ui/layouts/liquid-glass-container/index.ios.d.ts +0 -1
- package/ui/layouts/liquid-glass-container/index.ios.js +2 -43
- package/ui/layouts/liquid-glass-container/index.ios.js.map +1 -1
- package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js.map +1 -1
- package/ui/layouts/root-layout/index.android.js.map +1 -1
- package/ui/layouts/root-layout/index.ios.js.map +1 -1
- package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
- package/ui/layouts/root-layout/root-layout-stack.js.map +1 -1
- package/ui/layouts/stack-layout/index.android.js.map +1 -1
- package/ui/layouts/stack-layout/index.ios.js +3 -0
- package/ui/layouts/stack-layout/index.ios.js.map +1 -1
- package/ui/layouts/stack-layout/stack-layout-common.js.map +1 -1
- package/ui/layouts/wrap-layout/index.android.js.map +1 -1
- package/ui/layouts/wrap-layout/index.ios.js +3 -0
- package/ui/layouts/wrap-layout/index.ios.js.map +1 -1
- package/ui/layouts/wrap-layout/wrap-layout-common.js.map +1 -1
- package/ui/list-picker/index.android.d.ts +1 -0
- package/ui/list-picker/index.android.js +6 -5
- package/ui/list-picker/index.android.js.map +1 -1
- package/ui/list-picker/index.ios.js.map +1 -1
- package/ui/list-picker/list-picker-common.js.map +1 -1
- package/ui/list-view/index.android.js +19 -11
- package/ui/list-view/index.android.js.map +1 -1
- package/ui/list-view/index.d.ts +47 -3
- package/ui/list-view/index.ios.d.ts +13 -3
- package/ui/list-view/index.ios.js +132 -41
- package/ui/list-view/index.ios.js.map +1 -1
- package/ui/list-view/list-view-common.d.ts +19 -0
- package/ui/list-view/list-view-common.js +30 -0
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/events.js.map +1 -1
- package/ui/page/index.android.js.map +1 -1
- package/ui/page/index.d.ts +1 -1
- package/ui/page/index.ios.d.ts +3 -1
- package/ui/page/index.ios.js +33 -20
- package/ui/page/index.ios.js.map +1 -1
- package/ui/page/page-common.d.ts +5 -1
- package/ui/page/page-common.js.map +1 -1
- package/ui/placeholder/index.android.js.map +1 -1
- package/ui/placeholder/index.js.map +1 -1
- package/ui/placeholder/placeholder-common.js.map +1 -1
- package/ui/progress/index.android.js.map +1 -1
- package/ui/progress/index.ios.js.map +1 -1
- package/ui/progress/progress-common.js.map +1 -1
- package/ui/proxy-view-container/index.js.map +1 -1
- package/ui/repeater/index.d.ts +2 -1
- package/ui/repeater/index.js.map +1 -1
- package/ui/scroll-view/index.android.d.ts +2 -1
- package/ui/scroll-view/index.android.js +4 -1
- package/ui/scroll-view/index.android.js.map +1 -1
- package/ui/scroll-view/index.d.ts +53 -0
- package/ui/scroll-view/index.ios.d.ts +13 -1
- package/ui/scroll-view/index.ios.js +100 -20
- package/ui/scroll-view/index.ios.js.map +1 -1
- package/ui/scroll-view/scroll-view-common.d.ts +13 -0
- package/ui/scroll-view/scroll-view-common.js +27 -0
- package/ui/scroll-view/scroll-view-common.js.map +1 -1
- package/ui/search-bar/index.android.js +2 -2
- package/ui/search-bar/index.android.js.map +1 -1
- package/ui/search-bar/index.ios.js.map +1 -1
- package/ui/search-bar/search-bar-common.js.map +1 -1
- package/ui/segmented-bar/index.android.js +8 -8
- package/ui/segmented-bar/index.android.js.map +1 -1
- package/ui/segmented-bar/index.ios.js.map +1 -1
- package/ui/segmented-bar/segmented-bar-common.d.ts +5 -1
- package/ui/segmented-bar/segmented-bar-common.js +6 -1
- package/ui/segmented-bar/segmented-bar-common.js.map +1 -1
- package/ui/slider/index.android.js +1 -2
- package/ui/slider/index.android.js.map +1 -1
- package/ui/slider/index.ios.js.map +1 -1
- package/ui/slider/slider-common.js.map +1 -1
- package/ui/split-view/index.android.js.map +1 -1
- package/ui/split-view/index.ios.js.map +1 -1
- package/ui/split-view/split-view-common.js.map +1 -1
- package/ui/styling/background-common.d.ts +2 -0
- package/ui/styling/background-common.js +10 -2
- package/ui/styling/background-common.js.map +1 -1
- package/ui/styling/background.android.d.ts +4 -1
- package/ui/styling/background.android.js +5 -2
- package/ui/styling/background.android.js.map +1 -1
- package/ui/styling/background.d.ts +2 -2
- package/ui/styling/background.ios.d.ts +1 -1
- package/ui/styling/background.ios.js +10 -3
- package/ui/styling/background.ios.js.map +1 -1
- package/ui/styling/box-shadow.js.map +1 -1
- package/ui/styling/clip-path-function.js.map +1 -1
- package/ui/styling/converters.js.map +1 -1
- package/ui/styling/css-animation-parser.js.map +1 -1
- package/ui/styling/css-selector.d.ts +60 -13
- package/ui/styling/css-selector.js +311 -50
- package/ui/styling/css-selector.js.map +1 -1
- package/ui/styling/css-shadow.js.map +1 -1
- package/ui/styling/css-stroke.js.map +1 -1
- package/ui/styling/css-transform.js.map +1 -1
- package/ui/styling/css-utils.d.ts +16 -0
- package/ui/styling/css-utils.js +121 -7
- package/ui/styling/css-utils.js.map +1 -1
- package/ui/styling/font-common.js.map +1 -1
- package/ui/styling/font-interfaces.js.map +1 -1
- package/ui/styling/font.android.js.map +1 -1
- package/ui/styling/font.ios.js.map +1 -1
- package/ui/styling/length-shared.d.ts +2 -0
- package/ui/styling/length-shared.js +29 -2
- package/ui/styling/length-shared.js.map +1 -1
- package/ui/styling/linear-gradient.js.map +1 -1
- package/ui/styling/style/index.d.ts +29 -2
- package/ui/styling/style/index.js +1 -0
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.d.ts +5 -0
- package/ui/styling/style-properties.js +172 -101
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.d.ts +24 -3
- package/ui/styling/style-scope.js +461 -63
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/styling/styling-profile.js.map +1 -1
- package/ui/styling/styling-shared.js.map +1 -1
- package/ui/switch/index.android.js +1 -1
- package/ui/switch/index.android.js.map +1 -1
- package/ui/switch/index.ios.js +5 -1
- package/ui/switch/index.ios.js.map +1 -1
- package/ui/switch/switch-common.js.map +1 -1
- package/ui/tab-view/index.android.js +13 -17
- package/ui/tab-view/index.android.js.map +1 -1
- package/ui/tab-view/index.d.ts +5 -3
- package/ui/tab-view/index.ios.d.ts +2 -1
- package/ui/tab-view/index.ios.js +83 -20
- package/ui/tab-view/index.ios.js.map +1 -1
- package/ui/tab-view/tab-view-common.d.ts +6 -1
- package/ui/tab-view/tab-view-common.js +17 -1
- package/ui/tab-view/tab-view-common.js.map +1 -1
- package/ui/text-base/formatted-string.js.map +1 -1
- package/ui/text-base/index.android.js +6 -9
- package/ui/text-base/index.android.js.map +1 -1
- package/ui/text-base/index.ios.d.ts +3 -0
- package/ui/text-base/index.ios.js +26 -4
- package/ui/text-base/index.ios.js.map +1 -1
- package/ui/text-base/span.js.map +1 -1
- package/ui/text-base/text-base-common.js.map +1 -1
- package/ui/text-field/index.android.js.map +1 -1
- package/ui/text-field/index.ios.js +13 -5
- package/ui/text-field/index.ios.js.map +1 -1
- package/ui/text-field/text-field-common.js.map +1 -1
- package/ui/text-view/index.android.js.map +1 -1
- package/ui/text-view/index.ios.js.map +1 -1
- package/ui/text-view/text-view-common.js.map +1 -1
- package/ui/time-picker/index.android.js +1 -1
- package/ui/time-picker/index.android.js.map +1 -1
- package/ui/time-picker/index.ios.js.map +1 -1
- package/ui/time-picker/time-picker-common.js.map +1 -1
- package/ui/transition/fade-transition.android.js.map +1 -1
- package/ui/transition/fade-transition.ios.js.map +1 -1
- package/ui/transition/flip-transition.android.js.map +1 -1
- package/ui/transition/index.android.js.map +1 -1
- package/ui/transition/index.d.ts +2 -1
- package/ui/transition/index.ios.js.map +1 -1
- package/ui/transition/modal-transition.android.js.map +1 -1
- package/ui/transition/modal-transition.ios.js +33 -5
- package/ui/transition/modal-transition.ios.js.map +1 -1
- package/ui/transition/page-transition.android.d.ts +4 -0
- package/ui/transition/page-transition.android.js +171 -86
- package/ui/transition/page-transition.android.js.map +1 -1
- package/ui/transition/page-transition.ios.d.ts +5 -0
- package/ui/transition/page-transition.ios.js +298 -36
- package/ui/transition/page-transition.ios.js.map +1 -1
- package/ui/transition/shared-transition-helper.android.d.ts +3 -0
- package/ui/transition/shared-transition-helper.android.js +9 -0
- package/ui/transition/shared-transition-helper.android.js.map +1 -1
- package/ui/transition/shared-transition-helper.d.ts +7 -0
- package/ui/transition/shared-transition-helper.ios.d.ts +48 -0
- package/ui/transition/shared-transition-helper.ios.js +977 -95
- package/ui/transition/shared-transition-helper.ios.js.map +1 -1
- package/ui/transition/shared-transition.d.ts +134 -0
- package/ui/transition/shared-transition.js +90 -2
- package/ui/transition/shared-transition.js.map +1 -1
- package/ui/transition/slide-transition.android.js.map +1 -1
- package/ui/transition/slide-transition.ios.js.map +1 -1
- package/ui/utils.android.js.map +1 -1
- package/ui/utils.d.ts +2 -0
- package/ui/utils.ios.js.map +1 -1
- package/ui/web-view/index.android.js +1 -1
- package/ui/web-view/index.android.js.map +1 -1
- package/ui/web-view/index.ios.js.map +1 -1
- package/ui/web-view/web-view-common.js.map +1 -1
- package/ui/web-view/web-view-interfaces.js.map +1 -1
- package/utils/android-runtime-version.d.ts +12 -0
- package/utils/android-runtime-version.js +36 -0
- package/utils/android-runtime-version.js.map +1 -0
- package/utils/animation-helpers.js.map +1 -1
- package/utils/common.js.map +1 -1
- package/utils/constants.android.js.map +1 -1
- package/utils/constants.ios.js.map +1 -1
- package/utils/debug-source.js.map +1 -1
- package/utils/debug.js.map +1 -1
- package/utils/index.android.js.map +1 -1
- package/utils/index.ios.js.map +1 -1
- package/utils/layout-helper/index.android.js.map +1 -1
- package/utils/layout-helper/index.ios.js +11 -3
- package/utils/layout-helper/index.ios.js.map +1 -1
- package/utils/layout-helper/layout-helper-common.js.map +1 -1
- package/utils/layout-helper/layout-helper-shared.js.map +1 -1
- package/utils/lazy.js.map +1 -1
- package/utils/macrotask-scheduler.js.map +1 -1
- package/utils/mainthread-helper.android.js.map +1 -1
- package/utils/mainthread-helper.ios.js.map +1 -1
- package/utils/module-merge.js.map +1 -1
- package/utils/native-helper-for-android.js +9 -3
- package/utils/native-helper-for-android.js.map +1 -1
- package/utils/native-helper.android.d.ts +66 -2
- package/utils/native-helper.android.js.map +1 -1
- package/utils/native-helper.d.ts +2 -2
- package/utils/native-helper.ios.d.ts +52 -2
- package/utils/native-helper.ios.js +35 -5
- package/utils/native-helper.ios.js.map +1 -1
- package/utils/native-helper.types.d.ts +2 -0
- package/utils/number-utils.js.map +1 -1
- package/utils/platform-check.d.ts +1 -1
- package/utils/platform-check.js.map +1 -1
- package/utils/shared.js.map +1 -1
- package/utils/types.js.map +1 -1
- package/utils/utils-shared.js.map +1 -1
- package/wgc/atob.js.map +1 -1
- package/wgc/btoa.js.map +1 -1
- package/wgc/crypto/SubtleCrypto.js.map +1 -1
- package/wgc/crypto/index.d.ts +1 -1
- package/wgc/crypto/index.js +12 -8
- package/wgc/crypto/index.js.map +1 -1
- package/wgc/index.js.map +1 -1
- package/xhr/index.d.ts +5 -4
- package/xhr/index.js +18 -18
- package/xhr/index.js.map +1 -1
- package/xml/index.d.ts +2 -2
- package/xml/index.js +1 -1
- package/xml/index.js.map +1 -1
- package/LICENSE +0 -19
- package/fetch/index.mjs +0 -535
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
package org.nativescript.widgets;
|
|
18
18
|
|
|
19
19
|
import android.content.Context;
|
|
20
|
-
import android.graphics.Canvas;
|
|
21
|
-
import android.graphics.drawable.Drawable;
|
|
22
20
|
import android.util.AttributeSet;
|
|
23
21
|
import android.util.SparseIntArray;
|
|
24
22
|
import android.view.View;
|
|
@@ -51,12 +49,8 @@ import java.util.List;
|
|
|
51
49
|
* <li>{@code justifyContent}</li>
|
|
52
50
|
* <li>{@code alignItems}</li>
|
|
53
51
|
* <li>{@code alignContent}</li>
|
|
54
|
-
* <li>{@code
|
|
55
|
-
* <li>{@code
|
|
56
|
-
* <li>{@code showDividerVertical}</li>
|
|
57
|
-
* <li>{@code dividerDrawable}</li>
|
|
58
|
-
* <li>{@code dividerDrawableHorizontal}</li>
|
|
59
|
-
* <li>{@code dividerDrawableVertical}</li>
|
|
52
|
+
* <li>{@code rowGap}</li>
|
|
53
|
+
* <li>{@code columnGap}</li>
|
|
60
54
|
* </ul>
|
|
61
55
|
* for the FlexboxLayout.
|
|
62
56
|
* <p>
|
|
@@ -221,77 +215,13 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
221
215
|
private int mAlignContent = ALIGN_CONTENT_STRETCH;
|
|
222
216
|
|
|
223
217
|
/**
|
|
224
|
-
*
|
|
225
|
-
* {@link #setShowDividerHorizontal(int)} or {@link #setShowDividerVertical(int)}.
|
|
226
|
-
* One or more of the values (such as
|
|
227
|
-
* {@link #SHOW_DIVIDER_BEGINNING} | {@link #SHOW_DIVIDER_MIDDLE}) can be passed to those set
|
|
228
|
-
* methods.
|
|
218
|
+
* This attribute controls the row gap in the flex container.
|
|
229
219
|
*/
|
|
230
|
-
|
|
231
|
-
value = {
|
|
232
|
-
SHOW_DIVIDER_NONE,
|
|
233
|
-
SHOW_DIVIDER_BEGINNING,
|
|
234
|
-
SHOW_DIVIDER_MIDDLE,
|
|
235
|
-
SHOW_DIVIDER_END
|
|
236
|
-
})
|
|
237
|
-
@Retention(RetentionPolicy.SOURCE)
|
|
238
|
-
public @interface DividerMode {
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Constant to how no dividers
|
|
244
|
-
*/
|
|
245
|
-
public static final int SHOW_DIVIDER_NONE = 0;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Constant to show a divider at the beginning of the flex lines (or flex items).
|
|
249
|
-
*/
|
|
250
|
-
public static final int SHOW_DIVIDER_BEGINNING = 1;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Constant to show dividers between flex lines or flex items.
|
|
254
|
-
*/
|
|
255
|
-
public static final int SHOW_DIVIDER_MIDDLE = 1 << 1;
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Constant to show a divider at the end of the flex lines or flex items.
|
|
259
|
-
*/
|
|
260
|
-
public static final int SHOW_DIVIDER_END = 1 << 2;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* The drawable to be drawn for the horizontal dividers.
|
|
264
|
-
*/
|
|
265
|
-
private Drawable mDividerDrawableHorizontal;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* The drawable to be drawn for the vertical dividers.
|
|
269
|
-
*/
|
|
270
|
-
private Drawable mDividerDrawableVertical;
|
|
271
|
-
|
|
220
|
+
private int mRowGap = 0;
|
|
272
221
|
/**
|
|
273
|
-
*
|
|
274
|
-
* be the combination of the value of {@link #SHOW_DIVIDER_NONE},
|
|
275
|
-
* {@link #SHOW_DIVIDER_BEGINNING}, {@link #SHOW_DIVIDER_MIDDLE} and {@link #SHOW_DIVIDER_END}
|
|
222
|
+
* This attribute controls the column gap in the flex container.
|
|
276
223
|
*/
|
|
277
|
-
private int
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Indicates the divider mode for the {@link #mDividerDrawableVertical}. The value needs to
|
|
281
|
-
* be the combination of the value of {@link #SHOW_DIVIDER_NONE},
|
|
282
|
-
* {@link #SHOW_DIVIDER_BEGINNING}, {@link #SHOW_DIVIDER_MIDDLE} and {@link #SHOW_DIVIDER_END}
|
|
283
|
-
*/
|
|
284
|
-
private int mShowDividerVertical;
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* The height of the {@link #mDividerDrawableHorizontal}.
|
|
288
|
-
*/
|
|
289
|
-
private int mDividerHorizontalHeight;
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* The width of the {@link #mDividerDrawableVertical}.
|
|
293
|
-
*/
|
|
294
|
-
private int mDividerVerticalWidth;
|
|
224
|
+
private int mColumnGap = 0;
|
|
295
225
|
|
|
296
226
|
/**
|
|
297
227
|
* Holds reordered indices, which {@link LayoutParams#order} parameters are taken into account
|
|
@@ -324,47 +254,6 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
324
254
|
|
|
325
255
|
public FlexboxLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
326
256
|
super(context, attrs, defStyleAttr);
|
|
327
|
-
|
|
328
|
-
// NOTE: We do not support android xml.
|
|
329
|
-
// TypedArray a = context.obtainStyledAttributes(
|
|
330
|
-
// attrs, R.styleable.FlexboxLayout, defStyleAttr, 0);
|
|
331
|
-
// mFlexDirection = a.getInt(R.styleable.FlexboxLayout_flexDirection, FLEX_DIRECTION_ROW);
|
|
332
|
-
// mFlexWrap = a.getInt(R.styleable.FlexboxLayout_flexWrap, FLEX_WRAP_NOWRAP);
|
|
333
|
-
// mJustifyContent = a
|
|
334
|
-
// .getInt(R.styleable.FlexboxLayout_justifyContent, JUSTIFY_CONTENT_FLEX_START);
|
|
335
|
-
// mAlignItems = a.getInt(R.styleable.FlexboxLayout_alignItems, ALIGN_ITEMS_STRETCH);
|
|
336
|
-
// mAlignContent = a.getInt(R.styleable.FlexboxLayout_alignContent, ALIGN_CONTENT_STRETCH);
|
|
337
|
-
// Drawable drawable = a.getDrawable(R.styleable.FlexboxLayout_dividerDrawable);
|
|
338
|
-
// if (drawable != null) {
|
|
339
|
-
// setDividerDrawableHorizontal(drawable);
|
|
340
|
-
// setDividerDrawableVertical(drawable);
|
|
341
|
-
// }
|
|
342
|
-
// Drawable drawableHorizontal = a
|
|
343
|
-
// .getDrawable(R.styleable.FlexboxLayout_dividerDrawableHorizontal);
|
|
344
|
-
// if (drawableHorizontal != null) {
|
|
345
|
-
// setDividerDrawableHorizontal(drawableHorizontal);
|
|
346
|
-
// }
|
|
347
|
-
// Drawable drawableVertical = a
|
|
348
|
-
// .getDrawable(R.styleable.FlexboxLayout_dividerDrawableVertical);
|
|
349
|
-
// if (drawableVertical != null) {
|
|
350
|
-
// setDividerDrawableVertical(drawableVertical);
|
|
351
|
-
// }
|
|
352
|
-
// int dividerMode = a.getInt(R.styleable.FlexboxLayout_showDivider, SHOW_DIVIDER_NONE);
|
|
353
|
-
// if (dividerMode != SHOW_DIVIDER_NONE) {
|
|
354
|
-
// mShowDividerVertical = dividerMode;
|
|
355
|
-
// mShowDividerHorizontal = dividerMode;
|
|
356
|
-
// }
|
|
357
|
-
// int dividerModeVertical = a
|
|
358
|
-
// .getInt(R.styleable.FlexboxLayout_showDividerVertical, SHOW_DIVIDER_NONE);
|
|
359
|
-
// if (dividerModeVertical != SHOW_DIVIDER_NONE) {
|
|
360
|
-
// mShowDividerVertical = dividerModeVertical;
|
|
361
|
-
// }
|
|
362
|
-
// int dividerModeHorizontal = a
|
|
363
|
-
// .getInt(R.styleable.FlexboxLayout_showDividerHorizontal, SHOW_DIVIDER_NONE);
|
|
364
|
-
// if (dividerModeHorizontal != SHOW_DIVIDER_NONE) {
|
|
365
|
-
// mShowDividerHorizontal = dividerModeHorizontal;
|
|
366
|
-
// }
|
|
367
|
-
// a.recycle();
|
|
368
257
|
}
|
|
369
258
|
|
|
370
259
|
@Override
|
|
@@ -482,13 +371,15 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
482
371
|
Collections.sort(orders);
|
|
483
372
|
if (mOrderCache == null) {
|
|
484
373
|
mOrderCache = new SparseIntArray(childCount);
|
|
374
|
+
} else {
|
|
375
|
+
mOrderCache.clear();
|
|
485
376
|
}
|
|
486
|
-
|
|
377
|
+
|
|
487
378
|
int[] reorderedIndices = new int[childCount];
|
|
488
379
|
int i = 0;
|
|
489
380
|
for (Order order : orders) {
|
|
490
381
|
reorderedIndices[i] = order.index;
|
|
491
|
-
mOrderCache.append(
|
|
382
|
+
mOrderCache.append(order.index, order.order);
|
|
492
383
|
i++;
|
|
493
384
|
}
|
|
494
385
|
return reorderedIndices;
|
|
@@ -496,7 +387,7 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
496
387
|
|
|
497
388
|
@NonNull
|
|
498
389
|
private List<Order> createOrders(int childCount) {
|
|
499
|
-
List<Order> orders = new ArrayList<>();
|
|
390
|
+
List<Order> orders = new ArrayList<>(childCount);
|
|
500
391
|
for (int i = 0; i < childCount; i++) {
|
|
501
392
|
View child = getChildAt(i);
|
|
502
393
|
LayoutParams params = (LayoutParams) child.getLayoutParams();
|
|
@@ -555,6 +446,7 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
555
446
|
* @see #setFlexWrap(int)
|
|
556
447
|
* @see #setAlignItems(int)
|
|
557
448
|
* @see #setAlignContent(int)
|
|
449
|
+
* @see #setColumnGap(int)
|
|
558
450
|
*/
|
|
559
451
|
private void measureHorizontal(int widthMeasureSpec, int heightMeasureSpec) {
|
|
560
452
|
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
|
@@ -566,109 +458,107 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
566
458
|
// Determine how many flex lines are needed in this layout by measuring each child.
|
|
567
459
|
// (Expand or shrink the view depending on the flexGrow and flexShrink attributes in a later
|
|
568
460
|
// loop)
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
FlexLine flexLine = new FlexLine();
|
|
575
|
-
|
|
576
|
-
// The index of the view in a same flex line.
|
|
577
|
-
int indexInFlexLine = 0;
|
|
578
|
-
flexLine.mMainSize = paddingStart + paddingEnd;
|
|
579
|
-
for (int i = 0; i < childCount; i++) {
|
|
580
|
-
View child = getReorderedChildAt(i);
|
|
581
|
-
if (child == null) {
|
|
582
|
-
addFlexLineIfLastFlexItem(i, childCount, flexLine);
|
|
583
|
-
continue;
|
|
584
|
-
} else if (child.getVisibility() == View.GONE) {
|
|
585
|
-
flexLine.mItemCount++;
|
|
586
|
-
flexLine.mGoneItemCount++;
|
|
587
|
-
addFlexLineIfLastFlexItem(i, childCount, flexLine);
|
|
588
|
-
continue;
|
|
589
|
-
}
|
|
461
|
+
int childCount = getChildCount();
|
|
462
|
+
int paddingStart = ViewCompat.getPaddingStart(this);
|
|
463
|
+
int paddingEnd = ViewCompat.getPaddingEnd(this);
|
|
464
|
+
int largestHeightInRow = Integer.MIN_VALUE;
|
|
465
|
+
FlexLine flexLine = new FlexLine();
|
|
590
466
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
467
|
+
// The index of the view in a same flex line.
|
|
468
|
+
int indexInFlexLine = 0;
|
|
469
|
+
flexLine.mMainSize = paddingStart + paddingEnd;
|
|
470
|
+
for (int i = 0; i < childCount; i++) {
|
|
471
|
+
View child = getReorderedChildAt(i);
|
|
472
|
+
if (child == null) {
|
|
473
|
+
addFlexLineIfLastFlexItem(i, childCount, flexLine);
|
|
474
|
+
continue;
|
|
475
|
+
} else if (child.getVisibility() == View.GONE) {
|
|
476
|
+
flexLine.mItemCount++;
|
|
477
|
+
flexLine.mGoneItemCount++;
|
|
478
|
+
addFlexLineIfLastFlexItem(i, childCount, flexLine);
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
595
481
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
// Use the dimension from the layout_width attribute if the widthMode is not
|
|
601
|
-
// MeasureSpec.EXACTLY even if any fraction value is set to
|
|
602
|
-
// layout_flexBasisPercent.
|
|
603
|
-
// There are likely quite few use cases where assigning any fraction values
|
|
604
|
-
// with widthMode is not MeasureSpec.EXACTLY (e.g. FlexboxLayout's layout_width
|
|
605
|
-
// is set to wrap_content)
|
|
606
|
-
}
|
|
607
|
-
int childWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec,
|
|
608
|
-
getPaddingLeft() + getPaddingRight() + lp.leftMargin
|
|
609
|
-
+ lp.rightMargin, childWidth < 0 ? LayoutParams.WRAP_CONTENT : childWidth);
|
|
610
|
-
int childHeightMeasureSpec = getChildMeasureSpec(heightMeasureSpec,
|
|
611
|
-
getPaddingTop() + getPaddingBottom() + lp.topMargin
|
|
612
|
-
+ lp.bottomMargin, lp.height < 0 ? LayoutParams.WRAP_CONTENT : lp.height);
|
|
613
|
-
|
|
614
|
-
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
|
|
615
|
-
|
|
616
|
-
// Check the size constraint after the first measurement for the child
|
|
617
|
-
// To prevent the child's width/height violate the size constraints imposed by the
|
|
618
|
-
// {@link LayoutParams#minWidth}, {@link LayoutParams#minHeight},
|
|
619
|
-
// {@link LayoutParams#maxWidth} and {@link LayoutParams#maxHeight} attributes.
|
|
620
|
-
// E.g. When the child's layout_width is wrap_content the measured width may be
|
|
621
|
-
// less than the min width after the first measurement.
|
|
622
|
-
checkSizeConstraints(child);
|
|
623
|
-
|
|
624
|
-
childState = View.combineMeasuredStates(childState, child.getMeasuredState());
|
|
625
|
-
largestHeightInRow = Math.max(largestHeightInRow,
|
|
626
|
-
child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);
|
|
627
|
-
|
|
628
|
-
if (isWrapRequired(widthMode, widthSize, flexLine.mMainSize,
|
|
629
|
-
child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin, lp,
|
|
630
|
-
i, indexInFlexLine)) {
|
|
631
|
-
if (flexLine.getLayoutVisibleItemCount() > 0) {
|
|
632
|
-
addFlexLine(flexLine);
|
|
633
|
-
}
|
|
482
|
+
FlexboxLayout.LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
|
483
|
+
if (lp.alignSelf == LayoutParams.ALIGN_SELF_STRETCH) {
|
|
484
|
+
flexLine.mIndicesAlignSelfStretch.add(i);
|
|
485
|
+
}
|
|
634
486
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
// Check if the beginning or middle divider is required for the flex item
|
|
653
|
-
if (hasDividerBeforeChildAtAlongMainAxis(i, indexInFlexLine)) {
|
|
654
|
-
flexLine.mMainSize += mDividerVerticalWidth;
|
|
655
|
-
flexLine.mDividerLengthInMainSize += mDividerVerticalWidth;
|
|
656
|
-
}
|
|
487
|
+
int childWidth = lp.width;
|
|
488
|
+
if (lp.flexBasisPercent != LayoutParams.FLEX_BASIS_PERCENT_DEFAULT
|
|
489
|
+
&& widthMode == MeasureSpec.EXACTLY) {
|
|
490
|
+
childWidth = Math.round(widthSize * lp.flexBasisPercent);
|
|
491
|
+
// Use the dimension from the layout_width attribute if the widthMode is not
|
|
492
|
+
// MeasureSpec.EXACTLY even if any fraction value is set to
|
|
493
|
+
// layout_flexBasisPercent.
|
|
494
|
+
// There are likely quite few use cases where assigning any fraction values
|
|
495
|
+
// with widthMode is not MeasureSpec.EXACTLY (e.g. FlexboxLayout's layout_width
|
|
496
|
+
// is set to wrap_content)
|
|
497
|
+
}
|
|
498
|
+
int childWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec,
|
|
499
|
+
getPaddingLeft() + getPaddingRight() + lp.leftMargin
|
|
500
|
+
+ lp.rightMargin, childWidth < 0 ? LayoutParams.WRAP_CONTENT : childWidth);
|
|
501
|
+
int childHeightMeasureSpec = getChildMeasureSpec(heightMeasureSpec,
|
|
502
|
+
getPaddingTop() + getPaddingBottom() + lp.topMargin
|
|
503
|
+
+ lp.bottomMargin, lp.height < 0 ? LayoutParams.WRAP_CONTENT : lp.height);
|
|
657
504
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
505
|
+
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
|
|
506
|
+
|
|
507
|
+
// Check the size constraint after the first measurement for the child
|
|
508
|
+
// To prevent the child's width/height violate the size constraints imposed by the
|
|
509
|
+
// {@link LayoutParams#minWidth}, {@link LayoutParams#minHeight},
|
|
510
|
+
// {@link LayoutParams#maxWidth} and {@link LayoutParams#maxHeight} attributes.
|
|
511
|
+
// E.g. When the child's layout_width is wrap_content the measured width may be
|
|
512
|
+
// less than the min width after the first measurement.
|
|
513
|
+
checkSizeConstraints(child);
|
|
514
|
+
|
|
515
|
+
childState = View.combineMeasuredStates(childState, child.getMeasuredState());
|
|
516
|
+
largestHeightInRow = Math.max(largestHeightInRow,
|
|
517
|
+
child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);
|
|
518
|
+
|
|
519
|
+
if (isWrapRequired(widthMode, widthSize, flexLine.mMainSize,
|
|
520
|
+
child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin, lp,
|
|
521
|
+
i, indexInFlexLine)) {
|
|
522
|
+
if (flexLine.getLayoutVisibleItemCount() > 0) {
|
|
523
|
+
addFlexLine(flexLine);
|
|
669
524
|
}
|
|
670
|
-
|
|
525
|
+
|
|
526
|
+
flexLine = new FlexLine();
|
|
527
|
+
flexLine.mItemCount = 1;
|
|
528
|
+
flexLine.mMainSize = paddingStart + paddingEnd;
|
|
529
|
+
largestHeightInRow = child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
|
|
530
|
+
indexInFlexLine = 0;
|
|
531
|
+
} else {
|
|
532
|
+
flexLine.mItemCount++;
|
|
533
|
+
indexInFlexLine++;
|
|
534
|
+
}
|
|
535
|
+
flexLine.mMainSize += child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;
|
|
536
|
+
flexLine.mTotalFlexGrow += lp.flexGrow;
|
|
537
|
+
flexLine.mTotalFlexShrink += lp.flexShrink;
|
|
538
|
+
// Temporarily set the cross axis length as the largest child in the row
|
|
539
|
+
// Expand along the cross axis depending on the mAlignContent property if needed
|
|
540
|
+
// later
|
|
541
|
+
flexLine.mCrossSize = Math.max(flexLine.mCrossSize, largestHeightInRow);
|
|
542
|
+
|
|
543
|
+
// Check if column gap is required for the flex item
|
|
544
|
+
if (mColumnGap > 0 && hasPrecedingViews(i, indexInFlexLine)) {
|
|
545
|
+
flexLine.mMainSize += mColumnGap;
|
|
546
|
+
flexLine.mGapLengthInMainSize += mColumnGap;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (mFlexWrap != FLEX_WRAP_WRAP_REVERSE) {
|
|
550
|
+
flexLine.mMaxBaseline = Math
|
|
551
|
+
.max(flexLine.mMaxBaseline, child.getBaseline() + lp.topMargin);
|
|
552
|
+
} else {
|
|
553
|
+
// if the flex wrap property is FLEX_WRAP_WRAP_REVERSE, calculate the
|
|
554
|
+
// baseline as the distance from the cross end and the baseline
|
|
555
|
+
// since the cross size calculation is based on the distance from the cross end
|
|
556
|
+
flexLine.mMaxBaseline = Math
|
|
557
|
+
.max(flexLine.mMaxBaseline,
|
|
558
|
+
child.getMeasuredHeight() - child.getBaseline()
|
|
559
|
+
+ lp.bottomMargin);
|
|
671
560
|
}
|
|
561
|
+
addFlexLineIfLastFlexItem(i, childCount, flexLine);
|
|
672
562
|
}
|
|
673
563
|
|
|
674
564
|
determineMainSize(mFlexDirection, widthMeasureSpec, heightMeasureSpec);
|
|
@@ -676,28 +566,28 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
676
566
|
// TODO: Consider the case any individual child's alignSelf is set to ALIGN_SELF_BASELINE
|
|
677
567
|
if (mAlignItems == ALIGN_ITEMS_BASELINE) {
|
|
678
568
|
int viewIndex = 0;
|
|
679
|
-
for (FlexLine
|
|
569
|
+
for (FlexLine fl : mFlexLines) {
|
|
680
570
|
// The largest height value that also take the baseline shift into account
|
|
681
571
|
int largestHeightInLine = Integer.MIN_VALUE;
|
|
682
|
-
for (int i = viewIndex; i < viewIndex +
|
|
572
|
+
for (int i = viewIndex; i < viewIndex + fl.mItemCount; i++) {
|
|
683
573
|
View child = getReorderedChildAt(i);
|
|
684
574
|
LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
|
685
|
-
|
|
575
|
+
|
|
686
576
|
if (mFlexWrap != FLEX_WRAP_WRAP_REVERSE) {
|
|
687
|
-
int marginTop =
|
|
577
|
+
int marginTop = fl.mMaxBaseline - child.getBaseline();
|
|
688
578
|
marginTop = Math.max(marginTop, lp.topMargin);
|
|
689
579
|
largestHeightInLine = Math.max(largestHeightInLine,
|
|
690
580
|
child.getMeasuredHeight() + marginTop + lp.bottomMargin);
|
|
691
581
|
} else {
|
|
692
|
-
int marginBottom =
|
|
582
|
+
int marginBottom = fl.mMaxBaseline - child.getMeasuredHeight() +
|
|
693
583
|
child.getBaseline();
|
|
694
584
|
marginBottom = Math.max(marginBottom, lp.bottomMargin);
|
|
695
585
|
largestHeightInLine = Math.max(largestHeightInLine,
|
|
696
586
|
child.getMeasuredHeight() + lp.topMargin + marginBottom);
|
|
697
587
|
}
|
|
698
588
|
}
|
|
699
|
-
|
|
700
|
-
viewIndex +=
|
|
589
|
+
fl.mCrossSize = largestHeightInLine;
|
|
590
|
+
viewIndex += fl.mItemCount;
|
|
701
591
|
}
|
|
702
592
|
}
|
|
703
593
|
|
|
@@ -721,6 +611,8 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
721
611
|
* @see #setFlexWrap(int)
|
|
722
612
|
* @see #setAlignItems(int)
|
|
723
613
|
* @see #setAlignContent(int)
|
|
614
|
+
* @see #getRowGap()
|
|
615
|
+
* @see #setRowGap(int)
|
|
724
616
|
*/
|
|
725
617
|
private void measureVertical(int widthMeasureSpec, int heightMeasureSpec) {
|
|
726
618
|
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
|
@@ -814,8 +706,8 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
814
706
|
// later
|
|
815
707
|
flexLine.mCrossSize = Math.max(flexLine.mCrossSize, largestWidthInColumn);
|
|
816
708
|
|
|
817
|
-
if (
|
|
818
|
-
flexLine.mMainSize +=
|
|
709
|
+
if (mRowGap > 0 && hasPrecedingViews(i, indexInFlexLine)) {
|
|
710
|
+
flexLine.mMainSize += mRowGap;
|
|
819
711
|
}
|
|
820
712
|
addFlexLineIfLastFlexItem(i, childCount, flexLine);
|
|
821
713
|
}
|
|
@@ -846,7 +738,7 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
846
738
|
if (view.getMeasuredWidth() < lp.minWidth) {
|
|
847
739
|
needsMeasure = true;
|
|
848
740
|
childWidth = lp.minWidth;
|
|
849
|
-
} else if (view.getMeasuredWidth() > lp.maxWidth) {
|
|
741
|
+
} else if (lp.maxWidth >= 0 && view.getMeasuredWidth() > lp.maxWidth) {
|
|
850
742
|
needsMeasure = true;
|
|
851
743
|
childWidth = lp.maxWidth;
|
|
852
744
|
}
|
|
@@ -854,7 +746,7 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
854
746
|
if (childHeight < lp.minHeight) {
|
|
855
747
|
needsMeasure = true;
|
|
856
748
|
childHeight = lp.minHeight;
|
|
857
|
-
} else if (childHeight > lp.maxHeight) {
|
|
749
|
+
} else if (lp.maxHeight >= 0 && childHeight > lp.maxHeight) {
|
|
858
750
|
needsMeasure = true;
|
|
859
751
|
childHeight = lp.maxHeight;
|
|
860
752
|
}
|
|
@@ -872,19 +764,6 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
872
764
|
}
|
|
873
765
|
|
|
874
766
|
private void addFlexLine(FlexLine flexLine) {
|
|
875
|
-
// The size of the end divider isn't added until the flexLine is added to the flex container
|
|
876
|
-
// take the divider width (or height) into account when adding the flex line.
|
|
877
|
-
if (isMainAxisDirectionHorizontal(mFlexDirection)) {
|
|
878
|
-
if ((mShowDividerVertical & SHOW_DIVIDER_END) > 0) {
|
|
879
|
-
flexLine.mMainSize += mDividerVerticalWidth;
|
|
880
|
-
flexLine.mDividerLengthInMainSize += mDividerVerticalWidth;
|
|
881
|
-
}
|
|
882
|
-
} else {
|
|
883
|
-
if ((mShowDividerHorizontal & SHOW_DIVIDER_END) > 0) {
|
|
884
|
-
flexLine.mMainSize += mDividerHorizontalHeight;
|
|
885
|
-
flexLine.mDividerLengthInMainSize += mDividerHorizontalHeight;
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
767
|
mFlexLines.add(flexLine);
|
|
889
768
|
}
|
|
890
769
|
|
|
@@ -968,7 +847,7 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
968
847
|
int sizeBeforeExpand = flexLine.mMainSize;
|
|
969
848
|
boolean needsReExpand = false;
|
|
970
849
|
float unitSpace = (maxMainSize - flexLine.mMainSize) / flexLine.mTotalFlexGrow;
|
|
971
|
-
flexLine.mMainSize = paddingAlongMainAxis + flexLine.
|
|
850
|
+
flexLine.mMainSize = paddingAlongMainAxis + flexLine.mGapLengthInMainSize;
|
|
972
851
|
float accumulatedRoundError = 0;
|
|
973
852
|
for (int i = 0; i < flexLine.mItemCount; i++) {
|
|
974
853
|
View child = getReorderedChildAt(childIndex);
|
|
@@ -984,7 +863,7 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
984
863
|
if (!mChildrenFrozen[childIndex]) {
|
|
985
864
|
float rawCalculatedWidth = child.getMeasuredWidth() + unitSpace * lp.flexGrow + accumulatedRoundError;
|
|
986
865
|
int roundedCalculatedWidth = Math.round(rawCalculatedWidth);
|
|
987
|
-
if (roundedCalculatedWidth > lp.maxWidth) {
|
|
866
|
+
if (lp.maxWidth >= 0 && roundedCalculatedWidth > lp.maxWidth) {
|
|
988
867
|
// This means the child can't expand beyond the value of the maxWidth attribute.
|
|
989
868
|
// To adjust the flex line length to the size of maxMainSize, remaining
|
|
990
869
|
// positive free space needs to be re-distributed to other flex items
|
|
@@ -1008,7 +887,7 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1008
887
|
if (!mChildrenFrozen[childIndex]) {
|
|
1009
888
|
float rawCalculatedHeight = child.getMeasuredHeight() + unitSpace * lp.flexGrow;
|
|
1010
889
|
int roundedCalculatedHeight = Math.round(rawCalculatedHeight);
|
|
1011
|
-
if (roundedCalculatedHeight > lp.maxHeight) {
|
|
890
|
+
if (lp.maxHeight >= 0 && roundedCalculatedHeight > lp.maxHeight) {
|
|
1012
891
|
// This means the child can't expand beyond the value of the maxHeight
|
|
1013
892
|
// attribute.
|
|
1014
893
|
// To adjust the flex line length to the size of maxMainSize, remaining
|
|
@@ -1046,7 +925,7 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1046
925
|
* @param flexDirection the flexDirection value for this FlexboxLayout
|
|
1047
926
|
* @param maxMainSize the maximum main size. Shrank main size will be this size
|
|
1048
927
|
* @param paddingAlongMainAxis the padding value along the main axis
|
|
1049
|
-
* @param startIndex the start index of the children views to be
|
|
928
|
+
* @param startIndex the start index of the children views to be shrunk. This index
|
|
1050
929
|
* needs to
|
|
1051
930
|
* be an absolute index in the flex container (FlexboxLayout),
|
|
1052
931
|
* not the relative index in the flex line.
|
|
@@ -1066,7 +945,7 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1066
945
|
boolean needsReShrink = false;
|
|
1067
946
|
float unitShrink = (flexLine.mMainSize - maxMainSize) / flexLine.mTotalFlexShrink;
|
|
1068
947
|
float accumulatedRoundError = 0;
|
|
1069
|
-
flexLine.mMainSize = paddingAlongMainAxis + flexLine.
|
|
948
|
+
flexLine.mMainSize = paddingAlongMainAxis + flexLine.mGapLengthInMainSize;
|
|
1070
949
|
for (int i = 0; i < flexLine.mItemCount; i++) {
|
|
1071
950
|
View child = getReorderedChildAt(childIndex);
|
|
1072
951
|
if (child == null) {
|
|
@@ -1490,6 +1369,10 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1490
1369
|
* @return {@code true} if a wrap is required, {@code false} otherwise
|
|
1491
1370
|
* @see #getFlexWrap()
|
|
1492
1371
|
* @see #setFlexWrap(int)
|
|
1372
|
+
* @see #getRowGap()
|
|
1373
|
+
* @see #setRowGap(int)
|
|
1374
|
+
* @see #getColumnGap()
|
|
1375
|
+
* @see #setColumnGap(int)
|
|
1493
1376
|
*/
|
|
1494
1377
|
private boolean isWrapRequired(int mode, int maxSize, int currentLength, int childLength,
|
|
1495
1378
|
LayoutParams lp, int childAbsoluteIndex, int childRelativeIndexInFlexLine) {
|
|
@@ -1503,20 +1386,14 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1503
1386
|
return false;
|
|
1504
1387
|
}
|
|
1505
1388
|
if (isMainAxisDirectionHorizontal(mFlexDirection)) {
|
|
1506
|
-
if (
|
|
1389
|
+
if (mColumnGap > 0 && hasPrecedingViews(childAbsoluteIndex,
|
|
1507
1390
|
childRelativeIndexInFlexLine)) {
|
|
1508
|
-
childLength +=
|
|
1509
|
-
}
|
|
1510
|
-
if ((mShowDividerVertical & SHOW_DIVIDER_END) > 0) {
|
|
1511
|
-
childLength += mDividerVerticalWidth;
|
|
1391
|
+
childLength += mColumnGap;
|
|
1512
1392
|
}
|
|
1513
1393
|
} else {
|
|
1514
|
-
if (
|
|
1394
|
+
if (mRowGap > 0 && hasPrecedingViews(childAbsoluteIndex,
|
|
1515
1395
|
childRelativeIndexInFlexLine)) {
|
|
1516
|
-
childLength +=
|
|
1517
|
-
}
|
|
1518
|
-
if ((mShowDividerHorizontal & SHOW_DIVIDER_END) > 0) {
|
|
1519
|
-
childLength += mDividerHorizontalHeight;
|
|
1396
|
+
childLength += mRowGap;
|
|
1520
1397
|
}
|
|
1521
1398
|
}
|
|
1522
1399
|
return maxSize < currentLength + childLength;
|
|
@@ -1536,31 +1413,21 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1536
1413
|
}
|
|
1537
1414
|
|
|
1538
1415
|
/**
|
|
1539
|
-
* Retrieve the sum of the cross sizes of all flex lines including
|
|
1416
|
+
* Retrieve the sum of the cross sizes of all flex lines including gutters.
|
|
1540
1417
|
*
|
|
1541
1418
|
* @return the sum of the cross sizes
|
|
1542
1419
|
*/
|
|
1543
1420
|
private int getSumOfCrossSize() {
|
|
1421
|
+
final boolean isHorizontalDirection = isMainAxisDirectionHorizontal(mFlexDirection);
|
|
1544
1422
|
int sum = 0;
|
|
1423
|
+
|
|
1545
1424
|
for (int i = 0, size = mFlexLines.size(); i < size; i++) {
|
|
1546
1425
|
FlexLine flexLine = mFlexLines.get(i);
|
|
1426
|
+
int gap = isHorizontalDirection ? mRowGap : mColumnGap;
|
|
1547
1427
|
|
|
1548
|
-
// Judge if
|
|
1549
|
-
if (
|
|
1550
|
-
|
|
1551
|
-
sum += mDividerHorizontalHeight;
|
|
1552
|
-
} else {
|
|
1553
|
-
sum += mDividerVerticalWidth;
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1557
|
-
// Judge if the end divider is required
|
|
1558
|
-
if (hasEndDividerAfterFlexLine(i)) {
|
|
1559
|
-
if (isMainAxisDirectionHorizontal(mFlexDirection)) {
|
|
1560
|
-
sum += mDividerHorizontalHeight;
|
|
1561
|
-
} else {
|
|
1562
|
-
sum += mDividerVerticalWidth;
|
|
1563
|
-
}
|
|
1428
|
+
// Judge if gap is required
|
|
1429
|
+
if (gap > 0 && hasPrecedingFlexLines(i)) {
|
|
1430
|
+
sum += gap;
|
|
1564
1431
|
}
|
|
1565
1432
|
sum += flexLine.mCrossSize;
|
|
1566
1433
|
}
|
|
@@ -1623,6 +1490,10 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1623
1490
|
* @see #setJustifyContent(int)
|
|
1624
1491
|
* @see #getAlignItems()
|
|
1625
1492
|
* @see #setAlignItems(int)
|
|
1493
|
+
* @see #getRowGap()
|
|
1494
|
+
* @see #setRowGap(int)
|
|
1495
|
+
* @see #getColumnGap()
|
|
1496
|
+
* @see #setColumnGap(int)
|
|
1626
1497
|
* @see LayoutParams#alignSelf
|
|
1627
1498
|
*/
|
|
1628
1499
|
private void layoutHorizontal(boolean isRtl, int left, int top, int right, int bottom) {
|
|
@@ -1646,9 +1517,9 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1646
1517
|
float childRight;
|
|
1647
1518
|
for (int i = 0, size = mFlexLines.size(); i < size; i++) {
|
|
1648
1519
|
FlexLine flexLine = mFlexLines.get(i);
|
|
1649
|
-
if (
|
|
1650
|
-
childBottom -=
|
|
1651
|
-
childTop +=
|
|
1520
|
+
if (mRowGap > 0 && hasPrecedingFlexLines(i)) {
|
|
1521
|
+
childBottom -= mRowGap;
|
|
1522
|
+
childTop += mRowGap;
|
|
1652
1523
|
}
|
|
1653
1524
|
float spaceBetweenItem = 0f;
|
|
1654
1525
|
switch (mJustifyContent) {
|
|
@@ -1700,9 +1571,9 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1700
1571
|
LayoutParams lp = ((LayoutParams) child.getLayoutParams());
|
|
1701
1572
|
childLeft += lp.leftMargin;
|
|
1702
1573
|
childRight -= lp.rightMargin;
|
|
1703
|
-
if (
|
|
1704
|
-
childLeft +=
|
|
1705
|
-
childRight -=
|
|
1574
|
+
if (mColumnGap > 0 && hasPrecedingViews(currentViewIndex, j)) {
|
|
1575
|
+
childLeft += mColumnGap;
|
|
1576
|
+
childRight -= mColumnGap;
|
|
1706
1577
|
}
|
|
1707
1578
|
|
|
1708
1579
|
if (mFlexWrap == FLEX_WRAP_WRAP_REVERSE) {
|
|
@@ -1842,6 +1713,10 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1842
1713
|
* @see #setJustifyContent(int)
|
|
1843
1714
|
* @see #getAlignItems()
|
|
1844
1715
|
* @see #setAlignItems(int)
|
|
1716
|
+
* @see #getRowGap()
|
|
1717
|
+
* @see #setRowGap(int)
|
|
1718
|
+
* @see #getColumnGap()
|
|
1719
|
+
* @see #setColumnGap(int)
|
|
1845
1720
|
* @see LayoutParams#alignSelf
|
|
1846
1721
|
*/
|
|
1847
1722
|
private void layoutVertical(boolean isRtl, boolean fromBottomToTop, int left, int top,
|
|
@@ -1868,9 +1743,9 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1868
1743
|
|
|
1869
1744
|
for (int i = 0, size = mFlexLines.size(); i < size; i++) {
|
|
1870
1745
|
FlexLine flexLine = mFlexLines.get(i);
|
|
1871
|
-
if (
|
|
1872
|
-
childLeft +=
|
|
1873
|
-
childRight -=
|
|
1746
|
+
if (mColumnGap > 0 && hasPrecedingFlexLines(i)) {
|
|
1747
|
+
childLeft += mColumnGap;
|
|
1748
|
+
childRight -= mColumnGap;
|
|
1874
1749
|
}
|
|
1875
1750
|
float spaceBetweenItem = 0f;
|
|
1876
1751
|
switch (mJustifyContent) {
|
|
@@ -1922,9 +1797,9 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
1922
1797
|
LayoutParams lp = ((LayoutParams) child.getLayoutParams());
|
|
1923
1798
|
childTop += lp.topMargin;
|
|
1924
1799
|
childBottom -= lp.bottomMargin;
|
|
1925
|
-
if (
|
|
1926
|
-
childTop +=
|
|
1927
|
-
childBottom -=
|
|
1800
|
+
if (mRowGap > 0 && hasPrecedingViews(currentViewIndex, j)) {
|
|
1801
|
+
childTop += mRowGap;
|
|
1802
|
+
childBottom -= mRowGap;
|
|
1928
1803
|
}
|
|
1929
1804
|
if (isRtl) {
|
|
1930
1805
|
if (fromBottomToTop) {
|
|
@@ -2033,235 +1908,6 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
2033
1908
|
}
|
|
2034
1909
|
}
|
|
2035
1910
|
|
|
2036
|
-
@Override
|
|
2037
|
-
protected void onDraw(Canvas canvas) {
|
|
2038
|
-
if (mDividerDrawableVertical == null && mDividerDrawableHorizontal == null) {
|
|
2039
|
-
return;
|
|
2040
|
-
}
|
|
2041
|
-
if (mShowDividerHorizontal == SHOW_DIVIDER_NONE
|
|
2042
|
-
&& mShowDividerVertical == SHOW_DIVIDER_NONE) {
|
|
2043
|
-
return;
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
int layoutDirection = ViewCompat.getLayoutDirection(this);
|
|
2047
|
-
boolean isRtl;
|
|
2048
|
-
boolean fromBottomToTop = false;
|
|
2049
|
-
switch (mFlexDirection) {
|
|
2050
|
-
case FLEX_DIRECTION_ROW:
|
|
2051
|
-
isRtl = layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL;
|
|
2052
|
-
if (mFlexWrap == FLEX_WRAP_WRAP_REVERSE) {
|
|
2053
|
-
fromBottomToTop = true;
|
|
2054
|
-
}
|
|
2055
|
-
drawDividersHorizontal(canvas, isRtl, fromBottomToTop);
|
|
2056
|
-
break;
|
|
2057
|
-
case FLEX_DIRECTION_ROW_REVERSE:
|
|
2058
|
-
isRtl = layoutDirection != ViewCompat.LAYOUT_DIRECTION_RTL;
|
|
2059
|
-
if (mFlexWrap == FLEX_WRAP_WRAP_REVERSE) {
|
|
2060
|
-
fromBottomToTop = true;
|
|
2061
|
-
}
|
|
2062
|
-
drawDividersHorizontal(canvas, isRtl, fromBottomToTop);
|
|
2063
|
-
break;
|
|
2064
|
-
case FLEX_DIRECTION_COLUMN:
|
|
2065
|
-
isRtl = layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL;
|
|
2066
|
-
if (mFlexWrap == FLEX_WRAP_WRAP_REVERSE) {
|
|
2067
|
-
isRtl = !isRtl;
|
|
2068
|
-
}
|
|
2069
|
-
drawDividersVertical(canvas, isRtl, false /* fromBottomToTop */);
|
|
2070
|
-
break;
|
|
2071
|
-
case FLEX_DIRECTION_COLUMN_REVERSE:
|
|
2072
|
-
isRtl = layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL;
|
|
2073
|
-
if (mFlexWrap == FLEX_WRAP_WRAP_REVERSE) {
|
|
2074
|
-
isRtl = !isRtl;
|
|
2075
|
-
}
|
|
2076
|
-
drawDividersVertical(canvas, isRtl, true /* fromBottomToTop */);
|
|
2077
|
-
break;
|
|
2078
|
-
}
|
|
2079
|
-
}
|
|
2080
|
-
|
|
2081
|
-
/**
|
|
2082
|
-
* Sub method for {@link #onDraw(Canvas)} when the main axis direction is horizontal
|
|
2083
|
-
* ({@link #mFlexDirection} is either of {@link #FLEX_DIRECTION_ROW} or
|
|
2084
|
-
* {@link #FLEX_DIRECTION_ROW_REVERSE}.
|
|
2085
|
-
*
|
|
2086
|
-
* @param canvas the canvas on which the background will be drawn
|
|
2087
|
-
* @param isRtl {@code true} when the horizontal layout direction is right to left,
|
|
2088
|
-
* {@code false} otherwise
|
|
2089
|
-
* @param fromBottomToTop {@code true} when the vertical layout direction is bottom to top,
|
|
2090
|
-
* {@code false} otherwise
|
|
2091
|
-
*/
|
|
2092
|
-
private void drawDividersHorizontal(Canvas canvas, boolean isRtl, boolean fromBottomToTop) {
|
|
2093
|
-
int currentViewIndex = 0;
|
|
2094
|
-
int paddingLeft = getPaddingLeft();
|
|
2095
|
-
int paddingRight = getPaddingRight();
|
|
2096
|
-
int horizontalDividerLength = Math.max(0, getWidth() - paddingRight - paddingLeft);
|
|
2097
|
-
for (int i = 0, size = mFlexLines.size(); i < size; i++) {
|
|
2098
|
-
FlexLine flexLine = mFlexLines.get(i);
|
|
2099
|
-
for (int j = 0; j < flexLine.mItemCount; j++) {
|
|
2100
|
-
View view = getReorderedChildAt(currentViewIndex);
|
|
2101
|
-
|
|
2102
|
-
if (view == null || view.getVisibility() == View.GONE) {
|
|
2103
|
-
continue;
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
|
-
LayoutParams lp = (LayoutParams) view.getLayoutParams();
|
|
2107
|
-
|
|
2108
|
-
// Judge if the beginning or middle divider is needed
|
|
2109
|
-
if (hasDividerBeforeChildAtAlongMainAxis(currentViewIndex, j)) {
|
|
2110
|
-
int dividerLeft;
|
|
2111
|
-
if (isRtl) {
|
|
2112
|
-
dividerLeft = view.getRight() + lp.rightMargin;
|
|
2113
|
-
} else {
|
|
2114
|
-
dividerLeft = view.getLeft() - lp.leftMargin - mDividerVerticalWidth;
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
|
-
drawVerticalDivider(canvas, dividerLeft, flexLine.mTop, flexLine.mCrossSize);
|
|
2118
|
-
}
|
|
2119
|
-
|
|
2120
|
-
// Judge if the end divider is needed
|
|
2121
|
-
if (j == flexLine.mItemCount - 1) {
|
|
2122
|
-
if ((mShowDividerVertical & SHOW_DIVIDER_END) > 0) {
|
|
2123
|
-
int dividerLeft;
|
|
2124
|
-
if (isRtl) {
|
|
2125
|
-
dividerLeft = view.getLeft() - lp.leftMargin - mDividerVerticalWidth;
|
|
2126
|
-
} else {
|
|
2127
|
-
dividerLeft = view.getRight() + lp.rightMargin;
|
|
2128
|
-
}
|
|
2129
|
-
|
|
2130
|
-
drawVerticalDivider(canvas, dividerLeft, flexLine.mTop,
|
|
2131
|
-
flexLine.mCrossSize);
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
currentViewIndex++;
|
|
2135
|
-
}
|
|
2136
|
-
|
|
2137
|
-
// Judge if the beginning or middle dividers are needed before the flex line
|
|
2138
|
-
if (hasDividerBeforeFlexLine(i)) {
|
|
2139
|
-
int horizontalDividerTop;
|
|
2140
|
-
if (fromBottomToTop) {
|
|
2141
|
-
horizontalDividerTop = flexLine.mBottom;
|
|
2142
|
-
} else {
|
|
2143
|
-
horizontalDividerTop = flexLine.mTop - mDividerHorizontalHeight;
|
|
2144
|
-
}
|
|
2145
|
-
drawHorizontalDivider(canvas, paddingLeft, horizontalDividerTop,
|
|
2146
|
-
horizontalDividerLength);
|
|
2147
|
-
}
|
|
2148
|
-
// Judge if the end divider is needed before the flex line
|
|
2149
|
-
if (hasEndDividerAfterFlexLine(i)) {
|
|
2150
|
-
if ((mShowDividerHorizontal & SHOW_DIVIDER_END) > 0) {
|
|
2151
|
-
int horizontalDividerTop;
|
|
2152
|
-
if (fromBottomToTop) {
|
|
2153
|
-
horizontalDividerTop = flexLine.mTop - mDividerHorizontalHeight;
|
|
2154
|
-
} else {
|
|
2155
|
-
horizontalDividerTop = flexLine.mBottom;
|
|
2156
|
-
}
|
|
2157
|
-
drawHorizontalDivider(canvas, paddingLeft, horizontalDividerTop,
|
|
2158
|
-
horizontalDividerLength);
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
/**
|
|
2165
|
-
* Sub method for {@link #onDraw(Canvas)} when the main axis direction is vertical
|
|
2166
|
-
* ({@link #mFlexDirection} is either of {@link #FLEX_DIRECTION_COLUMN} or
|
|
2167
|
-
* {@link #FLEX_DIRECTION_COLUMN_REVERSE}.
|
|
2168
|
-
*
|
|
2169
|
-
* @param canvas the canvas on which the background will be drawn
|
|
2170
|
-
* @param isRtl {@code true} when the horizontal layout direction is right to left,
|
|
2171
|
-
* {@code false} otherwise
|
|
2172
|
-
* @param fromBottomToTop {@code true} when the vertical layout direction is bottom to top,
|
|
2173
|
-
* {@code false} otherwise
|
|
2174
|
-
*/
|
|
2175
|
-
private void drawDividersVertical(Canvas canvas, boolean isRtl, boolean fromBottomToTop) {
|
|
2176
|
-
int currentViewIndex = 0;
|
|
2177
|
-
int paddingTop = getPaddingTop();
|
|
2178
|
-
int paddingBottom = getPaddingBottom();
|
|
2179
|
-
int verticalDividerLength = Math.max(0, getHeight() - paddingBottom - paddingTop);
|
|
2180
|
-
for (int i = 0, size = mFlexLines.size(); i < size; i++) {
|
|
2181
|
-
FlexLine flexLine = mFlexLines.get(i);
|
|
2182
|
-
|
|
2183
|
-
// Draw horizontal dividers if needed
|
|
2184
|
-
for (int j = 0; j < flexLine.mItemCount; j++) {
|
|
2185
|
-
View view = getReorderedChildAt(currentViewIndex);
|
|
2186
|
-
|
|
2187
|
-
if (view == null || view.getVisibility() == View.GONE) {
|
|
2188
|
-
continue;
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
LayoutParams lp = (LayoutParams) view.getLayoutParams();
|
|
2192
|
-
|
|
2193
|
-
// Judge if the beginning or middle divider is needed
|
|
2194
|
-
if (hasDividerBeforeChildAtAlongMainAxis(currentViewIndex, j)) {
|
|
2195
|
-
int dividerTop;
|
|
2196
|
-
if (fromBottomToTop) {
|
|
2197
|
-
dividerTop = view.getBottom() + lp.bottomMargin;
|
|
2198
|
-
} else {
|
|
2199
|
-
dividerTop = view.getTop() - lp.topMargin - mDividerHorizontalHeight;
|
|
2200
|
-
}
|
|
2201
|
-
|
|
2202
|
-
drawHorizontalDivider(canvas, flexLine.mLeft, dividerTop, flexLine.mCrossSize);
|
|
2203
|
-
}
|
|
2204
|
-
|
|
2205
|
-
// Judge if the end divider is needed
|
|
2206
|
-
if (j == flexLine.mItemCount - 1) {
|
|
2207
|
-
if ((mShowDividerHorizontal & SHOW_DIVIDER_END) > 0) {
|
|
2208
|
-
int dividerTop;
|
|
2209
|
-
if (fromBottomToTop) {
|
|
2210
|
-
dividerTop = view.getTop() - lp.topMargin - mDividerHorizontalHeight;
|
|
2211
|
-
} else {
|
|
2212
|
-
dividerTop = view.getBottom() + lp.bottomMargin;
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
drawHorizontalDivider(canvas, flexLine.mLeft, dividerTop,
|
|
2216
|
-
flexLine.mCrossSize);
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
currentViewIndex++;
|
|
2220
|
-
}
|
|
2221
|
-
|
|
2222
|
-
// Judge if the beginning or middle dividers are needed before the flex line
|
|
2223
|
-
if (hasDividerBeforeFlexLine(i)) {
|
|
2224
|
-
int verticalDividerLeft;
|
|
2225
|
-
if (isRtl) {
|
|
2226
|
-
verticalDividerLeft = flexLine.mRight;
|
|
2227
|
-
} else {
|
|
2228
|
-
verticalDividerLeft = flexLine.mLeft - mDividerVerticalWidth;
|
|
2229
|
-
}
|
|
2230
|
-
drawVerticalDivider(canvas, verticalDividerLeft, paddingTop,
|
|
2231
|
-
verticalDividerLength);
|
|
2232
|
-
}
|
|
2233
|
-
if (hasEndDividerAfterFlexLine(i)) {
|
|
2234
|
-
if ((mShowDividerVertical & SHOW_DIVIDER_END) > 0) {
|
|
2235
|
-
int verticalDividerLeft;
|
|
2236
|
-
if (isRtl) {
|
|
2237
|
-
verticalDividerLeft = flexLine.mLeft - mDividerVerticalWidth;
|
|
2238
|
-
} else {
|
|
2239
|
-
verticalDividerLeft = flexLine.mRight;
|
|
2240
|
-
}
|
|
2241
|
-
drawVerticalDivider(canvas, verticalDividerLeft, paddingTop,
|
|
2242
|
-
verticalDividerLength);
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
|
|
2248
|
-
private void drawVerticalDivider(Canvas canvas, int left, int top, int length) {
|
|
2249
|
-
if (mDividerDrawableVertical == null) {
|
|
2250
|
-
return;
|
|
2251
|
-
}
|
|
2252
|
-
mDividerDrawableVertical.setBounds(left, top, left + mDividerVerticalWidth, top + length);
|
|
2253
|
-
mDividerDrawableVertical.draw(canvas);
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
|
-
private void drawHorizontalDivider(Canvas canvas, int left, int top, int length) {
|
|
2257
|
-
if (mDividerDrawableHorizontal == null) {
|
|
2258
|
-
return;
|
|
2259
|
-
}
|
|
2260
|
-
mDividerDrawableHorizontal
|
|
2261
|
-
.setBounds(left, top, left + length, top + mDividerHorizontalHeight);
|
|
2262
|
-
mDividerDrawableHorizontal.draw(canvas);
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
1911
|
@Override
|
|
2266
1912
|
protected LayoutParams generateDefaultLayoutParams() {
|
|
2267
1913
|
return new FlexboxLayout.LayoutParams();
|
|
@@ -2354,248 +2000,73 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
2354
2000
|
}
|
|
2355
2001
|
}
|
|
2356
2002
|
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
* original list excluding a dummy flex line (flex line that doesn't have any flex items in it
|
|
2360
|
-
* but used for the alignment along the cross axis).
|
|
2361
|
-
* Thus any changes of the returned list are not reflected to the original list.
|
|
2362
|
-
*/
|
|
2363
|
-
public List<FlexLine> getFlexLines() {
|
|
2364
|
-
List<FlexLine> result = new ArrayList<>(mFlexLines.size());
|
|
2365
|
-
for (FlexLine flexLine : mFlexLines) {
|
|
2366
|
-
if (flexLine.getLayoutVisibleItemCount() == 0) {
|
|
2367
|
-
continue;
|
|
2368
|
-
}
|
|
2369
|
-
result.add(flexLine);
|
|
2370
|
-
}
|
|
2371
|
-
return result;
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
/**
|
|
2375
|
-
* @return the horizontal divider drawable that will divide each item.
|
|
2376
|
-
* @see #setDividerDrawable(Drawable)
|
|
2377
|
-
* @see #setDividerDrawableHorizontal(Drawable)
|
|
2378
|
-
*/
|
|
2379
|
-
public Drawable getDividerDrawableHorizontal() {
|
|
2380
|
-
return mDividerDrawableHorizontal;
|
|
2381
|
-
}
|
|
2382
|
-
|
|
2383
|
-
/**
|
|
2384
|
-
* @return the vertical divider drawable that will divide each item.
|
|
2385
|
-
* @see #setDividerDrawable(Drawable)
|
|
2386
|
-
* @see #setDividerDrawableVertical(Drawable)
|
|
2387
|
-
*/
|
|
2388
|
-
public Drawable getDividerDrawableVertical() {
|
|
2389
|
-
return mDividerDrawableVertical;
|
|
2003
|
+
public int getRowGap() {
|
|
2004
|
+
return mRowGap;
|
|
2390
2005
|
}
|
|
2391
2006
|
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
* @param divider Drawable that will divide each item for both horizontally and vertically.
|
|
2397
|
-
* @see #setShowDivider(int)
|
|
2398
|
-
*/
|
|
2399
|
-
public void setDividerDrawable(Drawable divider) {
|
|
2400
|
-
setDividerDrawableHorizontal(divider);
|
|
2401
|
-
setDividerDrawableVertical(divider);
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
/**
|
|
2405
|
-
* Set a drawable to be used as a horizontal divider between items.
|
|
2406
|
-
*
|
|
2407
|
-
* @param divider Drawable that will divide each item.
|
|
2408
|
-
* @see #setDividerDrawable(Drawable)
|
|
2409
|
-
* @see #setShowDivider(int)
|
|
2410
|
-
* @see #setShowDividerHorizontal(int)
|
|
2411
|
-
*/
|
|
2412
|
-
public void setDividerDrawableHorizontal(Drawable divider) {
|
|
2413
|
-
if (divider == mDividerDrawableHorizontal) {
|
|
2414
|
-
return;
|
|
2415
|
-
}
|
|
2416
|
-
mDividerDrawableHorizontal = divider;
|
|
2417
|
-
if (divider != null) {
|
|
2418
|
-
mDividerHorizontalHeight = divider.getIntrinsicHeight();
|
|
2419
|
-
} else {
|
|
2420
|
-
mDividerHorizontalHeight = 0;
|
|
2421
|
-
}
|
|
2422
|
-
setWillNotDrawFlag();
|
|
2423
|
-
requestLayout();
|
|
2424
|
-
}
|
|
2425
|
-
|
|
2426
|
-
/**
|
|
2427
|
-
* Set a drawable to be used as a vertical divider between items.
|
|
2428
|
-
*
|
|
2429
|
-
* @param divider Drawable that will divide each item.
|
|
2430
|
-
* @see #setDividerDrawable(Drawable)
|
|
2431
|
-
* @see #setShowDivider(int)
|
|
2432
|
-
* @see #setShowDividerVertical(int)
|
|
2433
|
-
*/
|
|
2434
|
-
public void setDividerDrawableVertical(Drawable divider) {
|
|
2435
|
-
if (divider == mDividerDrawableVertical) {
|
|
2436
|
-
return;
|
|
2437
|
-
}
|
|
2438
|
-
mDividerDrawableVertical = divider;
|
|
2439
|
-
if (divider != null) {
|
|
2440
|
-
mDividerVerticalWidth = divider.getIntrinsicWidth();
|
|
2441
|
-
} else {
|
|
2442
|
-
mDividerVerticalWidth = 0;
|
|
2007
|
+
public void setRowGap(int rowGap) {
|
|
2008
|
+
if (mRowGap != rowGap) {
|
|
2009
|
+
mRowGap = rowGap;
|
|
2010
|
+
requestLayout();
|
|
2443
2011
|
}
|
|
2444
|
-
setWillNotDrawFlag();
|
|
2445
|
-
requestLayout();
|
|
2446
2012
|
}
|
|
2447
2013
|
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
return mShowDividerVertical;
|
|
2014
|
+
public int getColumnGap() {
|
|
2015
|
+
return mColumnGap;
|
|
2451
2016
|
}
|
|
2452
2017
|
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
/**
|
|
2459
|
-
* Set how dividers should be shown between items in this layout. This method sets the
|
|
2460
|
-
* divider mode for both horizontally and vertically.
|
|
2461
|
-
*
|
|
2462
|
-
* @param dividerMode One or more of {@link #SHOW_DIVIDER_BEGINNING},
|
|
2463
|
-
* {@link #SHOW_DIVIDER_MIDDLE}, or {@link #SHOW_DIVIDER_END},
|
|
2464
|
-
* or {@link #SHOW_DIVIDER_NONE} to show no dividers.
|
|
2465
|
-
* @see #setShowDividerVertical(int)
|
|
2466
|
-
* @see #setShowDividerHorizontal(int)
|
|
2467
|
-
*/
|
|
2468
|
-
public void setShowDivider(@DividerMode int dividerMode) {
|
|
2469
|
-
setShowDividerVertical(dividerMode);
|
|
2470
|
-
setShowDividerHorizontal(dividerMode);
|
|
2471
|
-
}
|
|
2472
|
-
|
|
2473
|
-
/**
|
|
2474
|
-
* Set how vertical dividers should be shown between items in this layout
|
|
2475
|
-
*
|
|
2476
|
-
* @param dividerMode One or more of {@link #SHOW_DIVIDER_BEGINNING},
|
|
2477
|
-
* {@link #SHOW_DIVIDER_MIDDLE}, or {@link #SHOW_DIVIDER_END},
|
|
2478
|
-
* or {@link #SHOW_DIVIDER_NONE} to show no dividers.
|
|
2479
|
-
* @see #setShowDivider(int)
|
|
2480
|
-
*/
|
|
2481
|
-
public void setShowDividerVertical(@DividerMode int dividerMode) {
|
|
2482
|
-
if (dividerMode != mShowDividerVertical) {
|
|
2483
|
-
mShowDividerVertical = dividerMode;
|
|
2018
|
+
public void setColumnGap(int columnGap) {
|
|
2019
|
+
if (mColumnGap != columnGap) {
|
|
2020
|
+
mColumnGap = columnGap;
|
|
2484
2021
|
requestLayout();
|
|
2485
2022
|
}
|
|
2486
2023
|
}
|
|
2487
2024
|
|
|
2488
2025
|
/**
|
|
2489
|
-
*
|
|
2490
|
-
*
|
|
2491
|
-
*
|
|
2492
|
-
*
|
|
2493
|
-
* or {@link #SHOW_DIVIDER_NONE} to show no dividers.
|
|
2494
|
-
* @see #setShowDivider(int)
|
|
2495
|
-
*/
|
|
2496
|
-
public void setShowDividerHorizontal(@DividerMode int dividerMode) {
|
|
2497
|
-
if (dividerMode != mShowDividerHorizontal) {
|
|
2498
|
-
mShowDividerHorizontal = dividerMode;
|
|
2499
|
-
requestLayout();
|
|
2500
|
-
}
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
|
-
private void setWillNotDrawFlag() {
|
|
2504
|
-
setWillNotDraw(mDividerDrawableHorizontal == null && mDividerDrawableVertical == null);
|
|
2505
|
-
}
|
|
2506
|
-
|
|
2507
|
-
/**
|
|
2508
|
-
* Check if a divider is needed before the view whose indices are passed as arguments.
|
|
2509
|
-
*
|
|
2510
|
-
* @param childAbsoluteIndex the absolute index of the view to be judged
|
|
2511
|
-
* @param childRelativeIndexInFlexLine the relative index in the flex line where the view
|
|
2512
|
-
* belongs
|
|
2513
|
-
* @return {@code true} if a divider is needed, {@code false} otherwise
|
|
2026
|
+
* @return the flex lines composing this flex container. This method returns a copy of the
|
|
2027
|
+
* original list excluding a dummy flex line (flex line that doesn't have any flex items in it
|
|
2028
|
+
* but used for the alignment along the cross axis).
|
|
2029
|
+
* Thus, any changes of the returned list are not reflected to the original list.
|
|
2514
2030
|
*/
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
if (
|
|
2519
|
-
|
|
2520
|
-
} else {
|
|
2521
|
-
return (mShowDividerHorizontal & SHOW_DIVIDER_BEGINNING) != 0;
|
|
2522
|
-
}
|
|
2523
|
-
} else {
|
|
2524
|
-
if (isMainAxisDirectionHorizontal(mFlexDirection)) {
|
|
2525
|
-
return (mShowDividerVertical & SHOW_DIVIDER_MIDDLE) != 0;
|
|
2526
|
-
} else {
|
|
2527
|
-
return (mShowDividerHorizontal & SHOW_DIVIDER_MIDDLE) != 0;
|
|
2031
|
+
public List<FlexLine> getFlexLines() {
|
|
2032
|
+
List<FlexLine> result = new ArrayList<>(mFlexLines.size());
|
|
2033
|
+
for (FlexLine flexLine : mFlexLines) {
|
|
2034
|
+
if (flexLine.getLayoutVisibleItemCount() == 0) {
|
|
2035
|
+
continue;
|
|
2528
2036
|
}
|
|
2037
|
+
result.add(flexLine);
|
|
2529
2038
|
}
|
|
2039
|
+
return result;
|
|
2530
2040
|
}
|
|
2531
2041
|
|
|
2532
|
-
private boolean
|
|
2533
|
-
int childRelativeIndexInFlexLine) {
|
|
2042
|
+
private boolean hasPrecedingViews(int childAbsoluteIndex, int childRelativeIndexInFlexLine) {
|
|
2534
2043
|
for (int i = 1; i <= childRelativeIndexInFlexLine; i++) {
|
|
2535
2044
|
View view = getReorderedChildAt(childAbsoluteIndex - i);
|
|
2536
2045
|
if (view != null && view.getVisibility() != View.GONE) {
|
|
2537
|
-
return
|
|
2046
|
+
return true;
|
|
2538
2047
|
}
|
|
2539
2048
|
}
|
|
2540
|
-
return
|
|
2049
|
+
return false;
|
|
2541
2050
|
}
|
|
2542
2051
|
|
|
2543
2052
|
/**
|
|
2544
|
-
* Check if
|
|
2053
|
+
* Check if any flex line is preceding the flex line whose index is passed as an argument.
|
|
2545
2054
|
*
|
|
2546
2055
|
* @param flexLineIndex the index of the flex line to be checked
|
|
2547
|
-
* @return {@code true} if a
|
|
2056
|
+
* @return {@code true} if a flex line is preceding, {@code false} otherwise
|
|
2548
2057
|
*/
|
|
2549
|
-
private boolean
|
|
2058
|
+
private boolean hasPrecedingFlexLines(int flexLineIndex) {
|
|
2550
2059
|
if (flexLineIndex < 0 || flexLineIndex >= mFlexLines.size()) {
|
|
2551
2060
|
return false;
|
|
2552
2061
|
}
|
|
2553
|
-
if (allFlexLinesAreDummyBefore(flexLineIndex)) {
|
|
2554
|
-
if (isMainAxisDirectionHorizontal(mFlexDirection)) {
|
|
2555
|
-
return (mShowDividerHorizontal & SHOW_DIVIDER_BEGINNING) != 0;
|
|
2556
|
-
} else {
|
|
2557
|
-
return (mShowDividerVertical & SHOW_DIVIDER_BEGINNING) != 0;
|
|
2558
|
-
}
|
|
2559
|
-
} else {
|
|
2560
|
-
if (isMainAxisDirectionHorizontal(mFlexDirection)) {
|
|
2561
|
-
return (mShowDividerHorizontal & SHOW_DIVIDER_MIDDLE) != 0;
|
|
2562
|
-
} else {
|
|
2563
|
-
return (mShowDividerVertical & SHOW_DIVIDER_MIDDLE) != 0;
|
|
2564
|
-
}
|
|
2565
|
-
}
|
|
2566
|
-
}
|
|
2567
2062
|
|
|
2568
|
-
private boolean allFlexLinesAreDummyBefore(int flexLineIndex) {
|
|
2569
2063
|
for (int i = 0; i < flexLineIndex; i++) {
|
|
2570
2064
|
if (mFlexLines.get(i).getLayoutVisibleItemCount() > 0) {
|
|
2571
|
-
return
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
return true;
|
|
2575
|
-
}
|
|
2576
|
-
|
|
2577
|
-
/**
|
|
2578
|
-
* Check if a end divider is needed after the flex line whose index is passed as an argument.
|
|
2579
|
-
*
|
|
2580
|
-
* @param flexLineIndex the index of the flex line to be checked
|
|
2581
|
-
* @return {@code true} if a divider is needed, {@code false} otherwise
|
|
2582
|
-
*/
|
|
2583
|
-
private boolean hasEndDividerAfterFlexLine(int flexLineIndex) {
|
|
2584
|
-
if (flexLineIndex < 0 || flexLineIndex >= mFlexLines.size()) {
|
|
2585
|
-
return false;
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
for (int i = flexLineIndex + 1; i < mFlexLines.size(); i++) {
|
|
2589
|
-
if (mFlexLines.get(i).getLayoutVisibleItemCount() > 0) {
|
|
2590
|
-
return false;
|
|
2065
|
+
return true;
|
|
2591
2066
|
}
|
|
2592
2067
|
}
|
|
2593
|
-
if (isMainAxisDirectionHorizontal(mFlexDirection)) {
|
|
2594
|
-
return (mShowDividerHorizontal & SHOW_DIVIDER_END) != 0;
|
|
2595
|
-
} else {
|
|
2596
|
-
return (mShowDividerVertical & SHOW_DIVIDER_END) != 0;
|
|
2597
|
-
}
|
|
2598
2068
|
|
|
2069
|
+
return false;
|
|
2599
2070
|
}
|
|
2600
2071
|
|
|
2601
2072
|
/**
|
|
@@ -2623,8 +2094,6 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
2623
2094
|
|
|
2624
2095
|
public static final int ALIGN_SELF_STRETCH = ALIGN_ITEMS_STRETCH;
|
|
2625
2096
|
|
|
2626
|
-
private static final int MAX_SIZE = Integer.MAX_VALUE & View.MEASURED_SIZE_MASK;
|
|
2627
|
-
|
|
2628
2097
|
/**
|
|
2629
2098
|
* This attribute can change the ordering of the children views are laid out.
|
|
2630
2099
|
* By default, children are displayed and laid out in the same order as they appear in the
|
|
@@ -2680,20 +2149,14 @@ public class FlexboxLayout extends LayoutBase {
|
|
|
2680
2149
|
*/
|
|
2681
2150
|
public int minHeight;
|
|
2682
2151
|
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
public int maxWidth = MAX_SIZE;
|
|
2687
|
-
|
|
2688
|
-
/**
|
|
2689
|
-
* This attribute determines the maximum height the child can expand to.
|
|
2690
|
-
*/
|
|
2691
|
-
public int maxHeight = MAX_SIZE;
|
|
2152
|
+
// maxWidth / maxHeight are inherited from CommonLayoutParams (-1 means unconstrained),
|
|
2153
|
+
// so that the max-width / max-height style properties, including percent values resolved
|
|
2154
|
+
// in CommonLayoutParams.adjustChildrenLayoutParams, are honored inside flexbox as well.
|
|
2692
2155
|
|
|
2693
2156
|
/**
|
|
2694
2157
|
* This attribute forces a flex line wrapping. i.e. if this is set to {@code true} for a
|
|
2695
2158
|
* flex item, the item will become the first item of the new flex line. (A wrapping happens
|
|
2696
|
-
* regardless of the flex items being processed in the
|
|
2159
|
+
* regardless of the flex items being processed in the previous flex line)
|
|
2697
2160
|
* This attribute is ignored if the flex_wrap attribute is set as nowrap.
|
|
2698
2161
|
* The equivalent attribute isn't defined in the original CSS Flexible Box Module
|
|
2699
2162
|
* specification, but having this attribute is useful for Android developers to flatten
|