|
@@ -1,7 +1,6 @@
|
1
|
1
|
package com.reactnativenavigation.parse.params;
|
2
|
2
|
|
3
|
3
|
import android.graphics.Typeface;
|
4
|
|
-import androidx.annotation.Nullable;
|
5
|
4
|
import android.view.MenuItem;
|
6
|
5
|
|
7
|
6
|
import com.reactnativenavigation.parse.Component;
|
|
@@ -18,10 +17,13 @@ import org.json.JSONObject;
|
18
|
17
|
import java.util.ArrayList;
|
19
|
18
|
import java.util.Objects;
|
20
|
19
|
|
|
20
|
+import androidx.annotation.Nullable;
|
|
21
|
+
|
21
|
22
|
public class Button {
|
22
|
23
|
public String instanceId = "btn" + CompatUtils.generateViewId();
|
23
|
24
|
|
24
|
25
|
@Nullable public String id;
|
|
26
|
+ public Text accessibilityLabel = new NullText();
|
25
|
27
|
public Text text = new NullText();
|
26
|
28
|
public Bool enabled = new NullBool();
|
27
|
29
|
public Bool disableIconTint = new NullBool();
|
|
@@ -37,6 +39,7 @@ public class Button {
|
37
|
39
|
|
38
|
40
|
public boolean equals(Button other) {
|
39
|
41
|
return Objects.equals(id, other.id) &&
|
|
42
|
+ accessibilityLabel.equals(other.accessibilityLabel) &&
|
40
|
43
|
text.equals(other.text) &&
|
41
|
44
|
enabled.equals(other.enabled) &&
|
42
|
45
|
disableIconTint.equals(other.disableIconTint) &&
|
|
@@ -54,6 +57,7 @@ public class Button {
|
54
|
57
|
private static Button parseJson(JSONObject json, TypefaceLoader typefaceManager) {
|
55
|
58
|
Button button = new Button();
|
56
|
59
|
button.id = json.optString("id");
|
|
60
|
+ button.accessibilityLabel = TextParser.parse(json, "accessibilityLabel");
|
57
|
61
|
button.text = TextParser.parse(json, "text");
|
58
|
62
|
button.enabled = BoolParser.parse(json, "enabled");
|
59
|
63
|
button.disableIconTint = BoolParser.parse(json, "disableIconTint");
|
|
@@ -133,6 +137,7 @@ public class Button {
|
133
|
137
|
|
134
|
138
|
public void mergeWith(Button other) {
|
135
|
139
|
if (other.text.hasValue()) text = other.text;
|
|
140
|
+ if (other.accessibilityLabel.hasValue()) accessibilityLabel = other.accessibilityLabel;
|
136
|
141
|
if (other.enabled.hasValue()) enabled = other.enabled;
|
137
|
142
|
if (other.disableIconTint.hasValue()) disableIconTint = other.disableIconTint;
|
138
|
143
|
if (other.color.hasValue()) color = other.color;
|
|
@@ -150,6 +155,7 @@ public class Button {
|
150
|
155
|
|
151
|
156
|
public void mergeWithDefault(Button defaultOptions) {
|
152
|
157
|
if (!text.hasValue()) text = defaultOptions.text;
|
|
158
|
+ if (!accessibilityLabel.hasValue()) accessibilityLabel = defaultOptions.accessibilityLabel;
|
153
|
159
|
if (!enabled.hasValue()) enabled = defaultOptions.enabled;
|
154
|
160
|
if (!disableIconTint.hasValue()) disableIconTint = defaultOptions.disableIconTint;
|
155
|
161
|
if (!color.hasValue()) color = defaultOptions.color;
|