Browse Source

merged from master

Daniel Zlotin 8 years ago
parent
commit
e9a010ad2a

+ 2
- 0
android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java View File

@@ -61,6 +61,8 @@ public class StyleParams {
61 61
     public int selectedTopTabIndicatorHeight;
62 62
     public Color selectedTopTabIndicatorColor;
63 63
 
64
+    public Color screenBackgroundColor;
65
+
64 66
     public boolean drawScreenAboveBottomTabs;
65 67
 
66 68
     public Color snackbarButtonColor;

+ 6
- 0
android/app/src/main/java/com/reactnativenavigation/params/parsers/StyleParamsParser.java View File

@@ -48,6 +48,8 @@ public class StyleParamsParser {
48 48
             result.drawScreenBelowTopBar = false;
49 49
         }
50 50
 
51
+        result.screenBackgroundColor = getColor("screenBackgroundColor", getDefaultScreenBackgroundColor());
52
+
51 53
         result.bottomTabsHidden = getBoolean("bottomTabsHidden", getDefaultBottomTabsHidden());
52 54
         result.drawScreenAboveBottomTabs = !result.bottomTabsHidden &&
53 55
                                            params.getBoolean("drawScreenAboveBottomTabs", getDefaultDrawScreenAboveBottomTabs());
@@ -134,6 +136,10 @@ public class StyleParamsParser {
134 136
         return AppStyle.appStyle != null && AppStyle.appStyle.drawScreenBelowTopBar;
135 137
     }
136 138
 
139
+    private StyleParams.Color getDefaultScreenBackgroundColor() {
140
+        return AppStyle.appStyle != null ? AppStyle.appStyle.screenBackgroundColor : getColor("screenBackgroundColor", new StyleParams.Color());
141
+    }
142
+
137 143
     private boolean getDefaultTopTabsHidden() {
138 144
         return AppStyle.appStyle != null && AppStyle.appStyle.topTabsHidden;
139 145
     }

+ 2
- 1
android/app/src/main/java/com/reactnativenavigation/screens/CollapsingViewPagerScreen.java View File

@@ -6,6 +6,7 @@ import android.support.v7.app.AppCompatActivity;
6 6
 import android.widget.ScrollView;
7 7
 
8 8
 import com.reactnativenavigation.events.Event;
9
+import com.reactnativenavigation.events.ViewPagerScreenChangedEvent;
9 10
 import com.reactnativenavigation.events.ViewPagerScreenScrollStartEvent;
10 11
 import com.reactnativenavigation.params.PageParams;
11 12
 import com.reactnativenavigation.params.ScreenParams;
@@ -91,7 +92,7 @@ public class CollapsingViewPagerScreen extends ViewPagerScreen {
91 92
     @Override
92 93
     public void onEvent(Event event) {
93 94
         super.onEvent(event);
94
-        if (ViewPagerScreenScrollStartEvent.TYPE.equals(event.getType())) {
95
+        if (ViewPagerScreenScrollStartEvent.TYPE.equals(event.getType()) || ViewPagerScreenChangedEvent.TYPE.equals(event.getType())) {
95 96
             ((CollapsingView) topBar).collapse(new CollapseAmount(CollapseCalculator.Direction.Down));
96 97
             ((CollapsingView) viewPager).collapse(new CollapseAmount(CollapseCalculator.Direction.Down));
97 98
         }

+ 3
- 0
android/app/src/main/java/com/reactnativenavigation/screens/Screen.java View File

@@ -71,6 +71,9 @@ public abstract class Screen extends RelativeLayout implements Subscriber {
71 71
         setStatusBarColor(styleParams.statusBarColor);
72 72
         setNavigationBarColor(styleParams.navigationBarColor);
73 73
         topBar.setStyle(styleParams);
74
+        if (styleParams.screenBackgroundColor.hasColor()) {
75
+            setBackgroundColor(styleParams.screenBackgroundColor.getColor());
76
+        }
74 77
     }
75 78
 
76 79
     private void createViews() {

+ 2
- 0
android/app/src/main/java/com/reactnativenavigation/screens/ViewPagerScreen.java View File

@@ -5,6 +5,8 @@ import android.support.design.widget.TabLayout;
5 5
 import android.support.v4.view.ViewPager;
6 6
 import android.support.v7.app.AppCompatActivity;
7 7
 
8
+import com.reactnativenavigation.events.Event;
9
+import com.reactnativenavigation.events.ViewPagerScreenChangedEvent;
8 10
 import com.reactnativenavigation.params.BaseScreenParams;
9 11
 import com.reactnativenavigation.params.PageParams;
10 12
 import com.reactnativenavigation.params.ScreenParams;

+ 2
- 0
src/deprecated/platformSpecificDeprecated.android.js View File

@@ -141,6 +141,8 @@ function convertStyleParams(originalStyleObject) {
141 141
     selectedTopTabIndicatorHeight: originalStyleObject.selectedTopTabIndicatorHeight,
142 142
     selectedTopTabIndicatorColor: originalStyleObject.selectedTopTabIndicatorColor,
143 143
 
144
+    screenBackgroundColor: originalStyleObject.screenBackgroundColor,
145
+
144 146
     drawScreenAboveBottomTabs: !originalStyleObject.drawUnderTabBar,
145 147
 
146 148
     bottomTabsColor: originalStyleObject.tabBarBackgroundColor,