react-native-navigation的迁移库

ModalOptions.java 879B

123456789101112131415161718192021222324252627282930
  1. package com.reactnativenavigation.parse;
  2. import org.json.JSONObject;
  3. public class ModalOptions {
  4. public static ModalOptions parse(JSONObject json) {
  5. ModalOptions options = new ModalOptions();
  6. if (json == null) return options;
  7. options.presentationStyle = ModalPresentationStyle.fromString(json.optString("modalPresentationStyle"));
  8. return options;
  9. }
  10. public ModalPresentationStyle presentationStyle = ModalPresentationStyle.Unspecified;
  11. public void mergeWith(ModalOptions other) {
  12. if (other.hasValue()) presentationStyle = other.presentationStyle;
  13. }
  14. private boolean hasValue() {
  15. return presentationStyle != ModalPresentationStyle.Unspecified;
  16. }
  17. public void mergeWithDefault(ModalOptions defaultOptions) {
  18. if (!hasValue()) presentationStyle = defaultOptions.presentationStyle;
  19. }
  20. }