react-native-navigation的迁移库

StyleParams.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package com.reactnativenavigation.params;
  2. import android.os.Bundle;
  3. import android.support.annotation.ColorInt;
  4. public class StyleParams {
  5. public static class Color {
  6. @ColorInt
  7. private Integer color = null;
  8. public Color() {
  9. color = null;
  10. }
  11. public Color(Integer color) {
  12. this.color = color;
  13. }
  14. public boolean hasColor() {
  15. return color != null;
  16. }
  17. @ColorInt
  18. public int getColor() {
  19. if (!hasColor()) {
  20. throw new RuntimeException("Color undefined");
  21. }
  22. return color;
  23. }
  24. public static Color parse(Bundle bundle, String key) {
  25. return bundle.containsKey(key) ? new Color(bundle.getInt(key)) : new Color();
  26. }
  27. public String getHexColor() {
  28. return String.format("#%06X", (0xFFFFFF & getColor()));
  29. }
  30. public int getColor(int defaultColor) {
  31. return hasColor() ? getColor() : defaultColor;
  32. }
  33. }
  34. public Orientation orientation;
  35. public Color statusBarColor;
  36. public Color contextualMenuStatusBarColor;
  37. public Color contextualMenuButtonsColor;
  38. public Color contextualMenuBackgroundColor;
  39. public Color topBarColor;
  40. public CollapsingTopBarParams collapsingTopBarParams;
  41. public boolean topBarCollapseOnScroll;
  42. public boolean topBarElevationShadowEnabled;
  43. public boolean topTabsHidden;
  44. public boolean drawScreenBelowTopBar;
  45. public boolean titleBarHidden;
  46. public boolean titleBarHideOnScroll;
  47. public boolean topBarTransparent;
  48. public boolean topBarTranslucent;
  49. public Color titleBarTitleColor;
  50. public Color titleBarSubtitleColor;
  51. public Color titleBarButtonColor;
  52. public Color titleBarDisabledButtonColor;
  53. public boolean backButtonHidden;
  54. public Color topTabTextColor;
  55. public Color topTabIconColor;
  56. public Color selectedTopTabTextColor;
  57. public Color selectedTopTabIconColor;
  58. public int selectedTopTabIndicatorHeight;
  59. public Color selectedTopTabIndicatorColor;
  60. public boolean topTabScrollable;
  61. public Color screenBackgroundColor;
  62. public boolean drawScreenAboveBottomTabs;
  63. public Color snackbarButtonColor;
  64. public boolean bottomTabsHidden;
  65. public boolean bottomTabsHiddenOnScroll;
  66. public Color bottomTabsColor;
  67. public Color selectedBottomTabsButtonColor;
  68. public Color bottomTabsButtonColor;
  69. public boolean forceTitlesDisplay;
  70. public Color bottomTabBadgeTextColor;
  71. public Color bottomTabBadgeBackgroundColor;
  72. public String bottomTabFontFamily;
  73. public Color navigationBarColor;
  74. }