|
@@ -0,0 +1,35 @@
|
|
1
|
+package com.reactnativenavigation.params.parsers;
|
|
2
|
+
|
|
3
|
+import android.os.Bundle;
|
|
4
|
+import android.support.annotation.NonNull;
|
|
5
|
+
|
|
6
|
+import com.reactnativenavigation.params.TopTabParams;
|
|
7
|
+
|
|
8
|
+import java.util.ArrayList;
|
|
9
|
+import java.util.List;
|
|
10
|
+
|
|
11
|
+public class TopTabParamsParser extends Parser {
|
|
12
|
+ private static final String KEY_SCREEN_ID = "screenId";
|
|
13
|
+ private static final String KEY_SCREEN_INSTANCE_ID = "screenInstanceID";
|
|
14
|
+ private static final String KEY_TITLE = "title";
|
|
15
|
+ private static final String KEY_PROPS = "passProps";
|
|
16
|
+
|
|
17
|
+ @SuppressWarnings("ConstantConditions")
|
|
18
|
+ public static List<TopTabParams> parse(Bundle params) {
|
|
19
|
+ List<TopTabParams> result = new ArrayList<>();
|
|
20
|
+ for (String key : params.keySet()) {
|
|
21
|
+ result.add(parseItem(params.getBundle(key)));
|
|
22
|
+ }
|
|
23
|
+ return result;
|
|
24
|
+ }
|
|
25
|
+
|
|
26
|
+ @NonNull
|
|
27
|
+ private static TopTabParams parseItem(Bundle params) {
|
|
28
|
+ TopTabParams result = new TopTabParams();
|
|
29
|
+ result.screenId = params.getString(KEY_SCREEN_ID);
|
|
30
|
+ result.screenInstanceId = params.getString(KEY_SCREEN_INSTANCE_ID);
|
|
31
|
+ result.title = params.getString(KEY_TITLE);
|
|
32
|
+ result.passProps = params.getBundle(KEY_PROPS);
|
|
33
|
+ return result;
|
|
34
|
+ }
|
|
35
|
+}
|