@nativescript/core 9.0.0-next-09-24-2025-17985801416 → 9.0.0-next-10-06-2025-18277360121

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.
Files changed (181) hide show
  1. package/inspector_modules.js +74 -47
  2. package/inspector_modules.js.map +1 -1
  3. package/package.json +1 -1
  4. package/platforms/android/include.gradle +51 -0
  5. package/platforms/android/java/org/nativescript/Process.java +59 -0
  6. package/platforms/android/java/org/nativescript/widgets/AbsoluteLayout.java +88 -0
  7. package/platforms/android/java/org/nativescript/widgets/AnimatorHelper.java +61 -0
  8. package/platforms/android/java/org/nativescript/widgets/Async.java +1356 -0
  9. package/platforms/android/java/org/nativescript/widgets/BorderDrawable.java +936 -0
  10. package/platforms/android/java/org/nativescript/widgets/BottomNavigationBar.java +308 -0
  11. package/platforms/android/java/org/nativescript/widgets/BoxShadowDrawable.java +175 -0
  12. package/platforms/android/java/org/nativescript/widgets/CSSValue.java +34 -0
  13. package/platforms/android/java/org/nativescript/widgets/CommonLayoutParams.java +456 -0
  14. package/platforms/android/java/org/nativescript/widgets/ContentLayout.java +85 -0
  15. package/platforms/android/java/org/nativescript/widgets/CustomTransition.java +135 -0
  16. package/platforms/android/java/org/nativescript/widgets/CustomTypefaceSpan.java +44 -0
  17. package/platforms/android/java/org/nativescript/widgets/Dock.java +15 -0
  18. package/platforms/android/java/org/nativescript/widgets/DockLayout.java +185 -0
  19. package/platforms/android/java/org/nativescript/widgets/FileHelper.java +815 -0
  20. package/platforms/android/java/org/nativescript/widgets/FlexLine.java +177 -0
  21. package/platforms/android/java/org/nativescript/widgets/FlexboxLayout.java +2769 -0
  22. package/platforms/android/java/org/nativescript/widgets/FragmentBase.java +14 -0
  23. package/platforms/android/java/org/nativescript/widgets/GridLayout.java +1172 -0
  24. package/platforms/android/java/org/nativescript/widgets/GridUnitType.java +10 -0
  25. package/platforms/android/java/org/nativescript/widgets/HorizontalScrollView.java +256 -0
  26. package/platforms/android/java/org/nativescript/widgets/ImageView.java +423 -0
  27. package/platforms/android/java/org/nativescript/widgets/ItemSpec.java +56 -0
  28. package/platforms/android/java/org/nativescript/widgets/LayoutBase.java +98 -0
  29. package/platforms/android/java/org/nativescript/widgets/LinearGradientDefinition.java +46 -0
  30. package/platforms/android/java/org/nativescript/widgets/Orientation.java +9 -0
  31. package/platforms/android/java/org/nativescript/widgets/OriginPoint.java +74 -0
  32. package/platforms/android/java/org/nativescript/widgets/ScrollSavedState.java +63 -0
  33. package/platforms/android/java/org/nativescript/widgets/SegmentedBarColorDrawable.java +27 -0
  34. package/platforms/android/java/org/nativescript/widgets/StackLayout.java +231 -0
  35. package/platforms/android/java/org/nativescript/widgets/StyleableTextView.java +50 -0
  36. package/platforms/android/java/org/nativescript/widgets/TabIconRenderingMode.java +6 -0
  37. package/platforms/android/java/org/nativescript/widgets/TabItemSpec.java +15 -0
  38. package/platforms/android/java/org/nativescript/widgets/TabLayout.java +451 -0
  39. package/platforms/android/java/org/nativescript/widgets/TabStrip.java +294 -0
  40. package/platforms/android/java/org/nativescript/widgets/TabViewPager.java +64 -0
  41. package/platforms/android/java/org/nativescript/widgets/TabsBar.java +443 -0
  42. package/platforms/android/java/org/nativescript/widgets/Utils.java +546 -0
  43. package/platforms/android/java/org/nativescript/widgets/VerticalScrollView.java +258 -0
  44. package/platforms/android/java/org/nativescript/widgets/ViewHelper.java +564 -0
  45. package/platforms/android/java/org/nativescript/widgets/WrapLayout.java +252 -0
  46. package/platforms/android/java/org/nativescript/widgets/image/AsyncTask.java +679 -0
  47. package/platforms/android/java/org/nativescript/widgets/image/BitmapOwner.java +17 -0
  48. package/platforms/android/java/org/nativescript/widgets/image/Cache.java +471 -0
  49. package/platforms/android/java/org/nativescript/widgets/image/DiskLruCache.java +970 -0
  50. package/platforms/android/java/org/nativescript/widgets/image/Fetcher.java +747 -0
  51. package/platforms/android/java/org/nativescript/widgets/image/Utils.java +58 -0
  52. package/platforms/android/java/org/nativescript/widgets/image/Worker.java +571 -0
  53. package/platforms/ios/src/TNSWidgets/Info.plist +26 -0
  54. package/platforms/ios/src/TNSWidgets/NSData+Async.m +42 -0
  55. package/platforms/ios/src/TNSWidgets/NSFileHandle+Async.m +82 -0
  56. package/platforms/ios/src/TNSWidgets/NSObject+Swizzling.m +68 -0
  57. package/platforms/ios/src/TNSWidgets/NSString+Async.m +51 -0
  58. package/platforms/ios/src/TNSWidgets/TNSLabel.m +42 -0
  59. package/platforms/ios/src/TNSWidgets/UIImage+TNSBlocks.m +77 -0
  60. package/platforms/ios/src/TNSWidgets/UIView+PassThroughParent.m +53 -0
  61. package/platforms/ios/src/TNSWidgets/UIView+PropertyBag.m +72 -0
  62. package/platforms/ios/src/module.modulemap +5 -0
  63. package/platforms/android/widgets-release.aar +0 -0
  64. package/platforms/ios/TNSWidgets.xcframework/Info.plist +0 -102
  65. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
  66. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
  67. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Info.plist +0 -0
  68. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Modules/module.modulemap +0 -6
  69. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/TNSWidgets +0 -0
  70. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
  71. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  72. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
  73. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
  74. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
  75. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
  76. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
  77. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
  78. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
  79. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
  80. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
  81. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
  82. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Modules/module.modulemap +0 -6
  83. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
  84. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
  85. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Resources/Info.plist +0 -52
  86. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSCCrypto.h +0 -60
  87. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSData+Async.h +0 -24
  88. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSFileHandle+Async.h +0 -22
  89. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSString+Async.h +0 -25
  90. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSLabel.h +0 -16
  91. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSProcess.h +0 -29
  92. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSWidgets.h +0 -25
  93. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIImage+TNSBlocks.h +0 -26
  94. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIView+PassThroughParent.h +0 -17
  95. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Modules/module.modulemap +0 -6
  96. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/NSObject+Swizzling.h +0 -17
  97. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/UIView+PropertyBag.h +0 -18
  98. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Resources/Info.plist +0 -52
  99. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/TNSWidgets +0 -0
  100. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSCCrypto.h +0 -60
  101. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSData+Async.h +0 -24
  102. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSFileHandle+Async.h +0 -22
  103. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSString+Async.h +0 -25
  104. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSLabel.h +0 -16
  105. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSProcess.h +0 -29
  106. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSWidgets.h +0 -25
  107. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/UIImage+TNSBlocks.h +0 -26
  108. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/UIView+PassThroughParent.h +0 -17
  109. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Modules/module.modulemap +0 -6
  110. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/PrivateHeaders/NSObject+Swizzling.h +0 -17
  111. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/PrivateHeaders/UIView+PropertyBag.h +0 -18
  112. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Resources/Info.plist +0 -52
  113. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/TNSWidgets +0 -0
  114. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
  115. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  116. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
  117. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +0 -82
  118. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
  119. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
  120. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
  121. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
  122. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
  123. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
  124. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
  125. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
  126. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
  127. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
  128. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Modules/module.modulemap +0 -6
  129. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
  130. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
  131. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
  132. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +0 -223
  133. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
  134. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  135. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
  136. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +0 -82
  137. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
  138. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
  139. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
  140. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
  141. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
  142. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
  143. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
  144. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
  145. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
  146. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Info.plist +0 -0
  147. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Modules/module.modulemap +0 -6
  148. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
  149. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
  150. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/TNSWidgets +0 -0
  151. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
  152. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  153. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
  154. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
  155. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
  156. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
  157. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
  158. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
  159. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
  160. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
  161. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
  162. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
  163. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
  164. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Modules/module.modulemap +0 -6
  165. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
  166. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
  167. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
  168. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +0 -223
  169. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
  170. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  171. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
  172. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +0 -82
  173. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/NSData+Async.h +0 -0
  174. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/NSFileHandle+Async.h +0 -0
  175. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/PrivateHeaders → src/TNSWidgets}/NSObject+Swizzling.h +0 -0
  176. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/NSString+Async.h +0 -0
  177. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/TNSLabel.h +0 -0
  178. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/TNSWidgets.h +0 -0
  179. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/UIImage+TNSBlocks.h +0 -0
  180. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/UIView+PassThroughParent.h +0 -0
  181. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/PrivateHeaders → src/TNSWidgets}/UIView+PropertyBag.h +0 -0
