react-native-navigation 7.24.3-snapshot.492 → 7.25.0-snapshot.543
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/lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java +7 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/BottomTabOptions.java +4 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/Options.java +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/OverlayOptions.java +3 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/OverlayOptions.kt +31 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/layout/LayoutInsets.kt +44 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/layout/LayoutOptions.kt +71 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/JSONParser.java +0 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/PrimitiveExt.kt +9 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenter.java +2 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java +31 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildController.java +6 -13
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +32 -10
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalStack.java +4 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/navigator/Navigator.java +25 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/overlay/OverlayManager.kt +104 -33
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/parent/ParentController.java +86 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuController.java +12 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +18 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +51 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonController.kt +7 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/Presenter.java +23 -7
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/RootPresenter.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewController.java +24 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabs.java +29 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsContainer.kt +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsLayout.java +10 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/component/ComponentLayout.java +10 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/overlay/AttachedOverlayContainer.kt +69 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/overlay/ViewTooltip.java +921 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/sidemenu/SideMenuRoot.java +9 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/StackLayout.java +14 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/TopBar.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabsStyleHelper.java +0 -1
- package/lib/dist/src/interfaces/Options.d.ts +34 -0
- package/lib/ios/RNNBasePresenter.m +17 -0
- package/lib/ios/RNNBottomTabsController.m +1 -0
- package/lib/ios/RNNComponentViewController.m +5 -0
- package/lib/ios/RNNLayoutOptions.h +2 -1
- package/lib/ios/RNNLayoutOptions.m +4 -0
- package/lib/ios/RNNStackPresenter.m +1 -0
- package/lib/src/interfaces/Options.ts +38 -0
- package/package.json +3 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/LayoutOptions.java +0 -48
package/lib/android/app/src/main/java/com/reactnativenavigation/views/sidemenu/SideMenuRoot.java
CHANGED
|
@@ -12,6 +12,7 @@ import com.reactnativenavigation.options.SideMenuOptions;
|
|
|
12
12
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
13
13
|
import com.reactnativenavigation.views.BehaviourAdapter;
|
|
14
14
|
import com.reactnativenavigation.views.BehaviourDelegate;
|
|
15
|
+
import com.reactnativenavigation.views.overlay.AttachedOverlayContainer;
|
|
15
16
|
|
|
16
17
|
import androidx.annotation.RestrictTo;
|
|
17
18
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
@@ -23,9 +24,16 @@ import static com.reactnativenavigation.utils.CoordinatorLayoutUtils.matchParent
|
|
|
23
24
|
|
|
24
25
|
public class SideMenuRoot extends CoordinatorLayout {
|
|
25
26
|
private SideMenu sideMenu;
|
|
27
|
+
final private AttachedOverlayContainer attachedOverlayContainer ;
|
|
26
28
|
|
|
27
29
|
public SideMenuRoot(Context context) {
|
|
28
30
|
super(context);
|
|
31
|
+
attachedOverlayContainer = new AttachedOverlayContainer(context);
|
|
32
|
+
addView(attachedOverlayContainer,LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public AttachedOverlayContainer getAttachedOverlayContainer() {
|
|
36
|
+
return attachedOverlayContainer;
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
public void addSideMenu(SideMenu sideMenu, BehaviourAdapter behaviourAdapter) {
|
|
@@ -89,4 +97,4 @@ public class SideMenuRoot extends CoordinatorLayout {
|
|
|
89
97
|
public SideMenu getSideMenu() {
|
|
90
98
|
return sideMenu;
|
|
91
99
|
}
|
|
92
|
-
}
|
|
100
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/StackLayout.java
CHANGED
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.viewcontrollers.stack.topbar.TopBarController;
|
|
|
9
9
|
import com.reactnativenavigation.views.component.Component;
|
|
10
10
|
import com.reactnativenavigation.views.component.Renderable;
|
|
11
11
|
import com.reactnativenavigation.views.stack.topbar.ScrollDIsabledBehavior;
|
|
12
|
+
import com.reactnativenavigation.views.overlay.AttachedOverlayContainer;
|
|
12
13
|
|
|
13
14
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
14
15
|
|
|
@@ -17,18 +18,27 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
|
17
18
|
@SuppressLint("ViewConstructor")
|
|
18
19
|
public class StackLayout extends CoordinatorLayout implements Component {
|
|
19
20
|
private String stackId;
|
|
21
|
+
final private AttachedOverlayContainer attachedOverlayContainer ;
|
|
20
22
|
|
|
21
23
|
public StackLayout(Context context, TopBarController topBarController, String stackId) {
|
|
22
24
|
super(context);
|
|
23
25
|
this.stackId = stackId;
|
|
26
|
+
attachedOverlayContainer = new AttachedOverlayContainer(getContext());
|
|
24
27
|
createLayout(topBarController);
|
|
25
28
|
}
|
|
26
29
|
|
|
30
|
+
public AttachedOverlayContainer getAttachedOverlayContainer() {
|
|
31
|
+
return attachedOverlayContainer;
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
private void createLayout(TopBarController topBarController) {
|
|
28
35
|
View topBar = topBarController.createView(getContext(), this);
|
|
36
|
+
|
|
29
37
|
CoordinatorLayout.LayoutParams lp = new LayoutParams(MATCH_PARENT, UiUtils.getTopBarHeight(getContext()));
|
|
30
38
|
lp.setBehavior(new ScrollDIsabledBehavior());
|
|
31
39
|
addView(topBar, lp);
|
|
40
|
+
addView(attachedOverlayContainer,LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
|
|
41
|
+
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
public String getStackId() {
|
|
@@ -37,8 +47,8 @@ public class StackLayout extends CoordinatorLayout implements Component {
|
|
|
37
47
|
|
|
38
48
|
@Override
|
|
39
49
|
public boolean isRendered() {
|
|
40
|
-
return getChildCount() >=
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
return getChildCount() >= 3 &&
|
|
51
|
+
getChildAt(2) instanceof Renderable &&
|
|
52
|
+
((Renderable) getChildAt(2)).isRendered();
|
|
43
53
|
}
|
|
44
|
-
}
|
|
54
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/TopBar.java
CHANGED
|
@@ -31,7 +31,6 @@ import com.reactnativenavigation.options.params.Number;
|
|
|
31
31
|
import com.reactnativenavigation.options.params.ThemeColour;
|
|
32
32
|
import com.reactnativenavigation.options.parsers.TypefaceLoader;
|
|
33
33
|
import com.reactnativenavigation.utils.CompatUtils;
|
|
34
|
-
import com.reactnativenavigation.utils.ContextKt;
|
|
35
34
|
import com.reactnativenavigation.utils.UiUtils;
|
|
36
35
|
import com.reactnativenavigation.viewcontrollers.stack.topbar.TopBarCollapseBehavior;
|
|
37
36
|
import com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController;
|
|
@@ -5,7 +5,6 @@ import android.graphics.Typeface;
|
|
|
5
5
|
import android.view.ViewGroup;
|
|
6
6
|
import android.widget.TextView;
|
|
7
7
|
|
|
8
|
-
import com.reactnativenavigation.options.params.Colour;
|
|
9
8
|
import com.reactnativenavigation.options.params.Number;
|
|
10
9
|
import com.reactnativenavigation.options.params.ThemeColour;
|
|
11
10
|
import com.reactnativenavigation.utils.Functions.Func1;
|
|
@@ -133,6 +133,16 @@ export interface OptionsLayout {
|
|
|
133
133
|
* #### (iOS specific)
|
|
134
134
|
*/
|
|
135
135
|
autoHideHomeIndicator?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Add insets to the top layout
|
|
138
|
+
*/
|
|
139
|
+
insets?: Insets;
|
|
140
|
+
/**
|
|
141
|
+
* Resizes the layout when keyboard is visible
|
|
142
|
+
* @default true
|
|
143
|
+
* #### (Android specific)
|
|
144
|
+
*/
|
|
145
|
+
adjustResize?: boolean;
|
|
136
146
|
}
|
|
137
147
|
export declare enum OptionsModalPresentationStyle {
|
|
138
148
|
formSheet = "formSheet",
|
|
@@ -840,6 +850,10 @@ export interface ImageSystemSource {
|
|
|
840
850
|
}
|
|
841
851
|
export declare type ImageResource = ImageSourcePropType | string | ImageSystemSource;
|
|
842
852
|
export interface OptionsBottomTab {
|
|
853
|
+
/**
|
|
854
|
+
* Unique id in order to be found in the view hierarchy
|
|
855
|
+
*/
|
|
856
|
+
id?: string;
|
|
843
857
|
dotIndicator?: DotIndicatorOptions;
|
|
844
858
|
/**
|
|
845
859
|
* Set the text to display below the icon
|
|
@@ -1005,6 +1019,26 @@ export interface OverlayOptions {
|
|
|
1005
1019
|
* Set this to true if your Overlay contains a TextInput.
|
|
1006
1020
|
*/
|
|
1007
1021
|
handleKeyboardEvents?: boolean;
|
|
1022
|
+
/**
|
|
1023
|
+
* Attach overlay to anchor view in a certain layer of layout as a tooltip
|
|
1024
|
+
*/
|
|
1025
|
+
attach?: {
|
|
1026
|
+
/**
|
|
1027
|
+
* layout id to look for to add as a layer
|
|
1028
|
+
* which can be componentId or stackId or bottomTabsId.
|
|
1029
|
+
*/
|
|
1030
|
+
layoutId: string;
|
|
1031
|
+
anchor?: {
|
|
1032
|
+
/**
|
|
1033
|
+
* Anchor view id, TopBar Button, Title Component, BottomTab.
|
|
1034
|
+
*/
|
|
1035
|
+
id: string;
|
|
1036
|
+
/**
|
|
1037
|
+
* The anchor view side that the tooltip will be displayed.
|
|
1038
|
+
*/
|
|
1039
|
+
gravity: 'top' | 'left' | 'right' | 'bottom';
|
|
1040
|
+
};
|
|
1041
|
+
};
|
|
1008
1042
|
}
|
|
1009
1043
|
export interface ModalOptions {
|
|
1010
1044
|
/**
|
|
@@ -58,6 +58,15 @@
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
- (void)applyOptions:(RNNNavigationOptions *)options {
|
|
61
|
+
UIViewController *viewController = self.boundViewController;
|
|
62
|
+
RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
|
|
63
|
+
if (withDefault.layout.insets.hasValue) {
|
|
64
|
+
viewController.topMostViewController.additionalSafeAreaInsets =
|
|
65
|
+
UIEdgeInsetsMake([withDefault.layout.insets.top withDefault:0],
|
|
66
|
+
[withDefault.layout.insets.left withDefault:0],
|
|
67
|
+
[withDefault.layout.insets.bottom withDefault:0],
|
|
68
|
+
[withDefault.layout.insets.right withDefault:0]);
|
|
69
|
+
}
|
|
61
70
|
}
|
|
62
71
|
|
|
63
72
|
- (void)mergeOptions:(RNNNavigationOptions *)mergeOptions
|
|
@@ -83,6 +92,14 @@
|
|
|
83
92
|
_prefersHomeIndicatorAutoHidden = mergeOptions.layout.autoHideHomeIndicator.get;
|
|
84
93
|
[self.boundViewController setNeedsUpdateOfHomeIndicatorAutoHidden];
|
|
85
94
|
}
|
|
95
|
+
|
|
96
|
+
if (mergeOptions.layout.insets.hasValue) {
|
|
97
|
+
self.boundViewController.topMostViewController.additionalSafeAreaInsets =
|
|
98
|
+
UIEdgeInsetsMake([withDefault.layout.insets.top withDefault:0],
|
|
99
|
+
[withDefault.layout.insets.left withDefault:0],
|
|
100
|
+
[withDefault.layout.insets.bottom withDefault:0],
|
|
101
|
+
[withDefault.layout.insets.right withDefault:0]);
|
|
102
|
+
}
|
|
86
103
|
}
|
|
87
104
|
|
|
88
105
|
- (void)renderComponents:(RNNNavigationOptions *)options
|
|
@@ -111,6 +111,11 @@
|
|
|
111
111
|
[self updateReactViewConstraints];
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
- (void)viewDidLayoutSubviews {
|
|
115
|
+
[super viewDidLayoutSubviews];
|
|
116
|
+
[self.presenter applyOptionsOnViewDidLayoutSubviews:self.resolveOptions];
|
|
117
|
+
}
|
|
118
|
+
|
|
114
119
|
- (void)updateReactViewConstraints {
|
|
115
120
|
if (self.isViewLoaded && self.reactView) {
|
|
116
121
|
[NSLayoutConstraint deactivateConstraints:_reactViewConstraints];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
#import "RNNInsetsOptions.h"
|
|
1
2
|
#import "RNNOptions.h"
|
|
2
|
-
|
|
3
3
|
@interface RNNLayoutOptions : RNNOptions
|
|
4
4
|
|
|
5
5
|
@property(nonatomic, strong) Color *backgroundColor;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
@property(nonatomic, strong) Text *direction;
|
|
8
8
|
@property(nonatomic, strong) id orientation;
|
|
9
9
|
@property(nonatomic, strong) Bool *autoHideHomeIndicator;
|
|
10
|
+
@property(nonatomic, strong) RNNInsetsOptions *insets;
|
|
10
11
|
|
|
11
12
|
- (UIInterfaceOrientationMask)supportedOrientations;
|
|
12
13
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
self.direction = [TextParser parse:dict key:@"direction"];
|
|
12
12
|
self.orientation = dict[@"orientation"];
|
|
13
13
|
self.autoHideHomeIndicator = [BoolParser parse:dict key:@"autoHideHomeIndicator"];
|
|
14
|
+
self.insets = [[RNNInsetsOptions alloc] initWithDict:dict[@"insets"]];
|
|
14
15
|
return self;
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -25,6 +26,9 @@
|
|
|
25
26
|
self.orientation = options.orientation;
|
|
26
27
|
if (options.autoHideHomeIndicator)
|
|
27
28
|
self.autoHideHomeIndicator = options.autoHideHomeIndicator;
|
|
29
|
+
if (options.insets.hasValue) {
|
|
30
|
+
self.insets = options.insets;
|
|
31
|
+
}
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
- (UIInterfaceOrientationMask)supportedOrientations {
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
- (void)applyOptionsOnViewDidLayoutSubviews:(RNNNavigationOptions *)options {
|
|
91
|
+
[super applyOptionsOnViewDidLayoutSubviews:options];
|
|
91
92
|
RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
|
|
92
93
|
if (withDefault.topBar.background.component.name.hasValue) {
|
|
93
94
|
[self presentBackgroundComponent];
|
|
@@ -180,6 +180,18 @@ export interface OptionsLayout {
|
|
|
180
180
|
* #### (iOS specific)
|
|
181
181
|
*/
|
|
182
182
|
autoHideHomeIndicator?: boolean;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Add insets to the top layout
|
|
186
|
+
*/
|
|
187
|
+
insets?: Insets;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Resizes the layout when keyboard is visible
|
|
191
|
+
* @default true
|
|
192
|
+
* #### (Android specific)
|
|
193
|
+
*/
|
|
194
|
+
adjustResize?: boolean;
|
|
183
195
|
}
|
|
184
196
|
|
|
185
197
|
export enum OptionsModalPresentationStyle {
|
|
@@ -920,6 +932,11 @@ export interface ImageSystemSource {
|
|
|
920
932
|
export type ImageResource = ImageSourcePropType | string | ImageSystemSource;
|
|
921
933
|
|
|
922
934
|
export interface OptionsBottomTab {
|
|
935
|
+
/**
|
|
936
|
+
* Unique id in order to be found in the view hierarchy
|
|
937
|
+
*/
|
|
938
|
+
id?: string;
|
|
939
|
+
|
|
923
940
|
dotIndicator?: DotIndicatorOptions;
|
|
924
941
|
|
|
925
942
|
/**
|
|
@@ -1089,6 +1106,27 @@ export interface OverlayOptions {
|
|
|
1089
1106
|
* Set this to true if your Overlay contains a TextInput.
|
|
1090
1107
|
*/
|
|
1091
1108
|
handleKeyboardEvents?: boolean;
|
|
1109
|
+
|
|
1110
|
+
/**
|
|
1111
|
+
* Attach overlay to anchor view in a certain layer of layout as a tooltip
|
|
1112
|
+
*/
|
|
1113
|
+
attach?: {
|
|
1114
|
+
/**
|
|
1115
|
+
* layout id to look for to add as a layer
|
|
1116
|
+
* which can be componentId or stackId or bottomTabsId.
|
|
1117
|
+
*/
|
|
1118
|
+
layoutId: string;
|
|
1119
|
+
anchor?: {
|
|
1120
|
+
/**
|
|
1121
|
+
* Anchor view id, TopBar Button, Title Component, BottomTab.
|
|
1122
|
+
*/
|
|
1123
|
+
id: string;
|
|
1124
|
+
/**
|
|
1125
|
+
* The anchor view side that the tooltip will be displayed.
|
|
1126
|
+
*/
|
|
1127
|
+
gravity: 'top' | 'left' | 'right' | 'bottom';
|
|
1128
|
+
};
|
|
1129
|
+
};
|
|
1092
1130
|
}
|
|
1093
1131
|
|
|
1094
1132
|
export interface ModalOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-navigation",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.25.0-snapshot.543",
|
|
4
4
|
"description": "React Native Navigation - truly native navigation for iOS and Android",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"nativePackage": true,
|
|
@@ -66,6 +66,8 @@
|
|
|
66
66
|
"tslib": "1.9.3"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
+
"pixelmatch": "^5.2.1",
|
|
70
|
+
"pngjs": "^6.0.0",
|
|
69
71
|
"@babel/plugin-proposal-export-default-from": "7.10.1",
|
|
70
72
|
"@babel/plugin-proposal-export-namespace-from": "7.10.1",
|
|
71
73
|
"@babel/types": "7.15.6",
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation.options;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
|
|
5
|
-
import com.reactnativenavigation.options.params.NullNumber;
|
|
6
|
-
import com.reactnativenavigation.options.params.Number;
|
|
7
|
-
import com.reactnativenavigation.options.params.ThemeColour;
|
|
8
|
-
import com.reactnativenavigation.options.params.NullThemeColour;
|
|
9
|
-
import com.reactnativenavigation.options.parsers.NumberParser;
|
|
10
|
-
|
|
11
|
-
import org.json.JSONObject;
|
|
12
|
-
|
|
13
|
-
public class LayoutOptions {
|
|
14
|
-
public static LayoutOptions parse(Context context, JSONObject json) {
|
|
15
|
-
LayoutOptions result = new LayoutOptions();
|
|
16
|
-
if (json == null) return result;
|
|
17
|
-
|
|
18
|
-
result.backgroundColor = ThemeColour.parse(context, json.optJSONObject("backgroundColor"));
|
|
19
|
-
result.componentBackgroundColor = ThemeColour.parse(context, json.optJSONObject("componentBackgroundColor"));
|
|
20
|
-
result.topMargin = NumberParser.parse(json, "topMargin");
|
|
21
|
-
result.orientation = OrientationOptions.parse(json);
|
|
22
|
-
result.direction = LayoutDirection.fromString(json.optString("direction", ""));
|
|
23
|
-
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public ThemeColour backgroundColor = new NullThemeColour();
|
|
28
|
-
public ThemeColour componentBackgroundColor = new NullThemeColour();
|
|
29
|
-
public Number topMargin = new NullNumber();
|
|
30
|
-
public OrientationOptions orientation = new OrientationOptions();
|
|
31
|
-
public LayoutDirection direction = LayoutDirection.DEFAULT;
|
|
32
|
-
|
|
33
|
-
public void mergeWith(LayoutOptions other) {
|
|
34
|
-
if (other.backgroundColor.hasValue()) backgroundColor = other.backgroundColor;
|
|
35
|
-
if (other.componentBackgroundColor.hasValue()) componentBackgroundColor = other.componentBackgroundColor;
|
|
36
|
-
if (other.topMargin.hasValue()) topMargin = other.topMargin;
|
|
37
|
-
if (other.orientation.hasValue()) orientation = other.orientation;
|
|
38
|
-
if (other.direction.hasValue()) direction = other.direction;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public void mergeWithDefault(LayoutOptions defaultOptions) {
|
|
42
|
-
if (!backgroundColor.hasValue()) backgroundColor = defaultOptions.backgroundColor;
|
|
43
|
-
if (!componentBackgroundColor.hasValue()) componentBackgroundColor = defaultOptions.componentBackgroundColor;
|
|
44
|
-
if (!topMargin.hasValue()) topMargin = defaultOptions.topMargin;
|
|
45
|
-
if (!orientation.hasValue()) orientation = defaultOptions.orientation;
|
|
46
|
-
if (!direction.hasValue()) direction = defaultOptions.direction;
|
|
47
|
-
}
|
|
48
|
-
}
|