Explorar el Código

Initial commit

Use custom BottomNavigation view.
change BottomTabActivity layout, content frame is now being drawn
behind BottomTabs.
Guy Carmeli hace 8 años
padre
commit
9c7f5efd45

+ 6
- 0
android/app/src/main/java/com/reactnativenavigation/activities/BottomTabActivity.java Ver fichero

78
         StyleHelper.updateStyles(mToolbar, initialScreen);
78
         StyleHelper.updateStyles(mToolbar, initialScreen);
79
     }
79
     }
80
 
80
 
81
+    private void setupBottomTabs(Screen initialScreen) {
82
+        if (initialScreen.bottomTabsHiddenOnScroll) {
83
+
84
+        }
85
+    }
86
+
81
     @Override
87
     @Override
82
     protected void onResume() {
88
     protected void onResume() {
83
         super.onResume();
89
         super.onResume();

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

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

+ 33
- 0
android/app/src/main/java/com/reactnativenavigation/views/BottomNavigation.java Ver fichero

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 Ver fichero

27
         android:layout_height="0dp"
27
         android:layout_height="0dp"
28
         android:layout_weight="1">
28
         android:layout_weight="1">
29
 
29
 
30
-        <android.support.design.widget.CoordinatorLayout
31
-            android:id="@+id/contentFrame"
30
+        <RelativeLayout
32
             android:layout_width="match_parent"
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
         <FrameLayout
45
         <FrameLayout
37
             android:id="@+id/drawerFrame"
46
             android:id="@+id/drawerFrame"
40
             android:layout_gravity="start" />
49
             android:layout_gravity="start" />
41
     </android.support.v4.widget.DrawerLayout>
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
 </LinearLayout>
52
 </LinearLayout>