@@ -0,0 +1,936 @@
1
+ package org.nativescript.widgets;
2
+
3
+ import android.annotation.TargetApi;
4
+ import android.content.Context;
5
+ import android.graphics.Bitmap;
6
+ import android.graphics.BitmapShader;
7
+ import android.graphics.Canvas;
8
+ import android.graphics.Color;
9
+ import android.graphics.LinearGradient;
10
+ import android.graphics.Matrix;
11
+ import android.graphics.Outline;
12
+ import android.graphics.Paint;
13
+ import android.graphics.Path;
14
+ import android.graphics.PointF;
15
+ import android.graphics.Rect;
16
+ import android.graphics.RectF;
17
+ import android.graphics.Shader;
18
+ import android.graphics.drawable.ColorDrawable;
19
+ import android.graphics.drawable.Drawable;
20
+ import android.os.Build;
21
+
22
+ import androidx.annotation.NonNull;
23
+
24
+ import org.nativescript.widgets.image.BitmapOwner;
25
+ import org.nativescript.widgets.image.Fetcher;
26
+
27
+ import java.util.Locale;
28
+ import java.util.regex.Pattern;
29
+
30
+ /**
31
+ * Created by hristov on 6/15/2016.
32
+ */
33
+ public class BorderDrawable extends ColorDrawable implements BitmapOwner {
34
+ private final float density;
35
+ private String id;
36
+
37
+ private int borderTopColor;
38
+ private int borderRightColor;
39
+ private int borderBottomColor;
40
+ private int borderLeftColor;
41
+
42
+ private float borderTopWidth;
43
+ private float borderRightWidth;
44
+ private float borderBottomWidth;
45
+ private float borderLeftWidth;
46
+
47
+ private float borderTopLeftRadius;
48
+ private float borderTopRightRadius;
49
+ private float borderBottomRightRadius;
50
+ private float borderBottomLeftRadius;
51
+
52
+ private String clipPath;
53
+
54
+ private int backgroundColor;
55
+ private String backgroundImage;
56
+ private Bitmap backgroundBitmap;
57
+ private LinearGradientDefinition backgroundGradient;
58
+ private String backgroundRepeat;
59
+ private String backgroundPosition;
60
+ private CSSValue[] backgroundPositionParsedCSSValues;
61
+ private String backgroundSize;
62
+ private CSSValue[] backgroundSizeParsedCSSValues;
63
+
64
+ private Drawable drawable;
65
+
66
+ public float getDensity() {
67
+ return density;
68
+ }
69
+
70
+ public int getBorderTopColor() {
71
+ return borderTopColor;
72
+ }
73
+
74
+ public int getBorderRightColor() {
75
+ return borderRightColor;
76
+ }
77
+
78
+ public int getBorderBottomColor() {
79
+ return borderBottomColor;
80
+ }
81
+
82
+ public int getBorderLeftColor() {
83
+ return borderLeftColor;
84
+ }
85
+
86
+ public int getUniformBorderColor() {
87
+ if (this.hasUniformBorderColor()) {
88
+ return this.borderTopColor;
89
+ }
90
+
91
+ return 0;
92
+ }
93
+
94
+ public float getBorderTopWidth() {
95
+ return borderTopWidth;
96
+ }
97
+
98
+ public float getBorderRightWidth() {
99
+ return borderRightWidth;
100
+ }
101
+
102
+ public float getBorderBottomWidth() {
103
+ return borderBottomWidth;
104
+ }
105
+
106
+ public float getBorderLeftWidth() {
107
+ return borderLeftWidth;
108
+ }
109
+
110
+ public float getUniformBorderWidth() {
111
+ if (this.hasUniformBorderWidth()) {
112
+ return this.borderTopWidth;
113
+ }
114
+
115
+ return 0;
116
+ }
117
+
118
+ public float getBorderTopLeftRadius() {
119
+ return borderTopLeftRadius;
120
+ }
121
+
122
+ public float getBorderTopRightRadius() {
123
+ return borderTopRightRadius;
124
+ }
125
+
126
+ public float getBorderBottomRightRadius() {
127
+ return borderBottomRightRadius;
128
+ }
129
+
130
+ public float getBorderBottomLeftRadius() {
131
+ return borderBottomLeftRadius;
132
+ }
133
+
134
+ public float getUniformBorderRadius() {
135
+ if (this.hasUniformBorderRadius()) {
136
+ return this.borderTopLeftRadius;
137
+ }
138
+
139
+ return 0;
140
+ }
141
+
142
+ public String getClipPath() {
143
+ return clipPath;
144
+ }
145
+
146
+ public int getBackgroundColor() {
147
+ return backgroundColor;
148
+ }
149
+
150
+ public String getBackgroundImage() {
151
+ return backgroundImage;
152
+ }
153
+
154
+ public Bitmap getBackgroundBitmap() {
155
+ return backgroundBitmap;
156
+ }
157
+
158
+ public LinearGradientDefinition getBackgroundGradient() {
159
+ return backgroundGradient;
160
+ }
161
+
162
+ public String getBackgroundRepeat() {
163
+ return backgroundRepeat;
164
+ }
165
+
166
+ public String getBackgroundPosition() {
167
+ return backgroundPosition;
168
+ }
169
+
170
+ public String getBackgroundSize() {
171
+ return backgroundSize;
172
+ }
173
+
174
+ public boolean hasBorderWidth() {
175
+ return this.borderTopWidth != 0
176
+ || this.borderRightWidth != 0
177
+ || this.borderBottomWidth != 0
178
+ || this.borderLeftWidth != 0;
179
+ }
180
+
181
+ public boolean hasUniformBorderColor() {
182
+ return this.borderTopColor == this.borderRightColor &&
183
+ this.borderTopColor == this.borderBottomColor &&
184
+ this.borderTopColor == this.borderLeftColor;
185
+ }
186
+
187
+ public boolean hasUniformBorderWidth() {
188
+ return this.borderTopWidth == this.borderRightWidth &&
189
+ this.borderTopWidth == this.borderBottomWidth &&
190
+ this.borderTopWidth == this.borderLeftWidth;
191
+ }
192
+
193
+ public boolean hasUniformBorderRadius() {
194
+ return this.borderTopLeftRadius == this.borderTopRightRadius &&
195
+ this.borderTopLeftRadius == this.borderBottomRightRadius &&
196
+ this.borderTopLeftRadius == this.borderBottomLeftRadius;
197
+ }
198
+
199
+ public boolean hasUniformBorder() {
200
+ return this.hasUniformBorderColor() &&
201
+ this.hasUniformBorderWidth() &&
202
+ this.hasUniformBorderRadius();
203
+ }
204
+
205
+ public BorderDrawable(float density) {
206
+ super();
207
+ this.density = density;
208
+ }
209
+
210
+ public BorderDrawable(float density, String id) {
211
+ super();
212
+ this.density = density;
213
+ this.id = id;
214
+ }
215
+
216
+ public void refresh(int borderTopColor,
217
+ int borderRightColor,
218
+ int borderBottomColor,
219
+ int borderLeftColor,
220
+
221
+ float borderTopWidth,
222
+ float borderRightWidth,
223
+ float borderBottomWidth,
224
+ float borderLeftWidth,
225
+
226
+ float borderTopLeftRadius,
227
+ float borderTopRightRadius,
228
+ float borderBottomRightRadius,
229
+ float borderBottomLeftRadius,
230
+
231
+ String clipPath,
232
+
233
+ int backgroundColor,
234
+ String backgroundImageUri,
235
+ Bitmap backgroundBitmap,
236
+ LinearGradientDefinition backgroundGradient,
237
+ Context context,
238
+ String backgroundRepeat,
239
+ String backgroundPosition,
240
+ CSSValue[] backgroundPositionParsedCSSValues,
241
+ String backgroundSize,
242
+ CSSValue[] backgroundSizeParsedCSSValues) {
243
+
244
+ this.borderTopColor = borderTopColor;
245
+ this.borderRightColor = borderRightColor;
246
+ this.borderBottomColor = borderBottomColor;
247
+ this.borderLeftColor = borderLeftColor;
248
+
249
+ this.borderTopWidth = borderTopWidth;
250
+ this.borderRightWidth = borderRightWidth;
251
+ this.borderBottomWidth = borderBottomWidth;
252
+ this.borderLeftWidth = borderLeftWidth;
253
+
254
+ this.borderTopLeftRadius = borderTopLeftRadius;
255
+ this.borderTopRightRadius = borderTopRightRadius;
256
+ this.borderBottomRightRadius = borderBottomRightRadius;
257
+ this.borderBottomLeftRadius = borderBottomLeftRadius;
258
+
259
+ this.clipPath = clipPath;
260
+
261
+ this.backgroundColor = backgroundColor;
262
+ this.backgroundImage = backgroundImageUri;
263
+ this.backgroundBitmap = backgroundBitmap;
264
+ this.backgroundGradient = backgroundGradient;
265
+ this.backgroundRepeat = backgroundRepeat;
266
+ this.backgroundPosition = backgroundPosition;
267
+ this.backgroundPositionParsedCSSValues = backgroundPositionParsedCSSValues;
268
+ this.backgroundSize = backgroundSize;
269
+ this.backgroundSizeParsedCSSValues = backgroundSizeParsedCSSValues;
270
+
271
+ this.invalidateSelf();
272
+ if (backgroundImageUri != null) {
273
+ Fetcher fetcher = Fetcher.getInstance(context);
274
+ // TODO: Implement option to pass load-mode like in ImageView class.
275
+ boolean loadAsync = backgroundImageUri.startsWith("http");
276
+
277
+ // Maintain aspect ratio for background images by default and size will be handled by border drawable
278
+ fetcher.loadImage(backgroundImageUri, this, 0, 0, true, true, loadAsync, null);
279
+ }
280
+ }
281
+
282
+ RectF backgroundBoundsF = new RectF();
283
+ Path backgroundPath = new Path();
284
+ RectF backgroundRect = new RectF();
285
+ Paint backgroundColorPaint = new Paint();
286
+ Path backgroundNoRepeatPath = new Path();
287
+ Paint backgroundImagePaint = new Paint();
288
+ Paint backgroundGradientPaint = new Paint();
289
+ Paint borderPaint = new Paint();
290
+ Path borderPath = new Path();
291
+ RectF borderOuterRect = new RectF();
292
+ RectF borderInnerRect = new RectF();
293
+
294
+ PointF lto = new PointF(); // left-top-outside
295
+ PointF lti = new PointF(); // left-top-inside
296
+
297
+ PointF rto = new PointF(); // right-top-outside
298
+ PointF rti = new PointF(); // right-top-outside
299
+
300
+ PointF rbo = new PointF(); // right-bottom-outside
301
+ PointF rbi = new PointF(); // right-bottom-inside
302
+
303
+ PointF lbo = new PointF(); // left-bottom-outside
304
+ PointF lbi = new PointF(); // left-bottom-inside
305
+
306
+
307
+ Paint topBorderPaint = new Paint();
308
+ Path topBorderPath = new Path();
309
+
310
+ Paint rightBorderPaint = new Paint();
311
+ Path rightBorderPath = new Path();
312
+
313
+ Paint bottomBorderPaint = new Paint();
314
+ Path bottomBorderPath = new Path();
315
+
316
+ Paint leftBorderPaint = new Paint();
317
+ Path leftBorderPath = new Path();
318
+
319
+ @Override
320
+ public void draw(Canvas canvas) {
321
+ Rect bounds = this.getBounds();
322
+ float width = (float) bounds.width();
323
+ float height = (float) bounds.height();
324
+
325
+ if (width <= 0 || height <= 0) {
326
+ // When the view is off-screen the bounds might be empty and we don't have anything to draw.
327
+ return;
328
+ }
329
+
330
+ backgroundBoundsF.set(bounds.left, bounds.top, bounds.right, bounds.bottom);
331
+
332
+ float topBackoffAntialias = calculateBackoffAntialias(this.borderTopColor, this.borderTopWidth);
333
+ float rightBackoffAntialias = calculateBackoffAntialias(this.borderRightColor, this.borderRightWidth);
334
+ float bottomBackoffAntialias = calculateBackoffAntialias(this.borderBottomColor, this.borderBottomWidth);
335
+ float leftBackoffAntialias = calculateBackoffAntialias(this.borderLeftColor, this.borderLeftWidth);
336
+
337
+ float[] backgroundRadii = {
338
+ Math.max(0, borderTopLeftRadius + leftBackoffAntialias), Math.max(0, borderTopLeftRadius + topBackoffAntialias),
339
+ Math.max(0, borderTopRightRadius + rightBackoffAntialias), Math.max(0, borderTopRightRadius + topBackoffAntialias),
340
+ Math.max(0, borderBottomRightRadius + rightBackoffAntialias), Math.max(0, borderBottomRightRadius + bottomBackoffAntialias),
341
+ Math.max(0, borderBottomLeftRadius + leftBackoffAntialias), Math.max(0, borderBottomLeftRadius + bottomBackoffAntialias)
342
+ };
343
+
344
+ backgroundPath.reset();
345
+
346
+ backgroundRect.set(leftBackoffAntialias,
347
+ topBackoffAntialias,
348
+ width - rightBackoffAntialias,
349
+ height - bottomBackoffAntialias);
350
+
351
+ backgroundPath.addRoundRect(backgroundRect, backgroundRadii, Path.Direction.CW);
352
+
353
+ // draw background
354
+ if (this.backgroundColor != 0) {
355
+ backgroundColorPaint.reset();
356
+ backgroundColorPaint.setStyle(Paint.Style.FILL);
357
+ backgroundColorPaint.setColor(this.backgroundColor);
358
+ backgroundColorPaint.setAntiAlias(true);
359
+
360
+ if (this.clipPath != null && !this.clipPath.isEmpty()) {
361
+ drawClipPath(this.clipPath, canvas, backgroundColorPaint, backgroundBoundsF, this.density);
362
+ } else {
363
+ canvas.drawPath(backgroundPath, backgroundColorPaint);
364
+ }
365
+ }
366
+
367
+ if (this.backgroundBitmap != null) {
368
+ BackgroundDrawParams params = this.getDrawParams(width, height);
369
+ Matrix transform = new Matrix();
370
+ if (params.sizeX > 0 && params.sizeY > 0) {
371
+ float scaleX = params.sizeX / this.backgroundBitmap.getWidth();
372
+ float scaleY = params.sizeY / this.backgroundBitmap.getHeight();
373
+ transform.setScale(scaleX, scaleY, 0, 0);
374
+ } else {
375
+ params.sizeX = this.backgroundBitmap.getWidth();
376
+ params.sizeY = this.backgroundBitmap.getHeight();
377
+ }
378
+ transform.postTranslate(params.posX, params.posY);
379
+
380
+
381
+ backgroundImagePaint.reset();
382
+
383
+ BitmapShader shader = new BitmapShader(
384
+ this.backgroundBitmap,
385
+ params.repeatX ? Shader.TileMode.REPEAT : Shader.TileMode.CLAMP,
386
+ params.repeatY ? Shader.TileMode.REPEAT : Shader.TileMode.CLAMP
387
+ );
388
+ shader.setLocalMatrix(transform);
389
+ backgroundImagePaint.setAntiAlias(true);
390
+ backgroundImagePaint.setFilterBitmap(true);
391
+ backgroundImagePaint.setShader(shader);
392
+
393
+ float imageWidth = params.repeatX ? width : params.sizeX;
394
+ float imageHeight = params.repeatY ? height : params.sizeY;
395
+ params.posX = params.repeatX ? 0 : params.posX;
396
+ params.posY = params.repeatY ? 0 : params.posY;
397
+
398
+ if (this.clipPath != null && !this.clipPath.isEmpty()) {
399
+ drawClipPath(this.clipPath, canvas, backgroundImagePaint, backgroundBoundsF, this.density);
400
+ } else {
401
+ boolean supportsPathOp = android.os.Build.VERSION.SDK_INT >= 19;
402
+ if (supportsPathOp) {
403
+ backgroundNoRepeatPath.reset();
404
+ backgroundNoRepeatPath.addRect(params.posX, params.posY, params.posX + imageWidth, params.posY + imageHeight, Path.Direction.CCW);
405
+ intersect(backgroundNoRepeatPath, backgroundPath);
406
+ canvas.drawPath(backgroundNoRepeatPath, backgroundImagePaint);
407
+ } else {
408
+ // Clipping here will not be anti-aliased but at least it won't shine through the rounded corners.
409
+ canvas.save();
410
+ canvas.clipRect(params.posX, params.posY, params.posX + imageWidth, params.posY + imageHeight);
411
+ canvas.drawPath(backgroundPath, backgroundImagePaint);
412
+ canvas.restore();
413
+ }
414
+ }
415
+ }
416
+
417
+ if (this.backgroundGradient != null) {
418
+ LinearGradientDefinition def = this.backgroundGradient;
419
+
420
+ backgroundGradientPaint.reset();
421
+
422
+ LinearGradient shader = new LinearGradient(
423
+ def.getStartX() * width, def.getStartY() * height,
424
+ def.getEndX() * width, def.getEndY() * height,
425
+ def.getColors(), def.getStops(), Shader.TileMode.MIRROR);
426
+ backgroundGradientPaint.setAntiAlias(true);
427
+ backgroundGradientPaint.setFilterBitmap(true);
428
+ backgroundGradientPaint.setShader(shader);
429
+
430
+ if (this.clipPath != null && !this.clipPath.isEmpty()) {
431
+ drawClipPath(this.clipPath, canvas, backgroundGradientPaint, backgroundBoundsF, this.density);
432
+ } else {
433
+ canvas.drawPath(backgroundPath, backgroundGradientPaint);
434
+ }
435
+ }
436
+
437
+ // draw border
438
+ if (this.clipPath != null && !this.clipPath.isEmpty()) {
439
+ float borderWidth = this.getUniformBorderWidth();
440
+ if (borderWidth > 0) {
441
+ borderPaint.reset();
442
+ borderPaint.setColor(this.getUniformBorderColor());
443
+ borderPaint.setStyle(Paint.Style.STROKE);
444
+ borderPaint.setStrokeWidth(borderWidth);
445
+ drawClipPath(this.clipPath, canvas, borderPaint, backgroundBoundsF, this.density);
446
+ }
447
+ } else if (!this.hasBorderWidth()) {
448
+ // No borders trap.
449
+ } else if (this.hasUniformBorderColor()) {
450
+ // iOS and browsers use black when no color is specified.
451
+ if (borderLeftWidth > 0 || borderTopWidth > 0 || borderRightWidth > 0 || borderBottomWidth > 0) {
452
+ borderPaint.reset();
453
+ borderPaint.setColor(this.getUniformBorderColor());
454
+ borderPaint.setStyle(Paint.Style.FILL);
455
+ borderPaint.setAntiAlias(true);
456
+
457
+ borderPath.reset();
458
+
459
+ borderOuterRect.set(0, 0, width, height);
460
+
461
+ float[] borderOuterRadii = {
462
+ borderTopLeftRadius, borderTopLeftRadius,
463
+ borderTopRightRadius, borderTopRightRadius,
464
+ borderBottomRightRadius, borderBottomRightRadius,
465
+ borderBottomLeftRadius, borderBottomLeftRadius
466
+ };
467
+ borderPath.addRoundRect(borderOuterRect, borderOuterRadii, Path.Direction.CW);
468
+
469
+ borderInnerRect.set(
470
+ borderLeftWidth,
471
+ borderTopWidth,
472
+ width - borderRightWidth,
473
+ height - borderBottomWidth
474
+ );
475
+ float[] borderInnerRadii = {
476
+ Math.max(0, borderTopLeftRadius - borderLeftWidth), Math.max(0, borderTopLeftRadius - borderTopWidth),
477
+ Math.max(0, borderTopRightRadius - borderRightWidth), Math.max(0, borderTopRightRadius - borderTopWidth),
478
+ Math.max(0, borderBottomRightRadius - borderRightWidth), Math.max(0, borderBottomRightRadius - borderBottomWidth),
479
+ Math.max(0, borderBottomLeftRadius - borderLeftWidth), Math.max(0, borderBottomLeftRadius - borderBottomWidth)
480
+ };
481
+ borderPath.addRoundRect(borderInnerRect, borderInnerRadii, Path.Direction.CCW);
482
+
483
+ canvas.drawPath(borderPath, borderPaint);
484
+ }
485
+ } else {
486
+ float top = this.borderTopWidth;
487
+ float right = this.borderRightWidth;
488
+ float bottom = this.borderBottomWidth;
489
+ float left = this.borderLeftWidth;
490
+
491
+ //lto rto
492
+ // +---------------------+
493
+ // |lti rti|
494
+ // | |
495
+ // | |
496
+ // | |
497
+ // | |
498
+ // |lbi rbi|
499
+ // +---------------------+
500
+ //lbo rbo
501
+
502
+ lto.set(0, 0); // left-top-outside
503
+ lti.set(left, top); // left-top-inside
504
+
505
+ rto.set(bounds.right, 0); // right-top-outside
506
+ rti.set(bounds.right - right, top); // right-top-outside
507
+
508
+ rbo.set(bounds.right, bounds.bottom); // right-bottom-outside
509
+ rbi.set(bounds.right - right, bounds.bottom - bottom); // right-bottom-inside
510
+
511
+ lbo.set(0, bounds.bottom); // left-bottom-outside
512
+ lbi.set(left, bounds.bottom - bottom); // left-bottom-inside
513
+
514
+
515
+ if (this.borderTopWidth > 0) {
516
+ topBorderPaint.reset();
517
+ topBorderPaint.setColor(this.borderTopColor);
518
+ topBorderPaint.setAntiAlias(true);
519
+
520
+ topBorderPath.reset();
521
+ topBorderPath.setFillType(Path.FillType.EVEN_ODD);
522
+ topBorderPath.moveTo(lto.x, lto.y);
523
+ topBorderPath.lineTo(rto.x, rto.y);
524
+ topBorderPath.lineTo(rti.x, rti.y);
525
+ topBorderPath.lineTo(lti.x, lti.y);
526
+ topBorderPath.close();
527
+ canvas.drawPath(topBorderPath, topBorderPaint);
528
+ }
529
+
530
+ if (this.borderRightWidth > 0) {
531
+
532
+ rightBorderPaint.reset();
533
+ rightBorderPaint.setColor(this.borderRightColor);
534
+ rightBorderPaint.setAntiAlias(true);
535
+
536
+ rightBorderPath.reset();
537
+ rightBorderPath.setFillType(Path.FillType.EVEN_ODD);
538
+ rightBorderPath.moveTo(rto.x, rto.y);
539
+ rightBorderPath.lineTo(rbo.x, rbo.y);
540
+ rightBorderPath.lineTo(rbi.x, rbi.y);
541
+ rightBorderPath.lineTo(rti.x, rti.y);
542
+ rightBorderPath.close();
543
+ canvas.drawPath(rightBorderPath, rightBorderPaint);
544
+ }
545
+
546
+ if (this.borderBottomWidth > 0) {
547
+
548
+ bottomBorderPaint.reset();
549
+ bottomBorderPaint.setColor(this.borderBottomColor);
550
+ bottomBorderPaint.setAntiAlias(true);
551
+
552
+ bottomBorderPath.reset();
553
+ bottomBorderPath.setFillType(Path.FillType.EVEN_ODD);
554
+ bottomBorderPath.moveTo(rbo.x, rbo.y);
555
+ bottomBorderPath.lineTo(lbo.x, lbo.y);
556
+ bottomBorderPath.lineTo(lbi.x, lbi.y);
557
+ bottomBorderPath.lineTo(rbi.x, rbi.y);
558
+ bottomBorderPath.close();
559
+ canvas.drawPath(bottomBorderPath, bottomBorderPaint);
560
+ }
561
+
562
+ if (this.borderLeftWidth > 0) {
563
+ leftBorderPaint.reset();
564
+ leftBorderPaint.setColor(this.borderLeftColor);
565
+ leftBorderPaint.setAntiAlias(true);
566
+
567
+ leftBorderPath.reset();
568
+ leftBorderPath.setFillType(Path.FillType.EVEN_ODD);
569
+ leftBorderPath.moveTo(lbo.x, lbo.y);
570
+ leftBorderPath.lineTo(lto.x, lto.y);
571
+ leftBorderPath.lineTo(lti.x, lti.y);
572
+ leftBorderPath.lineTo(lbi.x, lbi.y);
573
+ leftBorderPath.close();
574
+ canvas.drawPath(leftBorderPath, leftBorderPaint);
575
+ }
576
+ }
577
+ }
578
+
579
+ private static float calculateBackoffAntialias(int borderColor, float borderWidth) {
580
+ // We will inset background colors and images so antialiasing will not color pixels outside the border.
581
+ // If the border is transparent we will backoff less, and we will not backoff more than half a pixel or half the border width.
582
+ float halfBorderWidth = borderWidth / 2.0f;
583
+ float normalizedBorderAlpha = ((float) Color.alpha(borderColor)) / 255.0f;
584
+ return Math.min(1f, halfBorderWidth) * normalizedBorderAlpha;
585
+ }
586
+
587
+ @TargetApi(19)
588
+ private static void intersect(Path path1, Path path2) {
589
+ path1.op(path2, Path.Op.INTERSECT);
590
+ }
591
+
592
+ private final static Pattern spaceAndComma = Pattern.compile("[\\s,]+");
593
+ private final static Pattern space = Pattern.compile("\\s+");
594
+
595
+ private static void drawClipPath(String clipPath, Canvas canvas, Paint paint, RectF bounds, float density) {
596
+ // Sample string is polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%);
597
+ String functionName = clipPath.substring(0, clipPath.indexOf("("));
598
+ String value = clipPath.substring(clipPath.indexOf("(") + 1, clipPath.indexOf(")"));
599
+
600
+ String[] arr;
601
+ float top;
602
+ float right;
603
+ float bottom;
604
+ float left;
605
+ switch (functionName) {
606
+ case "rect":
607
+ arr = spaceAndComma.split(value);
608
+
609
+ top = cssValueToDevicePixels(arr[0], bounds.bottom, density);
610
+ right = cssValueToDevicePixels(arr[1], bounds.right, density);
611
+ bottom = cssValueToDevicePixels(arr[2], bounds.bottom, density);
612
+ left = cssValueToDevicePixels(arr[3], bounds.right, density);
613
+
614
+ canvas.drawRect(left, top, right, bottom, paint);
615
+ break;
616
+ case "inset":
617
+ arr = spaceAndComma.split(value);
618
+ String topString = "0";
619
+ String rightString = "0";
620
+ String bottomString = "0";
621
+ String leftString = "0";
622
+ if (arr.length == 1) {
623
+ topString = rightString = bottomString = leftString = arr[0];
624
+ } else if (arr.length == 2) {
625
+ topString = bottomString = arr[0];
626
+ rightString = leftString = arr[1];
627
+ } else if (arr.length == 3) {
628
+ topString = arr[0];
629
+ rightString = leftString = arr[1];
630
+ bottomString = arr[2];
631
+ } else if (arr.length == 4) {
632
+ topString = arr[0];
633
+ rightString = arr[1];
634
+ bottomString = arr[2];
635
+ leftString = arr[3];
636
+ }
637
+
638
+ top = cssValueToDevicePixels(topString, bounds.bottom, density);
639
+ right = cssValueToDevicePixels("100%", bounds.right, density) - cssValueToDevicePixels(rightString, bounds.right, density);
640
+ bottom = cssValueToDevicePixels("100%", bounds.bottom, density) - cssValueToDevicePixels(bottomString, bounds.bottom, density);
641
+ left = cssValueToDevicePixels(leftString, bounds.right, density);
642
+
643
+ canvas.drawRect(left, top, right, bottom, paint);
644
+ break;
645
+ case "circle":
646
+ arr = space.split(value);
647
+ float radius = cssValueToDevicePixels(arr[0], (Math.min(bounds.width(), bounds.height())) / 2, density);
648
+ float y = cssValueToDevicePixels(arr[2], bounds.height(), density);
649
+ float x = cssValueToDevicePixels(arr[3], bounds.width(), density);
650
+ canvas.drawCircle(x, y, radius, paint);
651
+ break;
652
+ case "ellipse":
653
+ arr = space.split(value);
654
+ float rX = cssValueToDevicePixels(arr[0], bounds.right, density);
655
+ float rY = cssValueToDevicePixels(arr[1], bounds.bottom, density);
656
+ float cX = cssValueToDevicePixels(arr[3], bounds.right, density);
657
+ float cY = cssValueToDevicePixels(arr[4], bounds.bottom, density);
658
+ left = cX - rX;
659
+ top = cY - rY;
660
+ right = (rX * 2) + left;
661
+ bottom = (rY * 2) + top;
662
+
663
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
664
+ canvas.drawOval(left, top, right, bottom, paint);
665
+ } else {
666
+ canvas.drawOval(new RectF(left, top, right, bottom), paint);
667
+ }
668
+ break;
669
+ case "polygon":
670
+ Path path = new Path();
671
+ PointF firstPoint = null;
672
+ arr = value.split(",");
673
+ for (String s : arr) {
674
+ String[] xy = space.split(s.trim());
675
+ PointF point = new PointF(cssValueToDevicePixels(xy[0], bounds.width(), density), cssValueToDevicePixels(xy[1], bounds.height(), density));
676
+
677
+ if (firstPoint == null) {
678
+ firstPoint = point;
679
+ path.moveTo(point.x, point.y);
680
+ }
681
+
682
+ path.lineTo(point.x, point.y);
683
+ }
684
+ if (firstPoint != null) {
685
+ path.lineTo(firstPoint.x, firstPoint.y);
686
+ }
687
+ canvas.drawPath(path, paint);
688
+ break;
689
+ }
690
+ }
691
+
692
+ private BackgroundDrawParams getDrawParams(float width, float height) {
693
+ BackgroundDrawParams res = new BackgroundDrawParams();
694
+
695
+ // repeat
696
+ if (this.backgroundRepeat != null && !this.backgroundRepeat.isEmpty()) {
697
+ switch (this.backgroundRepeat.toLowerCase(Locale.ENGLISH)) {
698
+ case "no-repeat":
699
+ res.repeatX = false;
700
+ res.repeatY = false;
701
+ break;
702
+
703
+ case "repeat-x":
704
+ res.repeatY = false;
705
+ break;
706
+
707
+ case "repeat-y":
708
+ res.repeatX = false;
709
+ break;
710
+ }
711
+ }
712
+
713
+ float imageWidth = this.backgroundBitmap.getWidth();
714
+ float imageHeight = this.backgroundBitmap.getHeight();
715
+
716
+ // size
717
+ if (this.backgroundSize != null && !this.backgroundSize.isEmpty()) {
718
+ if (this.backgroundSizeParsedCSSValues.length == 2) {
719
+ CSSValue vx = this.backgroundSizeParsedCSSValues[0];
720
+ CSSValue vy = this.backgroundSizeParsedCSSValues[1];
721
+ if ("%".equals(vx.getUnit()) && "%".equals(vy.getUnit())) {
722
+ imageWidth = width * vx.getValue() / 100;
723
+ imageHeight = height * vy.getValue() / 100;
724
+
725
+ res.sizeX = imageWidth;
726
+ res.sizeY = imageHeight;
727
+ } else if ("number".equals(vx.getType()) && "number".equals(vy.getType()) &&
728
+ (("px".equals(vx.getUnit()) && "px".equals(vy.getUnit())) || ((vx.getUnit() == null || vx.getUnit().isEmpty()) && (vy.getUnit() == null || vy.getUnit().isEmpty())))) {
729
+ imageWidth = vx.getValue();
730
+ imageHeight = vy.getValue();
731
+
732
+ res.sizeX = imageWidth;
733
+ res.sizeY = imageHeight;
734
+ }
735
+ } else if (this.backgroundSizeParsedCSSValues.length == 1 && "ident".equals(this.backgroundSizeParsedCSSValues[0].getType())) {
736
+ float scale = 0;
737
+
738
+ if ("cover".equals(this.backgroundSizeParsedCSSValues[0].getString())) {
739
+ scale = Math.max(width / imageWidth, height / imageHeight);
740
+ } else if ("contain".equals(this.backgroundSizeParsedCSSValues[0].getString())) {
741
+ scale = Math.min(width / imageWidth, height / imageHeight);
742
+ }
743
+
744
+ if (scale > 0) {
745
+ imageWidth *= scale;
746
+ imageHeight *= scale;
747
+
748
+ res.sizeX = imageWidth;
749
+ res.sizeY = imageHeight;
750
+ }
751
+ }
752
+ }
753
+
754
+ // position
755
+ if (this.backgroundPosition != null && !this.backgroundPosition.isEmpty()) {
756
+ CSSValue[] xy = parsePosition(this.backgroundPositionParsedCSSValues);
757
+ if (xy != null) {
758
+ CSSValue vx = xy[0];
759
+ CSSValue vy = xy[1];
760
+ float spaceX = width - imageWidth;
761
+ float spaceY = height - imageHeight;
762
+
763
+ if ("%".equals(vx.getUnit()) && "%".equals(vy.getUnit())) {
764
+ res.posX = spaceX * vx.getValue() / 100;
765
+ res.posY = spaceY * vy.getValue() / 100;
766
+ } else if ("number".equals(vx.getType()) && "number".equals(vy.getType()) &&
767
+ (("px".equals(vx.getUnit()) && "px".equals(vy.getUnit())) || ((vx.getUnit() == null || vx.getUnit().isEmpty()) && (vy.getUnit() == null || vy.getUnit().isEmpty())))) {
768
+ res.posX = vx.getValue();
769
+ res.posY = vy.getValue();
770
+ } else if ("ident".equals(vx.getType()) && "ident".equals(vy.getType())) {
771
+ if ("center".equals(vx.getString().toLowerCase(Locale.ENGLISH))) {
772
+ res.posX = spaceX / 2;
773
+ } else if ("right".equals(vx.getString().toLowerCase(Locale.ENGLISH))) {
774
+ res.posX = spaceX;
775
+ }
776
+
777
+ if ("center".equals(vy.getString().toLowerCase(Locale.ENGLISH))) {
778
+ res.posY = spaceY / 2;
779
+ } else if ("bottom".equals(vy.getString().toLowerCase(Locale.ENGLISH))) {
780
+ res.posY = spaceY;
781
+ }
782
+ } else if ("number".equals(vx.getType()) && "ident".equals(vy.getType())) {
783
+ if ("%".equals(vx.getUnit())) {
784
+ res.posX = spaceX * vx.getValue() / 100;
785
+ } else if ("px".equals(vx.getUnit()) || vx.getUnit() == null || vx.getUnit().isEmpty()) {
786
+ res.posX = vx.getValue();
787
+ }
788
+
789
+ if ("center".equals(vy.getString().toLowerCase(Locale.ENGLISH))) {
790
+ res.posY = spaceY / 2;
791
+ } else if ("bottom".equals(vy.getString().toLowerCase(Locale.ENGLISH))) {
792
+ res.posY = spaceY;
793
+ }
794
+ }
795
+ }
796
+ }
797
+
798
+ return res;
799
+ }
800
+
801
+ private static CSSValue[] parsePosition(CSSValue[] values) {
802
+ if (values.length == 2) {
803
+ return values;
804
+ }
805
+
806
+ CSSValue[] result = null;
807
+ if (values.length == 1) {
808
+ // If you only one keyword is specified, the other value is "center"
809
+ CSSValue center = new CSSValue("ident", "center", null, 0);
810
+
811
+ if ("ident".equals(values[0].getType())) {
812
+ String val = values[0].getString().toLowerCase(Locale.ENGLISH);
813
+
814
+ switch (val) {
815
+ case "left":
816
+ case "right":
817
+ result = new CSSValue[]{values[0], center};
818
+ break;
819
+ case "top":
820
+ case "bottom":
821
+ result = new CSSValue[]{center, values[0]};
822
+ break;
823
+ case "center":
824
+ result = new CSSValue[]{center, center};
825
+ break;
826
+ }
827
+ } else if ("number".equals(values[0].getType())) {
828
+ result = new CSSValue[]{values[0], center};
829
+ }
830
+ }
831
+
832
+ return result;
833
+ }
834
+
835
+ private static float cssValueToDevicePixels(String source, float total, float density) {
836
+ source = source.trim();
837
+ if (source.contains("%")) {
838
+ return Float.parseFloat(source.replace("%", "")) * total / 100;
839
+ } else if (source.contains("px")) {
840
+ return Float.parseFloat(source.replace("px", "")) * density;
841
+ } else {
842
+ return Float.parseFloat(source) * density;
843
+ }
844
+ }
845
+
846
+ public String toDebugString() {
847
+ return getClass().getSimpleName() + "@" + Integer.toHexString(hashCode()) + "; " +
848
+
849
+ "id: " + this.id + "; " +
850
+
851
+ "borderTopColor: " + this.borderTopColor + "; " +
852
+ "borderRightColor: " + this.borderRightColor + "; " +
853
+ "borderBottomColor: " + this.borderBottomColor + "; " +
854
+ "borderLeftColor: " + this.borderLeftColor + "; " +
855
+
856
+ "borderTopWidth: " + this.borderTopWidth + "; " +
857
+ "borderRightWidth: " + this.borderRightWidth + "; " +
858
+ "borderBottomWidth: " + this.borderBottomWidth + "; " +
859
+ "borderLeftWidth: " + this.borderLeftWidth + "; " +
860
+
861
+ "borderTopLeftRadius: " + this.borderTopLeftRadius + "; " +
862
+ "borderTopRightRadius: " + this.borderTopRightRadius + "; " +
863
+ "borderBottomRightRadius: " + this.borderBottomRightRadius + "; " +
864
+ "borderBottomLeftRadius: " + this.borderBottomLeftRadius + "; " +
865
+
866
+ "clipPath: " + this.clipPath + "; " +
867
+ "backgroundColor: " + this.backgroundColor + "; " +
868
+ "backgroundImage: " + this.backgroundImage + "; " +
869
+ "backgroundBitmap: " + this.backgroundBitmap + "; " +
870
+ "backgroundRepeat: " + this.backgroundRepeat + "; " +
871
+ "backgroundPosition: " + this.backgroundPosition + "; " +
872
+ "backgroundSize: " + this.backgroundSize + "; "
873
+ ;
874
+ }
875
+
876
+ @Override
877
+ public void setBitmap(Bitmap value) {
878
+ backgroundBitmap = value;
879
+ invalidateSelf();
880
+ drawable = null;
881
+ }
882
+
883
+ @Override
884
+ public void setDrawable(Drawable asyncDrawable) {
885
+ drawable = asyncDrawable;
886
+ }
887
+
888
+ @Override
889
+ public Drawable getDrawable() {
890
+ return drawable;
891
+ }
892
+
893
+
894
+ private final Path outlineBackgroundPath = new Path();
895
+ private final RectF outlineRectF = new RectF();
896
+
897
+ @Override
898
+ public void getOutline(@NonNull Outline outline) {
899
+ if (android.os.Build.VERSION.SDK_INT >= 21) {
900
+ outlineRectF.setEmpty();
901
+ outlineRectF.set(getBounds());
902
+ if (hasUniformBorderRadius()) {
903
+ outline.setRoundRect(getBounds(), borderTopLeftRadius);
904
+ } else {
905
+ // cliping with path is only support on API >= 33
906
+ // before it only works for rectangle, circle, or round rect
907
+ outlineBackgroundPath.reset();
908
+ float[] backgroundRadii = {
909
+ Math.max(0, borderTopLeftRadius), Math.max(0, borderTopLeftRadius),
910
+ Math.max(0, borderTopRightRadius), Math.max(0, borderTopRightRadius),
911
+ Math.max(0, borderBottomRightRadius), Math.max(0, borderBottomRightRadius),
912
+ Math.max(0, borderBottomLeftRadius), Math.max(0, borderBottomLeftRadius)
913
+ };
914
+ outlineBackgroundPath.addRoundRect(outlineRectF, backgroundRadii, Path.Direction.CW);
915
+
916
+ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
917
+ // see setConvexPath notes
918
+ outline.setPath(outlineBackgroundPath);
919
+ } else {
920
+ outline.setConvexPath(outlineBackgroundPath);
921
+ }
922
+ }
923
+ } else {
924
+ throw new IllegalStateException("Method supported on API 21 or higher");
925
+ }
926
+ }
927
+
928
+ private static class BackgroundDrawParams {
929
+ private boolean repeatX = true;
930
+ private boolean repeatY = true;
931
+ private float posX;
932
+ private float posY;
933
+ private float sizeX;
934
+ private float sizeY;
935
+ }
936
+ }