|
@@ -1,17 +1,51 @@
|
1
|
1
|
package com.reactnativenavigation.layouts;
|
2
|
2
|
|
3
|
3
|
import android.content.Context;
|
|
4
|
+import android.os.Bundle;
|
4
|
5
|
import android.widget.LinearLayout;
|
5
|
6
|
|
6
|
|
-public class ScreenLayout extends LinearLayout {
|
|
7
|
+import com.facebook.react.ReactInstanceManager;
|
|
8
|
+import com.reactnativenavigation.views.ContentView;
|
|
9
|
+import com.reactnativenavigation.views.ScrollDirectionListener;
|
7
|
10
|
|
8
|
|
- public static class Params {
|
|
11
|
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
12
|
+import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
9
|
13
|
|
10
|
|
- }
|
|
14
|
+public class ScreenLayout extends LinearLayout implements ScrollDirectionListener.OnScrollChanged {
|
|
15
|
+
|
|
16
|
+ private final ReactInstanceManager reactInstanceManager;
|
|
17
|
+ private final String moduleName;
|
|
18
|
+ private final Bundle passProps;
|
|
19
|
+ private ContentView contentView;
|
|
20
|
+ private TopBar topBar;
|
11
|
21
|
|
12
|
|
- public ScreenLayout(Context context, Params params) {
|
|
22
|
+ public ScreenLayout(Context context, ReactInstanceManager reactInstanceManager, String moduleName, Bundle passProps) {
|
13
|
23
|
super(context);
|
|
24
|
+ this.reactInstanceManager = reactInstanceManager;
|
|
25
|
+ this.moduleName = moduleName;
|
|
26
|
+ this.passProps = passProps;
|
14
|
27
|
setOrientation(VERTICAL);
|
15
|
|
- addView();
|
|
28
|
+
|
|
29
|
+ createViews();
|
|
30
|
+ }
|
|
31
|
+
|
|
32
|
+ private void createViews() {
|
|
33
|
+ addTopBar();
|
|
34
|
+ addContentView();
|
|
35
|
+ }
|
|
36
|
+
|
|
37
|
+ private void addTopBar() {
|
|
38
|
+ topBar = new TopBar(getContext());
|
|
39
|
+ addView(topBar, new LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+ private void addContentView() {
|
|
43
|
+ contentView = new ContentView(getContext(), reactInstanceManager, moduleName, passProps, this);
|
|
44
|
+ addView(contentView, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
|
|
45
|
+ }
|
|
46
|
+
|
|
47
|
+ @Override
|
|
48
|
+ public void onScrollChanged(ScrollDirectionListener.Direction direction) {
|
|
49
|
+
|
16
|
50
|
}
|
17
|
51
|
}
|