Browse Source

converted layouts to CoordinatorLayout

Daniel Zlotin 8 years ago
parent
commit
be932b849b

+ 3
- 4
android/app/src/main/java/com/reactnativenavigation/activities/BottomTabActivity.java View File

4
 import android.graphics.drawable.Drawable;
4
 import android.graphics.drawable.Drawable;
5
 import android.os.AsyncTask;
5
 import android.os.AsyncTask;
6
 import android.os.Bundle;
6
 import android.os.Bundle;
7
-import android.view.Menu;
7
+import android.support.design.widget.CoordinatorLayout;
8
 import android.view.View;
8
 import android.view.View;
9
-import android.widget.FrameLayout;
10
 
9
 
11
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
10
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
12
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;
11
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;
38
     private static boolean DEFAULT_TAB_INACTIVE_TITLES = true;
37
     private static boolean DEFAULT_TAB_INACTIVE_TITLES = true;
39
 
38
 
40
     private AHBottomNavigation mBottomNavigation;
39
     private AHBottomNavigation mBottomNavigation;
41
-    private FrameLayout mContentFrame;
40
+    private CoordinatorLayout mContentFrame;
42
     private ArrayList<ScreenStack> mScreenStacks;
41
     private ArrayList<ScreenStack> mScreenStacks;
43
     private int mCurrentStackPosition = -1;
42
     private int mCurrentStackPosition = -1;
44
 
43
 
50
         setContentView(R.layout.bottom_tab_activity);
49
         setContentView(R.layout.bottom_tab_activity);
51
         mToolbar = (RnnToolBar) findViewById(R.id.toolbar);
50
         mToolbar = (RnnToolBar) findViewById(R.id.toolbar);
52
         mBottomNavigation = (AHBottomNavigation) findViewById(R.id.bottom_tab_bar);
51
         mBottomNavigation = (AHBottomNavigation) findViewById(R.id.bottom_tab_bar);
53
-        mContentFrame = (FrameLayout) findViewById(R.id.contentFrame);
52
+        mContentFrame = (CoordinatorLayout) findViewById(R.id.contentFrame);
54
 
53
 
55
         final ArrayList<Screen> screens = (ArrayList<Screen>) getIntent().getSerializableExtra(EXTRA_SCREENS);
54
         final ArrayList<Screen> screens = (ArrayList<Screen>) getIntent().getSerializableExtra(EXTRA_SCREENS);
56
         final Drawer drawer = (Drawer) getIntent().getSerializableExtra(DRAWER_PARAMS);
55
         final Drawer drawer = (Drawer) getIntent().getSerializableExtra(DRAWER_PARAMS);

+ 2
- 2
android/app/src/main/java/com/reactnativenavigation/activities/SingleScreenActivity.java View File

1
 package com.reactnativenavigation.activities;
1
 package com.reactnativenavigation.activities;
2
 
2
 
3
-import android.widget.FrameLayout;
3
+import android.support.design.widget.CoordinatorLayout;
4
 
4
 
5
 import com.reactnativenavigation.R;
5
 import com.reactnativenavigation.R;
6
 import com.reactnativenavigation.core.RctManager;
6
 import com.reactnativenavigation.core.RctManager;
34
         setupDrawer(screen, drawer, R.id.drawerFrame, R.id.drawerLayout);
34
         setupDrawer(screen, drawer, R.id.drawerFrame, R.id.drawerLayout);
35
 
35
 
36
         mScreenStack = new ScreenStack(this);
36
         mScreenStack = new ScreenStack(this);
37
-        FrameLayout contentFrame = (FrameLayout) findViewById(R.id.contentFrame);
37
+        CoordinatorLayout contentFrame = (CoordinatorLayout) findViewById(R.id.contentFrame);
38
         assert contentFrame != null;
38
         assert contentFrame != null;
39
         contentFrame.addView(mScreenStack);
39
         contentFrame.addView(mScreenStack);
40
         mScreenStack.push(screen);
40
         mScreenStack.push(screen);

+ 3
- 3
android/app/src/main/java/com/reactnativenavigation/views/ScreenStack.java View File

2
 
2
 
3
 import android.animation.LayoutTransition;
3
 import android.animation.LayoutTransition;
4
 import android.content.Context;
4
 import android.content.Context;
5
+import android.support.design.widget.CoordinatorLayout;
5
 import android.util.AttributeSet;
6
 import android.util.AttributeSet;
6
 import android.view.ViewGroup;
7
 import android.view.ViewGroup;
7
-import android.widget.FrameLayout;
8
 
8
 
9
 import com.facebook.react.ReactInstanceManager;
9
 import com.facebook.react.ReactInstanceManager;
10
 import com.reactnativenavigation.activities.BaseReactActivity;
10
 import com.reactnativenavigation.activities.BaseReactActivity;
15
 
15
 
16
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
16
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
17
 
17
 
18
-public class ScreenStack extends FrameLayout {
18
+public class ScreenStack extends android.support.design.widget.CoordinatorLayout {
19
 
19
 
20
     private static final int DISAPPEAR_ANIMATION_DELAY = 200;
20
     private static final int DISAPPEAR_ANIMATION_DELAY = 200;
21
 
21
 
163
     public void addToScreen(ViewGroup parent) {
163
     public void addToScreen(ViewGroup parent) {
164
         mStack.peek().view.onReAddToScreen();
164
         mStack.peek().view.onReAddToScreen();
165
 
165
 
166
-        parent.addView(this, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
166
+        parent.addView(this, new CoordinatorLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
167
     }
167
     }
168
 
168
 
169
     public void removeAllReactViews() {
169
     public void removeAllReactViews() {

+ 1
- 1
android/app/src/main/res/layout/bottom_tab_activity.xml View File

27
         android:layout_height="0dp"
27
         android:layout_height="0dp"
28
         android:layout_weight="1">
28
         android:layout_weight="1">
29
 
29
 
30
-        <FrameLayout
30
+        <android.support.design.widget.CoordinatorLayout
31
             android:id="@+id/contentFrame"
31
             android:id="@+id/contentFrame"
32
             android:layout_width="match_parent"
32
             android:layout_width="match_parent"
33
             android:layout_height="0dp"
33
             android:layout_height="0dp"

+ 1
- 1
android/app/src/main/res/layout/single_screen_activity.xml View File

23
         android:layout_width="match_parent"
23
         android:layout_width="match_parent"
24
         android:layout_height="match_parent">
24
         android:layout_height="match_parent">
25
 
25
 
26
-        <FrameLayout
26
+        <android.support.design.widget.CoordinatorLayout
27
             android:id="@+id/contentFrame"
27
             android:id="@+id/contentFrame"
28
             android:layout_width="match_parent"
28
             android:layout_width="match_parent"
29
             android:layout_height="match_parent" />
29
             android:layout_height="match_parent" />