@akylas/nativescript 8.9.9 → 8.9.11
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 +2 -2
- 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 +915 -0
- package/platforms/android/java/org/nativescript/widgets/BottomNavigationBar.java +308 -0
- package/platforms/android/java/org/nativescript/widgets/BoxShadowDrawable.java +165 -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 +797 -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/FolderHelper.java +899 -0
- package/platforms/android/java/org/nativescript/widgets/FragmentBase.java +14 -0
- package/platforms/android/java/org/nativescript/widgets/GridLayout.java +1170 -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 +424 -0
- package/platforms/android/java/org/nativescript/widgets/ItemSpec.java +56 -0
- package/platforms/android/java/org/nativescript/widgets/LayoutBase.java +110 -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 +550 -0
- package/platforms/android/java/org/nativescript/widgets/VerticalScrollView.java +258 -0
- package/platforms/android/java/org/nativescript/widgets/ViewHelper.java +735 -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/android/widgets-release.aar +0 -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/TNSProcess.m +30 -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/ui/core/properties/index.js +3 -3
- package/ui/core/properties/index.js.map +1 -1
- package/ui/page/index.ios.js +7 -6
- package/ui/page/index.ios.js.map +1 -1
- 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/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/TNSWidgets +0 -0
- 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/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}/TNSProcess.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,735 @@
|
|
|
1
|
+
package org.nativescript.widgets;
|
|
2
|
+
|
|
3
|
+
import android.annotation.TargetApi;
|
|
4
|
+
import android.graphics.Outline;
|
|
5
|
+
import android.graphics.Path;
|
|
6
|
+
import android.graphics.Rect;
|
|
7
|
+
import android.view.Gravity;
|
|
8
|
+
import android.view.View;
|
|
9
|
+
import android.view.ViewGroup;
|
|
10
|
+
import android.view.ViewOutlineProvider;
|
|
11
|
+
import android.widget.FrameLayout;
|
|
12
|
+
import android.widget.TextView;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import androidx.appcompat.widget.AppCompatTextView;
|
|
16
|
+
|
|
17
|
+
import java.lang.reflect.Field;
|
|
18
|
+
import java.lang.Class;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Created by hhristov on 8/23/16.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
public class ViewHelper {
|
|
25
|
+
private ViewHelper() {
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static final int version = android.os.Build.VERSION.SDK_INT;
|
|
30
|
+
static final boolean LOLLIPOP = android.os.Build.VERSION.SDK_INT >= 21;
|
|
31
|
+
static final boolean PI = android.os.Build.VERSION.SDK_INT >= 28;
|
|
32
|
+
static final boolean TIRAMISU = android.os.Build.VERSION.SDK_INT >= 33;
|
|
33
|
+
|
|
34
|
+
public static int getMinWidth(android.view.View view) {
|
|
35
|
+
return view.getMinimumWidth();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public static void setMinWidth(android.view.View view, int value) {
|
|
39
|
+
if (view instanceof TextView) {
|
|
40
|
+
((android.widget.TextView) view).setMinWidth(value);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
view.setMinimumWidth(value);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public static int getMinHeight(android.view.View view) {
|
|
47
|
+
return view.getMinimumHeight();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public static void setMinHeight(android.view.View view, int value) {
|
|
51
|
+
if (view instanceof TextView) {
|
|
52
|
+
((android.widget.TextView) view).setMinHeight(value);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
view.setMinimumHeight(value);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public static int getWidth(android.view.View view) {
|
|
59
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
60
|
+
if (params != null) {
|
|
61
|
+
return params.width;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return ViewGroup.LayoutParams.MATCH_PARENT;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public static void setWidth(android.view.View view, int value) {
|
|
68
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
69
|
+
if (params == null) {
|
|
70
|
+
params = new CommonLayoutParams();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
params.width = value;
|
|
74
|
+
if (params instanceof CommonLayoutParams) {
|
|
75
|
+
((CommonLayoutParams) params).widthPercent = -1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
view.setLayoutParams(params);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public static void setWidthPercent(android.view.View view, float value) {
|
|
82
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
83
|
+
if (params == null) {
|
|
84
|
+
params = new CommonLayoutParams();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (params instanceof CommonLayoutParams) {
|
|
88
|
+
CommonLayoutParams lp = (CommonLayoutParams) params;
|
|
89
|
+
lp.widthPercent = value;
|
|
90
|
+
lp.width = (lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL
|
|
91
|
+
? ViewGroup.LayoutParams.MATCH_PARENT
|
|
92
|
+
: ViewGroup.LayoutParams.WRAP_CONTENT;
|
|
93
|
+
view.setLayoutParams(params);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public static int getHeight(android.view.View view) {
|
|
98
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
99
|
+
if (params != null) {
|
|
100
|
+
return params.height;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return ViewGroup.LayoutParams.MATCH_PARENT;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
public static void setHeight(android.view.View view, int value) {
|
|
107
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
108
|
+
if (params == null) {
|
|
109
|
+
params = new CommonLayoutParams();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
params.height = value;
|
|
113
|
+
if (params instanceof CommonLayoutParams) {
|
|
114
|
+
((CommonLayoutParams) params).heightPercent = -1;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
view.setLayoutParams(params);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public static void setHeightPercent(android.view.View view, float value) {
|
|
121
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
122
|
+
if (params == null) {
|
|
123
|
+
params = new CommonLayoutParams();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (params instanceof CommonLayoutParams) {
|
|
127
|
+
CommonLayoutParams lp = (CommonLayoutParams) params;
|
|
128
|
+
lp.heightPercent = value;
|
|
129
|
+
lp.height = (lp.gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.FILL_VERTICAL
|
|
130
|
+
? ViewGroup.LayoutParams.MATCH_PARENT
|
|
131
|
+
: ViewGroup.LayoutParams.WRAP_CONTENT;
|
|
132
|
+
view.setLayoutParams(params);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public static Rect getMargin(android.view.View view) {
|
|
137
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
138
|
+
if (params instanceof ViewGroup.MarginLayoutParams) {
|
|
139
|
+
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) params;
|
|
140
|
+
return new Rect(lp.leftMargin, lp.topMargin, lp.rightMargin, lp.bottomMargin);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return new Rect();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
public static void setMargin(android.view.View view, int left, int top, int right, int bottom) {
|
|
147
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
148
|
+
// Initialize if empty.
|
|
149
|
+
if (params == null) {
|
|
150
|
+
params = new CommonLayoutParams();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Set margins only if params are of the correct type.
|
|
154
|
+
if (params instanceof ViewGroup.MarginLayoutParams) {
|
|
155
|
+
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) params;
|
|
156
|
+
lp.leftMargin = left;
|
|
157
|
+
lp.topMargin = top;
|
|
158
|
+
lp.rightMargin = right;
|
|
159
|
+
lp.bottomMargin = bottom;
|
|
160
|
+
view.setLayoutParams(params);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
public static int getMarginLeft(android.view.View view) {
|
|
165
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
166
|
+
if (params instanceof ViewGroup.MarginLayoutParams) {
|
|
167
|
+
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) params;
|
|
168
|
+
return lp.leftMargin;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public static void setMarginLeft(android.view.View view, int value) {
|
|
175
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
176
|
+
// Initialize if empty.
|
|
177
|
+
if (params == null) {
|
|
178
|
+
params = new CommonLayoutParams();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Set margins only if params are of the correct type.
|
|
182
|
+
if (params instanceof ViewGroup.MarginLayoutParams) {
|
|
183
|
+
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) params;
|
|
184
|
+
lp.leftMargin = value;
|
|
185
|
+
view.setLayoutParams(params);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (params instanceof CommonLayoutParams) {
|
|
189
|
+
CommonLayoutParams lp = (CommonLayoutParams) params;
|
|
190
|
+
lp.leftMarginPercent = -1;
|
|
191
|
+
view.setLayoutParams(params);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public static void setMarginLeftPercent(android.view.View view, float value) {
|
|
196
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
197
|
+
if (params == null) {
|
|
198
|
+
params = new CommonLayoutParams();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (params instanceof CommonLayoutParams) {
|
|
202
|
+
CommonLayoutParams lp = (CommonLayoutParams) params;
|
|
203
|
+
lp.leftMargin = 0;
|
|
204
|
+
lp.leftMarginPercent = value;
|
|
205
|
+
view.setLayoutParams(params);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
public static int getMarginTop(android.view.View view) {
|
|
210
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
211
|
+
if (params instanceof ViewGroup.MarginLayoutParams) {
|
|
212
|
+
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) params;
|
|
213
|
+
return lp.topMargin;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
public static void setMarginTop(android.view.View view, int value) {
|
|
220
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
221
|
+
// Initialize if empty.
|
|
222
|
+
if (params == null) {
|
|
223
|
+
params = new CommonLayoutParams();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Set margins only if params are of the correct type.
|
|
227
|
+
if (params instanceof ViewGroup.MarginLayoutParams) {
|
|
228
|
+
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) params;
|
|
229
|
+
lp.topMargin = value;
|
|
230
|
+
view.setLayoutParams(params);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (params instanceof CommonLayoutParams) {
|
|
234
|
+
CommonLayoutParams lp = (CommonLayoutParams) params;
|
|
235
|
+
lp.topMarginPercent = -1;
|
|
236
|
+
view.setLayoutParams(params);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
public static void setMarginTopPercent(android.view.View view, float value) {
|
|
241
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
242
|
+
if (params == null) {
|
|
243
|
+
params = new CommonLayoutParams();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (params instanceof CommonLayoutParams) {
|
|
247
|
+
CommonLayoutParams lp = (CommonLayoutParams) params;
|
|
248
|
+
lp.topMargin = 0;
|
|
249
|
+
lp.topMarginPercent = value;
|
|
250
|
+
view.setLayoutParams(params);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
public static int getMarginRight(android.view.View view) {
|
|
255
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
256
|
+
if (params instanceof ViewGroup.MarginLayoutParams) {
|
|
257
|
+
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) params;
|
|
258
|
+
return lp.rightMargin;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return 0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
public static void setMarginRight(android.view.View view, int value) {
|
|
265
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
266
|
+
// Initialize if empty.
|
|
267
|
+
if (params == null) {
|
|
268
|
+
params = new CommonLayoutParams();
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Set margins only if params are of the correct type.
|
|
272
|
+
if (params instanceof ViewGroup.MarginLayoutParams) {
|
|
273
|
+
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) params;
|
|
274
|
+
lp.rightMargin = value;
|
|
275
|
+
view.setLayoutParams(params);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (params instanceof CommonLayoutParams) {
|
|
279
|
+
CommonLayoutParams lp = (CommonLayoutParams) params;
|
|
280
|
+
lp.rightMarginPercent = -1;
|
|
281
|
+
view.setLayoutParams(params);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
public static void setMarginRightPercent(android.view.View view, float value) {
|
|
286
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
287
|
+
if (params == null) {
|
|
288
|
+
params = new CommonLayoutParams();
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (params instanceof CommonLayoutParams) {
|
|
292
|
+
CommonLayoutParams lp = (CommonLayoutParams) params;
|
|
293
|
+
lp.rightMargin = 0;
|
|
294
|
+
lp.rightMarginPercent = value;
|
|
295
|
+
view.setLayoutParams(params);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
public static int getMarginBottom(android.view.View view) {
|
|
300
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
301
|
+
if (params instanceof ViewGroup.MarginLayoutParams) {
|
|
302
|
+
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) params;
|
|
303
|
+
return lp.bottomMargin;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return 0;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
public static void setMarginBottom(android.view.View view, int value) {
|
|
310
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
311
|
+
// Initialize if empty.
|
|
312
|
+
if (params == null) {
|
|
313
|
+
params = new CommonLayoutParams();
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Set margins only if params are of the correct type.
|
|
317
|
+
if (params instanceof ViewGroup.MarginLayoutParams) {
|
|
318
|
+
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) params;
|
|
319
|
+
lp.bottomMargin = value;
|
|
320
|
+
view.setLayoutParams(params);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (params instanceof CommonLayoutParams) {
|
|
324
|
+
CommonLayoutParams lp = (CommonLayoutParams) params;
|
|
325
|
+
lp.bottomMarginPercent = -1;
|
|
326
|
+
view.setLayoutParams(params);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
public static void setMarginBottomPercent(android.view.View view, float value) {
|
|
331
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
332
|
+
if (params == null) {
|
|
333
|
+
params = new CommonLayoutParams();
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (params instanceof CommonLayoutParams) {
|
|
337
|
+
CommonLayoutParams lp = (CommonLayoutParams) params;
|
|
338
|
+
lp.bottomMargin = 0;
|
|
339
|
+
lp.bottomMarginPercent = value;
|
|
340
|
+
view.setLayoutParams(params);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
public static String getHorizontalAlignment(android.view.View view) {
|
|
345
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
346
|
+
if (params instanceof FrameLayout.LayoutParams) {
|
|
347
|
+
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) params;
|
|
348
|
+
if (Gravity.isHorizontal(lp.gravity)) {
|
|
349
|
+
switch (lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
|
350
|
+
case Gravity.LEFT:
|
|
351
|
+
return "left";
|
|
352
|
+
case Gravity.CENTER:
|
|
353
|
+
return "center";
|
|
354
|
+
case Gravity.RIGHT:
|
|
355
|
+
return "right";
|
|
356
|
+
case Gravity.FILL_HORIZONTAL:
|
|
357
|
+
return "stretch";
|
|
358
|
+
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return "stretch";
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
private static Field getField(Class clazz, String field) {
|
|
367
|
+
Field result = null;
|
|
368
|
+
try {
|
|
369
|
+
result = clazz.getDeclaredField(field);
|
|
370
|
+
} catch (Throwable e) {}
|
|
371
|
+
if (result != null) {
|
|
372
|
+
return result;
|
|
373
|
+
}
|
|
374
|
+
while((clazz = clazz.getSuperclass()) != null) {
|
|
375
|
+
try {
|
|
376
|
+
result = clazz.getDeclaredField(field);
|
|
377
|
+
} catch (Throwable e) {}
|
|
378
|
+
if (result != null) {
|
|
379
|
+
return result;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return result;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
public static void setHorizontalAlignment(android.view.View view, String value) throws Throwable {
|
|
386
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
387
|
+
// Initialize if empty.
|
|
388
|
+
if (params == null) {
|
|
389
|
+
params = new CommonLayoutParams();
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
Field field = getField(params.getClass(), "gravity");
|
|
393
|
+
if (field != null) {
|
|
394
|
+
int gravity = field.getInt(params);
|
|
395
|
+
Field weightField = getField(params.getClass(), "weight");
|
|
396
|
+
switch (value) {
|
|
397
|
+
case "left":
|
|
398
|
+
gravity = Gravity.LEFT | (gravity & Gravity.VERTICAL_GRAVITY_MASK);
|
|
399
|
+
if (weightField != null && weightField.getFloat(params) < 0) {
|
|
400
|
+
weightField.setFloat(params, -2.0f);
|
|
401
|
+
}
|
|
402
|
+
break;
|
|
403
|
+
case "center":
|
|
404
|
+
case "middle":
|
|
405
|
+
gravity = Gravity.CENTER_HORIZONTAL | (gravity & Gravity.VERTICAL_GRAVITY_MASK);
|
|
406
|
+
if (weightField != null && weightField.getFloat(params) < 0) {
|
|
407
|
+
weightField.setFloat(params, -2.0f);
|
|
408
|
+
}
|
|
409
|
+
break;
|
|
410
|
+
case "right":
|
|
411
|
+
gravity = Gravity.RIGHT | (gravity & Gravity.VERTICAL_GRAVITY_MASK);
|
|
412
|
+
if (weightField != null && weightField.getFloat(params) < 0) {
|
|
413
|
+
weightField.setFloat(params, -2.0f);
|
|
414
|
+
}
|
|
415
|
+
break;
|
|
416
|
+
case "stretch":
|
|
417
|
+
gravity = Gravity.FILL_HORIZONTAL | (gravity & Gravity.VERTICAL_GRAVITY_MASK);
|
|
418
|
+
if (weightField != null && weightField.getFloat(params) < 0) {
|
|
419
|
+
weightField.setFloat(params, -1.0f);
|
|
420
|
+
}
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
field.setInt(params, gravity);
|
|
424
|
+
view.setLayoutParams(params);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
public static String getVerticalAlignment(android.view.View view) {
|
|
429
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
430
|
+
if (params instanceof FrameLayout.LayoutParams) {
|
|
431
|
+
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) params;
|
|
432
|
+
if (Gravity.isHorizontal(lp.gravity)) {
|
|
433
|
+
switch (lp.gravity & Gravity.VERTICAL_GRAVITY_MASK) {
|
|
434
|
+
case Gravity.TOP:
|
|
435
|
+
return "top";
|
|
436
|
+
case Gravity.CENTER:
|
|
437
|
+
return "center";
|
|
438
|
+
case Gravity.BOTTOM:
|
|
439
|
+
return "bottom";
|
|
440
|
+
case Gravity.FILL_VERTICAL:
|
|
441
|
+
return "stretch";
|
|
442
|
+
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
return "stretch";
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
public static void setVerticalAlignment(android.view.View view, String value) throws Throwable{
|
|
451
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
452
|
+
// Initialize if empty.
|
|
453
|
+
if (params == null) {
|
|
454
|
+
params = new CommonLayoutParams();
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
Field field = getField(params.getClass(), "gravity");
|
|
458
|
+
if (field != null) {
|
|
459
|
+
int gravity = field.getInt(params);
|
|
460
|
+
switch (value) {
|
|
461
|
+
case "top":
|
|
462
|
+
gravity = Gravity.TOP | (gravity & Gravity.HORIZONTAL_GRAVITY_MASK);
|
|
463
|
+
if (params.height < 0) {
|
|
464
|
+
params.height = -2;
|
|
465
|
+
}
|
|
466
|
+
break;
|
|
467
|
+
case "center":
|
|
468
|
+
case "middle":
|
|
469
|
+
gravity = Gravity.CENTER_VERTICAL | (gravity & Gravity.HORIZONTAL_GRAVITY_MASK);
|
|
470
|
+
if (params.height < 0) {
|
|
471
|
+
params.height = -2;
|
|
472
|
+
}
|
|
473
|
+
break;
|
|
474
|
+
case "bottom":
|
|
475
|
+
gravity = Gravity.BOTTOM | (gravity & Gravity.HORIZONTAL_GRAVITY_MASK);
|
|
476
|
+
if (params.height < 0) {
|
|
477
|
+
params.height = -2;
|
|
478
|
+
}
|
|
479
|
+
break;
|
|
480
|
+
case "stretch":
|
|
481
|
+
gravity = Gravity.FILL_VERTICAL | (gravity & Gravity.HORIZONTAL_GRAVITY_MASK);
|
|
482
|
+
if (params.height < 0) {
|
|
483
|
+
params.height = -1;
|
|
484
|
+
}
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
field.setInt(params, gravity);
|
|
488
|
+
view.setLayoutParams(params);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
public static Rect getPadding(android.view.View view) {
|
|
493
|
+
return new Rect(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom());
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
public static void setPadding(android.view.View view, int left, int top, int right, int bottom) {
|
|
497
|
+
view.setPadding(left, top, right, bottom);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
public static int getPaddingLeft(android.view.View view) {
|
|
501
|
+
return view.getPaddingLeft();
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
public static void setPaddingLeft(android.view.View view, int value) {
|
|
505
|
+
view.setPadding(value, view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom());
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
public static int getPaddingTop(android.view.View view) {
|
|
509
|
+
return view.getPaddingTop();
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
public static void setPaddingTop(android.view.View view, int value) {
|
|
513
|
+
view.setPadding(view.getPaddingLeft(), value, view.getPaddingRight(), view.getPaddingBottom());
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
public static int getPaddingRight(android.view.View view) {
|
|
517
|
+
return view.getPaddingRight();
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
public static void setPaddingRight(android.view.View view, int value) {
|
|
521
|
+
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), value, view.getPaddingBottom());
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
public static int getPaddingBottom(android.view.View view) {
|
|
525
|
+
return view.getPaddingBottom();
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
public static void setPaddingBottom(android.view.View view, int value) {
|
|
529
|
+
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), value);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
public static float getRotate(android.view.View view) {
|
|
533
|
+
return view.getRotation();
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
public static void setRotate(android.view.View view, float value) {
|
|
537
|
+
view.setRotation(value);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
public static float getRotateX(android.view.View view) {
|
|
541
|
+
return view.getRotationX();
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
public static void setRotateX(android.view.View view, float value) {
|
|
545
|
+
view.setRotationX(value);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
public static float getRotateY(android.view.View view) {
|
|
549
|
+
return view.getRotationY();
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
public static void setRotateY(android.view.View view, float value) {
|
|
553
|
+
view.setRotationY(value);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
public static void setPerspective(android.view.View view, float value) {
|
|
557
|
+
view.setCameraDistance(value);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
public static float getScaleX(android.view.View view) {
|
|
561
|
+
return view.getScaleX();
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
public static void setScaleX(android.view.View view, float value) {
|
|
565
|
+
view.setScaleX(value);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
public static float getScaleY(android.view.View view) {
|
|
569
|
+
return view.getScaleY();
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
public static void setScaleY(android.view.View view, float value) {
|
|
573
|
+
view.setScaleY(value);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
public static float getTranslateX(android.view.View view) {
|
|
577
|
+
return view.getTranslationX();
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
public static void setTranslateX(android.view.View view, float value) {
|
|
581
|
+
view.setTranslationX(value);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
public static float getTranslateY(android.view.View view) {
|
|
585
|
+
return view.getTranslationY();
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
public static void setTranslateY(android.view.View view, float value) {
|
|
589
|
+
view.setTranslationY(value);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
@TargetApi(21)
|
|
593
|
+
public static float getZIndex(android.view.View view) {
|
|
594
|
+
if (LOLLIPOP) {
|
|
595
|
+
return view.getZ();
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
return 0;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
@TargetApi(21)
|
|
602
|
+
public static void setZIndex(android.view.View view, float value) {
|
|
603
|
+
if (LOLLIPOP) {
|
|
604
|
+
view.setZ(value);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
@TargetApi(21)
|
|
609
|
+
public static float getLetterspacing(android.widget.TextView textView) {
|
|
610
|
+
if (LOLLIPOP) {
|
|
611
|
+
return textView.getLetterSpacing();
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
return 0;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
@TargetApi(21)
|
|
618
|
+
public static void setLetterspacing(android.widget.TextView textView, float value) {
|
|
619
|
+
if (LOLLIPOP) {
|
|
620
|
+
textView.setLetterSpacing(value);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
public static void setCommonGridLayoutParam(android.view.View view, String type, int value) throws Throwable {
|
|
625
|
+
ViewGroup.LayoutParams params = view.getLayoutParams();
|
|
626
|
+
// Initialize if empty.
|
|
627
|
+
if (params == null) {
|
|
628
|
+
params = new CommonLayoutParams();
|
|
629
|
+
}
|
|
630
|
+
if (params instanceof CommonLayoutParams) {
|
|
631
|
+
switch(type) {
|
|
632
|
+
case "row":
|
|
633
|
+
((CommonLayoutParams)params).row = value;
|
|
634
|
+
break;
|
|
635
|
+
case "rowSpan":
|
|
636
|
+
((CommonLayoutParams)params).rowSpan = value;
|
|
637
|
+
break;
|
|
638
|
+
case "column":
|
|
639
|
+
((CommonLayoutParams)params).column = value;
|
|
640
|
+
break;
|
|
641
|
+
case "columnSpan":
|
|
642
|
+
((CommonLayoutParams)params).columnSpan = value;
|
|
643
|
+
break;
|
|
644
|
+
}
|
|
645
|
+
view.setLayoutParams(params);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
@TargetApi(21)
|
|
651
|
+
public static void setOutlineProvider(android.view.View view, int borderTopLeftRadius,
|
|
652
|
+
int borderTopRightRadius,
|
|
653
|
+
int borderBottomRightRadius,
|
|
654
|
+
int borderBottomLeftRadius) {
|
|
655
|
+
if (LOLLIPOP) {
|
|
656
|
+
view.setOutlineProvider(new ViewOutlineProvider() {
|
|
657
|
+
@Override
|
|
658
|
+
public void getOutline(View view, Outline outline) {
|
|
659
|
+
if (borderTopLeftRadius == borderTopRightRadius && borderTopLeftRadius == borderBottomRightRadius && borderTopLeftRadius == borderBottomLeftRadius) {
|
|
660
|
+
outline.setRoundRect(0,0, view.getWidth(), view.getHeight(), borderTopLeftRadius);
|
|
661
|
+
} else if (TIRAMISU) {
|
|
662
|
+
Path path = new Path();
|
|
663
|
+
float[] radii = {
|
|
664
|
+
borderTopLeftRadius,
|
|
665
|
+
borderTopLeftRadius,
|
|
666
|
+
borderTopRightRadius,
|
|
667
|
+
borderTopRightRadius,
|
|
668
|
+
borderBottomRightRadius,
|
|
669
|
+
borderBottomRightRadius,
|
|
670
|
+
borderBottomLeftRadius,
|
|
671
|
+
borderBottomLeftRadius}
|
|
672
|
+
;
|
|
673
|
+
path.addRoundRect(
|
|
674
|
+
0, 0, view.getWidth(), view.getHeight(), radii, Path.Direction.CW);
|
|
675
|
+
outline.setConvexPath(path);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
view.setClipToOutline(true);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
@TargetApi(21)
|
|
684
|
+
public static void clearOutlineProvider(android.view.View view) {
|
|
685
|
+
view.setClipToOutline(false);
|
|
686
|
+
view.setOutlineProvider(null);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
public static boolean isTextView(View view) {
|
|
690
|
+
return view instanceof android.widget.TextView;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
public static View getChildAppCompatTextView(ViewGroup view) {
|
|
694
|
+
int numChildren = view.getChildCount();
|
|
695
|
+
|
|
696
|
+
for (int i = 0; i < numChildren; i += 1) {
|
|
697
|
+
View childAndroidView = view.getChildAt(i);
|
|
698
|
+
if (childAndroidView instanceof AppCompatTextView) {
|
|
699
|
+
return childAndroidView;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
return null;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
public static void toolbarAccessibilityScreenChanged(androidx.appcompat.widget.Toolbar nativeView) {
|
|
706
|
+
nativeView.setFocusable(false);
|
|
707
|
+
nativeView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
|
708
|
+
|
|
709
|
+
android.view.View announceView = null;
|
|
710
|
+
int numChildren = nativeView.getChildCount();
|
|
711
|
+
for (int i = 0; i < numChildren; i += 1) {
|
|
712
|
+
View childView = nativeView.getChildAt(i);
|
|
713
|
+
if (childView == null) {
|
|
714
|
+
continue;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
childView.setFocusable(true);
|
|
718
|
+
if (childView instanceof AppCompatTextView) {
|
|
719
|
+
announceView = childView;
|
|
720
|
+
if (PI) {
|
|
721
|
+
announceView.setAccessibilityHeading(true);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (announceView == null) {
|
|
726
|
+
announceView = nativeView;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
announceView.setFocusable(true);
|
|
730
|
+
announceView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
|
|
731
|
+
|
|
732
|
+
announceView.sendAccessibilityEvent(android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
|
733
|
+
announceView.sendAccessibilityEvent(android.view.accessibility.AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED);
|
|
734
|
+
}
|
|
735
|
+
}
|