@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.
- package/package.json +1 -1
- package/platforms/android/include.gradle +51 -0
- package/platforms/android/java/org/nativescript/Process.java +59 -0
- package/platforms/android/java/org/nativescript/widgets/AbsoluteLayout.java +88 -0
- package/platforms/android/java/org/nativescript/widgets/AnimatorHelper.java +61 -0
- package/platforms/android/java/org/nativescript/widgets/Async.java +1356 -0
- package/platforms/android/java/org/nativescript/widgets/BorderDrawable.java +936 -0
- package/platforms/android/java/org/nativescript/widgets/BottomNavigationBar.java +308 -0
- package/platforms/android/java/org/nativescript/widgets/BoxShadowDrawable.java +175 -0
- package/platforms/android/java/org/nativescript/widgets/CSSValue.java +34 -0
- package/platforms/android/java/org/nativescript/widgets/CommonLayoutParams.java +456 -0
- package/platforms/android/java/org/nativescript/widgets/ContentLayout.java +85 -0
- package/platforms/android/java/org/nativescript/widgets/CustomTransition.java +135 -0
- package/platforms/android/java/org/nativescript/widgets/CustomTypefaceSpan.java +44 -0
- package/platforms/android/java/org/nativescript/widgets/Dock.java +15 -0
- package/platforms/android/java/org/nativescript/widgets/DockLayout.java +185 -0
- package/platforms/android/java/org/nativescript/widgets/FileHelper.java +815 -0
- package/platforms/android/java/org/nativescript/widgets/FlexLine.java +177 -0
- package/platforms/android/java/org/nativescript/widgets/FlexboxLayout.java +2769 -0
- package/platforms/android/java/org/nativescript/widgets/FragmentBase.java +14 -0
- package/platforms/android/java/org/nativescript/widgets/GridLayout.java +1172 -0
- package/platforms/android/java/org/nativescript/widgets/GridUnitType.java +10 -0
- package/platforms/android/java/org/nativescript/widgets/HorizontalScrollView.java +256 -0
- package/platforms/android/java/org/nativescript/widgets/ImageView.java +423 -0
- package/platforms/android/java/org/nativescript/widgets/ItemSpec.java +56 -0
- package/platforms/android/java/org/nativescript/widgets/LayoutBase.java +98 -0
- package/platforms/android/java/org/nativescript/widgets/LinearGradientDefinition.java +46 -0
- package/platforms/android/java/org/nativescript/widgets/Orientation.java +9 -0
- package/platforms/android/java/org/nativescript/widgets/OriginPoint.java +74 -0
- package/platforms/android/java/org/nativescript/widgets/ScrollSavedState.java +63 -0
- package/platforms/android/java/org/nativescript/widgets/SegmentedBarColorDrawable.java +27 -0
- package/platforms/android/java/org/nativescript/widgets/StackLayout.java +231 -0
- package/platforms/android/java/org/nativescript/widgets/StyleableTextView.java +50 -0
- package/platforms/android/java/org/nativescript/widgets/TabIconRenderingMode.java +6 -0
- package/platforms/android/java/org/nativescript/widgets/TabItemSpec.java +15 -0
- package/platforms/android/java/org/nativescript/widgets/TabLayout.java +451 -0
- package/platforms/android/java/org/nativescript/widgets/TabStrip.java +294 -0
- package/platforms/android/java/org/nativescript/widgets/TabViewPager.java +64 -0
- package/platforms/android/java/org/nativescript/widgets/TabsBar.java +443 -0
- package/platforms/android/java/org/nativescript/widgets/Utils.java +546 -0
- package/platforms/android/java/org/nativescript/widgets/VerticalScrollView.java +258 -0
- package/platforms/android/java/org/nativescript/widgets/ViewHelper.java +564 -0
- package/platforms/android/java/org/nativescript/widgets/WrapLayout.java +252 -0
- package/platforms/android/java/org/nativescript/widgets/image/AsyncTask.java +679 -0
- package/platforms/android/java/org/nativescript/widgets/image/BitmapOwner.java +17 -0
- package/platforms/android/java/org/nativescript/widgets/image/Cache.java +471 -0
- package/platforms/android/java/org/nativescript/widgets/image/DiskLruCache.java +970 -0
- package/platforms/android/java/org/nativescript/widgets/image/Fetcher.java +747 -0
- package/platforms/android/java/org/nativescript/widgets/image/Utils.java +58 -0
- package/platforms/android/java/org/nativescript/widgets/image/Worker.java +571 -0
- package/platforms/ios/src/TNSWidgets/Info.plist +26 -0
- package/platforms/ios/src/TNSWidgets/NSData+Async.m +42 -0
- package/platforms/ios/src/TNSWidgets/NSFileHandle+Async.m +82 -0
- package/platforms/ios/src/TNSWidgets/NSObject+Swizzling.m +68 -0
- package/platforms/ios/src/TNSWidgets/NSString+Async.m +51 -0
- package/platforms/ios/src/TNSWidgets/TNSLabel.m +42 -0
- package/platforms/ios/src/TNSWidgets/UIImage+TNSBlocks.m +77 -0
- package/platforms/ios/src/TNSWidgets/UIView+PassThroughParent.m +53 -0
- package/platforms/ios/src/TNSWidgets/UIView+PropertyBag.m +72 -0
- package/platforms/ios/src/module.modulemap +5 -0
- package/platforms/android/widgets-release.aar +0 -0
- package/platforms/ios/TNSWidgets.xcframework/Info.plist +0 -102
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Modules/module.modulemap +0 -6
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Modules/module.modulemap +0 -6
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Resources/Info.plist +0 -52
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSCCrypto.h +0 -60
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSData+Async.h +0 -24
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSFileHandle+Async.h +0 -22
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSString+Async.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSLabel.h +0 -16
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSProcess.h +0 -29
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSWidgets.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIImage+TNSBlocks.h +0 -26
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIView+PassThroughParent.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Modules/module.modulemap +0 -6
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/NSObject+Swizzling.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/UIView+PropertyBag.h +0 -18
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Resources/Info.plist +0 -52
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSCCrypto.h +0 -60
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSData+Async.h +0 -24
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSFileHandle+Async.h +0 -22
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSString+Async.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSLabel.h +0 -16
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSProcess.h +0 -29
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSWidgets.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/UIImage+TNSBlocks.h +0 -26
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/UIView+PassThroughParent.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Modules/module.modulemap +0 -6
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/PrivateHeaders/NSObject+Swizzling.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/PrivateHeaders/UIView+PropertyBag.h +0 -18
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Resources/Info.plist +0 -52
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +0 -82
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Modules/module.modulemap +0 -6
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +0 -223
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +0 -82
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Modules/module.modulemap +0 -6
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSCCrypto.h +0 -60
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSData+Async.h +0 -24
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSFileHandle+Async.h +0 -22
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSString+Async.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSLabel.h +0 -16
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSProcess.h +0 -29
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSWidgets.h +0 -25
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +0 -26
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Modules/module.modulemap +0 -6
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +0 -17
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +0 -18
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +0 -223
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +0 -20
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +0 -82
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +0 -82
- /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/NSData+Async.h +0 -0
- /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/NSFileHandle+Async.h +0 -0
- /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/PrivateHeaders → src/TNSWidgets}/NSObject+Swizzling.h +0 -0
- /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/NSString+Async.h +0 -0
- /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/TNSLabel.h +0 -0
- /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/TNSWidgets.h +0 -0
- /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/UIImage+TNSBlocks.h +0 -0
- /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers → src/TNSWidgets}/UIView+PassThroughParent.h +0 -0
- /package/platforms/ios/{TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/PrivateHeaders → src/TNSWidgets}/UIView+PropertyBag.h +0 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
package org.nativescript.widgets;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.graphics.Rect;
|
|
5
|
+
import android.os.Parcelable;
|
|
6
|
+
import android.util.AttributeSet;
|
|
7
|
+
import android.view.MotionEvent;
|
|
8
|
+
import android.view.View;
|
|
9
|
+
import android.view.ViewGroup;
|
|
10
|
+
import android.widget.FrameLayout;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @author hhristov
|
|
14
|
+
*/
|
|
15
|
+
public class HorizontalScrollView extends android.widget.HorizontalScrollView {
|
|
16
|
+
|
|
17
|
+
private final Rect mTempRect = new Rect();
|
|
18
|
+
|
|
19
|
+
private int contentMeasuredWidth = 0;
|
|
20
|
+
private int contentMeasuredHeight = 0;
|
|
21
|
+
private int scrollableLength = 0;
|
|
22
|
+
private ScrollSavedState mSavedState;
|
|
23
|
+
private boolean isFirstLayout = true;
|
|
24
|
+
private boolean scrollEnabled = true;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* True when the layout has changed but the traversal has not come through yet.
|
|
28
|
+
* Ideally the view hierarchy would keep track of this for us.
|
|
29
|
+
*/
|
|
30
|
+
private boolean mIsLayoutDirty = true;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The child to give focus to in the event that a child has requested focus while the
|
|
34
|
+
* layout is dirty. This prevents the scroll from being wrong if the child has not been
|
|
35
|
+
* laid out before requesting focus.
|
|
36
|
+
*/
|
|
37
|
+
private View mChildToScrollTo = null;
|
|
38
|
+
|
|
39
|
+
public HorizontalScrollView(Context context) {
|
|
40
|
+
super(context);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public int getScrollableLength() {
|
|
44
|
+
return this.scrollableLength;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public boolean getScrollEnabled() {
|
|
48
|
+
return this.scrollEnabled;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public void setScrollEnabled(boolean value) {
|
|
52
|
+
this.scrollEnabled = value;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@Override
|
|
56
|
+
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
|
57
|
+
// Do nothing with intercepted touch events if we are not scrollable
|
|
58
|
+
if (!this.scrollEnabled) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return super.onInterceptTouchEvent(ev);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@Override
|
|
66
|
+
public boolean onTouchEvent(MotionEvent ev) {
|
|
67
|
+
if (!this.scrollEnabled && (ev.getAction() == MotionEvent.ACTION_DOWN || ev.getAction() == MotionEvent.ACTION_MOVE)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return super.onTouchEvent(ev);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@Override
|
|
75
|
+
public void requestLayout() {
|
|
76
|
+
this.mIsLayoutDirty = true;
|
|
77
|
+
super.requestLayout();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@Override
|
|
81
|
+
protected CommonLayoutParams generateDefaultLayoutParams() {
|
|
82
|
+
return new CommonLayoutParams();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* {@inheritDoc}
|
|
87
|
+
*/
|
|
88
|
+
@Override
|
|
89
|
+
public CommonLayoutParams generateLayoutParams(AttributeSet attrs) {
|
|
90
|
+
return new CommonLayoutParams();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* {@inheritDoc}
|
|
95
|
+
*/
|
|
96
|
+
@Override
|
|
97
|
+
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
|
|
98
|
+
return p instanceof CommonLayoutParams;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Override
|
|
102
|
+
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams from) {
|
|
103
|
+
if (from instanceof CommonLayoutParams)
|
|
104
|
+
return new CommonLayoutParams((CommonLayoutParams) from);
|
|
105
|
+
|
|
106
|
+
if (from instanceof FrameLayout.LayoutParams)
|
|
107
|
+
return new CommonLayoutParams((FrameLayout.LayoutParams) from);
|
|
108
|
+
|
|
109
|
+
if (from instanceof ViewGroup.MarginLayoutParams)
|
|
110
|
+
return new CommonLayoutParams((ViewGroup.MarginLayoutParams) from);
|
|
111
|
+
|
|
112
|
+
return new CommonLayoutParams(from);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@Override
|
|
116
|
+
public void requestChildFocus(View child, View focused) {
|
|
117
|
+
if (!mIsLayoutDirty) {
|
|
118
|
+
this.scrollToChild(focused);
|
|
119
|
+
} else {
|
|
120
|
+
// The child may not be laid out yet, we can't compute the scroll yet
|
|
121
|
+
mChildToScrollTo = focused;
|
|
122
|
+
}
|
|
123
|
+
super.requestChildFocus(child, focused);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@Override
|
|
127
|
+
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
128
|
+
CommonLayoutParams.adjustChildrenLayoutParams(this, widthMeasureSpec, heightMeasureSpec);
|
|
129
|
+
|
|
130
|
+
// Don't call measure because it will measure content twice.
|
|
131
|
+
// ScrollView is expected to have single child so we measure only the first child.
|
|
132
|
+
View child = this.getChildCount() > 0 ? this.getChildAt(0) : null;
|
|
133
|
+
if (child == null) {
|
|
134
|
+
this.scrollableLength = 0;
|
|
135
|
+
this.contentMeasuredWidth = 0;
|
|
136
|
+
this.contentMeasuredHeight = 0;
|
|
137
|
+
} else {
|
|
138
|
+
CommonLayoutParams.measureChild(child, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), heightMeasureSpec);
|
|
139
|
+
this.contentMeasuredWidth = CommonLayoutParams.getDesiredWidth(child);
|
|
140
|
+
this.contentMeasuredHeight = CommonLayoutParams.getDesiredHeight(child);
|
|
141
|
+
|
|
142
|
+
// Android ScrollView does not account to child margins so we set them as paddings. Otherwise you can never scroll to bottom.
|
|
143
|
+
CommonLayoutParams lp = (CommonLayoutParams) child.getLayoutParams();
|
|
144
|
+
this.setPadding(lp.leftMargin, lp.topMargin, lp.rightMargin, lp.bottomMargin);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Don't add in our paddings because they are already added as child margins. (we will include them twice if we add them).
|
|
148
|
+
// Check the previous line - this.setPadding(lp.leftMargin, lp.topMargin, lp.rightMargin, lp.bottomMargin);
|
|
149
|
+
//this.contentMeasuredWidth += this.getPaddingLeft() + this.getPaddingRight();
|
|
150
|
+
//this.contentMeasuredHeight += this.getPaddingTop() + this.getPaddingBottom();
|
|
151
|
+
|
|
152
|
+
// Check against our minimum height
|
|
153
|
+
this.contentMeasuredWidth = Math.max(this.contentMeasuredWidth, this.getSuggestedMinimumWidth());
|
|
154
|
+
this.contentMeasuredHeight = Math.max(this.contentMeasuredHeight, this.getSuggestedMinimumHeight());
|
|
155
|
+
|
|
156
|
+
int widthSizeAndState = resolveSizeAndState(this.contentMeasuredWidth, widthMeasureSpec, 0);
|
|
157
|
+
int heightSizeAndState = resolveSizeAndState(this.contentMeasuredHeight, heightMeasureSpec, 0);
|
|
158
|
+
|
|
159
|
+
this.setMeasuredDimension(widthSizeAndState, heightSizeAndState);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@Override
|
|
163
|
+
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
164
|
+
int childWidth = 0;
|
|
165
|
+
if (this.getChildCount() > 0) {
|
|
166
|
+
View child = this.getChildAt(0);
|
|
167
|
+
childWidth = child.getMeasuredWidth();
|
|
168
|
+
|
|
169
|
+
int width = right - left;
|
|
170
|
+
int height = bottom - top;
|
|
171
|
+
|
|
172
|
+
this.scrollableLength = this.contentMeasuredWidth - width;
|
|
173
|
+
CommonLayoutParams.layoutChild(child, 0, 0, Math.max(this.contentMeasuredWidth, width), height);
|
|
174
|
+
this.scrollableLength = Math.max(0, this.scrollableLength);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
this.mIsLayoutDirty = false;
|
|
178
|
+
// Give a child focus if it needs it
|
|
179
|
+
if (this.mChildToScrollTo != null && Utils.isViewDescendantOf(this.mChildToScrollTo, this)) {
|
|
180
|
+
this.scrollToChild(this.mChildToScrollTo);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
this.mChildToScrollTo = null;
|
|
184
|
+
|
|
185
|
+
int scrollX = this.getScrollX();
|
|
186
|
+
int scrollY = this.getScrollY();
|
|
187
|
+
|
|
188
|
+
if (this.isFirstLayout) {
|
|
189
|
+
this.isFirstLayout = false;
|
|
190
|
+
|
|
191
|
+
final int scrollRange = Math.max(0, childWidth - (right - left - this.getPaddingLeft() - this.getPaddingRight()));
|
|
192
|
+
if (this.mSavedState != null) {
|
|
193
|
+
scrollX = this.isLayoutRtl() ? scrollRange - mSavedState.scrollOffsetFromStart : mSavedState.scrollOffsetFromStart;
|
|
194
|
+
mSavedState = null;
|
|
195
|
+
} else {
|
|
196
|
+
if (this.isLayoutRtl()) {
|
|
197
|
+
scrollX = scrollRange - scrollX;
|
|
198
|
+
} // mScrollX default value is "0" for LTR
|
|
199
|
+
}
|
|
200
|
+
// Don't forget to clamp
|
|
201
|
+
if (scrollX > scrollRange) {
|
|
202
|
+
scrollX = scrollRange;
|
|
203
|
+
} else if (scrollX < 0) {
|
|
204
|
+
scrollX = 0;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Calling this with the present values causes it to re-claim them
|
|
209
|
+
this.scrollTo(scrollX, scrollY);
|
|
210
|
+
CommonLayoutParams.restoreOriginalParams(this);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@Override
|
|
214
|
+
protected void onAttachedToWindow() {
|
|
215
|
+
super.onAttachedToWindow();
|
|
216
|
+
this.isFirstLayout = true;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@Override
|
|
220
|
+
protected void onDetachedFromWindow() {
|
|
221
|
+
super.onDetachedFromWindow();
|
|
222
|
+
this.isFirstLayout = true;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@Override
|
|
226
|
+
protected void onRestoreInstanceState(Parcelable state) {
|
|
227
|
+
ScrollSavedState ss = (ScrollSavedState) state;
|
|
228
|
+
super.onRestoreInstanceState(ss.getSuperState());
|
|
229
|
+
this.mSavedState = ss;
|
|
230
|
+
this.requestLayout();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@Override
|
|
234
|
+
protected Parcelable onSaveInstanceState() {
|
|
235
|
+
Parcelable superState = super.onSaveInstanceState();
|
|
236
|
+
ScrollSavedState ss = new ScrollSavedState(superState);
|
|
237
|
+
ss.scrollOffsetFromStart = isLayoutRtl() ? -this.getScrollX() : this.getScrollX();
|
|
238
|
+
return ss;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
private void scrollToChild(View child) {
|
|
242
|
+
child.getDrawingRect(mTempRect);
|
|
243
|
+
|
|
244
|
+
/* Offset from child's local coordinates to ScrollView coordinates */
|
|
245
|
+
offsetDescendantRectToMyCoords(child, mTempRect);
|
|
246
|
+
|
|
247
|
+
int scrollDelta = computeScrollDeltaToGetChildRectOnScreen(mTempRect);
|
|
248
|
+
if (scrollDelta != 0) {
|
|
249
|
+
this.scrollBy(scrollDelta, 0);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
private boolean isLayoutRtl() {
|
|
254
|
+
return (this.getLayoutDirection() == LAYOUT_DIRECTION_RTL);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
package org.nativescript.widgets;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.graphics.Bitmap;
|
|
5
|
+
import android.graphics.BitmapShader;
|
|
6
|
+
import android.graphics.Canvas;
|
|
7
|
+
import android.graphics.ColorFilter;
|
|
8
|
+
import android.graphics.Matrix;
|
|
9
|
+
import android.graphics.Paint;
|
|
10
|
+
import android.graphics.Path;
|
|
11
|
+
import android.graphics.Rect;
|
|
12
|
+
import android.graphics.RectF;
|
|
13
|
+
import android.graphics.Shader;
|
|
14
|
+
import android.graphics.drawable.BitmapDrawable;
|
|
15
|
+
import android.graphics.drawable.Drawable;
|
|
16
|
+
import android.os.Build;
|
|
17
|
+
|
|
18
|
+
import androidx.annotation.Nullable;
|
|
19
|
+
import androidx.appcompat.app.AppCompatDelegate;
|
|
20
|
+
|
|
21
|
+
import org.nativescript.widgets.image.BitmapOwner;
|
|
22
|
+
import org.nativescript.widgets.image.Fetcher;
|
|
23
|
+
import org.nativescript.widgets.image.Worker;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @author hhristov
|
|
27
|
+
*/
|
|
28
|
+
public class ImageView extends androidx.appcompat.widget.AppCompatImageView implements BitmapOwner {
|
|
29
|
+
private static final double EPSILON = 1E-05;
|
|
30
|
+
|
|
31
|
+
private final Path path = new Path();
|
|
32
|
+
private final RectF rect = new RectF();
|
|
33
|
+
private final Paint paint = new Paint();
|
|
34
|
+
|
|
35
|
+
private double scaleW = 1;
|
|
36
|
+
private double scaleH = 1;
|
|
37
|
+
|
|
38
|
+
private float rotationAngle;
|
|
39
|
+
|
|
40
|
+
private final Matrix mMatrix;
|
|
41
|
+
private Bitmap mBitmap;
|
|
42
|
+
private String mUri;
|
|
43
|
+
private int mDecodeWidth;
|
|
44
|
+
private int mDecodeHeight;
|
|
45
|
+
private boolean mKeepAspectRatio;
|
|
46
|
+
private boolean mUseCache;
|
|
47
|
+
private boolean mAsync;
|
|
48
|
+
private Worker.OnImageLoadedListener mListener;
|
|
49
|
+
private boolean mAttachedToWindow = false;
|
|
50
|
+
|
|
51
|
+
static {
|
|
52
|
+
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public float getRotationAngle() {
|
|
56
|
+
return rotationAngle;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public void setRotationAngle(float rotationAngle) {
|
|
60
|
+
this.rotationAngle = rotationAngle;
|
|
61
|
+
invalidate();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public ImageView(Context context) {
|
|
65
|
+
super(context);
|
|
66
|
+
this.mMatrix = new Matrix();
|
|
67
|
+
this.setScaleType(ScaleType.FIT_CENTER);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@Override
|
|
71
|
+
protected void onAttachedToWindow() {
|
|
72
|
+
mAttachedToWindow = true;
|
|
73
|
+
super.onAttachedToWindow();
|
|
74
|
+
this.loadImage();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@Override
|
|
78
|
+
protected void onDetachedFromWindow() {
|
|
79
|
+
mAttachedToWindow = false;
|
|
80
|
+
super.onDetachedFromWindow();
|
|
81
|
+
if (mUri != null) {
|
|
82
|
+
// Clear the bitmap as we are not in the visual tree.
|
|
83
|
+
this.setImageBitmap(null);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@Override
|
|
88
|
+
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
89
|
+
|
|
90
|
+
int width = MeasureSpec.getSize(widthMeasureSpec);
|
|
91
|
+
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
|
92
|
+
|
|
93
|
+
int height = MeasureSpec.getSize(heightMeasureSpec);
|
|
94
|
+
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
|
95
|
+
|
|
96
|
+
Drawable drawable = this.getDrawable();
|
|
97
|
+
int measureWidth;
|
|
98
|
+
int measureHeight;
|
|
99
|
+
if (drawable != null) {
|
|
100
|
+
measureWidth = drawable.getIntrinsicWidth();
|
|
101
|
+
measureHeight = drawable.getIntrinsicHeight();
|
|
102
|
+
} else {
|
|
103
|
+
measureWidth = 0;
|
|
104
|
+
measureHeight = 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
boolean finiteWidth = widthMode != MeasureSpec.UNSPECIFIED;
|
|
108
|
+
boolean finiteHeight = heightMode != MeasureSpec.UNSPECIFIED;
|
|
109
|
+
|
|
110
|
+
if (measureWidth != 0 && measureHeight != 0 && (finiteWidth || finiteHeight)) {
|
|
111
|
+
this.computeScaleFactor(width, height, finiteWidth, finiteHeight, measureWidth, measureHeight);
|
|
112
|
+
int resultW = (int) Math.round(measureWidth * this.scaleW);
|
|
113
|
+
int resultH = (int) Math.round(measureHeight * this.scaleH);
|
|
114
|
+
|
|
115
|
+
measureWidth = finiteWidth ? Math.min(resultW, width) : resultW;
|
|
116
|
+
measureHeight = finiteHeight ? Math.min(resultH, height) : resultH;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
measureWidth += this.getPaddingLeft() + this.getPaddingRight();
|
|
120
|
+
measureHeight += this.getPaddingTop() + this.getPaddingBottom();
|
|
121
|
+
|
|
122
|
+
measureWidth = Math.max(measureWidth, getSuggestedMinimumWidth());
|
|
123
|
+
measureHeight = Math.max(measureHeight, getSuggestedMinimumHeight());
|
|
124
|
+
|
|
125
|
+
if (CommonLayoutParams.debuggable > 0) {
|
|
126
|
+
StringBuilder sb = CommonLayoutParams.getStringBuilder();
|
|
127
|
+
sb.append("ImageView onMeasure: ");
|
|
128
|
+
sb.append(MeasureSpec.toString(widthMeasureSpec));
|
|
129
|
+
sb.append(", ");
|
|
130
|
+
sb.append(MeasureSpec.toString(heightMeasureSpec));
|
|
131
|
+
sb.append(", stretch: ");
|
|
132
|
+
sb.append(this.getScaleType());
|
|
133
|
+
sb.append(", measureWidth: ");
|
|
134
|
+
sb.append(measureWidth);
|
|
135
|
+
sb.append(", measureHeight: ");
|
|
136
|
+
sb.append(measureHeight);
|
|
137
|
+
|
|
138
|
+
CommonLayoutParams.log(CommonLayoutParams.TAG, sb.toString());
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
int widthSizeAndState = resolveSizeAndState(measureWidth, widthMeasureSpec, 0);
|
|
142
|
+
int heightSizeAndState = resolveSizeAndState(measureHeight, heightMeasureSpec, 0);
|
|
143
|
+
|
|
144
|
+
this.setMeasuredDimension(widthSizeAndState, heightSizeAndState);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private void computeScaleFactor(int measureWidth, int measureHeight, boolean widthIsFinite, boolean heightIsFinite, double nativeWidth, double nativeHeight) {
|
|
148
|
+
|
|
149
|
+
this.scaleW = 1;
|
|
150
|
+
this.scaleH = 1;
|
|
151
|
+
|
|
152
|
+
ScaleType scale = this.getScaleType();
|
|
153
|
+
if ((scale == ScaleType.CENTER_CROP || scale == ScaleType.FIT_CENTER || scale == ScaleType.FIT_XY) &&
|
|
154
|
+
(widthIsFinite || heightIsFinite)) {
|
|
155
|
+
|
|
156
|
+
this.scaleW = (nativeWidth > 0) ? measureWidth / nativeWidth : 0d;
|
|
157
|
+
this.scaleH = (nativeHeight > 0) ? measureHeight / nativeHeight : 0d;
|
|
158
|
+
|
|
159
|
+
if (!widthIsFinite) {
|
|
160
|
+
this.scaleW = scaleH;
|
|
161
|
+
} else if (!heightIsFinite) {
|
|
162
|
+
this.scaleH = scaleW;
|
|
163
|
+
} else {
|
|
164
|
+
// No infinite dimensions.
|
|
165
|
+
switch (scale) {
|
|
166
|
+
case FIT_CENTER:
|
|
167
|
+
this.scaleH = Math.min(this.scaleW, this.scaleH);
|
|
168
|
+
this.scaleW = this.scaleH;
|
|
169
|
+
break;
|
|
170
|
+
case CENTER_CROP:
|
|
171
|
+
this.scaleH = Math.max(this.scaleW, this.scaleH);
|
|
172
|
+
this.scaleW = this.scaleH;
|
|
173
|
+
break;
|
|
174
|
+
default:
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
public void setUri(String uri, int decodeWidth, int decodeHeight, boolean useCache, boolean async) {
|
|
182
|
+
this.setUri(uri, decodeWidth, decodeHeight, false, useCache, async);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
public void setUri(String uri, int decodeWidth, int decodeHeight, boolean keepAspectRatio, boolean useCache, boolean async) {
|
|
186
|
+
mUri = uri;
|
|
187
|
+
mDecodeWidth = decodeWidth;
|
|
188
|
+
mDecodeHeight = decodeHeight;
|
|
189
|
+
mKeepAspectRatio = keepAspectRatio;
|
|
190
|
+
mUseCache = useCache;
|
|
191
|
+
mAsync = async;
|
|
192
|
+
|
|
193
|
+
// Clear current bitmap only if we set empty URI.
|
|
194
|
+
// We support setting bitmap through ImageSource (e.g. Bitmap).
|
|
195
|
+
if (uri == null || uri.trim().equals("")) {
|
|
196
|
+
this.setImageBitmap(null);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Begin loading image only if we are attached to window.
|
|
200
|
+
if (mAttachedToWindow) {
|
|
201
|
+
loadImage();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
public void setImageLoadedListener(Worker.OnImageLoadedListener listener) {
|
|
206
|
+
mListener = listener;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private void loadImage() {
|
|
210
|
+
Fetcher fetcher = Fetcher.getInstance(this.getContext());
|
|
211
|
+
if (mUri != null && fetcher != null) {
|
|
212
|
+
// Get the Bitmap from cache.
|
|
213
|
+
fetcher.loadImage(mUri, this, mDecodeWidth, mDecodeHeight, mKeepAspectRatio, mUseCache, mAsync, mListener);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
private boolean mSettingBitmap = false;
|
|
218
|
+
|
|
219
|
+
@Override
|
|
220
|
+
public void setImageBitmap(Bitmap bm) {
|
|
221
|
+
Fetcher fetcher = Fetcher.getInstance(this.getContext());
|
|
222
|
+
// if we have existing bitmap from uri notify fetcher that this bitmap is not shown in this ImageView instance.
|
|
223
|
+
// This is needed so that fetcher inner cache could reuse the bitmap only when no other ImageView shows it.
|
|
224
|
+
if (mUseCache && mUri != null && mBitmap != null && fetcher != null) {
|
|
225
|
+
fetcher.removeBitmap(mUri);
|
|
226
|
+
}
|
|
227
|
+
mSettingBitmap = true;
|
|
228
|
+
super.setImageBitmap(bm);
|
|
229
|
+
this.mBitmap = bm;
|
|
230
|
+
if (bm != null) {
|
|
231
|
+
bitmapWidth = bm.getWidth();
|
|
232
|
+
bitmapHeight = bm.getHeight();
|
|
233
|
+
bitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
|
|
234
|
+
} else {
|
|
235
|
+
bitmapWidth = -1;
|
|
236
|
+
bitmapHeight = -1;
|
|
237
|
+
}
|
|
238
|
+
mSettingBitmap = false;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
@Override
|
|
242
|
+
public void setImageDrawable(@Nullable Drawable drawable) {
|
|
243
|
+
super.setImageDrawable(drawable);
|
|
244
|
+
setBitmapShader();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
private final Canvas canvas = new Canvas();
|
|
249
|
+
private BitmapShader bitmapShader = null;
|
|
250
|
+
private int bitmapWidth = -1;
|
|
251
|
+
private int bitmapHeight = -1;
|
|
252
|
+
|
|
253
|
+
private void setBitmapShader() {
|
|
254
|
+
if (mSettingBitmap) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
Bitmap mBitmap = null;
|
|
258
|
+
Drawable drawable = getDrawable();
|
|
259
|
+
if (drawable != null) {
|
|
260
|
+
|
|
261
|
+
if (drawable instanceof BitmapDrawable) {
|
|
262
|
+
mBitmap = ((BitmapDrawable) drawable).getBitmap();
|
|
263
|
+
} else {
|
|
264
|
+
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
|
265
|
+
canvas.setBitmap(bitmap);
|
|
266
|
+
Rect previousBounds = null;
|
|
267
|
+
|
|
268
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
269
|
+
previousBounds = drawable.getBounds();
|
|
270
|
+
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
drawable.draw(canvas);
|
|
274
|
+
|
|
275
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
276
|
+
drawable.setBounds(previousBounds);
|
|
277
|
+
}
|
|
278
|
+
mBitmap = bitmap;
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
bitmapShader = null;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (mBitmap != null) {
|
|
285
|
+
bitmapWidth = mBitmap.getWidth();
|
|
286
|
+
bitmapHeight = mBitmap.getHeight();
|
|
287
|
+
bitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
|
|
288
|
+
} else {
|
|
289
|
+
bitmapWidth = -1;
|
|
290
|
+
bitmapHeight = -1;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
@Override
|
|
297
|
+
protected void onDraw(Canvas canvas) {
|
|
298
|
+
BorderDrawable background = this.getBackground() instanceof BorderDrawable ? (BorderDrawable) this.getBackground() : null;
|
|
299
|
+
if (this.mBitmap == null && this.getDrawable() != null) {
|
|
300
|
+
super.onDraw(canvas);
|
|
301
|
+
}
|
|
302
|
+
if (this.mBitmap != null) {
|
|
303
|
+
float borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius;
|
|
304
|
+
|
|
305
|
+
if (background != null) {
|
|
306
|
+
background.draw(canvas);
|
|
307
|
+
|
|
308
|
+
borderTopLeftRadius = background.getBorderTopLeftRadius();
|
|
309
|
+
borderTopRightRadius = background.getBorderTopRightRadius();
|
|
310
|
+
borderBottomRightRadius = background.getBorderBottomRightRadius();
|
|
311
|
+
borderBottomLeftRadius = background.getBorderBottomLeftRadius();
|
|
312
|
+
} else {
|
|
313
|
+
borderTopLeftRadius = borderTopRightRadius = borderBottomRightRadius = borderBottomLeftRadius = 0;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Padding?
|
|
317
|
+
float borderTopWidth = this.getPaddingTop();
|
|
318
|
+
float borderRightWidth = this.getPaddingRight();
|
|
319
|
+
float borderBottomWidth = this.getPaddingBottom();
|
|
320
|
+
float borderLeftWidth = this.getPaddingLeft();
|
|
321
|
+
|
|
322
|
+
float innerWidth, innerHeight;
|
|
323
|
+
|
|
324
|
+
float rotationDegree = this.getRotationAngle();
|
|
325
|
+
boolean swap = Math.abs(rotationDegree % 180) > 45 && Math.abs(rotationDegree % 180) < 135;
|
|
326
|
+
|
|
327
|
+
innerWidth = this.getWidth() - borderLeftWidth - borderRightWidth;
|
|
328
|
+
innerHeight = this.getHeight() - borderTopWidth - borderBottomWidth;
|
|
329
|
+
|
|
330
|
+
// TODO: Capture all created objects here in locals and update them instead...
|
|
331
|
+
path.reset();
|
|
332
|
+
paint.reset();
|
|
333
|
+
|
|
334
|
+
float[] radii = {
|
|
335
|
+
Math.max(0, borderTopLeftRadius - borderLeftWidth), Math.max(0, borderTopLeftRadius - borderTopWidth),
|
|
336
|
+
Math.max(0, borderTopRightRadius - borderRightWidth), Math.max(0, borderTopRightRadius - borderTopWidth),
|
|
337
|
+
Math.max(0, borderBottomRightRadius - borderRightWidth), Math.max(0, borderBottomRightRadius - borderBottomWidth),
|
|
338
|
+
Math.max(0, borderBottomLeftRadius - borderLeftWidth), Math.max(0, borderBottomLeftRadius - borderBottomWidth)
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
rect.setEmpty();
|
|
342
|
+
rect.set(borderLeftWidth, borderTopWidth, borderLeftWidth + innerWidth, borderTopWidth + innerHeight);
|
|
343
|
+
|
|
344
|
+
path.addRoundRect(rect, radii, Path.Direction.CW);
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
float bitmapWidth = (float) mBitmap.getWidth();
|
|
348
|
+
float bitmapHeight = (float) mBitmap.getHeight();
|
|
349
|
+
|
|
350
|
+
Matrix matrix = this.mMatrix;
|
|
351
|
+
matrix.reset();
|
|
352
|
+
|
|
353
|
+
matrix.postRotate(rotationDegree, bitmapWidth / 2, bitmapHeight / 2);
|
|
354
|
+
if (swap) {
|
|
355
|
+
matrix.postTranslate((bitmapHeight - bitmapWidth) / 2, (bitmapWidth - bitmapHeight) / 2);
|
|
356
|
+
float temp = bitmapWidth;
|
|
357
|
+
bitmapWidth = bitmapHeight;
|
|
358
|
+
bitmapHeight = temp;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
float fittingScaleX = innerWidth / bitmapWidth;
|
|
362
|
+
float fittingScaleY = innerHeight / bitmapHeight;
|
|
363
|
+
|
|
364
|
+
float uniformScale;
|
|
365
|
+
float pivotX, pivotY;
|
|
366
|
+
switch (this.getScaleType()) {
|
|
367
|
+
case FIT_CENTER: // aspectFit
|
|
368
|
+
uniformScale = Math.min(fittingScaleX, fittingScaleY);
|
|
369
|
+
matrix.postTranslate((innerWidth - bitmapWidth) / 2, (innerHeight - bitmapHeight) / 2);
|
|
370
|
+
matrix.postScale(uniformScale, uniformScale, innerWidth / 2, innerHeight / 2);
|
|
371
|
+
canvas.clipRect(
|
|
372
|
+
borderLeftWidth + (innerWidth - bitmapWidth * uniformScale) / 2,
|
|
373
|
+
borderTopWidth + (innerHeight - bitmapHeight * uniformScale) / 2,
|
|
374
|
+
borderLeftWidth + (innerWidth + bitmapWidth * uniformScale) / 2,
|
|
375
|
+
borderTopWidth + (innerHeight + bitmapHeight * uniformScale) / 2
|
|
376
|
+
);
|
|
377
|
+
break;
|
|
378
|
+
case CENTER_CROP: // aspectFill
|
|
379
|
+
uniformScale = Math.max(fittingScaleX, fittingScaleY);
|
|
380
|
+
matrix.postTranslate((innerWidth - bitmapWidth) / 2, (innerHeight - bitmapHeight) / 2);
|
|
381
|
+
matrix.postScale(uniformScale, uniformScale, innerWidth / 2, innerHeight / 2);
|
|
382
|
+
canvas.clipRect(
|
|
383
|
+
borderLeftWidth + (innerWidth - bitmapWidth * uniformScale) / 2,
|
|
384
|
+
borderTopWidth + (innerHeight - bitmapHeight * uniformScale) / 2,
|
|
385
|
+
borderLeftWidth + (innerWidth + bitmapWidth * uniformScale) / 2,
|
|
386
|
+
borderTopWidth + (innerHeight + bitmapHeight * uniformScale) / 2
|
|
387
|
+
);
|
|
388
|
+
break;
|
|
389
|
+
case FIT_XY: // fill
|
|
390
|
+
matrix.postScale(fittingScaleX, fittingScaleY);
|
|
391
|
+
break;
|
|
392
|
+
case MATRIX: // none
|
|
393
|
+
canvas.clipRect(
|
|
394
|
+
borderLeftWidth,
|
|
395
|
+
borderTopWidth,
|
|
396
|
+
borderLeftWidth + bitmapWidth,
|
|
397
|
+
borderTopWidth + bitmapHeight
|
|
398
|
+
);
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
matrix.postTranslate(borderLeftWidth, borderTopWidth);
|
|
402
|
+
bitmapShader.setLocalMatrix(matrix);
|
|
403
|
+
paint.setAntiAlias(true);
|
|
404
|
+
paint.setFilterBitmap(true);
|
|
405
|
+
paint.setShader(bitmapShader);
|
|
406
|
+
ColorFilter filter = this.getColorFilter();
|
|
407
|
+
if (filter != null) {
|
|
408
|
+
paint.setColorFilter(filter);
|
|
409
|
+
}
|
|
410
|
+
canvas.drawPath(path, paint);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
@Override
|
|
415
|
+
public void setBitmap(Bitmap value) {
|
|
416
|
+
this.setImageBitmap(value);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
@Override
|
|
420
|
+
public void setDrawable(Drawable asyncDrawable) {
|
|
421
|
+
this.setImageDrawable(asyncDrawable);
|
|
422
|
+
}
|
|
423
|
+
}
|