Procházet zdrojové kódy

Initial commit

Use custom BottomNavigation view.
change BottomTabActivity layout, content frame is now being drawn
behind BottomTabs.
Guy Carmeli před 8 roky
rodič
revize
9c7f5efd45

+ 6
- 0
android/app/src/main/java/com/reactnativenavigation/activities/BottomTabActivity.java Zobrazit soubor

@@ -78,6 +78,12 @@ public class BottomTabActivity extends BaseReactActivity implements AHBottomNavi
78 78
         StyleHelper.updateStyles(mToolbar, initialScreen);
79 79
     }
80 80
 
81
+    private void setupBottomTabs(Screen initialScreen) {
82
+        if (initialScreen.bottomTabsHiddenOnScroll) {
83
+
84
+        }
85
+    }
86
+
81 87
     @Override
82 88
     protected void onResume() {
83 89
         super.onResume();

+ 3
- 0
android/app/src/main/java/com/reactnativenavigation/core/objects/Screen.java Zobrazit soubor

@@ -44,6 +44,7 @@ public class Screen extends JsonObject implements Serializable {
44 44
     private static final String KEY_TAB_SELECTED_TEXT_COLOR = "tabSelectedTextColor";
45 45
     private static final String KEY_TAB_INDICATOR_COLOR = "tabIndicatorColor";
46 46
     private static final String KEY_BOTTOM_TABS_HIDDEN = "tabBarHidden";
47
+    private static final String KEY_BOTTOM_TABS_HIDDEN_ON_SCROLL = "bottomTabsHiddenOnScroll";
47 48
     private static final String KEY_PROPS = "passProps";
48 49
 
49 50
     public String title;
@@ -55,6 +56,7 @@ public class Screen extends JsonObject implements Serializable {
55 56
     public final String icon;
56 57
     public ArrayList<Button> buttons;
57 58
     public final boolean backButtonHidden;
59
+    public final boolean bottomTabsHiddenOnScroll;
58 60
     public HashMap<String, Object> passedProps = new HashMap<>();
59 61
 
60 62
     // Navigation styling
@@ -87,6 +89,7 @@ public class Screen extends JsonObject implements Serializable {
87 89
         }
88 90
         buttons = getButtons(screen);
89 91
         backButtonHidden = getBoolean(screen, KEY_BACK_BUTTON_HIDDEN);
92
+        bottomTabsHiddenOnScroll = getBoolean(screen, KEY_BOTTOM_TABS_HIDDEN_ON_SCROLL);
90 93
         setToolbarStyle(screen);
91 94
     }
92 95
 

+ 33
- 0
android/app/src/main/java/com/reactnativenavigation/views/BottomNavigation.java Zobrazit soubor

@@ -0,0 +1,33 @@
1
+package com.reactnativenavigation.views;
2
+
3
+import android.content.Context;
4
+import android.util.AttributeSet;
5
+
6
+import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
7
+
8
+/**
9
+ * Created by guyc on 10/07/16.
10
+ */
11
+public class BottomNavigation extends AHBottomNavigation {
12
+
13
+    public BottomNavigation(Context context) {
14
+        super(context);
15
+    }
16
+
17
+    public BottomNavigation(Context context, AttributeSet attrs) {
18
+        super(context, attrs);
19
+    }
20
+
21
+    public BottomNavigation(Context context, AttributeSet attrs, int defStyleAttr) {
22
+        super(context, attrs, defStyleAttr);
23
+    }
24
+
25
+    /**
26
+     * Synchronize the BottomNavigation with a {@link android.widget.ScrollView}. When
27
+     */
28
+    public void setupWithScrollView() {
29
+
30
+    }
31
+
32
+
33
+}

+ 13
- 9
android/app/src/main/res/layout/bottom_tab_activity.xml Zobrazit soubor

@@ -27,11 +27,20 @@
27 27
         android:layout_height="0dp"
28 28
         android:layout_weight="1">
29 29
 
30
-        <android.support.design.widget.CoordinatorLayout
31
-            android:id="@+id/contentFrame"
30
+        <RelativeLayout
32 31
             android:layout_width="match_parent"
33
-            android:layout_height="0dp"
34
-            android:layout_weight="1" />
32
+            android:layout_height="match_parent">
33
+            <android.support.design.widget.CoordinatorLayout
34
+                android:id="@+id/contentFrame"
35
+                android:layout_width="match_parent"
36
+                android:layout_height="match_parent" />
37
+
38
+            <com.reactnativenavigation.views.BottomNavigation
39
+                android:id="@+id/bottom_tab_bar"
40
+                android:layout_width="match_parent"
41
+                android:layout_height="wrap_content"
42
+                android:layout_alignParentBottom="true" />
43
+        </RelativeLayout>
35 44
 
36 45
         <FrameLayout
37 46
             android:id="@+id/drawerFrame"
@@ -40,9 +49,4 @@
40 49
             android:layout_gravity="start" />
41 50
     </android.support.v4.widget.DrawerLayout>
42 51
 
43
-    <com.aurelhubert.ahbottomnavigation.AHBottomNavigation
44
-        android:id="@+id/bottom_tab_bar"
45
-        android:layout_width="match_parent"
46
-        android:layout_height="wrap_content" />
47
-
48 52
 </LinearLayout>