@nativescript/core 9.0.0-next-09-27-2025-18063560861 → 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 (179) hide show
  1. package/package.json +1 -1
  2. package/platforms/android/include.gradle +51 -0
  3. package/platforms/android/java/org/nativescript/Process.java +59 -0
  4. package/platforms/android/java/org/nativescript/widgets/AbsoluteLayout.java +88 -0
  5. package/platforms/android/java/org/nativescript/widgets/AnimatorHelper.java +61 -0
  6. package/platforms/android/java/org/nativescript/widgets/Async.java +1356 -0
  7. package/platforms/android/java/org/nativescript/widgets/BorderDrawable.java +936 -0
  8. package/platforms/android/java/org/nativescript/widgets/BottomNavigationBar.java +308 -0
  9. package/platforms/android/java/org/nativescript/widgets/BoxShadowDrawable.java +175 -0
  10. package/platforms/android/java/org/nativescript/widgets/CSSValue.java +34 -0
  11. package/platforms/android/java/org/nativescript/widgets/CommonLayoutParams.java +456 -0
  12. package/platforms/android/java/org/nativescript/widgets/ContentLayout.java +85 -0
  13. package/platforms/android/java/org/nativescript/widgets/CustomTransition.java +135 -0
  14. package/platforms/android/java/org/nativescript/widgets/CustomTypefaceSpan.java +44 -0
  15. package/platforms/android/java/org/nativescript/widgets/Dock.java +15 -0
  16. package/platforms/android/java/org/nativescript/widgets/DockLayout.java +185 -0
  17. package/platforms/android/java/org/nativescript/widgets/FileHelper.java +815 -0
  18. package/platforms/android/java/org/nativescript/widgets/FlexLine.java +177 -0
  19. package/platforms/android/java/org/nativescript/widgets/FlexboxLayout.java +2769 -0
  20. package/platforms/android/java/org/nativescript/widgets/FragmentBase.java +14 -0
  21. package/platforms/android/java/org/nativescript/widgets/GridLayout.java +1172 -0
  22. package/platforms/android/java/org/nativescript/widgets/GridUnitType.java +10 -0
  23. package/platforms/android/java/org/nativescript/widgets/HorizontalScrollView.java +256 -0
  24. package/platforms/android/java/org/nativescript/widgets/ImageView.java +423 -0
  25. package/platforms/android/java/org/nativescript/widgets/ItemSpec.java +56 -0
  26. package/platforms/android/java/org/nativescript/widgets/LayoutBase.java +98 -0
  27. package/platforms/android/java/org/nativescript/widgets/LinearGradientDefinition.java +46 -0
  28. package/platforms/android/java/org/nativescript/widgets/Orientation.java +9 -0
  29. package/platforms/android/java/org/nativescript/widgets/OriginPoint.java +74 -0
  30. package/platforms/android/java/org/nativescript/widgets/ScrollSavedState.java +63 -0
  31. package/platforms/android/java/org/nativescript/widgets/SegmentedBarColorDrawable.java +27 -0
  32. package/platforms/android/java/org/nativescript/widgets/StackLayout.java +231 -0
  33. package/platforms/android/java/org/nativescript/widgets/StyleableTextView.java +50 -0
  34. package/platforms/android/java/org/nativescript/widgets/TabIconRenderingMode.java +6 -0
  35. package/platforms/android/java/org/nativescript/widgets/TabItemSpec.java +15 -0
  36. package/platforms/android/java/org/nativescript/widgets/TabLayout.java +451 -0
  37. package/platforms/android/java/org/nativescript/widgets/TabStrip.java +294 -0
  38. package/platforms/android/java/org/nativescript/widgets/TabViewPager.java +64 -0
  39. package/platforms/android/java/org/nativescript/widgets/TabsBar.java +443 -0
  40. package/platforms/android/java/org/nativescript/widgets/Utils.java +546 -0
  41. package/platforms/android/java/org/nativescript/widgets/VerticalScrollView.java +258 -0
  42. package/platforms/android/java/org/nativescript/widgets/ViewHelper.java +564 -0
  43. package/platforms/android/java/org/nativescript/widgets/WrapLayout.java +252 -0
  44. package/platforms/android/java/org/nativescript/widgets/image/AsyncTask.java +679 -0
  45. package/platforms/android/java/org/nativescript/widgets/image/BitmapOwner.java +17 -0
  46. package/platforms/android/java/org/nativescript/widgets/image/Cache.java +471 -0
  47. package/platforms/android/java/org/nativescript/widgets/image/DiskLruCache.java +970 -0
  48. package/platforms/android/java/org/nativescript/widgets/image/Fetcher.java +747 -0
  49. package/platforms/android/java/org/nativescript/widgets/image/Utils.java +58 -0
  50. package/platforms/android/java/org/nativescript/widgets/image/Worker.java +571 -0
  51. package/platforms/ios/src/TNSWidgets/Info.plist +26 -0
  52. package/platforms/ios/src/TNSWidgets/NSData+Async.m +42 -0
  53. package/platforms/ios/src/TNSWidgets/NSFileHandle+Async.m +82 -0
  54. package/platforms/ios/src/TNSWidgets/NSObject+Swizzling.m +68 -0
  55. package/platforms/ios/src/TNSWidgets/NSString+Async.m +51 -0
  56. package/platforms/ios/src/TNSWidgets/TNSLabel.m +42 -0
  57. package/platforms/ios/src/TNSWidgets/UIImage+TNSBlocks.m +77 -0
  58. package/platforms/ios/src/TNSWidgets/UIView+PassThroughParent.m +53 -0
  59. package/platforms/ios/src/TNSWidgets/UIView+PropertyBag.m +72 -0
  60. package/platforms/ios/src/module.modulemap +5 -0
  61. package/platforms/android/widgets-release.aar +0 -0
  62. package/platforms/ios/TNSWidgets.xcframework/Info.plist +0 -102
  63. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
  64. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
  65. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Info.plist +0 -0
  66. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Modules/module.modulemap +0 -6
  67. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/TNSWidgets +0 -0
  68. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
  69. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  70. package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
  71. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
  72. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
  73. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
  74. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
  75. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
  76. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
  77. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
  78. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
  79. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
  80. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Modules/module.modulemap +0 -6
  81. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
  82. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
  83. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Resources/Info.plist +0 -52
  84. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSCCrypto.h +0 -60
  85. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSData+Async.h +0 -24
  86. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSFileHandle+Async.h +0 -22
  87. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSString+Async.h +0 -25
  88. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSLabel.h +0 -16
  89. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSProcess.h +0 -29
  90. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSWidgets.h +0 -25
  91. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIImage+TNSBlocks.h +0 -26
  92. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIView+PassThroughParent.h +0 -17
  93. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Modules/module.modulemap +0 -6
  94. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/NSObject+Swizzling.h +0 -17
  95. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/UIView+PropertyBag.h +0 -18
  96. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Resources/Info.plist +0 -52
  97. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/TNSWidgets +0 -0
  98. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSCCrypto.h +0 -60
  99. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSData+Async.h +0 -24
  100. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSFileHandle+Async.h +0 -22
  101. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSString+Async.h +0 -25
  102. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSLabel.h +0 -16
  103. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSProcess.h +0 -29
  104. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSWidgets.h +0 -25
  105. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/UIImage+TNSBlocks.h +0 -26
  106. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/UIView+PassThroughParent.h +0 -17
  107. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Modules/module.modulemap +0 -6
  108. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/PrivateHeaders/NSObject+Swizzling.h +0 -17
  109. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/PrivateHeaders/UIView+PropertyBag.h +0 -18
  110. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Resources/Info.plist +0 -52
  111. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/TNSWidgets +0 -0
  112. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
  113. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  114. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
  115. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +0 -82
  116. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
  117. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
  118. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
  119. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
  120. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
  121. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
  122. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
  123. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
  124. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
  125. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
  126. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Modules/module.modulemap +0 -6
  127. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
  128. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
  129. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
  130. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +0 -223
  131. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
  132. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  133. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
  134. package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +0 -82
  135. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
  136. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
  137. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
  138. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
  139. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
  140. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
  141. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
  142. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
  143. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
  144. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Info.plist +0 -0
  145. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Modules/module.modulemap +0 -6
  146. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
  147. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
  148. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/TNSWidgets +0 -0
  149. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
  150. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  151. package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
  152. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
  153. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
  154. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
  155. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
  156. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
  157. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
  158. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
  159. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
  160. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
  161. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
  162. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Modules/module.modulemap +0 -6
  163. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
  164. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
  165. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
  166. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +0 -223
  167. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
  168. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
  169. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
  170. package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +0 -82
  171. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/NSData+Async.h +0 -0
  172. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/NSFileHandle+Async.h +0 -0
  173. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/PrivateHeaders → src/TNSWidgets}/NSObject+Swizzling.h +0 -0
  174. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/NSString+Async.h +0 -0
  175. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/TNSLabel.h +0 -0
  176. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/TNSWidgets.h +0 -0
  177. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/UIImage+TNSBlocks.h +0 -0
  178. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/UIView+PassThroughParent.h +0 -0
  179. /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/PrivateHeaders → src/TNSWidgets}/UIView+PropertyBag.h +0 -0
