Browse Source

fixed compiling

Daniel Zlotin 8 years ago
parent
commit
41b1be87e7

+ 7
- 5
android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java View File

@@ -1,7 +1,7 @@
1 1
 package com.reactnativenavigation.layouts;
2 2
 
3
-import android.content.Context;
4 3
 import android.graphics.Color;
4
+import android.support.v7.app.AppCompatActivity;
5 5
 import android.view.View;
6 6
 import android.widget.RelativeLayout;
7 7
 
@@ -22,13 +22,15 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
22 22
 
23 23
 public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottomNavigation.OnTabSelectedListener {
24 24
 
25
+    private final AppCompatActivity activity;
25 26
     private ActivityParams params;
26 27
     private BottomTabs bottomTabs;
27 28
     private ArrayList<ScreenStack> screenStacks;
28 29
     private int currentStackIndex = 0;
29 30
 
30
-    public BottomTabsLayout(Context context, ActivityParams params) {
31
-        super(context);
31
+    public BottomTabsLayout(AppCompatActivity activity, ActivityParams params) {
32
+        super(activity);
33
+        this.activity = activity;
32 34
         this.params = params;
33 35
         screenStacks = new ArrayList<>();
34 36
         createLayout();
@@ -66,7 +68,7 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
66 68
 
67 69
     private void addTabs() {
68 70
         for (ScreenParams screenParams : params.tabParams) {
69
-            ScreenStack stack = new ScreenStack(getContext(), screenParams);
71
+            ScreenStack stack = new ScreenStack(activity, screenParams);
70 72
             screenStacks.add(stack);
71 73
 
72 74
             AHBottomNavigationItem item = new AHBottomNavigationItem(screenParams.title, screenParams.tabIcon,
@@ -135,7 +137,7 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
135 137
         currentScreenStack.destroy();
136 138
         removeView(currentScreenStack);
137 139
 
138
-        ScreenStack newStack = new ScreenStack(getContext(), params);
140
+        ScreenStack newStack = new ScreenStack(activity, params);
139 141
         screenStacks.set(currentStackIndex, newStack);
140 142
         addView(newStack, 0, new RelativeLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
141 143
     }

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/layouts/LayoutFactory.java View File

@@ -19,7 +19,7 @@ public class LayoutFactory {
19 19
         return new SingleScreenLayout(activity, params.screenParams);
20 20
     }
21 21
 
22
-    private static Layout createBottomTabsScreenLayout(Activity activity, ActivityParams params) {
22
+    private static Layout createBottomTabsScreenLayout(AppCompatActivity activity, ActivityParams params) {
23 23
         return new BottomTabsLayout(activity, params);
24 24
     }
25 25
 //