@nativescript/core 9.0.0-next-10-06-2025-18277360121 → 9.0.0-next-10-09-2025-18367604937
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/package.json +1 -1
- package/platforms/android/widgets-release.aar +0 -0
- package/platforms/ios/TNSWidgets.xcframework/Info.plist +102 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +20 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Resources/Info.plist +52 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Resources/Info.plist +52 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Resources/Info.plist +52 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +20 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +223 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +20 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +20 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +223 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +20 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +82 -0
- package/platforms/ios/src/module.modulemap +0 -5
- package/ui/button/index.d.ts +1 -1
- package/ui/slider/index.d.ts +1 -1
- package/platforms/android/include.gradle +0 -51
- package/platforms/android/java/org/nativescript/Process.java +0 -59
- package/platforms/android/java/org/nativescript/widgets/AbsoluteLayout.java +0 -88
- package/platforms/android/java/org/nativescript/widgets/AnimatorHelper.java +0 -61
- package/platforms/android/java/org/nativescript/widgets/Async.java +0 -1356
- package/platforms/android/java/org/nativescript/widgets/BorderDrawable.java +0 -936
- package/platforms/android/java/org/nativescript/widgets/BottomNavigationBar.java +0 -308
- package/platforms/android/java/org/nativescript/widgets/BoxShadowDrawable.java +0 -175
- package/platforms/android/java/org/nativescript/widgets/CSSValue.java +0 -34
- package/platforms/android/java/org/nativescript/widgets/CommonLayoutParams.java +0 -456
- package/platforms/android/java/org/nativescript/widgets/ContentLayout.java +0 -85
- package/platforms/android/java/org/nativescript/widgets/CustomTransition.java +0 -135
- package/platforms/android/java/org/nativescript/widgets/CustomTypefaceSpan.java +0 -44
- package/platforms/android/java/org/nativescript/widgets/Dock.java +0 -15
- package/platforms/android/java/org/nativescript/widgets/DockLayout.java +0 -185
- package/platforms/android/java/org/nativescript/widgets/FileHelper.java +0 -815
- package/platforms/android/java/org/nativescript/widgets/FlexLine.java +0 -177
- package/platforms/android/java/org/nativescript/widgets/FlexboxLayout.java +0 -2769
- package/platforms/android/java/org/nativescript/widgets/FragmentBase.java +0 -14
- package/platforms/android/java/org/nativescript/widgets/GridLayout.java +0 -1172
- package/platforms/android/java/org/nativescript/widgets/GridUnitType.java +0 -10
- package/platforms/android/java/org/nativescript/widgets/HorizontalScrollView.java +0 -256
- package/platforms/android/java/org/nativescript/widgets/ImageView.java +0 -423
- package/platforms/android/java/org/nativescript/widgets/ItemSpec.java +0 -56
- package/platforms/android/java/org/nativescript/widgets/LayoutBase.java +0 -98
- package/platforms/android/java/org/nativescript/widgets/LinearGradientDefinition.java +0 -46
- package/platforms/android/java/org/nativescript/widgets/Orientation.java +0 -9
- package/platforms/android/java/org/nativescript/widgets/OriginPoint.java +0 -74
- package/platforms/android/java/org/nativescript/widgets/ScrollSavedState.java +0 -63
- package/platforms/android/java/org/nativescript/widgets/SegmentedBarColorDrawable.java +0 -27
- package/platforms/android/java/org/nativescript/widgets/StackLayout.java +0 -231
- package/platforms/android/java/org/nativescript/widgets/StyleableTextView.java +0 -50
- package/platforms/android/java/org/nativescript/widgets/TabIconRenderingMode.java +0 -6
- package/platforms/android/java/org/nativescript/widgets/TabItemSpec.java +0 -15
- package/platforms/android/java/org/nativescript/widgets/TabLayout.java +0 -451
- package/platforms/android/java/org/nativescript/widgets/TabStrip.java +0 -294
- package/platforms/android/java/org/nativescript/widgets/TabViewPager.java +0 -64
- package/platforms/android/java/org/nativescript/widgets/TabsBar.java +0 -443
- package/platforms/android/java/org/nativescript/widgets/Utils.java +0 -546
- package/platforms/android/java/org/nativescript/widgets/VerticalScrollView.java +0 -258
- package/platforms/android/java/org/nativescript/widgets/ViewHelper.java +0 -564
- package/platforms/android/java/org/nativescript/widgets/WrapLayout.java +0 -252
- package/platforms/android/java/org/nativescript/widgets/image/AsyncTask.java +0 -679
- package/platforms/android/java/org/nativescript/widgets/image/BitmapOwner.java +0 -17
- package/platforms/android/java/org/nativescript/widgets/image/Cache.java +0 -471
- package/platforms/android/java/org/nativescript/widgets/image/DiskLruCache.java +0 -970
- package/platforms/android/java/org/nativescript/widgets/image/Fetcher.java +0 -747
- package/platforms/android/java/org/nativescript/widgets/image/Utils.java +0 -58
- package/platforms/android/java/org/nativescript/widgets/image/Worker.java +0 -571
- package/platforms/ios/src/TNSWidgets/Info.plist +0 -26
- package/platforms/ios/src/TNSWidgets/NSData+Async.m +0 -42
- package/platforms/ios/src/TNSWidgets/NSFileHandle+Async.m +0 -82
- package/platforms/ios/src/TNSWidgets/NSObject+Swizzling.m +0 -68
- package/platforms/ios/src/TNSWidgets/NSString+Async.m +0 -51
- package/platforms/ios/src/TNSWidgets/TNSLabel.m +0 -42
- package/platforms/ios/src/TNSWidgets/UIImage+TNSBlocks.m +0 -77
- package/platforms/ios/src/TNSWidgets/UIView+PassThroughParent.m +0 -53
- package/platforms/ios/src/TNSWidgets/UIView+PropertyBag.m +0 -72
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/NSData+Async.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/NSFileHandle+Async.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/NSString+Async.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/TNSLabel.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/TNSWidgets.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/UIImage+TNSBlocks.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/UIView+PassThroughParent.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/PrivateHeaders}/NSObject+Swizzling.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/PrivateHeaders}/UIView+PropertyBag.h +0 -0
|
@@ -1,1172 +0,0 @@
|
|
|
1
|
-
package org.nativescript.widgets;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
import android.util.Log;
|
|
5
|
-
import android.view.Gravity;
|
|
6
|
-
import android.view.View;
|
|
7
|
-
import android.view.View.MeasureSpec;
|
|
8
|
-
import android.util.AttributeSet;
|
|
9
|
-
|
|
10
|
-
import org.json.JSONArray;
|
|
11
|
-
import org.json.JSONException;
|
|
12
|
-
import org.json.JSONObject;
|
|
13
|
-
|
|
14
|
-
import java.util.ArrayList;
|
|
15
|
-
import java.util.HashMap;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @author hhristov
|
|
19
|
-
*/
|
|
20
|
-
public class GridLayout extends LayoutBase {
|
|
21
|
-
protected final static String TAG = "GridLayout";
|
|
22
|
-
|
|
23
|
-
private final MeasureHelper helper = new MeasureHelper(this);
|
|
24
|
-
|
|
25
|
-
private final ArrayList<ItemSpec> _rows = new ArrayList<>();
|
|
26
|
-
private final ArrayList<ItemSpec> _cols = new ArrayList<>();
|
|
27
|
-
private final ArrayList<Integer> columnOffsets = new ArrayList<>();
|
|
28
|
-
private final ArrayList<Integer> rowOffsets = new ArrayList<>();
|
|
29
|
-
private final HashMap<View, MeasureSpecs> map = new HashMap<>();
|
|
30
|
-
|
|
31
|
-
public GridLayout(Context context) {
|
|
32
|
-
this(context, (AttributeSet)null);
|
|
33
|
-
}
|
|
34
|
-
public GridLayout(Context context, AttributeSet attrs) {
|
|
35
|
-
this(context, attrs, 0);
|
|
36
|
-
}
|
|
37
|
-
public GridLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
38
|
-
super(context, attrs, defStyleAttr);
|
|
39
|
-
}
|
|
40
|
-
public GridLayout(Context context, String rows) {
|
|
41
|
-
this(context);
|
|
42
|
-
this.addRowsFromJSON(rows);
|
|
43
|
-
}
|
|
44
|
-
public GridLayout(Context context, String rows, String columns) {
|
|
45
|
-
this(context, rows);
|
|
46
|
-
this.addColumnsFromJSON(rows);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private static void validateItemSpec(ItemSpec itemSpec) {
|
|
50
|
-
if (itemSpec == null) {
|
|
51
|
-
throw new Error("itemSpec is null.");
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (itemSpec.owner != null) {
|
|
55
|
-
throw new Error("itemSpec is already added to GridLayout.");
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public void addRow(ItemSpec itemSpec) {
|
|
60
|
-
validateItemSpec(itemSpec);
|
|
61
|
-
itemSpec.owner = this;
|
|
62
|
-
this._rows.add(itemSpec);
|
|
63
|
-
|
|
64
|
-
ItemGroup rowGroup = new ItemGroup(itemSpec);
|
|
65
|
-
this.helper.rows.add(rowGroup);
|
|
66
|
-
|
|
67
|
-
this.requestLayout();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public void addRow(int value, GridUnitType type) {
|
|
71
|
-
addRow(new ItemSpec(value, type));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public void addColumn(ItemSpec itemSpec) {
|
|
75
|
-
validateItemSpec(itemSpec);
|
|
76
|
-
itemSpec.owner = this;
|
|
77
|
-
this._cols.add(itemSpec);
|
|
78
|
-
|
|
79
|
-
ItemGroup columnGroup = new ItemGroup(itemSpec);
|
|
80
|
-
this.helper.columns.add(columnGroup);
|
|
81
|
-
|
|
82
|
-
this.requestLayout();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public void addColumn(int value, GridUnitType type) {
|
|
86
|
-
addColumn(new ItemSpec(value, type));
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public void addRowsFromJSON(String value) {
|
|
90
|
-
try {
|
|
91
|
-
if (value == null) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
JSONArray rows = new JSONArray(value);
|
|
95
|
-
for (int i = 0; i < rows.length() ; i++) {
|
|
96
|
-
JSONObject row = rows.getJSONObject(i);
|
|
97
|
-
addRow(row.getInt("value"), GridUnitType.values()[row.getInt("type")]);
|
|
98
|
-
}
|
|
99
|
-
} catch (JSONException exception) {
|
|
100
|
-
Log.e(TAG, "Caught JSONException...");
|
|
101
|
-
exception.printStackTrace();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
public void addColumnsFromJSON(String value) {
|
|
105
|
-
try {
|
|
106
|
-
if (value == null) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
JSONArray columns = new JSONArray(value);
|
|
110
|
-
for (int i = 0; i < columns.length() ; i++) {
|
|
111
|
-
JSONObject column = columns.getJSONObject(i);
|
|
112
|
-
addColumn(column.getInt("value"), GridUnitType.values()[column.getInt("type")]);
|
|
113
|
-
}
|
|
114
|
-
} catch (JSONException exception) {
|
|
115
|
-
Log.e(TAG, "Caught JSONException...");
|
|
116
|
-
exception.printStackTrace();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
public void addRowsAndColumnsFromJSON(String rowsString, String jsonString) {
|
|
120
|
-
addRowsFromJSON(rowsString);
|
|
121
|
-
addColumnsFromJSON(jsonString);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
public void removeColumnAt(int index) {
|
|
126
|
-
this._cols.remove(index);
|
|
127
|
-
this.helper.columns.get(index).children.clear();
|
|
128
|
-
this.helper.columns.remove(index);
|
|
129
|
-
this.requestLayout();
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
public void removeRowAt(int index) {
|
|
133
|
-
this._rows.remove(index);
|
|
134
|
-
this.helper.rows.get(index).children.clear();
|
|
135
|
-
this.helper.rows.remove(index);
|
|
136
|
-
this.requestLayout();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
public ItemSpec[] getColumns() {
|
|
140
|
-
ItemSpec[] copy = new ItemSpec[this._cols.size()];
|
|
141
|
-
copy = this._cols.toArray(copy);
|
|
142
|
-
return copy;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
public ItemSpec[] getRows() {
|
|
146
|
-
ItemSpec[] copy = new ItemSpec[this._rows.size()];
|
|
147
|
-
copy = this._rows.toArray(copy);
|
|
148
|
-
return copy;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public void reset() {
|
|
152
|
-
clearRows();
|
|
153
|
-
clearColumns();
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
public void clearRows() {
|
|
158
|
-
this._rows.clear();
|
|
159
|
-
for (int i = 0; i < this.helper.rows.size(); i++) {
|
|
160
|
-
this.helper.rows.get(i).children.clear();
|
|
161
|
-
}
|
|
162
|
-
this.helper.rows.clear();
|
|
163
|
-
this.requestLayout();
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
public void clearColumns() {
|
|
167
|
-
this._cols.clear();
|
|
168
|
-
for (int i = 0; i < this.helper.columns.size(); i++) {
|
|
169
|
-
this.helper.columns.get(i).children.clear();
|
|
170
|
-
}
|
|
171
|
-
this.helper.columns.clear();
|
|
172
|
-
this.requestLayout();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
@Override
|
|
176
|
-
public void addView(View child) {
|
|
177
|
-
super.addView(child);
|
|
178
|
-
this.addToMap(child);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
@Override
|
|
182
|
-
public void addView(View child, int index) {
|
|
183
|
-
super.addView(child, index);
|
|
184
|
-
this.addToMap(child);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
@Override
|
|
188
|
-
public void addView(View child, LayoutParams params) {
|
|
189
|
-
super.addView(child, params);
|
|
190
|
-
this.addToMap(child);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
@Override
|
|
194
|
-
public void removeView(View view) {
|
|
195
|
-
this.removeFromMap(view);
|
|
196
|
-
super.removeView(view);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
@Override
|
|
200
|
-
public void removeViewAt(int index) {
|
|
201
|
-
View view = this.getChildAt(index);
|
|
202
|
-
this.removeFromMap(view);
|
|
203
|
-
super.removeViewAt(index);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
@Override
|
|
207
|
-
public void removeViews(int start, int count) {
|
|
208
|
-
int end = start + count;
|
|
209
|
-
for (int i = start; i < end; i++) {
|
|
210
|
-
View view = this.getChildAt(i);
|
|
211
|
-
this.removeFromMap(view);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
super.removeViews(start, count);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
private int getColumnIndex(CommonLayoutParams lp) {
|
|
218
|
-
return Math.max(0, Math.min(lp.column, this._cols.size() - 1));
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
private int getRowIndex(CommonLayoutParams lp) {
|
|
222
|
-
return Math.max(0, Math.min(lp.row, this._rows.size() - 1));
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
private ItemSpec getColumnSpec(CommonLayoutParams lp) {
|
|
226
|
-
if (this._cols.size() == 0) {
|
|
227
|
-
return this.helper.singleColumn;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
int columnIndex = Math.min(lp.column, this._cols.size() - 1);
|
|
231
|
-
return this._cols.get(columnIndex);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
private ItemSpec getRowSpec(CommonLayoutParams lp) {
|
|
235
|
-
if (this._rows.size() == 0) {
|
|
236
|
-
return this.helper.singleRow;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
int rowIndex = Math.min(lp.row, this._rows.size() - 1);
|
|
240
|
-
return this._rows.get(rowIndex);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
private int getColumnSpan(CommonLayoutParams lp, int columnIndex) {
|
|
244
|
-
if (this._cols.size() == 0) {
|
|
245
|
-
return 1;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
return Math.min(lp.columnSpan, this._cols.size() - columnIndex);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
private int getRowSpan(CommonLayoutParams lp, int rowIndex) {
|
|
252
|
-
if (this._rows.size() == 0) {
|
|
253
|
-
return 1;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
return Math.min(lp.rowSpan, this._rows.size() - rowIndex);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
private void updateMeasureSpecs(View child, MeasureSpecs measureSpec) {
|
|
260
|
-
CommonLayoutParams lp = (CommonLayoutParams) child.getLayoutParams();
|
|
261
|
-
int columnIndex = this.getColumnIndex(lp);
|
|
262
|
-
ItemSpec column = this.getColumnSpec(lp);
|
|
263
|
-
int rowIndex = this.getRowIndex(lp);
|
|
264
|
-
ItemSpec row = this.getRowSpec(lp);
|
|
265
|
-
int columnSpan = this.getColumnSpan(lp, columnIndex);
|
|
266
|
-
int rowSpan = this.getRowSpan(lp, rowIndex);
|
|
267
|
-
|
|
268
|
-
measureSpec.setColumn(column);
|
|
269
|
-
measureSpec.setRow(row);
|
|
270
|
-
measureSpec.setColumnIndex(columnIndex);
|
|
271
|
-
measureSpec.setRowIndex(rowIndex);
|
|
272
|
-
measureSpec.setColumnSpan(columnSpan);
|
|
273
|
-
measureSpec.setRowSpan(rowSpan);
|
|
274
|
-
measureSpec.autoColumnsCount = 0;
|
|
275
|
-
measureSpec.autoRowsCount = 0;
|
|
276
|
-
measureSpec.measured = false;
|
|
277
|
-
measureSpec.pixelHeight = 0;
|
|
278
|
-
measureSpec.pixelWidth = 0;
|
|
279
|
-
measureSpec.starColumnsCount = 0;
|
|
280
|
-
measureSpec.starRowsCount = 0;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
private void addToMap(View child) {
|
|
284
|
-
MeasureSpecs measureSpec = new MeasureSpecs(child);
|
|
285
|
-
this.map.put(child, measureSpec);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
private void removeFromMap(View child) {
|
|
289
|
-
if (this.map.containsKey(child)) {
|
|
290
|
-
this.map.remove(child).child = null;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/* only used for N tests */
|
|
295
|
-
public float getRowActualLength(int index) {
|
|
296
|
-
return this.helper.rows.get(index).rowOrColumn._actualLength;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/* only used for N tests */
|
|
300
|
-
public float getColumnActualLength(int index) {
|
|
301
|
-
return this.helper.columns.get(index).rowOrColumn._actualLength;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
@Override
|
|
305
|
-
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
306
|
-
CommonLayoutParams.adjustChildrenLayoutParams(this, widthMeasureSpec, heightMeasureSpec);
|
|
307
|
-
|
|
308
|
-
int measureWidth = 0;
|
|
309
|
-
int measureHeight = 0;
|
|
310
|
-
|
|
311
|
-
int width = MeasureSpec.getSize(widthMeasureSpec);
|
|
312
|
-
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
|
313
|
-
|
|
314
|
-
int height = MeasureSpec.getSize(heightMeasureSpec);
|
|
315
|
-
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
|
316
|
-
|
|
317
|
-
int verticalPadding = this.getPaddingTop() + this.getPaddingBottom();
|
|
318
|
-
int horizontalPadding = this.getPaddingLeft() + this.getPaddingRight();
|
|
319
|
-
|
|
320
|
-
boolean infinityWidth = widthMode == MeasureSpec.UNSPECIFIED;
|
|
321
|
-
boolean infinityHeight = heightMode == MeasureSpec.UNSPECIFIED;
|
|
322
|
-
|
|
323
|
-
this.helper.width = Math.max(0, width - horizontalPadding);
|
|
324
|
-
this.helper.height = Math.max(0, height - verticalPadding);
|
|
325
|
-
|
|
326
|
-
int gravity = LayoutBase.getGravity(this);
|
|
327
|
-
int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
|
|
328
|
-
final int layoutDirection = this.getLayoutDirection();
|
|
329
|
-
final int horizontalGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection) & Gravity.HORIZONTAL_GRAVITY_MASK;
|
|
330
|
-
|
|
331
|
-
this.helper.stretchedHorizontally = widthMode == MeasureSpec.EXACTLY || (horizontalGravity == Gravity.FILL_HORIZONTAL && !infinityWidth);
|
|
332
|
-
this.helper.stretchedVertically = heightMode == MeasureSpec.EXACTLY || (verticalGravity == Gravity.FILL_VERTICAL && !infinityHeight);
|
|
333
|
-
|
|
334
|
-
this.helper.setInfinityWidth(infinityWidth);
|
|
335
|
-
this.helper.setInfinityHeight(infinityHeight);
|
|
336
|
-
|
|
337
|
-
this.helper.clearMeasureSpecs();
|
|
338
|
-
this.helper.init();
|
|
339
|
-
|
|
340
|
-
for (int i = 0, count = this.getChildCount(); i < count; i++) {
|
|
341
|
-
View child = this.getChildAt(i);
|
|
342
|
-
if (child.getVisibility() == View.GONE) {
|
|
343
|
-
continue;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
MeasureSpecs measureSpecs = this.map.get(child);
|
|
347
|
-
this.updateMeasureSpecs(child, measureSpecs);
|
|
348
|
-
this.helper.addMeasureSpec(measureSpecs);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
this.helper.measure();
|
|
352
|
-
|
|
353
|
-
// Add in our padding
|
|
354
|
-
measureWidth = this.helper.measuredWidth + horizontalPadding;
|
|
355
|
-
measureHeight = this.helper.measuredHeight + verticalPadding;
|
|
356
|
-
|
|
357
|
-
// Check against our minimum sizes
|
|
358
|
-
measureWidth = Math.max(measureWidth, this.getSuggestedMinimumWidth());
|
|
359
|
-
measureHeight = Math.max(measureHeight, this.getSuggestedMinimumHeight());
|
|
360
|
-
|
|
361
|
-
int widthSizeAndState = resolveSizeAndState(measureWidth, widthMeasureSpec, 0);
|
|
362
|
-
int heightSizeAndState = resolveSizeAndState(measureHeight, heightMeasureSpec, 0);
|
|
363
|
-
|
|
364
|
-
this.setMeasuredDimension(widthSizeAndState, heightSizeAndState);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
@Override
|
|
368
|
-
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
|
369
|
-
int paddingLeft = this.getPaddingLeft();
|
|
370
|
-
int paddingTop = this.getPaddingTop();
|
|
371
|
-
|
|
372
|
-
this.columnOffsets.clear();
|
|
373
|
-
this.rowOffsets.clear();
|
|
374
|
-
|
|
375
|
-
this.columnOffsets.add(paddingLeft);
|
|
376
|
-
this.rowOffsets.add(paddingTop);
|
|
377
|
-
|
|
378
|
-
float offset = this.columnOffsets.get(0);
|
|
379
|
-
int roundedOffset = paddingLeft;
|
|
380
|
-
int roundedLength = 0;
|
|
381
|
-
float actualLength = 0;
|
|
382
|
-
int size = this.helper.columns.size();
|
|
383
|
-
for (int i = 0; i < size; i++) {
|
|
384
|
-
ItemGroup columnGroup = this.helper.columns.get(i);
|
|
385
|
-
offset += columnGroup.length;
|
|
386
|
-
|
|
387
|
-
actualLength = offset - roundedOffset;
|
|
388
|
-
roundedLength = Math.round(actualLength);
|
|
389
|
-
columnGroup.rowOrColumn._actualLength = roundedLength;
|
|
390
|
-
roundedOffset += roundedLength;
|
|
391
|
-
|
|
392
|
-
this.columnOffsets.add(roundedOffset);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
offset = this.rowOffsets.get(0);
|
|
396
|
-
roundedOffset = this.getPaddingTop();
|
|
397
|
-
roundedLength = 0;
|
|
398
|
-
actualLength = 0;
|
|
399
|
-
size = this.helper.rows.size();
|
|
400
|
-
for (int i = 0; i < size; i++) {
|
|
401
|
-
ItemGroup rowGroup = this.helper.rows.get(i);
|
|
402
|
-
offset += rowGroup.length;
|
|
403
|
-
|
|
404
|
-
actualLength = offset - roundedOffset;
|
|
405
|
-
roundedLength = Math.round(actualLength);
|
|
406
|
-
rowGroup.rowOrColumn._actualLength = roundedLength;
|
|
407
|
-
roundedOffset += roundedLength;
|
|
408
|
-
|
|
409
|
-
this.rowOffsets.add(roundedOffset);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
int columns = this.helper.columns.size();
|
|
413
|
-
for (int i = 0; i < columns; i++) {
|
|
414
|
-
ItemGroup columnGroup = this.helper.columns.get(i);
|
|
415
|
-
int children = columnGroup.children.size();
|
|
416
|
-
for (int j = 0; j < children; j++) {
|
|
417
|
-
|
|
418
|
-
MeasureSpecs measureSpec = columnGroup.children.get(j);
|
|
419
|
-
int childLeft = this.columnOffsets.get(measureSpec.getColumnIndex());
|
|
420
|
-
int childRight = this.columnOffsets.get(measureSpec.getColumnIndex() + measureSpec.getColumnSpan());
|
|
421
|
-
int childTop = this.rowOffsets.get(measureSpec.getRowIndex());
|
|
422
|
-
int childBottom = this.rowOffsets.get(measureSpec.getRowIndex() + measureSpec.getRowSpan());
|
|
423
|
-
|
|
424
|
-
// No need to include margins in the width, height
|
|
425
|
-
CommonLayoutParams.layoutChild(measureSpec.child, childLeft, childTop, childRight, childBottom);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
CommonLayoutParams.restoreOriginalParams(this);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
class MeasureSpecs {
|
|
434
|
-
|
|
435
|
-
private int _columnSpan = 1;
|
|
436
|
-
private int _rowSpan = 1;
|
|
437
|
-
|
|
438
|
-
public int pixelWidth = 0;
|
|
439
|
-
public int pixelHeight = 0;
|
|
440
|
-
|
|
441
|
-
public int starColumnsCount = 0;
|
|
442
|
-
public int starRowsCount = 0;
|
|
443
|
-
|
|
444
|
-
public int autoColumnsCount = 0;
|
|
445
|
-
public int autoRowsCount = 0;
|
|
446
|
-
|
|
447
|
-
public boolean measured = false;
|
|
448
|
-
|
|
449
|
-
public View child;
|
|
450
|
-
private ItemSpec column;
|
|
451
|
-
private ItemSpec row;
|
|
452
|
-
private int columnIndex;
|
|
453
|
-
private int rowIndex;
|
|
454
|
-
|
|
455
|
-
MeasureSpecs(View child) {
|
|
456
|
-
this.child = child;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
public boolean getSpanned() {
|
|
460
|
-
return this._columnSpan > 1 || this._rowSpan > 1;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
public boolean getIsStar() {
|
|
464
|
-
return this.starRowsCount > 0 || this.starColumnsCount > 0;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
public int getColumnSpan() {
|
|
468
|
-
return this._columnSpan;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
public int getRowSpan() {
|
|
472
|
-
return this._rowSpan;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
public void setRowSpan(int value) {
|
|
476
|
-
// cannot have zero rowSpan.
|
|
477
|
-
this._rowSpan = Math.max(1, value);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
public void setColumnSpan(int value) {
|
|
481
|
-
// cannot have zero colSpan.
|
|
482
|
-
this._columnSpan = Math.max(1, value);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
public int getRowIndex() {
|
|
486
|
-
return this.rowIndex;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
public int getColumnIndex() {
|
|
490
|
-
return this.columnIndex;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
public void setRowIndex(int value) {
|
|
494
|
-
this.rowIndex = value;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
public void setColumnIndex(int value) {
|
|
498
|
-
this.columnIndex = value;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
public ItemSpec getRow() {
|
|
502
|
-
return this.row;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
public ItemSpec getColumn() {
|
|
506
|
-
return this.column;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
public void setRow(ItemSpec value) {
|
|
510
|
-
this.row = value;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
public void setColumn(ItemSpec value) {
|
|
514
|
-
this.column = value;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
class ItemGroup {
|
|
519
|
-
int length = 0;
|
|
520
|
-
int measuredCount = 0;
|
|
521
|
-
ItemSpec rowOrColumn;
|
|
522
|
-
ArrayList<MeasureSpecs> children = new ArrayList<MeasureSpecs>();
|
|
523
|
-
|
|
524
|
-
public int measureToFix = 0;
|
|
525
|
-
public int currentMeasureToFixCount = 0;
|
|
526
|
-
private boolean infinityLength = false;
|
|
527
|
-
|
|
528
|
-
ItemGroup(ItemSpec spec) {
|
|
529
|
-
this.rowOrColumn = spec;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
public void setIsLengthInfinity(boolean infinityLength) {
|
|
533
|
-
this.infinityLength = infinityLength;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
public void init() {
|
|
537
|
-
this.measuredCount = 0;
|
|
538
|
-
this.currentMeasureToFixCount = 0;
|
|
539
|
-
this.length = this.rowOrColumn.getIsAbsolute() ? this.rowOrColumn.getValue() : 0;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
public boolean getAllMeasured() {
|
|
543
|
-
return this.measuredCount == this.children.size();
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
public boolean getCanBeFixed() {
|
|
547
|
-
return this.currentMeasureToFixCount == this.measureToFix;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
public boolean getIsAuto() {
|
|
551
|
-
return this.rowOrColumn.getIsAuto() || (this.rowOrColumn.getIsStar() && this.infinityLength);
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
public boolean getIsStar() {
|
|
555
|
-
return this.rowOrColumn.getIsStar() && !this.infinityLength;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
public boolean getIsAbsolute() {
|
|
559
|
-
return this.rowOrColumn.getIsAbsolute();
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
class MeasureHelper {
|
|
564
|
-
public final ItemSpec singleRow = new ItemSpec();
|
|
565
|
-
public final ItemSpec singleColumn = new ItemSpec();
|
|
566
|
-
public final GridLayout grid;
|
|
567
|
-
|
|
568
|
-
static int infinity = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
|
|
569
|
-
ArrayList<ItemGroup> rows = new ArrayList<ItemGroup>();
|
|
570
|
-
ArrayList<ItemGroup> columns = new ArrayList<ItemGroup>();
|
|
571
|
-
|
|
572
|
-
public int width;
|
|
573
|
-
public int height;
|
|
574
|
-
public boolean stretchedHorizontally = false;
|
|
575
|
-
public boolean stretchedVertically = false;
|
|
576
|
-
|
|
577
|
-
private boolean infinityWidth = false;
|
|
578
|
-
private boolean infinityHeight = false;
|
|
579
|
-
|
|
580
|
-
private float minColumnStarValue;
|
|
581
|
-
private float maxColumnStarValue;
|
|
582
|
-
|
|
583
|
-
private float minRowStarValue;
|
|
584
|
-
private float maxRowStarValue;
|
|
585
|
-
|
|
586
|
-
int measuredWidth;
|
|
587
|
-
int measuredHeight;
|
|
588
|
-
|
|
589
|
-
private boolean fakeRowAdded = false;
|
|
590
|
-
private boolean fakeColumnAdded = false;
|
|
591
|
-
|
|
592
|
-
MeasureHelper(GridLayout grid) {
|
|
593
|
-
this.grid = grid;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
public void setInfinityWidth(boolean value) {
|
|
597
|
-
this.infinityWidth = value;
|
|
598
|
-
|
|
599
|
-
for (int i = 0, size = this.columns.size(); i < size; i++) {
|
|
600
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
601
|
-
columnGroup.setIsLengthInfinity(value);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
public void setInfinityHeight(boolean value) {
|
|
606
|
-
this.infinityHeight = value;
|
|
607
|
-
|
|
608
|
-
for (int i = 0, size = this.rows.size(); i < size; i++) {
|
|
609
|
-
ItemGroup rowGroup = this.rows.get(i);
|
|
610
|
-
rowGroup.setIsLengthInfinity(value);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
public void addMeasureSpec(MeasureSpecs measureSpec) {
|
|
615
|
-
// Get column stats
|
|
616
|
-
int size = measureSpec.getColumnIndex() + measureSpec.getColumnSpan();
|
|
617
|
-
for (int i = measureSpec.getColumnIndex(); i < size; i++) {
|
|
618
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
619
|
-
if (columnGroup.getIsAuto()) {
|
|
620
|
-
measureSpec.autoColumnsCount++;
|
|
621
|
-
} else if (columnGroup.getIsStar()) {
|
|
622
|
-
measureSpec.starColumnsCount += columnGroup.rowOrColumn.getValue();
|
|
623
|
-
} else if (columnGroup.getIsAbsolute()) {
|
|
624
|
-
measureSpec.pixelWidth += columnGroup.rowOrColumn.getValue();
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
if (measureSpec.autoColumnsCount > 0 && measureSpec.starColumnsCount == 0) {
|
|
629
|
-
// Determine which auto columns are affected by this element
|
|
630
|
-
for (int i = measureSpec.getColumnIndex(); i < size; i++) {
|
|
631
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
632
|
-
if (columnGroup.getIsAuto()) {
|
|
633
|
-
columnGroup.measureToFix++;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
// Get row stats
|
|
639
|
-
size = measureSpec.getRowIndex() + measureSpec.getRowSpan();
|
|
640
|
-
for (int i = measureSpec.getRowIndex(); i < size; i++) {
|
|
641
|
-
ItemGroup rowGroup = this.rows.get(i);
|
|
642
|
-
if (rowGroup.getIsAuto()) {
|
|
643
|
-
measureSpec.autoRowsCount++;
|
|
644
|
-
} else if (rowGroup.getIsStar()) {
|
|
645
|
-
measureSpec.starRowsCount += rowGroup.rowOrColumn.getValue();
|
|
646
|
-
} else if (rowGroup.getIsAbsolute()) {
|
|
647
|
-
measureSpec.pixelHeight += rowGroup.rowOrColumn.getValue();
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
if (measureSpec.autoRowsCount > 0 && measureSpec.starRowsCount == 0) {
|
|
652
|
-
// Determine which auto rows are affected by this element
|
|
653
|
-
for (int i = measureSpec.getRowIndex(); i < size; i++) {
|
|
654
|
-
ItemGroup rowGroup = this.rows.get(i);
|
|
655
|
-
if (rowGroup.getIsAuto()) {
|
|
656
|
-
rowGroup.measureToFix++;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
this.columns.get(measureSpec.getColumnIndex()).children.add(measureSpec);
|
|
662
|
-
this.rows.get(measureSpec.getRowIndex()).children.add(measureSpec);
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
public void clearMeasureSpecs() {
|
|
666
|
-
for (int i = 0, size = this.columns.size(); i < size; i++) {
|
|
667
|
-
this.columns.get(i).children.clear();
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
for (int i = 0, size = this.rows.size(); i < size; i++) {
|
|
671
|
-
this.rows.get(i).children.clear();
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
private static void initList(ArrayList<ItemGroup> list) {
|
|
676
|
-
for (int i = 0, size = list.size(); i < size; i++) {
|
|
677
|
-
ItemGroup item = list.get(i);
|
|
678
|
-
item.init();
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
private final ItemGroup singleRowGroup = new ItemGroup(singleRow);
|
|
683
|
-
private final ItemGroup singleColumnGroup = new ItemGroup(singleColumn);
|
|
684
|
-
|
|
685
|
-
void init() {
|
|
686
|
-
|
|
687
|
-
int rows = this.rows.size();
|
|
688
|
-
if (rows == 0) {
|
|
689
|
-
singleRowGroup.setIsLengthInfinity(this.infinityHeight);
|
|
690
|
-
this.rows.add(singleRowGroup);
|
|
691
|
-
this.fakeRowAdded = true;
|
|
692
|
-
} else if (rows > 1 && this.fakeRowAdded) {
|
|
693
|
-
this.rows.remove(0);
|
|
694
|
-
this.fakeRowAdded = false;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
int cols = this.columns.size();
|
|
698
|
-
if (cols == 0) {
|
|
699
|
-
this.fakeColumnAdded = true;
|
|
700
|
-
singleColumnGroup.setIsLengthInfinity(this.infinityWidth);
|
|
701
|
-
this.columns.add(singleColumnGroup);
|
|
702
|
-
} else if (cols > 1 && this.fakeColumnAdded) {
|
|
703
|
-
this.columns.remove(0);
|
|
704
|
-
this.fakeColumnAdded = false;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
initList(this.rows);
|
|
708
|
-
initList(this.columns);
|
|
709
|
-
|
|
710
|
-
this.minColumnStarValue = -1;
|
|
711
|
-
this.minRowStarValue = -1;
|
|
712
|
-
this.maxColumnStarValue = -1;
|
|
713
|
-
this.maxRowStarValue = -1;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
private void itemMeasured(MeasureSpecs measureSpec, boolean isFakeMeasure) {
|
|
717
|
-
if (!isFakeMeasure) {
|
|
718
|
-
this.columns.get(measureSpec.getColumnIndex()).measuredCount++;
|
|
719
|
-
this.rows.get(measureSpec.getRowIndex()).measuredCount++;
|
|
720
|
-
measureSpec.measured = true;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
if (measureSpec.autoColumnsCount > 0 && measureSpec.starColumnsCount == 0) {
|
|
724
|
-
int size = measureSpec.getColumnIndex() + measureSpec.getColumnSpan();
|
|
725
|
-
for (int i = measureSpec.getColumnIndex(); i < size; i++) {
|
|
726
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
727
|
-
if (columnGroup.getIsAuto()) {
|
|
728
|
-
columnGroup.currentMeasureToFixCount++;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
if (measureSpec.autoRowsCount > 0 && measureSpec.starRowsCount == 0) {
|
|
734
|
-
int size = measureSpec.getRowIndex() + measureSpec.getRowSpan();
|
|
735
|
-
for (int i = measureSpec.getRowIndex(); i < size; i++) {
|
|
736
|
-
ItemGroup rowGroup = this.rows.get(i);
|
|
737
|
-
if (rowGroup.getIsAuto()) {
|
|
738
|
-
rowGroup.currentMeasureToFixCount++;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
private void fixColumns() {
|
|
745
|
-
int currentColumnWidth = 0;
|
|
746
|
-
int columnStarCount = 0;
|
|
747
|
-
|
|
748
|
-
int columnCount = this.columns.size();
|
|
749
|
-
for (int i = 0; i < columnCount; i++) {
|
|
750
|
-
ItemGroup item = this.columns.get(i);
|
|
751
|
-
if (item.rowOrColumn.getIsStar()) {
|
|
752
|
-
columnStarCount += item.rowOrColumn.getValue();
|
|
753
|
-
} else {
|
|
754
|
-
// Star columns are still zeros (not calculated).
|
|
755
|
-
currentColumnWidth += item.length;
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
float widthForStarColumns = Math.max(0, this.width - currentColumnWidth);
|
|
760
|
-
this.maxColumnStarValue = columnStarCount > 0 ? widthForStarColumns / columnStarCount : 0;
|
|
761
|
-
|
|
762
|
-
updateStarLength(this.columns, this.maxColumnStarValue);
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
private void fixRows() {
|
|
766
|
-
int currentRowHeight = 0;
|
|
767
|
-
int rowStarCount = 0;
|
|
768
|
-
|
|
769
|
-
int rowCount = this.rows.size();
|
|
770
|
-
for (int i = 0; i < rowCount; i++) {
|
|
771
|
-
ItemGroup item = this.rows.get(i);
|
|
772
|
-
if (item.rowOrColumn.getIsStar()) {
|
|
773
|
-
rowStarCount += item.rowOrColumn.getValue();
|
|
774
|
-
} else {
|
|
775
|
-
// Star rows are still zeros (not calculated).
|
|
776
|
-
currentRowHeight += item.length;
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
float heightForStarRows = Math.max(0, this.height - currentRowHeight);
|
|
781
|
-
this.maxRowStarValue = rowStarCount > 0 ? heightForStarRows / rowStarCount : 0;
|
|
782
|
-
|
|
783
|
-
updateStarLength(this.rows, this.maxRowStarValue);
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
private static void updateStarLength(ArrayList<ItemGroup> list, float starValue) {
|
|
787
|
-
float offset = 0;
|
|
788
|
-
int roundedOffset = 0;
|
|
789
|
-
for (int i = 0, rowCount = list.size(); i < rowCount; i++) {
|
|
790
|
-
ItemGroup item = list.get(i);
|
|
791
|
-
if (item.getIsStar()) {
|
|
792
|
-
offset += item.rowOrColumn.getValue() * starValue;
|
|
793
|
-
|
|
794
|
-
float actualLength = offset - roundedOffset;
|
|
795
|
-
int roundedLength = Math.round(actualLength);
|
|
796
|
-
item.length = roundedLength;
|
|
797
|
-
roundedOffset += roundedLength;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
private void fakeMeasure() {
|
|
803
|
-
// Fake measure - measure all elements that have star rows and auto columns - with infinity Width and infinity Height
|
|
804
|
-
for (int i = 0, size = this.columns.size(); i < size; i++) {
|
|
805
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
806
|
-
if (columnGroup.getAllMeasured()) {
|
|
807
|
-
continue;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
for (int j = 0, childrenCount = columnGroup.children.size(); j < childrenCount; j++) {
|
|
811
|
-
MeasureSpecs measureSpec = columnGroup.children.get(j);
|
|
812
|
-
if (measureSpec.starRowsCount > 0 && measureSpec.autoColumnsCount > 0 && measureSpec.starColumnsCount == 0) {
|
|
813
|
-
this.measureChild(measureSpec, true);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
private void measureFixedColumnsNoStarRows() {
|
|
820
|
-
for (int i = 0, size = this.columns.size(); i < size; i++) {
|
|
821
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
822
|
-
for (int j = 0, childrenCount = columnGroup.children.size(); j < childrenCount; j++) {
|
|
823
|
-
MeasureSpecs measureSpec = columnGroup.children.get(j);
|
|
824
|
-
if (measureSpec.starColumnsCount > 0 && measureSpec.starRowsCount == 0) {
|
|
825
|
-
this.measureChildFixedColumns(measureSpec);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
private void measureNoStarColumnsFixedRows() {
|
|
832
|
-
for (int i = 0, size = this.columns.size(); i < size; i++) {
|
|
833
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
834
|
-
for (int j = 0, childrenCount = columnGroup.children.size(); j < childrenCount; j++) {
|
|
835
|
-
MeasureSpecs measureSpec = columnGroup.children.get(j);
|
|
836
|
-
if (measureSpec.starRowsCount > 0 && measureSpec.starColumnsCount == 0) {
|
|
837
|
-
this.measureChildFixedRows(measureSpec);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
private static boolean canFix(ArrayList<ItemGroup> list) {
|
|
844
|
-
for (int i = 0, size = list.size(); i < size; i++) {
|
|
845
|
-
ItemGroup item = list.get(i);
|
|
846
|
-
if (!item.getCanBeFixed()) {
|
|
847
|
-
return false;
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
return true;
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
private static int getMeasureLength(ArrayList<ItemGroup> list) {
|
|
855
|
-
int result = 0;
|
|
856
|
-
for (int i = 0, size = list.size(); i < size; i++) {
|
|
857
|
-
ItemGroup item = list.get(i);
|
|
858
|
-
result += item.length;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
return result;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
public void measure() {
|
|
865
|
-
|
|
866
|
-
// Measure auto & pixel columns and rows (no spans).
|
|
867
|
-
int size = this.columns.size();
|
|
868
|
-
for (int i = 0; i < size; i++) {
|
|
869
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
870
|
-
for (int j = 0, childrenCount = columnGroup.children.size(); j < childrenCount; j++) {
|
|
871
|
-
MeasureSpecs measureSpec = columnGroup.children.get(j);
|
|
872
|
-
if (measureSpec.getIsStar() || measureSpec.getSpanned()) {
|
|
873
|
-
continue;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
this.measureChild(measureSpec, false);
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
// Measure auto & pixel columns and rows (with spans).
|
|
881
|
-
for (int i = 0; i < size; i++) {
|
|
882
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
883
|
-
for (int j = 0, childrenCount = columnGroup.children.size(); j < childrenCount; j++) {
|
|
884
|
-
MeasureSpecs measureSpec = columnGroup.children.get(j);
|
|
885
|
-
if (measureSpec.getIsStar() || !measureSpec.getSpanned()) {
|
|
886
|
-
continue;
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
this.measureChild(measureSpec, false);
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
// try fix stars!
|
|
893
|
-
boolean fixColumns = canFix(this.columns);
|
|
894
|
-
boolean fixRows = canFix(this.rows);
|
|
895
|
-
|
|
896
|
-
if (fixColumns) {
|
|
897
|
-
this.fixColumns();
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
if (fixRows) {
|
|
901
|
-
this.fixRows();
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
if (!fixColumns && !fixRows) {
|
|
905
|
-
// Fake measure - measure all elements that have star rows and auto columns - with infinity Width and infinity Height
|
|
906
|
-
// should be able to fix rows after that
|
|
907
|
-
this.fakeMeasure();
|
|
908
|
-
|
|
909
|
-
this.fixColumns();
|
|
910
|
-
|
|
911
|
-
// Measure all elements that have star columns(already fixed), but no stars at the rows
|
|
912
|
-
this.measureFixedColumnsNoStarRows();
|
|
913
|
-
|
|
914
|
-
this.fixRows();
|
|
915
|
-
} else if (fixColumns && !fixRows) {
|
|
916
|
-
// Measure all elements that have star columns(already fixed) but no stars at the rows
|
|
917
|
-
this.measureFixedColumnsNoStarRows();
|
|
918
|
-
|
|
919
|
-
// Then
|
|
920
|
-
this.fixRows();
|
|
921
|
-
} else if (!fixColumns && fixRows) {
|
|
922
|
-
// Measure all elements that have star rows(already fixed) but no star at the columns
|
|
923
|
-
this.measureNoStarColumnsFixedRows();
|
|
924
|
-
|
|
925
|
-
// Then
|
|
926
|
-
this.fixColumns();
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
// Rows and columns are fixed here - measure remaining elements
|
|
930
|
-
size = this.columns.size();
|
|
931
|
-
for (int i = 0; i < size; i++) {
|
|
932
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
933
|
-
for (int j = 0, childCount = columnGroup.children.size(); j < childCount; j++) {
|
|
934
|
-
MeasureSpecs measureSpec = columnGroup.children.get(j);
|
|
935
|
-
if (!measureSpec.measured) {
|
|
936
|
-
this.measureChildFixedColumnsAndRows(measureSpec);
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
// If we are not stretched and minColumnStarValue is less than maxColumnStarValue
|
|
942
|
-
// we need to reduce the length of star columns.
|
|
943
|
-
if (!this.stretchedHorizontally && this.minColumnStarValue != -1 && this.minColumnStarValue < this.maxColumnStarValue) {
|
|
944
|
-
updateStarLength(this.columns, this.minColumnStarValue);
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
// If we are not stretched and minRowStarValue is less than maxRowStarValue
|
|
948
|
-
// we need to reduce the height of star maxRowStarValue.
|
|
949
|
-
if (!this.stretchedVertically && this.minRowStarValue != -1 && this.minRowStarValue < this.maxRowStarValue) {
|
|
950
|
-
updateStarLength(this.rows, this.minRowStarValue);
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
this.measuredWidth = getMeasureLength(this.columns);
|
|
954
|
-
this.measuredHeight = getMeasureLength(this.rows);
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
private void measureChild(MeasureSpecs measureSpec, boolean isFakeMeasure) {
|
|
958
|
-
int widthMeasureSpec = (measureSpec.autoColumnsCount > 0) ? infinity : MeasureSpec.makeMeasureSpec(measureSpec.pixelWidth, MeasureSpec.EXACTLY);
|
|
959
|
-
int heightMeasureSpec = (isFakeMeasure || measureSpec.autoRowsCount > 0) ? infinity : MeasureSpec.makeMeasureSpec(measureSpec.pixelHeight, MeasureSpec.EXACTLY);
|
|
960
|
-
|
|
961
|
-
CommonLayoutParams.measureChild(measureSpec.child, widthMeasureSpec, heightMeasureSpec);
|
|
962
|
-
final int childMeasuredWidth = CommonLayoutParams.getDesiredWidth(measureSpec.child);
|
|
963
|
-
final int childMeasuredHeight = CommonLayoutParams.getDesiredHeight(measureSpec.child);
|
|
964
|
-
|
|
965
|
-
int columnSpanEnd = measureSpec.getColumnIndex() + measureSpec.getColumnSpan();
|
|
966
|
-
int rowSpanEnd = measureSpec.getRowIndex() + measureSpec.getRowSpan();
|
|
967
|
-
|
|
968
|
-
if (measureSpec.autoColumnsCount > 0) {
|
|
969
|
-
int remainingSpace = childMeasuredWidth;
|
|
970
|
-
|
|
971
|
-
for (int i = measureSpec.getColumnIndex(); i < columnSpanEnd; i++) {
|
|
972
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
973
|
-
remainingSpace -= columnGroup.length;
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
if (remainingSpace > 0) {
|
|
977
|
-
int growSize = remainingSpace / measureSpec.autoColumnsCount;
|
|
978
|
-
for (int i = measureSpec.getColumnIndex(); i < columnSpanEnd; i++) {
|
|
979
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
980
|
-
if (columnGroup.getIsAuto()) {
|
|
981
|
-
columnGroup.length += growSize;
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
if (!isFakeMeasure && measureSpec.autoRowsCount > 0) {
|
|
988
|
-
int remainingSpace = childMeasuredHeight;
|
|
989
|
-
|
|
990
|
-
for (int i = measureSpec.getRowIndex(); i < rowSpanEnd; i++) {
|
|
991
|
-
ItemGroup rowGroup = this.rows.get(i);
|
|
992
|
-
remainingSpace -= rowGroup.length;
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
if (remainingSpace > 0) {
|
|
996
|
-
int growSize = remainingSpace / measureSpec.autoRowsCount;
|
|
997
|
-
for (int i = measureSpec.getRowIndex(); i < rowSpanEnd; i++) {
|
|
998
|
-
ItemGroup rowGroup = this.rows.get(i);
|
|
999
|
-
if (rowGroup.getIsAuto()) {
|
|
1000
|
-
rowGroup.length += growSize;
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
this.itemMeasured(measureSpec, isFakeMeasure);
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
private void measureChildFixedColumns(MeasureSpecs measureSpec) {
|
|
1010
|
-
int columnIndex = measureSpec.getColumnIndex();
|
|
1011
|
-
int columnSpanEnd = columnIndex + measureSpec.getColumnSpan();
|
|
1012
|
-
int rowIndex = measureSpec.getRowIndex();
|
|
1013
|
-
int rowSpanEnd = rowIndex + measureSpec.getRowSpan();
|
|
1014
|
-
|
|
1015
|
-
int measureWidth = 0;
|
|
1016
|
-
int growSize = 0;
|
|
1017
|
-
|
|
1018
|
-
for (int i = columnIndex; i < columnSpanEnd; i++) {
|
|
1019
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
1020
|
-
measureWidth += columnGroup.length;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
int widthMeasureSpec = MeasureSpec.makeMeasureSpec(measureWidth, this.stretchedHorizontally ? MeasureSpec.EXACTLY : MeasureSpec.AT_MOST);
|
|
1024
|
-
int heightMeasureSpec = (measureSpec.autoRowsCount > 0) ? infinity : MeasureSpec.makeMeasureSpec(measureSpec.pixelHeight, MeasureSpec.EXACTLY);
|
|
1025
|
-
|
|
1026
|
-
CommonLayoutParams.measureChild(measureSpec.child, widthMeasureSpec, heightMeasureSpec);
|
|
1027
|
-
final int childMeasuredWidth = CommonLayoutParams.getDesiredWidth(measureSpec.child);
|
|
1028
|
-
final int childMeasuredHeight = CommonLayoutParams.getDesiredHeight(measureSpec.child);
|
|
1029
|
-
|
|
1030
|
-
this.updateMinColumnStarValueIfNeeded(measureSpec, childMeasuredWidth);
|
|
1031
|
-
|
|
1032
|
-
// Distribute height over auto rows
|
|
1033
|
-
if (measureSpec.autoRowsCount > 0) {
|
|
1034
|
-
int remainingSpace = childMeasuredHeight;
|
|
1035
|
-
|
|
1036
|
-
for (int i = rowIndex; i < rowSpanEnd; i++) {
|
|
1037
|
-
ItemGroup rowGroup = this.rows.get(i);
|
|
1038
|
-
remainingSpace -= rowGroup.length;
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
if (remainingSpace > 0) {
|
|
1042
|
-
growSize = remainingSpace / measureSpec.autoRowsCount;
|
|
1043
|
-
for (int i = rowIndex; i < rowSpanEnd; i++) {
|
|
1044
|
-
ItemGroup rowGroup = this.rows.get(i);
|
|
1045
|
-
if (rowGroup.getIsAuto()) {
|
|
1046
|
-
rowGroup.length += growSize;
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
this.itemMeasured(measureSpec, false);
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
private void measureChildFixedRows(MeasureSpecs measureSpec) {
|
|
1056
|
-
int columnIndex = measureSpec.getColumnIndex();
|
|
1057
|
-
int columnSpanEnd = columnIndex + measureSpec.getColumnSpan();
|
|
1058
|
-
int rowIndex = measureSpec.getRowIndex();
|
|
1059
|
-
int rowSpanEnd = rowIndex + measureSpec.getRowSpan();
|
|
1060
|
-
int measureHeight = 0;
|
|
1061
|
-
|
|
1062
|
-
for (int i = rowIndex; i < rowSpanEnd; i++) {
|
|
1063
|
-
ItemGroup rowGroup = this.rows.get(i);
|
|
1064
|
-
measureHeight += rowGroup.length;
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
int widthMeasureSpec = (measureSpec.autoColumnsCount > 0) ? infinity : MeasureSpec.makeMeasureSpec(measureSpec.pixelWidth, MeasureSpec.EXACTLY);
|
|
1068
|
-
int heightMeasureSpec = MeasureSpec.makeMeasureSpec(measureHeight, this.stretchedVertically ? MeasureSpec.EXACTLY : MeasureSpec.AT_MOST);
|
|
1069
|
-
|
|
1070
|
-
CommonLayoutParams.measureChild(measureSpec.child, widthMeasureSpec, heightMeasureSpec);
|
|
1071
|
-
final int childMeasuredWidth = CommonLayoutParams.getDesiredWidth(measureSpec.child);
|
|
1072
|
-
final int childMeasuredHeight = CommonLayoutParams.getDesiredHeight(measureSpec.child);
|
|
1073
|
-
|
|
1074
|
-
int remainingSpace = 0;
|
|
1075
|
-
int growSize = 0;
|
|
1076
|
-
|
|
1077
|
-
// Distribute width over auto columns
|
|
1078
|
-
if (measureSpec.autoColumnsCount > 0) {
|
|
1079
|
-
remainingSpace = childMeasuredWidth;
|
|
1080
|
-
|
|
1081
|
-
for (int i = columnIndex; i < columnSpanEnd; i++) {
|
|
1082
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
1083
|
-
remainingSpace -= columnGroup.length;
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
if (remainingSpace > 0) {
|
|
1087
|
-
growSize = remainingSpace / measureSpec.autoColumnsCount;
|
|
1088
|
-
for (int i = columnIndex; i < columnSpanEnd; i++) {
|
|
1089
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
1090
|
-
if (columnGroup.getIsAuto()) {
|
|
1091
|
-
columnGroup.length += growSize;
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
this.updateMinRowStarValueIfNeeded(measureSpec, childMeasuredHeight);
|
|
1098
|
-
this.itemMeasured(measureSpec, false);
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
private void measureChildFixedColumnsAndRows(MeasureSpecs measureSpec) {
|
|
1102
|
-
int columnIndex = measureSpec.getColumnIndex();
|
|
1103
|
-
int columnSpanEnd = columnIndex + measureSpec.getColumnSpan();
|
|
1104
|
-
int rowIndex = measureSpec.getRowIndex();
|
|
1105
|
-
int rowSpanEnd = rowIndex + measureSpec.getRowSpan();
|
|
1106
|
-
|
|
1107
|
-
int measureWidth = 0;
|
|
1108
|
-
for (int i = columnIndex; i < columnSpanEnd; i++) {
|
|
1109
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
1110
|
-
measureWidth += columnGroup.length;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
int measureHeight = 0;
|
|
1114
|
-
for (int i = rowIndex; i < rowSpanEnd; i++) {
|
|
1115
|
-
ItemGroup rowGroup = this.rows.get(i);
|
|
1116
|
-
measureHeight += rowGroup.length;
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
// if (have stars) & (not stretch) - at most
|
|
1120
|
-
int widthMeasureSpec = MeasureSpec.makeMeasureSpec(measureWidth,
|
|
1121
|
-
(measureSpec.starColumnsCount > 0 && !this.stretchedHorizontally) ? MeasureSpec.AT_MOST : MeasureSpec.EXACTLY);
|
|
1122
|
-
|
|
1123
|
-
int heightMeasureSpec = MeasureSpec.makeMeasureSpec(measureHeight,
|
|
1124
|
-
(measureSpec.starRowsCount > 0 && !this.stretchedVertically) ? MeasureSpec.AT_MOST : MeasureSpec.EXACTLY);
|
|
1125
|
-
|
|
1126
|
-
CommonLayoutParams.measureChild(measureSpec.child, widthMeasureSpec, heightMeasureSpec);
|
|
1127
|
-
final int childMeasuredWidth = CommonLayoutParams.getDesiredWidth(measureSpec.child);
|
|
1128
|
-
final int childMeasuredHeight = CommonLayoutParams.getDesiredHeight(measureSpec.child);
|
|
1129
|
-
|
|
1130
|
-
this.updateMinColumnStarValueIfNeeded(measureSpec, childMeasuredWidth);
|
|
1131
|
-
this.updateMinRowStarValueIfNeeded(measureSpec, childMeasuredHeight);
|
|
1132
|
-
this.itemMeasured(measureSpec, false);
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
private void updateMinRowStarValueIfNeeded(MeasureSpecs measureSpec, int childMeasuredHeight) {
|
|
1136
|
-
if (!this.stretchedVertically && measureSpec.starRowsCount > 0) {
|
|
1137
|
-
int remainingSpace = childMeasuredHeight;
|
|
1138
|
-
int rowIndex = measureSpec.getRowIndex();
|
|
1139
|
-
int rowSpanEnd = rowIndex + measureSpec.getRowSpan();
|
|
1140
|
-
for (int i = rowIndex; i < rowSpanEnd; i++) {
|
|
1141
|
-
ItemGroup rowGroup = this.rows.get(i);
|
|
1142
|
-
if (!rowGroup.getIsStar()) {
|
|
1143
|
-
remainingSpace -= rowGroup.length;
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
if (remainingSpace > 0) {
|
|
1148
|
-
this.minRowStarValue = Math.max(remainingSpace / measureSpec.starRowsCount, this.minRowStarValue);
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
private void updateMinColumnStarValueIfNeeded(MeasureSpecs measureSpec, int childMeasuredWidth) {
|
|
1154
|
-
// When not stretched star columns are not fixed so we may grow them here
|
|
1155
|
-
// if there is an element that spans on multiple columns
|
|
1156
|
-
if (!this.stretchedHorizontally && measureSpec.starColumnsCount > 0) {
|
|
1157
|
-
int remainingSpace = childMeasuredWidth;
|
|
1158
|
-
int columnIndex = measureSpec.getColumnIndex();
|
|
1159
|
-
int columnSpanEnd = columnIndex + measureSpec.getColumnSpan();
|
|
1160
|
-
for (int i = columnIndex; i < columnSpanEnd; i++) {
|
|
1161
|
-
ItemGroup columnGroup = this.columns.get(i);
|
|
1162
|
-
if (!columnGroup.getIsStar()) {
|
|
1163
|
-
remainingSpace -= columnGroup.length;
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
if (remainingSpace > 0) {
|
|
1168
|
-
this.minColumnStarValue = Math.max(remainingSpace / measureSpec.starColumnsCount, this.minColumnStarValue);
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
}
|