@@ -0,0 +1,679 @@
1
+ /*
2
+ * Copyright (C) 2008 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package org.nativescript.widgets.image;
18
+
19
+ import android.annotation.TargetApi;
20
+ import android.os.Handler;
21
+ import android.os.Message;
22
+ import android.os.Process;
23
+
24
+ import java.util.ArrayDeque;
25
+ import java.util.concurrent.BlockingQueue;
26
+ import java.util.concurrent.Callable;
27
+ import java.util.concurrent.CancellationException;
28
+ import java.util.concurrent.ExecutionException;
29
+ import java.util.concurrent.Executor;
30
+ import java.util.concurrent.Executors;
31
+ import java.util.concurrent.FutureTask;
32
+ import java.util.concurrent.LinkedBlockingQueue;
33
+ import java.util.concurrent.ThreadFactory;
34
+ import java.util.concurrent.ThreadPoolExecutor;
35
+ import java.util.concurrent.TimeUnit;
36
+ import java.util.concurrent.TimeoutException;
37
+ import java.util.concurrent.atomic.AtomicBoolean;
38
+ import java.util.concurrent.atomic.AtomicInteger;
39
+
40
+ /**
41
+ * *************************************
42
+ * Copied from JB release framework:
43
+ * https://android.googlesource.com/platform/frameworks/base/+/jb-release/core/java/android/os/AsyncTask.java
44
+ * <p>
45
+ * so that threading behavior on all OS versions is the same and we can tweak behavior by using
46
+ * executeOnExecutor() if needed.
47
+ * <p>
48
+ * There are 3 changes in this copy of AsyncTask:
49
+ * -pre-HC a single thread executor is used for serial operation
50
+ * (Executors.newSingleThreadExecutor) and is the default
51
+ * -the default THREAD_POOL_EXECUTOR was changed to use DiscardOldestPolicy
52
+ * -a new fixed thread pool called DUAL_THREAD_EXECUTOR was added
53
+ * *************************************
54
+ *
55
+ * <p>AsyncTask enables proper and easy use of the UI thread. This class allows to
56
+ * perform background operations and publish results on the UI thread without
57
+ * having to manipulate threads and/or handlers.</p>
58
+ *
59
+ * <p>AsyncTask is designed to be a helper class around {@link Thread} and {@link Handler}
60
+ * and does not constitute a generic threading framework. AsyncTasks should ideally be
61
+ * used for short operations (a few seconds at the most.) If you need to keep threads
62
+ * running for long periods of time, it is highly recommended you use the various APIs
63
+ * provided by the <code>java.util.concurrent</code> pacakge such as {@link Executor},
64
+ * {@link ThreadPoolExecutor} and {@link FutureTask}.</p>
65
+ *
66
+ * <p>An asynchronous task is defined by a computation that runs on a background thread and
67
+ * whose result is published on the UI thread. An asynchronous task is defined by 3 generic
68
+ * types, called <code>Params</code>, <code>Progress</code> and <code>Result</code>,
69
+ * and 4 steps, called <code>onPreExecute</code>, <code>doInBackground</code>,
70
+ * <code>onProgressUpdate</code> and <code>onPostExecute</code>.</p>
71
+ *
72
+ * <div class="special reference">
73
+ * <h3>Developer Guides</h3>
74
+ * <p>For more information about using tasks and threads, read the
75
+ * <a href="{@docRoot}guide/topics/fundamentals/processes-and-threads.html">Processes and
76
+ * Threads</a> developer guide.</p>
77
+ * </div>
78
+ *
79
+ * <h2>Usage</h2>
80
+ * <p>AsyncTask must be subclassed to be used. The subclass will override at least
81
+ * one method ({@link #doInBackground}), and most often will override a
82
+ * second one ({@link #onPostExecute}.)</p>
83
+ *
84
+ * <p>Here is an example of subclassing:</p>
85
+ * <pre class="prettyprint">
86
+ * private class DownloadFilesTask extends AsyncTask&lt;URL, Integer, Long&gt; {
87
+ * protected Long doInBackground(URL... urls) {
88
+ * int count = urls.length;
89
+ * long totalSize = 0;
90
+ * for (int i = 0; i < count; i++) {
91
+ * totalSize += Downloader.downloadFile(urls[i]);
92
+ * publishProgress((int) ((i / (float) count) * 100));
93
+ * // Escape early if cancel() is called
94
+ * if (isCancelled()) break;
95
+ * }
96
+ * return totalSize;
97
+ * }
98
+ *
99
+ * protected void onProgressUpdate(Integer... progress) {
100
+ * setProgressPercent(progress[0]);
101
+ * }
102
+ *
103
+ * protected void onPostExecute(Long result) {
104
+ * showDialog("Downloaded " + result + " bytes");
105
+ * }
106
+ * }
107
+ * </pre>
108
+ *
109
+ * <p>Once created, a task is executed very simply:</p>
110
+ * <pre class="prettyprint">
111
+ * new DownloadFilesTask().execute(url1, url2, url3);
112
+ * </pre>
113
+ *
114
+ * <h2>AsyncTask's generic types</h2>
115
+ * <p>The three types used by an asynchronous task are the following:</p>
116
+ * <ol>
117
+ * <li><code>Params</code>, the type of the parameters sent to the task upon
118
+ * execution.</li>
119
+ * <li><code>Progress</code>, the type of the progress units published during
120
+ * the background computation.</li>
121
+ * <li><code>Result</code>, the type of the result of the background
122
+ * computation.</li>
123
+ * </ol>
124
+ * <p>Not all types are always used by an asynchronous task. To mark a type as unused,
125
+ * simply use the type {@link Void}:</p>
126
+ * <pre>
127
+ * private class MyTask extends AsyncTask&lt;Void, Void, Void&gt; { ... }
128
+ * </pre>
129
+ *
130
+ * <h2>The 4 steps</h2>
131
+ * <p>When an asynchronous task is executed, the task goes through 4 steps:</p>
132
+ * <ol>
133
+ * <li>{@link #onPreExecute()}, invoked on the UI thread immediately after the task
134
+ * is executed. This step is normally used to setup the task, for instance by
135
+ * showing a progress bar in the user interface.</li>
136
+ * <li>{@link #doInBackground}, invoked on the background thread
137
+ * immediately after {@link #onPreExecute()} finishes executing. This step is used
138
+ * to perform background computation that can take a long time. The parameters
139
+ * of the asynchronous task are passed to this step. The result of the computation must
140
+ * be returned by this step and will be passed back to the last step. This step
141
+ * can also use {@link #publishProgress} to publish one or more units
142
+ * of progress. These values are published on the UI thread, in the
143
+ * {@link #onProgressUpdate} step.</li>
144
+ * <li>{@link #onProgressUpdate}, invoked on the UI thread after a
145
+ * call to {@link #publishProgress}. The timing of the execution is
146
+ * undefined. This method is used to display any form of progress in the user
147
+ * interface while the background computation is still executing. For instance,
148
+ * it can be used to animate a progress bar or show logs in a text field.</li>
149
+ * <li>{@link #onPostExecute}, invoked on the UI thread after the background
150
+ * computation finishes. The result of the background computation is passed to
151
+ * this step as a parameter.</li>
152
+ * </ol>
153
+ *
154
+ * <h2>Cancelling a task</h2>
155
+ * <p>A task can be cancelled at any time by invoking {@link #cancel(boolean)}. Invoking
156
+ * this method will cause subsequent calls to {@link #isCancelled()} to return true.
157
+ * After invoking this method, {@link #onCancelled(Object)}, instead of
158
+ * {@link #onPostExecute(Object)} will be invoked after {@link #doInBackground(Object[])}
159
+ * returns. To ensure that a task is cancelled as quickly as possible, you should always
160
+ * check the return value of {@link #isCancelled()} periodically from
161
+ * {@link #doInBackground(Object[])}, if possible (inside a loop for instance.)</p>
162
+ *
163
+ * <h2>Threading rules</h2>
164
+ * <p>There are a few threading rules that must be followed for this class to
165
+ * work properly:</p>
166
+ * <ul>
167
+ * <li>The AsyncTask class must be loaded on the UI thread. This is done
168
+ * automatically as of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}.</li>
169
+ * <li>The task instance must be created on the UI thread.</li>
170
+ * <li>{@link #execute} must be invoked on the UI thread.</li>
171
+ * <li>Do not call {@link #onPreExecute()}, {@link #onPostExecute},
172
+ * {@link #doInBackground}, {@link #onProgressUpdate} manually.</li>
173
+ * <li>The task can be executed only once (an exception will be thrown if
174
+ * a second execution is attempted.)</li>
175
+ * </ul>
176
+ *
177
+ * <h2>Memory observability</h2>
178
+ * <p>AsyncTask guarantees that all callback calls are synchronized in such a way that the following
179
+ * operations are safe without explicit synchronizations.</p>
180
+ * <ul>
181
+ * <li>Set member fields in the constructor or {@link #onPreExecute}, and refer to them
182
+ * in {@link #doInBackground}.
183
+ * <li>Set member fields in {@link #doInBackground}, and refer to them in
184
+ * {@link #onProgressUpdate} and {@link #onPostExecute}.
185
+ * </ul>
186
+ *
187
+ * <h2>Order of execution</h2>
188
+ * <p>When first introduced, AsyncTasks were executed serially on a single background
189
+ * thread. Starting with {@link android.os.Build.VERSION_CODES#DONUT}, this was changed
190
+ * to a pool of threads allowing multiple tasks to operate in parallel. Starting with
191
+ * {@link android.os.Build.VERSION_CODES#HONEYCOMB}, tasks are executed on a single
192
+ * thread to avoid common application errors caused by parallel execution.</p>
193
+ * <p>If you truly want parallel execution, you can invoke
194
+ * {@link #executeOnExecutor(Executor, Object[])} with
195
+ * {@link #THREAD_POOL_EXECUTOR}.</p>
196
+ */
197
+ public abstract class AsyncTask<Params, Progress, Result> {
198
+ private static final String LOG_TAG = "AsyncTask";
199
+
200
+ private static final int CORE_POOL_SIZE = 5;
201
+ private static final int MAXIMUM_POOL_SIZE = 128;
202
+ private static final int KEEP_ALIVE = 1;
203
+
204
+ private static final ThreadFactory sThreadFactory = new ThreadFactory() {
205
+ private final AtomicInteger mCount = new AtomicInteger(1);
206
+
207
+ public Thread newThread(Runnable r) {
208
+ return new Thread(r, "AsyncTask #" + mCount.getAndIncrement());
209
+ }
210
+ };
211
+
212
+ private static final BlockingQueue<Runnable> sPoolWorkQueue =
213
+ new LinkedBlockingQueue<Runnable>(10);
214
+
215
+ /**
216
+ * An {@link Executor} that can be used to execute tasks in parallel.
217
+ */
218
+ public static final Executor THREAD_POOL_EXECUTOR
219
+ = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE,
220
+ TimeUnit.SECONDS, sPoolWorkQueue, sThreadFactory,
221
+ new ThreadPoolExecutor.DiscardOldestPolicy());
222
+
223
+ /**
224
+ * An {@link Executor} that executes tasks one at a time in serial
225
+ * order. This serialization is global to a particular process.
226
+ */
227
+ public static final Executor SERIAL_EXECUTOR = Utils.hasHoneycomb() ? new SerialExecutor() :
228
+ Executors.newSingleThreadExecutor(sThreadFactory);
229
+
230
+ public static final Executor DUAL_THREAD_EXECUTOR =
231
+ Executors.newFixedThreadPool(2, sThreadFactory);
232
+
233
+ private static final int MESSAGE_POST_RESULT = 0x1;
234
+ private static final int MESSAGE_POST_PROGRESS = 0x2;
235
+
236
+ private static final InternalHandler sHandler = new InternalHandler();
237
+
238
+ private static volatile Executor sDefaultExecutor = SERIAL_EXECUTOR;
239
+ private final WorkerRunnable<Params, Result> mWorker;
240
+ private final FutureTask<Result> mFuture;
241
+
242
+ private volatile Status mStatus = Status.PENDING;
243
+
244
+ private final AtomicBoolean mCancelled = new AtomicBoolean();
245
+ private final AtomicBoolean mTaskInvoked = new AtomicBoolean();
246
+
247
+ @TargetApi(11)
248
+ private static class SerialExecutor implements Executor {
249
+ final ArrayDeque<Runnable> mTasks = new ArrayDeque<Runnable>();
250
+ Runnable mActive;
251
+
252
+ public synchronized void execute(final Runnable r) {
253
+ mTasks.offer(new Runnable() {
254
+ public void run() {
255
+ try {
256
+ r.run();
257
+ } finally {
258
+ scheduleNext();
259
+ }
260
+ }
261
+ });
262
+ if (mActive == null) {
263
+ scheduleNext();
264
+ }
265
+ }
266
+
267
+ protected synchronized void scheduleNext() {
268
+ if ((mActive = mTasks.poll()) != null) {
269
+ THREAD_POOL_EXECUTOR.execute(mActive);
270
+ }
271
+ }
272
+ }
273
+
274
+ /**
275
+ * Indicates the current status of the task. Each status will be set only once
276
+ * during the lifetime of a task.
277
+ */
278
+ public enum Status {
279
+ /**
280
+ * Indicates that the task has not been executed yet.
281
+ */
282
+ PENDING,
283
+ /**
284
+ * Indicates that the task is running.
285
+ */
286
+ RUNNING,
287
+ /**
288
+ * Indicates that {@link AsyncTask#onPostExecute} has finished.
289
+ */
290
+ FINISHED,
291
+ }
292
+
293
+ /**
294
+ * @hide Used to force static handler to be created.
295
+ */
296
+ public static void init() {
297
+ sHandler.getLooper();
298
+ }
299
+
300
+ /**
301
+ * @hide
302
+ */
303
+ public static void setDefaultExecutor(Executor exec) {
304
+ sDefaultExecutor = exec;
305
+ }
306
+
307
+ /**
308
+ * Creates a new asynchronous task. This constructor must be invoked on the UI thread.
309
+ */
310
+ public AsyncTask() {
311
+ mWorker = new WorkerRunnable<Params, Result>() {
312
+ public Result call() throws Exception {
313
+ mTaskInvoked.set(true);
314
+
315
+ Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
316
+ //noinspection unchecked
317
+ return postResult(doInBackground(mParams));
318
+ }
319
+ };
320
+
321
+ mFuture = new FutureTask<Result>(mWorker) {
322
+ @Override
323
+ protected void done() {
324
+ try {
325
+ postResultIfNotInvoked(get());
326
+ } catch (InterruptedException e) {
327
+ android.util.Log.w(LOG_TAG, e);
328
+ } catch (ExecutionException e) {
329
+ throw new RuntimeException("An error occured while executing doInBackground()",
330
+ e.getCause());
331
+ } catch (CancellationException e) {
332
+ postResultIfNotInvoked(null);
333
+ }
334
+ }
335
+ };
336
+ }
337
+
338
+ private void postResultIfNotInvoked(Result result) {
339
+ final boolean wasTaskInvoked = mTaskInvoked.get();
340
+ if (!wasTaskInvoked) {
341
+ postResult(result);
342
+ }
343
+ }
344
+
345
+ private Result postResult(Result result) {
346
+ @SuppressWarnings("unchecked")
347
+ Message message = sHandler.obtainMessage(MESSAGE_POST_RESULT,
348
+ new AsyncTaskResult<Result>(this, result));
349
+ message.sendToTarget();
350
+ return result;
351
+ }
352
+
353
+ /**
354
+ * Returns the current status of this task.
355
+ *
356
+ * @return The current status.
357
+ */
358
+ public final Status getStatus() {
359
+ return mStatus;
360
+ }
361
+
362
+ /**
363
+ * Override this method to perform a computation on a background thread. The
364
+ * specified parameters are the parameters passed to {@link #execute}
365
+ * by the caller of this task.
366
+ * <p>
367
+ * This method can call {@link #publishProgress} to publish updates
368
+ * on the UI thread.
369
+ *
370
+ * @param params The parameters of the task.
371
+ * @return A result, defined by the subclass of this task.
372
+ * @see #onPreExecute()
373
+ * @see #onPostExecute
374
+ * @see #publishProgress
375
+ */
376
+ protected abstract Result doInBackground(Params... params);
377
+
378
+ /**
379
+ * Runs on the UI thread before {@link #doInBackground}.
380
+ *
381
+ * @see #onPostExecute
382
+ * @see #doInBackground
383
+ */
384
+ protected void onPreExecute() {
385
+ }
386
+
387
+ /**
388
+ * <p>Runs on the UI thread after {@link #doInBackground}. The
389
+ * specified result is the value returned by {@link #doInBackground}.</p>
390
+ *
391
+ * <p>This method won't be invoked if the task was cancelled.</p>
392
+ *
393
+ * @param result The result of the operation computed by {@link #doInBackground}.
394
+ * @see #onPreExecute
395
+ * @see #doInBackground
396
+ * @see #onCancelled(Object)
397
+ */
398
+ @SuppressWarnings({"UnusedDeclaration"})
399
+ protected void onPostExecute(Result result) {
400
+ }
401
+
402
+ /**
403
+ * Runs on the UI thread after {@link #publishProgress} is invoked.
404
+ * The specified values are the values passed to {@link #publishProgress}.
405
+ *
406
+ * @param values The values indicating progress.
407
+ * @see #publishProgress
408
+ * @see #doInBackground
409
+ */
410
+ @SuppressWarnings({"UnusedDeclaration"})
411
+ protected void onProgressUpdate(Progress... values) {
412
+ }
413
+
414
+ /**
415
+ * <p>Runs on the UI thread after {@link #cancel(boolean)} is invoked and
416
+ * {@link #doInBackground(Object[])} has finished.</p>
417
+ *
418
+ * <p>The default implementation simply invokes {@link #onCancelled()} and
419
+ * ignores the result. If you write your own implementation, do not call
420
+ * <code>super.onCancelled(result)</code>.</p>
421
+ *
422
+ * @param result The result, if any, computed in
423
+ * {@link #doInBackground(Object[])}, can be null
424
+ * @see #cancel(boolean)
425
+ * @see #isCancelled()
426
+ */
427
+ @SuppressWarnings({"UnusedParameters"})
428
+ protected void onCancelled(Result result) {
429
+ onCancelled();
430
+ }
431
+
432
+ /**
433
+ * <p>Applications should preferably override {@link #onCancelled(Object)}.
434
+ * This method is invoked by the default implementation of
435
+ * {@link #onCancelled(Object)}.</p>
436
+ *
437
+ * <p>Runs on the UI thread after {@link #cancel(boolean)} is invoked and
438
+ * {@link #doInBackground(Object[])} has finished.</p>
439
+ *
440
+ * @see #onCancelled(Object)
441
+ * @see #cancel(boolean)
442
+ * @see #isCancelled()
443
+ */
444
+ protected void onCancelled() {
445
+ }
446
+
447
+ /**
448
+ * Returns <tt>true</tt> if this task was cancelled before it completed
449
+ * normally. If you are calling {@link #cancel(boolean)} on the task,
450
+ * the value returned by this method should be checked periodically from
451
+ * {@link #doInBackground(Object[])} to end the task as soon as possible.
452
+ *
453
+ * @return <tt>true</tt> if task was cancelled before it completed
454
+ * @see #cancel(boolean)
455
+ */
456
+ public final boolean isCancelled() {
457
+ return mCancelled.get();
458
+ }
459
+
460
+ /**
461
+ * <p>Attempts to cancel execution of this task. This attempt will
462
+ * fail if the task has already completed, already been cancelled,
463
+ * or could not be cancelled for some other reason. If successful,
464
+ * and this task has not started when <tt>cancel</tt> is called,
465
+ * this task should never run. If the task has already started,
466
+ * then the <tt>mayInterruptIfRunning</tt> parameter determines
467
+ * whether the thread executing this task should be interrupted in
468
+ * an attempt to stop the task.</p>
469
+ *
470
+ * <p>Calling this method will result in {@link #onCancelled(Object)} being
471
+ * invoked on the UI thread after {@link #doInBackground(Object[])}
472
+ * returns. Calling this method guarantees that {@link #onPostExecute(Object)}
473
+ * is never invoked. After invoking this method, you should check the
474
+ * value returned by {@link #isCancelled()} periodically from
475
+ * {@link #doInBackground(Object[])} to finish the task as early as
476
+ * possible.</p>
477
+ *
478
+ * @param mayInterruptIfRunning <tt>true</tt> if the thread executing this
479
+ * task should be interrupted; otherwise, in-progress tasks are allowed
480
+ * to complete.
481
+ * @return <tt>false</tt> if the task could not be cancelled,
482
+ * typically because it has already completed normally;
483
+ * <tt>true</tt> otherwise
484
+ * @see #isCancelled()
485
+ * @see #onCancelled(Object)
486
+ */
487
+ public final boolean cancel(boolean mayInterruptIfRunning) {
488
+ mCancelled.set(true);
489
+ return mFuture.cancel(mayInterruptIfRunning);
490
+ }
491
+
492
+ /**
493
+ * Waits if necessary for the computation to complete, and then
494
+ * retrieves its result.
495
+ *
496
+ * @return The computed result.
497
+ * @throws CancellationException If the computation was cancelled.
498
+ * @throws ExecutionException If the computation threw an exception.
499
+ * @throws InterruptedException If the current thread was interrupted
500
+ * while waiting.
501
+ */
502
+ public final Result get() throws InterruptedException, ExecutionException {
503
+ return mFuture.get();
504
+ }
505
+
506
+ /**
507
+ * Waits if necessary for at most the given time for the computation
508
+ * to complete, and then retrieves its result.
509
+ *
510
+ * @param timeout Time to wait before cancelling the operation.
511
+ * @param unit The time unit for the timeout.
512
+ * @return The computed result.
513
+ * @throws CancellationException If the computation was cancelled.
514
+ * @throws ExecutionException If the computation threw an exception.
515
+ * @throws InterruptedException If the current thread was interrupted
516
+ * while waiting.
517
+ * @throws TimeoutException If the wait timed out.
518
+ */
519
+ public final Result get(long timeout, TimeUnit unit) throws InterruptedException,
520
+ ExecutionException, TimeoutException {
521
+ return mFuture.get(timeout, unit);
522
+ }
523
+
524
+ /**
525
+ * Executes the task with the specified parameters. The task returns
526
+ * itself (this) so that the caller can keep a reference to it.
527
+ *
528
+ * <p>Note: this function schedules the task on a queue for a single background
529
+ * thread or pool of threads depending on the platform version. When first
530
+ * introduced, AsyncTasks were executed serially on a single background thread.
531
+ * Starting with {@link android.os.Build.VERSION_CODES#DONUT}, this was changed
532
+ * to a pool of threads allowing multiple tasks to operate in parallel. Starting
533
+ * {@link android.os.Build.VERSION_CODES#HONEYCOMB}, tasks are back to being
534
+ * executed on a single thread to avoid common application errors caused
535
+ * by parallel execution. If you truly want parallel execution, you can use
536
+ * the {@link #executeOnExecutor} version of this method
537
+ * with {@link #THREAD_POOL_EXECUTOR}; however, see commentary there for warnings
538
+ * on its use.
539
+ *
540
+ * <p>This method must be invoked on the UI thread.
541
+ *
542
+ * @param params The parameters of the task.
543
+ * @return This instance of AsyncTask.
544
+ * @throws IllegalStateException If {@link #getStatus()} returns either
545
+ * {@link AsyncTask.Status#RUNNING} or {@link AsyncTask.Status#FINISHED}.
546
+ * @see #executeOnExecutor(Executor, Object[])
547
+ * @see #execute(Runnable)
548
+ */
549
+ public final AsyncTask<Params, Progress, Result> execute(Params... params) {
550
+ return executeOnExecutor(sDefaultExecutor, params);
551
+ }
552
+
553
+ /**
554
+ * Executes the task with the specified parameters. The task returns
555
+ * itself (this) so that the caller can keep a reference to it.
556
+ *
557
+ * <p>This method is typically used with {@link #THREAD_POOL_EXECUTOR} to
558
+ * allow multiple tasks to run in parallel on a pool of threads managed by
559
+ * AsyncTask, however you can also use your own {@link Executor} for custom
560
+ * behavior.
561
+ *
562
+ * <p><em>Warning:</em> Allowing multiple tasks to run in parallel from
563
+ * a thread pool is generally <em>not</em> what one wants, because the order
564
+ * of their operation is not defined. For example, if these tasks are used
565
+ * to modify any state in common (such as writing a file due to a button click),
566
+ * there are no guarantees on the order of the modifications.
567
+ * Without careful work it is possible in rare cases for the newer version
568
+ * of the data to be over-written by an older one, leading to obscure data
569
+ * loss and stability issues. Such changes are best
570
+ * executed in serial; to guarantee such work is serialized regardless of
571
+ * platform version you can use this function with {@link #SERIAL_EXECUTOR}.
572
+ *
573
+ * <p>This method must be invoked on the UI thread.
574
+ *
575
+ * @param exec The executor to use. {@link #THREAD_POOL_EXECUTOR} is available as a
576
+ * convenient process-wide thread pool for tasks that are loosely coupled.
577
+ * @param params The parameters of the task.
578
+ * @return This instance of AsyncTask.
579
+ * @throws IllegalStateException If {@link #getStatus()} returns either
580
+ * {@link AsyncTask.Status#RUNNING} or {@link AsyncTask.Status#FINISHED}.
581
+ * @see #execute(Object[])
582
+ */
583
+ public final AsyncTask<Params, Progress, Result> executeOnExecutor(Executor exec,
584
+ Params... params) {
585
+ if (mStatus != Status.PENDING) {
586
+ switch (mStatus) {
587
+ case RUNNING:
588
+ throw new IllegalStateException("Cannot execute task:"
589
+ + " the task is already running.");
590
+ case FINISHED:
591
+ throw new IllegalStateException("Cannot execute task:"
592
+ + " the task has already been executed "
593
+ + "(a task can be executed only once)");
594
+ }
595
+ }
596
+
597
+ mStatus = Status.RUNNING;
598
+
599
+ onPreExecute();
600
+
601
+ mWorker.mParams = params;
602
+ exec.execute(mFuture);
603
+
604
+ return this;
605
+ }
606
+
607
+ /**
608
+ * Convenience version of {@link #execute(Object...)} for use with
609
+ * a simple Runnable object. See {@link #execute(Object[])} for more
610
+ * information on the order of execution.
611
+ *
612
+ * @see #execute(Object[])
613
+ * @see #executeOnExecutor(Executor, Object[])
614
+ */
615
+ public static void execute(Runnable runnable) {
616
+ sDefaultExecutor.execute(runnable);
617
+ }
618
+
619
+ /**
620
+ * This method can be invoked from {@link #doInBackground} to
621
+ * publish updates on the UI thread while the background computation is
622
+ * still running. Each call to this method will trigger the execution of
623
+ * {@link #onProgressUpdate} on the UI thread.
624
+ * <p>
625
+ * {@link #onProgressUpdate} will note be called if the task has been
626
+ * canceled.
627
+ *
628
+ * @param values The progress values to update the UI with.
629
+ * @see #onProgressUpdate
630
+ * @see #doInBackground
631
+ */
632
+ protected final void publishProgress(Progress... values) {
633
+ if (!isCancelled()) {
634
+ sHandler.obtainMessage(MESSAGE_POST_PROGRESS,
635
+ new AsyncTaskResult<Progress>(this, values)).sendToTarget();
636
+ }
637
+ }
638
+
639
+ private void finish(Result result) {
640
+ if (isCancelled()) {
641
+ onCancelled(result);
642
+ } else {
643
+ onPostExecute(result);
644
+ }
645
+ mStatus = Status.FINISHED;
646
+ }
647
+
648
+ private static class InternalHandler extends Handler {
649
+ @SuppressWarnings({"unchecked", "RawUseOfParameterizedType"})
650
+ @Override
651
+ public void handleMessage(Message msg) {
652
+ AsyncTaskResult result = (AsyncTaskResult) msg.obj;
653
+ switch (msg.what) {
654
+ case MESSAGE_POST_RESULT:
655
+ // There is only one result
656
+ result.mTask.finish(result.mData[0]);
657
+ break;
658
+ case MESSAGE_POST_PROGRESS:
659
+ result.mTask.onProgressUpdate(result.mData);
660
+ break;
661
+ }
662
+ }
663
+ }
664
+
665
+ private static abstract class WorkerRunnable<Params, Result> implements Callable<Result> {
666
+ Params[] mParams;
667
+ }
668
+
669
+ @SuppressWarnings({"RawUseOfParameterizedType"})
670
+ private static class AsyncTaskResult<Data> {
671
+ final AsyncTask mTask;
672
+ final Data[] mData;
673
+
674
+ AsyncTaskResult(AsyncTask task, Data... data) {
675
+ mTask = task;
676
+ mData = data;
677
+ }
678
+ }
679
+ }
@@ -0,0 +1,17 @@
1
+ package org.nativescript.widgets.image;
2
+
3
+ import android.graphics.Bitmap;
4
+ import android.graphics.drawable.Drawable;
5
+
6
+ /**
7
+ * Created by hhristov on 4/18/17.
8
+ */
9
+
10
+ public interface BitmapOwner {
11
+ void setBitmap(Bitmap value);
12
+
13
+ void setDrawable(Drawable asyncDrawable);
14
+
15
+ Drawable getDrawable();
16
+
17
+ }