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
     public int selectedTopTabIndicatorHeight;
61
     public int selectedTopTabIndicatorHeight;
62
     public Color selectedTopTabIndicatorColor;
62
     public Color selectedTopTabIndicatorColor;
63
 
63
 
64
+    public Color screenBackgroundColor;
65
+
64
     public boolean drawScreenAboveBottomTabs;
66
     public boolean drawScreenAboveBottomTabs;
65
 
67
 
66
     public Color snackbarButtonColor;
68
     public Color snackbarButtonColor;

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

48
             result.drawScreenBelowTopBar = false;
48
             result.drawScreenBelowTopBar = false;
49
         }
49
         }
50
 
50
 
51
+        result.screenBackgroundColor = getColor("screenBackgroundColor", getDefaultScreenBackgroundColor());
52
+
51
         result.bottomTabsHidden = getBoolean("bottomTabsHidden", getDefaultBottomTabsHidden());
53
         result.bottomTabsHidden = getBoolean("bottomTabsHidden", getDefaultBottomTabsHidden());
52
         result.drawScreenAboveBottomTabs = !result.bottomTabsHidden &&
54
         result.drawScreenAboveBottomTabs = !result.bottomTabsHidden &&
53
                                            params.getBoolean("drawScreenAboveBottomTabs", getDefaultDrawScreenAboveBottomTabs());
55
                                            params.getBoolean("drawScreenAboveBottomTabs", getDefaultDrawScreenAboveBottomTabs());
134
         return AppStyle.appStyle != null && AppStyle.appStyle.drawScreenBelowTopBar;
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
     private boolean getDefaultTopTabsHidden() {
143
     private boolean getDefaultTopTabsHidden() {
138
         return AppStyle.appStyle != null && AppStyle.appStyle.topTabsHidden;
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
 import android.widget.ScrollView;
6
 import android.widget.ScrollView;
7
 
7
 
8
 import com.reactnativenavigation.events.Event;
8
 import com.reactnativenavigation.events.Event;
9
+import com.reactnativenavigation.events.ViewPagerScreenChangedEvent;
9
 import com.reactnativenavigation.events.ViewPagerScreenScrollStartEvent;
10
 import com.reactnativenavigation.events.ViewPagerScreenScrollStartEvent;
10
 import com.reactnativenavigation.params.PageParams;
11
 import com.reactnativenavigation.params.PageParams;
11
 import com.reactnativenavigation.params.ScreenParams;
12
 import com.reactnativenavigation.params.ScreenParams;
91
     @Override
92
     @Override
92
     public void onEvent(Event event) {
93
     public void onEvent(Event event) {
93
         super.onEvent(event);
94
         super.onEvent(event);
94
-        if (ViewPagerScreenScrollStartEvent.TYPE.equals(event.getType())) {
95
+        if (ViewPagerScreenScrollStartEvent.TYPE.equals(event.getType()) || ViewPagerScreenChangedEvent.TYPE.equals(event.getType())) {
95
             ((CollapsingView) topBar).collapse(new CollapseAmount(CollapseCalculator.Direction.Down));
96
             ((CollapsingView) topBar).collapse(new CollapseAmount(CollapseCalculator.Direction.Down));
96
             ((CollapsingView) viewPager).collapse(new CollapseAmount(CollapseCalculator.Direction.Down));
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
         setStatusBarColor(styleParams.statusBarColor);
71
         setStatusBarColor(styleParams.statusBarColor);
72
         setNavigationBarColor(styleParams.navigationBarColor);
72
         setNavigationBarColor(styleParams.navigationBarColor);
73
         topBar.setStyle(styleParams);
73
         topBar.setStyle(styleParams);
74
+        if (styleParams.screenBackgroundColor.hasColor()) {
75
+            setBackgroundColor(styleParams.screenBackgroundColor.getColor());
76
+        }
74
     }
77
     }
75
 
78
 
76
     private void createViews() {
79
     private void createViews() {

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

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

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

141
     selectedTopTabIndicatorHeight: originalStyleObject.selectedTopTabIndicatorHeight,
141
     selectedTopTabIndicatorHeight: originalStyleObject.selectedTopTabIndicatorHeight,
142
     selectedTopTabIndicatorColor: originalStyleObject.selectedTopTabIndicatorColor,
142
     selectedTopTabIndicatorColor: originalStyleObject.selectedTopTabIndicatorColor,
143
 
143
 
144
+    screenBackgroundColor: originalStyleObject.screenBackgroundColor,
145
+
144
     drawScreenAboveBottomTabs: !originalStyleObject.drawUnderTabBar,
146
     drawScreenAboveBottomTabs: !originalStyleObject.drawUnderTabBar,
145
 
147
 
146
     bottomTabsColor: originalStyleObject.tabBarBackgroundColor,
148
     bottomTabsColor: originalStyleObject.tabBarBackgroundColor,