@Test public void unsupportedOrientationsAreIgnored() throws Exception { OrientationOptions options = OrientationOptions.parse(create("default", "autoRotate")); assertThat(options.orientations).hasSize(1); assertThat(options.orientations.get(0)).isEqualTo(Orientation.Default); }
public static OrientationOptions parse(JSONObject json) { OrientationOptions options = new OrientationOptions(); if (json == null) return options; JSONArray orientations = json.optJSONArray("orientation"); if (orientations == null) { String orientation = json.optString("orientation", Orientation.Default.name); options.orientations.add(Orientation.fromString(orientation)); } else { List<Orientation> parsed = new ArrayList<>(); for (int i = 0; i < orientations.length(); i++) { Orientation o = Orientation.fromString(orientations.optString(i, "default")); if (o != null) { parsed.add(o); } } options.orientations = parsed; } return options; }
OrientationOptions { public static OrientationOptions parse(JSONObject json) { OrientationOptions options = new OrientationOptions(); if (json == null) return options; JSONArray orientations = json.optJSONArray("orientation"); if (orientations == null) { String orientation = json.optString("orientation", Orientation.Default.name); options.orientations.add(Orientation.fromString(orientation)); } else { List<Orientation> parsed = new ArrayList<>(); for (int i = 0; i < orientations.length(); i++) { Orientation o = Orientation.fromString(orientations.optString(i, "default")); if (o != null) { parsed.add(o); } } options.orientations = parsed; } return options; } }
OrientationOptions { public static OrientationOptions parse(JSONObject json) { OrientationOptions options = new OrientationOptions(); if (json == null) return options; JSONArray orientations = json.optJSONArray("orientation"); if (orientations == null) { String orientation = json.optString("orientation", Orientation.Default.name); options.orientations.add(Orientation.fromString(orientation)); } else { List<Orientation> parsed = new ArrayList<>(); for (int i = 0; i < orientations.length(); i++) { Orientation o = Orientation.fromString(orientations.optString(i, "default")); if (o != null) { parsed.add(o); } } options.orientations = parsed; } return options; }  }
OrientationOptions { public static OrientationOptions parse(JSONObject json) { OrientationOptions options = new OrientationOptions(); if (json == null) return options; JSONArray orientations = json.optJSONArray("orientation"); if (orientations == null) { String orientation = json.optString("orientation", Orientation.Default.name); options.orientations.add(Orientation.fromString(orientation)); } else { List<Orientation> parsed = new ArrayList<>(); for (int i = 0; i < orientations.length(); i++) { Orientation o = Orientation.fromString(orientations.optString(i, "default")); if (o != null) { parsed.add(o); } } options.orientations = parsed; } return options; }  static OrientationOptions parse(JSONObject json); int getValue(); boolean hasValue(); @CheckResult OrientationOptions copy(); OrientationOptions mergeWithDefault(OrientationOptions defaultOptions); @Override String toString(); }
OrientationOptions { public static OrientationOptions parse(JSONObject json) { OrientationOptions options = new OrientationOptions(); if (json == null) return options; JSONArray orientations = json.optJSONArray("orientation"); if (orientations == null) { String orientation = json.optString("orientation", Orientation.Default.name); options.orientations.add(Orientation.fromString(orientation)); } else { List<Orientation> parsed = new ArrayList<>(); for (int i = 0; i < orientations.length(); i++) { Orientation o = Orientation.fromString(orientations.optString(i, "default")); if (o != null) { parsed.add(o); } } options.orientations = parsed; } return options; }  static OrientationOptions parse(JSONObject json); int getValue(); boolean hasValue(); @CheckResult OrientationOptions copy(); OrientationOptions mergeWithDefault(OrientationOptions defaultOptions); @Override String toString();  }