-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathTopTabOptions.java
More file actions
36 lines (28 loc) · 1.22 KB
/
TopTabOptions.java
File metadata and controls
36 lines (28 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.reactnativenavigation.options;
import android.graphics.Typeface;
import androidx.annotation.Nullable;
import com.reactnativenavigation.options.params.NullText;
import com.reactnativenavigation.options.params.Text;
import com.reactnativenavigation.options.parsers.TextParser;
import com.reactnativenavigation.options.parsers.TypefaceLoader;
import org.json.JSONObject;
public class TopTabOptions {
public Text title = new NullText();
@Nullable public Typeface fontFamily;
public int tabIndex;
public static TopTabOptions parse(TypefaceLoader typefaceManager, JSONObject json) {
TopTabOptions result = new TopTabOptions();
if (json == null) return result;
result.title = TextParser.parse(json, "title");
result.fontFamily = typefaceManager.getTypeFace(json.optString("titleFontFamily"), null, null);
return result;
}
void mergeWith(TopTabOptions other) {
if (other.title.hasValue()) title = other.title;
if (other.fontFamily != null) fontFamily = other.fontFamily;
if (other.tabIndex >= 0) tabIndex = other.tabIndex;
}
void mergeWithDefault(TopTabOptions other) {
if (fontFamily == null) fontFamily = other.fontFamily;
}
}