|
@@ -23,9 +23,7 @@ import com.reactnativenavigation.viewcontrollers.navigator.Navigator;
|
23
|
23
|
|
24
|
24
|
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
|
25
|
25
|
|
26
|
|
-@SuppressWarnings("FieldCanBeLocal")
|
27
|
26
|
public class Presenter {
|
28
|
|
-
|
29
|
27
|
private Activity activity;
|
30
|
28
|
private Options defaultOptions;
|
31
|
29
|
|
|
@@ -194,13 +192,32 @@ public class Presenter {
|
194
|
192
|
}
|
195
|
193
|
|
196
|
194
|
private void applyNavigationBarOptions(NavigationBarOptions options) {
|
|
195
|
+ applyNavigationBarVisibility(options);
|
197
|
196
|
setNavigationBarBackgroundColor(options);
|
198
|
197
|
}
|
199
|
198
|
|
200
|
199
|
private void mergeNavigationBarOptions(NavigationBarOptions options) {
|
|
200
|
+ mergeNavigationBarVisibility(options);
|
201
|
201
|
setNavigationBarBackgroundColor(options);
|
202
|
202
|
}
|
203
|
203
|
|
|
204
|
+ private void mergeNavigationBarVisibility(NavigationBarOptions options) {
|
|
205
|
+ if (options.isVisible.hasValue()) applyNavigationBarOptions(options);
|
|
206
|
+ }
|
|
207
|
+
|
|
208
|
+ private void applyNavigationBarVisibility(NavigationBarOptions options) {
|
|
209
|
+ View decorView = activity.getWindow().getDecorView();
|
|
210
|
+ int flags = decorView.getSystemUiVisibility();
|
|
211
|
+ boolean defaultVisibility = (flags & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) == 0;
|
|
212
|
+ int hideNavigationBarFlags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
|
213
|
+ if (options.isVisible.get(defaultVisibility)) {
|
|
214
|
+ flags &= ~hideNavigationBarFlags;
|
|
215
|
+ } else {
|
|
216
|
+ flags |= hideNavigationBarFlags;
|
|
217
|
+ }
|
|
218
|
+ decorView.setSystemUiVisibility(flags);
|
|
219
|
+ }
|
|
220
|
+
|
204
|
221
|
private void setNavigationBarBackgroundColor(NavigationBarOptions navigationBar) {
|
205
|
222
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && navigationBar.backgroundColor.canApplyValue()) {
|
206
|
223
|
int defaultColor = activity.getWindow().getNavigationBarColor();
|