|
@@ -1,29 +1,40 @@
|
1
|
1
|
package com.reactnativenavigation.parse;
|
2
|
2
|
|
|
3
|
+import android.support.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+import com.reactnativenavigation.parse.params.Bool;
|
|
6
|
+import com.reactnativenavigation.parse.params.NullBool;
|
|
7
|
+import com.reactnativenavigation.parse.parsers.BoolParser;
|
|
8
|
+
|
3
|
9
|
import org.json.JSONObject;
|
4
|
10
|
|
5
|
11
|
public class ModalOptions {
|
6
|
12
|
|
7
|
|
- public static ModalOptions parse(JSONObject json) {
|
|
13
|
+ public static ModalOptions parse(final JSONObject json) {
|
8
|
14
|
ModalOptions options = new ModalOptions();
|
9
|
15
|
if (json == null) return options;
|
10
|
16
|
|
11
|
17
|
options.presentationStyle = ModalPresentationStyle.fromString(json.optString("modalPresentationStyle"));
|
|
18
|
+ options.blurOnUnmount = BoolParser.parse(json, "blurOnUnmount");
|
12
|
19
|
|
13
|
20
|
return options;
|
14
|
21
|
}
|
15
|
22
|
|
16
|
23
|
public ModalPresentationStyle presentationStyle = ModalPresentationStyle.Unspecified;
|
|
24
|
+ public @NonNull Bool blurOnUnmount = new NullBool();
|
17
|
25
|
|
18
|
|
- public void mergeWith(ModalOptions other) {
|
19
|
|
- if (other.hasValue()) presentationStyle = other.presentationStyle;
|
|
26
|
+ public void mergeWith(final ModalOptions other) {
|
|
27
|
+ if (other.presentationStyleHasValue()) presentationStyle = other.presentationStyle;
|
|
28
|
+ if (other.blurOnUnmount.hasValue()) blurOnUnmount = other.blurOnUnmount;
|
20
|
29
|
}
|
21
|
30
|
|
22
|
|
- private boolean hasValue() {
|
|
31
|
+ private boolean presentationStyleHasValue() {
|
23
|
32
|
return presentationStyle != ModalPresentationStyle.Unspecified;
|
24
|
33
|
}
|
25
|
34
|
|
26
|
|
- public void mergeWithDefault(ModalOptions defaultOptions) {
|
27
|
|
- if (!hasValue()) presentationStyle = defaultOptions.presentationStyle;
|
|
35
|
+ public void mergeWithDefault(final ModalOptions defaultOptions) {
|
|
36
|
+ if (!presentationStyleHasValue()) presentationStyle = defaultOptions.presentationStyle;
|
|
37
|
+ if (!blurOnUnmount.hasValue()) blurOnUnmount = defaultOptions.blurOnUnmount;
|
28
|
38
|
}
|
|
39
|
+
|
29
|
40
|
}
|