@nativescript/core 9.0.0-next-10-06-2025-18277360121 → 9.0.0-next-10-09-2025-18367604937
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/platforms/android/widgets-release.aar +0 -0
- package/platforms/ios/TNSWidgets.xcframework/Info.plist +102 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +20 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Resources/Info.plist +52 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/Resources/Info.plist +52 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/A/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/Resources/Info.plist +52 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/TNSWidgets.framework/Versions/Current/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +20 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +223 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +20 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/ios-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +20 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSCCrypto.h +60 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSData+Async.h +24 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSFileHandle+Async.h +22 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/NSString+Async.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSLabel.h +16 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSProcess.h +29 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/TNSWidgets.h +25 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIImage+TNSBlocks.h +26 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Headers/UIView+PassThroughParent.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Info.plist +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/Modules/module.modulemap +6 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/NSObject+Swizzling.h +17 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/PrivateHeaders/UIView+PropertyBag.h +18 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/TNSWidgets.framework/_CodeSignature/CodeResources +223 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Info.plist +20 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/DWARF/TNSWidgets +0 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/aarch64/TNSWidgets.yml +82 -0
- package/platforms/ios/TNSWidgets.xcframework/xros-arm64_x86_64-simulator/dSYMs/TNSWidgets.framework.dSYM/Contents/Resources/Relocations/x86_64/TNSWidgets.yml +82 -0
- package/platforms/ios/src/module.modulemap +0 -5
- package/ui/button/index.d.ts +1 -1
- package/ui/slider/index.d.ts +1 -1
- package/platforms/android/include.gradle +0 -51
- package/platforms/android/java/org/nativescript/Process.java +0 -59
- package/platforms/android/java/org/nativescript/widgets/AbsoluteLayout.java +0 -88
- package/platforms/android/java/org/nativescript/widgets/AnimatorHelper.java +0 -61
- package/platforms/android/java/org/nativescript/widgets/Async.java +0 -1356
- package/platforms/android/java/org/nativescript/widgets/BorderDrawable.java +0 -936
- package/platforms/android/java/org/nativescript/widgets/BottomNavigationBar.java +0 -308
- package/platforms/android/java/org/nativescript/widgets/BoxShadowDrawable.java +0 -175
- package/platforms/android/java/org/nativescript/widgets/CSSValue.java +0 -34
- package/platforms/android/java/org/nativescript/widgets/CommonLayoutParams.java +0 -456
- package/platforms/android/java/org/nativescript/widgets/ContentLayout.java +0 -85
- package/platforms/android/java/org/nativescript/widgets/CustomTransition.java +0 -135
- package/platforms/android/java/org/nativescript/widgets/CustomTypefaceSpan.java +0 -44
- package/platforms/android/java/org/nativescript/widgets/Dock.java +0 -15
- package/platforms/android/java/org/nativescript/widgets/DockLayout.java +0 -185
- package/platforms/android/java/org/nativescript/widgets/FileHelper.java +0 -815
- package/platforms/android/java/org/nativescript/widgets/FlexLine.java +0 -177
- package/platforms/android/java/org/nativescript/widgets/FlexboxLayout.java +0 -2769
- package/platforms/android/java/org/nativescript/widgets/FragmentBase.java +0 -14
- package/platforms/android/java/org/nativescript/widgets/GridLayout.java +0 -1172
- package/platforms/android/java/org/nativescript/widgets/GridUnitType.java +0 -10
- package/platforms/android/java/org/nativescript/widgets/HorizontalScrollView.java +0 -256
- package/platforms/android/java/org/nativescript/widgets/ImageView.java +0 -423
- package/platforms/android/java/org/nativescript/widgets/ItemSpec.java +0 -56
- package/platforms/android/java/org/nativescript/widgets/LayoutBase.java +0 -98
- package/platforms/android/java/org/nativescript/widgets/LinearGradientDefinition.java +0 -46
- package/platforms/android/java/org/nativescript/widgets/Orientation.java +0 -9
- package/platforms/android/java/org/nativescript/widgets/OriginPoint.java +0 -74
- package/platforms/android/java/org/nativescript/widgets/ScrollSavedState.java +0 -63
- package/platforms/android/java/org/nativescript/widgets/SegmentedBarColorDrawable.java +0 -27
- package/platforms/android/java/org/nativescript/widgets/StackLayout.java +0 -231
- package/platforms/android/java/org/nativescript/widgets/StyleableTextView.java +0 -50
- package/platforms/android/java/org/nativescript/widgets/TabIconRenderingMode.java +0 -6
- package/platforms/android/java/org/nativescript/widgets/TabItemSpec.java +0 -15
- package/platforms/android/java/org/nativescript/widgets/TabLayout.java +0 -451
- package/platforms/android/java/org/nativescript/widgets/TabStrip.java +0 -294
- package/platforms/android/java/org/nativescript/widgets/TabViewPager.java +0 -64
- package/platforms/android/java/org/nativescript/widgets/TabsBar.java +0 -443
- package/platforms/android/java/org/nativescript/widgets/Utils.java +0 -546
- package/platforms/android/java/org/nativescript/widgets/VerticalScrollView.java +0 -258
- package/platforms/android/java/org/nativescript/widgets/ViewHelper.java +0 -564
- package/platforms/android/java/org/nativescript/widgets/WrapLayout.java +0 -252
- package/platforms/android/java/org/nativescript/widgets/image/AsyncTask.java +0 -679
- package/platforms/android/java/org/nativescript/widgets/image/BitmapOwner.java +0 -17
- package/platforms/android/java/org/nativescript/widgets/image/Cache.java +0 -471
- package/platforms/android/java/org/nativescript/widgets/image/DiskLruCache.java +0 -970
- package/platforms/android/java/org/nativescript/widgets/image/Fetcher.java +0 -747
- package/platforms/android/java/org/nativescript/widgets/image/Utils.java +0 -58
- package/platforms/android/java/org/nativescript/widgets/image/Worker.java +0 -571
- package/platforms/ios/src/TNSWidgets/Info.plist +0 -26
- package/platforms/ios/src/TNSWidgets/NSData+Async.m +0 -42
- package/platforms/ios/src/TNSWidgets/NSFileHandle+Async.m +0 -82
- package/platforms/ios/src/TNSWidgets/NSObject+Swizzling.m +0 -68
- package/platforms/ios/src/TNSWidgets/NSString+Async.m +0 -51
- package/platforms/ios/src/TNSWidgets/TNSLabel.m +0 -42
- package/platforms/ios/src/TNSWidgets/UIImage+TNSBlocks.m +0 -77
- package/platforms/ios/src/TNSWidgets/UIView+PassThroughParent.m +0 -53
- package/platforms/ios/src/TNSWidgets/UIView+PropertyBag.m +0 -72
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/NSData+Async.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/NSFileHandle+Async.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/NSString+Async.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/TNSLabel.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/TNSWidgets.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/UIImage+TNSBlocks.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/Headers}/UIView+PassThroughParent.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/PrivateHeaders}/NSObject+Swizzling.h +0 -0
- /package/platforms/ios/{src/TNSWidgets → TNSWidgets.xcframework/ios-arm64/TNSWidgets.framework/PrivateHeaders}/UIView+PropertyBag.h +0 -0
|
@@ -1,471 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (C) 2012 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.Manifest;
|
|
20
|
-
import android.annotation.TargetApi;
|
|
21
|
-
import android.content.Context;
|
|
22
|
-
import android.content.pm.PackageManager;
|
|
23
|
-
import android.graphics.Bitmap;
|
|
24
|
-
import android.graphics.Bitmap.Config;
|
|
25
|
-
import android.graphics.BitmapFactory;
|
|
26
|
-
import android.os.Build.VERSION_CODES;
|
|
27
|
-
import android.os.Environment;
|
|
28
|
-
import android.os.StatFs;
|
|
29
|
-
import android.util.Log;
|
|
30
|
-
import android.util.LruCache;
|
|
31
|
-
|
|
32
|
-
import java.io.File;
|
|
33
|
-
import java.lang.ref.SoftReference;
|
|
34
|
-
import java.security.MessageDigest;
|
|
35
|
-
import java.security.NoSuchAlgorithmException;
|
|
36
|
-
import java.util.Collections;
|
|
37
|
-
import java.util.HashMap;
|
|
38
|
-
import java.util.HashSet;
|
|
39
|
-
import java.util.Iterator;
|
|
40
|
-
import java.util.Set;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* This class handles disk and memory caching of bitmaps in conjunction with the
|
|
44
|
-
* {@link Worker} class and its subclasses. Use
|
|
45
|
-
* {@link Cache#getInstance(CacheParams)} to get an instance of this
|
|
46
|
-
* class, although usually a cache should be added directly to an {@link Worker} by calling
|
|
47
|
-
* {@link Worker#addImageCache(Cache)}.
|
|
48
|
-
*/
|
|
49
|
-
public class Cache {
|
|
50
|
-
private static final String TAG = "JS";
|
|
51
|
-
|
|
52
|
-
// Default memory cache size in kilobytes
|
|
53
|
-
private static final int DEFAULT_MEM_CACHE_SIZE = 1024 * 5; // 5MB
|
|
54
|
-
|
|
55
|
-
// Constants to easily toggle various caches
|
|
56
|
-
private static final boolean DEFAULT_MEM_CACHE_ENABLED = true;
|
|
57
|
-
private static final boolean DEFAULT_DISK_CACHE_ENABLED = true;
|
|
58
|
-
|
|
59
|
-
private static Cache instance;
|
|
60
|
-
private HashMap<String, Integer> mMemoryCacheUsage;
|
|
61
|
-
private LruCache<String, Bitmap> mMemoryCache;
|
|
62
|
-
private CacheParams mParams;
|
|
63
|
-
|
|
64
|
-
private Set<SoftReference<Bitmap>> mReusableBitmaps;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Create a new Cache object using the specified parameters. This should not be
|
|
68
|
-
* called directly by other classes, instead use
|
|
69
|
-
* {@link Cache#getInstance(CacheParams)} to fetch an Cache
|
|
70
|
-
* instance.
|
|
71
|
-
*/
|
|
72
|
-
private Cache() {
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Return an {@link Cache} instance.
|
|
77
|
-
*
|
|
78
|
-
* @return An existing retained Cache object or a new one if one did not exist
|
|
79
|
-
*/
|
|
80
|
-
public static Cache getInstance(CacheParams cacheParams) {
|
|
81
|
-
if (instance == null) {
|
|
82
|
-
instance = new Cache();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (instance.mParams != cacheParams) {
|
|
86
|
-
instance.init(cacheParams);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return instance;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Initialize the cache, providing all parameters.
|
|
94
|
-
*
|
|
95
|
-
* @param cacheParams The cache parameters to initialize the cache
|
|
96
|
-
*/
|
|
97
|
-
private void init(CacheParams cacheParams) {
|
|
98
|
-
clearCache();
|
|
99
|
-
if (mReusableBitmaps != null) {
|
|
100
|
-
mReusableBitmaps.clear();
|
|
101
|
-
mReusableBitmaps = null;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
mParams = cacheParams;
|
|
105
|
-
|
|
106
|
-
// Set up memory cache
|
|
107
|
-
if (mParams.memoryCacheEnabled) {
|
|
108
|
-
if (Worker.debuggable > 0) {
|
|
109
|
-
Log.v(TAG, "Memory cache created (size = " + mParams.memCacheSize + ")");
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// If we're running on Honeycomb or newer, create a set of reusable bitmaps that can be
|
|
113
|
-
// populated into the inBitmap field of BitmapFactory.Options. Note that the set is
|
|
114
|
-
// of SoftReferences which will actually not be very effective due to the garbage
|
|
115
|
-
// collector being aggressive clearing Soft/WeakReferences. A better approach
|
|
116
|
-
// would be to use a strongly references bitmaps, however this would require some
|
|
117
|
-
// balancing of memory usage between this set and the bitmap LruCache. It would also
|
|
118
|
-
// require knowledge of the expected size of the bitmaps. From Honeycomb to JellyBean
|
|
119
|
-
// the size would need to be precise, from KitKat onward the size would just need to
|
|
120
|
-
// be the upper bound (due to changes in how inBitmap can re-use bitmaps).
|
|
121
|
-
if (Utils.hasHoneycomb()) {
|
|
122
|
-
mReusableBitmaps =
|
|
123
|
-
Collections.synchronizedSet(new HashSet<SoftReference<Bitmap>>());
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
mMemoryCacheUsage = new HashMap<String, Integer>();
|
|
127
|
-
mMemoryCache = new LruCache<String, Bitmap>(mParams.memCacheSize) {
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Notify the removed entry that is no longer being cached
|
|
131
|
-
*/
|
|
132
|
-
@Override
|
|
133
|
-
protected void entryRemoved(boolean evicted, String key,
|
|
134
|
-
Bitmap oldValue, Bitmap newValue) {
|
|
135
|
-
Integer count = mMemoryCacheUsage.get(key);
|
|
136
|
-
if (Utils.hasHoneycomb() && (count == null || count == 0)) {
|
|
137
|
-
// We're running on Honeycomb or later, so add the bitmap
|
|
138
|
-
// to a SoftReference set for possible use with inBitmap later
|
|
139
|
-
mReusableBitmaps.add(new SoftReference<Bitmap>(oldValue));
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Measure item size in kilobytes rather than units which is more practical
|
|
145
|
-
* for a bitmap cache
|
|
146
|
-
*/
|
|
147
|
-
@Override
|
|
148
|
-
protected int sizeOf(String key, Bitmap value) {
|
|
149
|
-
final int bitmapSize = getBitmapSize(value) / 1024;
|
|
150
|
-
return bitmapSize == 0 ? 1 : bitmapSize;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Adds a bitmap to both memory and disk cache.
|
|
158
|
-
*
|
|
159
|
-
* @param data Unique identifier for the bitmap to store
|
|
160
|
-
* @param value The bitmap drawable to store
|
|
161
|
-
*/
|
|
162
|
-
public void addBitmapToCache(String data, Bitmap value) {
|
|
163
|
-
if (data == null || value == null) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Add to memory cache
|
|
168
|
-
if (mMemoryCache != null) {
|
|
169
|
-
Bitmap currentValue = mMemoryCache.get(data);
|
|
170
|
-
// NOTE: If we have existing we probably loaded it sync so we don't want to add the new one,
|
|
171
|
-
// because this will make the previous bitmap free for reuse but it is used somewhere.
|
|
172
|
-
// Probably won't happen often.
|
|
173
|
-
if (currentValue == null) {
|
|
174
|
-
Integer count = mMemoryCacheUsage.get(data);
|
|
175
|
-
// NOTE: count should be null here.
|
|
176
|
-
mMemoryCacheUsage.put(data, count == null ? 1 : count + 1);
|
|
177
|
-
mMemoryCache.put(data, value);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Get from memory cache.
|
|
184
|
-
*
|
|
185
|
-
* @param data Unique identifier for which item to get
|
|
186
|
-
* @return The bitmap if found in cache, null otherwise
|
|
187
|
-
*/
|
|
188
|
-
public Bitmap getBitmapFromMemCache(String data) {
|
|
189
|
-
Bitmap memValue = null;
|
|
190
|
-
|
|
191
|
-
if (mMemoryCache != null) {
|
|
192
|
-
memValue = mMemoryCache.get(data);
|
|
193
|
-
if (memValue != null) {
|
|
194
|
-
Integer count = mMemoryCacheUsage.get(data);
|
|
195
|
-
mMemoryCacheUsage.put(data, count == null ? 1 : count + 1);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (Worker.debuggable > 0 && memValue != null) {
|
|
200
|
-
Log.v(TAG, "Memory cache hit");
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return memValue;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
public void reduceDisplayedCounter(String uri) {
|
|
207
|
-
if (mMemoryCache != null) {
|
|
208
|
-
Integer count = mMemoryCacheUsage.get(uri);
|
|
209
|
-
if (count != null) {
|
|
210
|
-
if (count == 1) {
|
|
211
|
-
mMemoryCacheUsage.remove(uri);
|
|
212
|
-
} else {
|
|
213
|
-
mMemoryCacheUsage.put(uri, count - 1);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* @param options - BitmapFactory.Options with out* options populated
|
|
221
|
-
* @return Bitmap that case be used for inBitmap
|
|
222
|
-
*/
|
|
223
|
-
protected Bitmap getBitmapFromReusableSet(BitmapFactory.Options options) {
|
|
224
|
-
//BEGIN_INCLUDE(get_bitmap_from_reusable_set)
|
|
225
|
-
Bitmap bitmap = null;
|
|
226
|
-
|
|
227
|
-
if (mReusableBitmaps != null && !mReusableBitmaps.isEmpty()) {
|
|
228
|
-
synchronized (mReusableBitmaps) {
|
|
229
|
-
final Iterator<SoftReference<Bitmap>> iterator = mReusableBitmaps.iterator();
|
|
230
|
-
Bitmap item;
|
|
231
|
-
|
|
232
|
-
while (iterator.hasNext()) {
|
|
233
|
-
item = iterator.next().get();
|
|
234
|
-
|
|
235
|
-
if (null != item && item.isMutable()) {
|
|
236
|
-
// Check to see it the item can be used for inBitmap
|
|
237
|
-
if (canUseForInBitmap(item, options)) {
|
|
238
|
-
bitmap = item;
|
|
239
|
-
|
|
240
|
-
// Remove from reusable set so it can't be used again
|
|
241
|
-
iterator.remove();
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
} else {
|
|
245
|
-
// Remove from the set if the reference has been cleared.
|
|
246
|
-
iterator.remove();
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return bitmap;
|
|
253
|
-
//END_INCLUDE(get_bitmap_from_reusable_set)
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Clears both the memory and disk cache associated with this Cache object. Note that
|
|
258
|
-
* this includes disk access so this should not be executed on the main/UI thread.
|
|
259
|
-
*/
|
|
260
|
-
public void clearCache() {
|
|
261
|
-
if (mMemoryCache != null) {
|
|
262
|
-
mMemoryCache.evictAll();
|
|
263
|
-
if (Worker.debuggable > 0) {
|
|
264
|
-
Log.v(TAG, "Memory cache cleared");
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
if (mMemoryCacheUsage != null) {
|
|
268
|
-
mMemoryCacheUsage.clear();
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
mMemoryCacheUsage = null;
|
|
272
|
-
mMemoryCache = null;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* A holder class that contains cache parameters.
|
|
277
|
-
*/
|
|
278
|
-
public static class CacheParams {
|
|
279
|
-
public int memCacheSize = DEFAULT_MEM_CACHE_SIZE;
|
|
280
|
-
public boolean memoryCacheEnabled = DEFAULT_MEM_CACHE_ENABLED;
|
|
281
|
-
public boolean diskCacheEnabled = DEFAULT_DISK_CACHE_ENABLED;
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Sets the memory cache size based on a percentage of the max available VM memory.
|
|
285
|
-
* Eg. setting percent to 0.2 would set the memory cache to one fifth of the available
|
|
286
|
-
* memory. Throws {@link IllegalArgumentException} if percent is < 0.01 or > .8.
|
|
287
|
-
* memCacheSize is stored in kilobytes instead of bytes as this will eventually be passed
|
|
288
|
-
* to construct a LruCache which takes an int in its constructor.
|
|
289
|
-
* <p>
|
|
290
|
-
* This value should be chosen carefully based on a number of factors
|
|
291
|
-
* Refer to the corresponding Android Training class for more discussion:
|
|
292
|
-
* http://developer.android.com/training/displaying-bitmaps/
|
|
293
|
-
*
|
|
294
|
-
* @param percent Percent of available app memory to use to size memory cache
|
|
295
|
-
*/
|
|
296
|
-
public void setMemCacheSizePercent(float percent) {
|
|
297
|
-
if (percent < 0.01f || percent > 0.8f) {
|
|
298
|
-
throw new IllegalArgumentException("setMemCacheSizePercent - percent must be "
|
|
299
|
-
+ "between 0.01 and 0.8 (inclusive)");
|
|
300
|
-
}
|
|
301
|
-
memCacheSize = Math.round(percent * Runtime.getRuntime().maxMemory() / 1024);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* @param candidate - Bitmap to check
|
|
307
|
-
* @param targetOptions - Options that have the out* value populated
|
|
308
|
-
* @return true if <code>candidate</code> can be used for inBitmap re-use with
|
|
309
|
-
* <code>targetOptions</code>
|
|
310
|
-
*/
|
|
311
|
-
@TargetApi(VERSION_CODES.KITKAT)
|
|
312
|
-
private static boolean canUseForInBitmap(
|
|
313
|
-
Bitmap candidate, BitmapFactory.Options targetOptions) {
|
|
314
|
-
//BEGIN_INCLUDE(can_use_for_inbitmap)
|
|
315
|
-
if (!Utils.hasKitKat()) {
|
|
316
|
-
// On earlier versions, the dimensions must match exactly and the inSampleSize must be 1
|
|
317
|
-
return candidate.getWidth() == targetOptions.outWidth
|
|
318
|
-
&& candidate.getHeight() == targetOptions.outHeight
|
|
319
|
-
&& targetOptions.inSampleSize == 1;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// From Android 4.4 (KitKat) onward we can re-use if the byte size of the new bitmap
|
|
323
|
-
// is smaller than the reusable bitmap candidate allocation byte count.
|
|
324
|
-
int width = targetOptions.outWidth / targetOptions.inSampleSize;
|
|
325
|
-
int height = targetOptions.outHeight / targetOptions.inSampleSize;
|
|
326
|
-
int byteCount = width * height * getBytesPerPixel(candidate.getConfig());
|
|
327
|
-
return byteCount <= candidate.getAllocationByteCount();
|
|
328
|
-
//END_INCLUDE(can_use_for_inbitmap)
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Return the byte usage per pixel of a bitmap based on its configuration.
|
|
333
|
-
*
|
|
334
|
-
* @param config The bitmap configuration.
|
|
335
|
-
* @return The byte usage per pixel.
|
|
336
|
-
*/
|
|
337
|
-
private static int getBytesPerPixel(Config config) {
|
|
338
|
-
if (config == Config.ARGB_8888) {
|
|
339
|
-
return 4;
|
|
340
|
-
} else if (config == Config.RGB_565) {
|
|
341
|
-
return 2;
|
|
342
|
-
} else if (config == Config.ARGB_4444) {
|
|
343
|
-
return 2;
|
|
344
|
-
} else if (config == Config.ALPHA_8) {
|
|
345
|
-
return 1;
|
|
346
|
-
}
|
|
347
|
-
return 1;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Get a usable cache directory (external if available, internal otherwise).
|
|
352
|
-
*
|
|
353
|
-
* @param context The context to use
|
|
354
|
-
* @param uniqueName A unique directory name to append to the cache dir
|
|
355
|
-
* @return The cache dir
|
|
356
|
-
*/
|
|
357
|
-
public static File getDiskCacheDir(Context context, String uniqueName) {
|
|
358
|
-
// Check if media is mounted or storage is built-in, if so, try and use external cache dir
|
|
359
|
-
// otherwise use internal cache dir
|
|
360
|
-
final File cacheFilePath = Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) ||
|
|
361
|
-
!isExternalStorageRemovable() ? getExternalCacheDir(context) : context.getCacheDir();
|
|
362
|
-
// In case there is no external storage isExternalStorageRemovable returns False and we get Null from getExternalCacheDir.
|
|
363
|
-
// If this is the case - fall back to internal cache dir.
|
|
364
|
-
final String cachePath = cacheFilePath != null ? cacheFilePath.getPath() : context.getCacheDir().getPath();
|
|
365
|
-
return new File(cachePath + File.separator + uniqueName);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* A hashing method that changes a string (like a URL) into a hash suitable for using as a
|
|
370
|
-
* disk filename.
|
|
371
|
-
*/
|
|
372
|
-
public static String hashKeyForDisk(String key) {
|
|
373
|
-
String cacheKey;
|
|
374
|
-
try {
|
|
375
|
-
final MessageDigest mDigest = MessageDigest.getInstance("MD5");
|
|
376
|
-
mDigest.update(key.getBytes());
|
|
377
|
-
cacheKey = bytesToHexString(mDigest.digest());
|
|
378
|
-
} catch (NoSuchAlgorithmException e) {
|
|
379
|
-
cacheKey = String.valueOf(key.hashCode());
|
|
380
|
-
}
|
|
381
|
-
return cacheKey;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
private static String bytesToHexString(byte[] bytes) {
|
|
385
|
-
// http://stackoverflow.com/questions/332079
|
|
386
|
-
StringBuilder sb = new StringBuilder();
|
|
387
|
-
for (int i = 0; i < bytes.length; i++) {
|
|
388
|
-
String hex = Integer.toHexString(0xFF & bytes[i]);
|
|
389
|
-
if (hex.length() == 1) {
|
|
390
|
-
sb.append('0');
|
|
391
|
-
}
|
|
392
|
-
sb.append(hex);
|
|
393
|
-
}
|
|
394
|
-
return sb.toString();
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Get the size in bytes of a bitmap in a BitmapDrawable. Note that from Android 4.4 (KitKat)
|
|
399
|
-
* onward this returns the allocated memory size of the bitmap which can be larger than the
|
|
400
|
-
* actual bitmap data byte count (in the case it was re-used).
|
|
401
|
-
*
|
|
402
|
-
* @param bitmap
|
|
403
|
-
* @return size in bytes
|
|
404
|
-
*/
|
|
405
|
-
@TargetApi(VERSION_CODES.KITKAT)
|
|
406
|
-
public static int getBitmapSize(Bitmap bitmap) {
|
|
407
|
-
// From KitKat onward use getAllocationByteCount() as allocated bytes can potentially be
|
|
408
|
-
// larger than bitmap byte count.
|
|
409
|
-
if (Utils.hasKitKat()) {
|
|
410
|
-
return bitmap.getAllocationByteCount();
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
if (Utils.hasHoneycombMR1()) {
|
|
414
|
-
return bitmap.getByteCount();
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// Pre HC-MR1
|
|
418
|
-
return bitmap.getRowBytes() * bitmap.getHeight();
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* Check if external storage is built-in or removable.
|
|
423
|
-
*
|
|
424
|
-
* @return True if external storage is removable (like an SD card), false
|
|
425
|
-
* otherwise.
|
|
426
|
-
*/
|
|
427
|
-
@TargetApi(VERSION_CODES.GINGERBREAD)
|
|
428
|
-
public static boolean isExternalStorageRemovable() {
|
|
429
|
-
if (Utils.hasGingerbread()) {
|
|
430
|
-
return Environment.isExternalStorageRemovable();
|
|
431
|
-
}
|
|
432
|
-
return true;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Get the external app cache directory.
|
|
437
|
-
*
|
|
438
|
-
* @param context The context to use
|
|
439
|
-
* @return The external cache dir
|
|
440
|
-
*/
|
|
441
|
-
@TargetApi(VERSION_CODES.FROYO)
|
|
442
|
-
public static File getExternalCacheDir(Context context) {
|
|
443
|
-
if (Utils.hasFroyo()) {
|
|
444
|
-
if (Utils.hasKitKat() ||
|
|
445
|
-
context.checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, android.os.Process.myPid(), android.os.Process.myUid()) == PackageManager.PERMISSION_GRANTED) {
|
|
446
|
-
return context.getExternalCacheDir();
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
return null;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// Before Froyo we need to construct the external cache dir ourselves
|
|
453
|
-
final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/";
|
|
454
|
-
return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Check how much usable space is available at a given path.
|
|
459
|
-
*
|
|
460
|
-
* @param path The path to check
|
|
461
|
-
* @return The space available in bytes
|
|
462
|
-
*/
|
|
463
|
-
@TargetApi(VERSION_CODES.GINGERBREAD)
|
|
464
|
-
public static long getUsableSpace(File path) {
|
|
465
|
-
if (Utils.hasGingerbread()) {
|
|
466
|
-
return path.getUsableSpace();
|
|
467
|
-
}
|
|
468
|
-
final StatFs stats = new StatFs(path.getPath());
|
|
469
|
-
return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
|
|
470
|
-
}
|
|
471
|
-
}
|