react-native-navigation的迁移库

StyleHelper.java 917B

12345678910111213141516171819202122232425262728293031
  1. package com.reactnativenavigation.utils;
  2. import android.content.Context;
  3. import android.support.v4.content.ContextCompat;
  4. import android.view.Window;
  5. import com.reactnativenavigation.core.objects.Screen;
  6. /**
  7. * Created by guyc on 07/05/16.
  8. */
  9. public class StyleHelper {
  10. public static void setWindowStyle(Window window, Context context, Screen screen) {
  11. if (SdkSupports.lollipop()) {
  12. final int black = ContextCompat.getColor(context, android.R.color.black);
  13. if (screen.statusBarColor != null) {
  14. window.setStatusBarColor(screen.statusBarColor);
  15. } else {
  16. window.setStatusBarColor(black);
  17. }
  18. if (screen.navigationBarColor != null) {
  19. window.setNavigationBarColor(screen.navigationBarColor);
  20. } else {
  21. window.setNavigationBarColor(black);
  22. }
  23. }
  24. }
  25. }