Browse Source

initial commit for AppLayout

Guy Carmeli 8 years ago
parent
commit
2ecae6bc8b

+ 4
- 3
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java View File

@@ -8,7 +8,7 @@ import android.view.KeyEvent;
8 8
 
9 9
 import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
10 10
 import com.reactnativenavigation.NavigationApplication;
11
-import com.reactnativenavigation.layouts.ScreenLayout;
11
+import com.reactnativenavigation.layouts.SingleScreenLayout;
12 12
 import com.reactnativenavigation.params.ActivityParams;
13 13
 import com.reactnativenavigation.params.parsers.ActivityParamsParser;
14 14
 import com.reactnativenavigation.react.JsDevReloadHandler;
@@ -42,8 +42,9 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
42 42
     }
43 43
 
44 44
     private void createLayout() {
45
-        ScreenLayout screenLayout = new ScreenLayout(this, activityParams.screenParams);
46
-        setContentView(screenLayout);
45
+        SingleScreenLayout singleScreenLayout = new SingleScreenLayout(this, activityParams.screenParams);
46
+        singleScreenLayout.createLayout();
47
+        setContentView(singleScreenLayout);
47 48
     }
48 49
 
49 50
     @Override

+ 21
- 0
android/app/src/main/java/com/reactnativenavigation/layouts/SingleScreenLayout.java View File

@@ -0,0 +1,21 @@
1
+package com.reactnativenavigation.layouts;
2
+
3
+import android.content.Context;
4
+import android.widget.FrameLayout;
5
+
6
+import com.reactnativenavigation.params.ScreenParams;
7
+
8
+public class SingleScreenLayout extends FrameLayout {
9
+
10
+    private final ScreenParams screenParams;
11
+
12
+    public SingleScreenLayout(Context context, ScreenParams screenParams) {
13
+        super(context);
14
+        this.screenParams = screenParams;
15
+    }
16
+
17
+    public void createLayout() {
18
+        ScreenLayout screenLayout = new ScreenLayout(getContext(), screenParams);
19
+        addView(screenLayout);
20
+    }
21
+}