private void writeImageOptionsAnnotation(Boolean flipRtl, RepeatStyle repeatStyle) { if (flipRtl != null || repeatStyle != null) { StringBuilder b = new StringBuilder("@ImageOptions("); if (null != flipRtl) { b.append("flipRtl=").append(flipRtl); if (repeatStyle != null) { b.append(", "); } } if (repeatStyle != null) { b.append(String.format("repeatStyle=%s.%s", repeatStyleType.getName(), repeatStyle.toString())); } b.append(")"); writer.write(b.toString()); } } }
/** * Interprets <ui:image> elements. */ private void createImage(XMLElement elem) throws UnableToCompleteException { String name = elem.consumeRequiredRawAttribute(FIELD_ATTRIBUTE); // @source is optional on ImageResource String source = elem.consumeRawAttribute(SOURCE_ATTRIBUTE, null); Boolean flipRtl = elem.consumeBooleanConstantAttribute(FLIP_RTL_ATTRIBUTE); RepeatStyle repeatStyle = null; if (elem.hasAttribute(REPEAT_STYLE_ATTRIBUTE)) { String value = elem.consumeRawAttribute(REPEAT_STYLE_ATTRIBUTE); try { repeatStyle = RepeatStyle.valueOf(value); } catch (IllegalArgumentException e) { writer.die(elem, "Bad repeatStyle value %s", value); } } ImplicitImageResource imageMethod = bundleClass.createImageResource(name, source, flipRtl, repeatStyle); FieldWriter field = fieldManager.registerField(imageResourceType, imageMethod.getName()); field.setInitializer(String.format("%s.%s()", fieldManager.convertFieldToGetter(bundleClass.getFieldName()), imageMethod.getName())); }
/** * Interprets <ui:image> elements. */ private void createImage(XMLElement elem) throws UnableToCompleteException { String name = elem.consumeRequiredRawAttribute(FIELD_ATTRIBUTE); // @source is optional on ImageResource String source = elem.consumeRawAttribute(SOURCE_ATTRIBUTE, null); Boolean flipRtl = elem.consumeBooleanConstantAttribute(FLIP_RTL_ATTRIBUTE); RepeatStyle repeatStyle = null; if (elem.hasAttribute(REPEAT_STYLE_ATTRIBUTE)) { String value = elem.consumeRawAttribute(REPEAT_STYLE_ATTRIBUTE); try { repeatStyle = RepeatStyle.valueOf(value); } catch (IllegalArgumentException e) { writer.die(elem, "Bad repeatStyle value %s", value); } } ImplicitImageResource imageMethod = bundleClass.createImageResource(name, source, flipRtl, repeatStyle); FieldWriter field = fieldManager.registerField(imageResourceType, imageMethod.getName()); field.setInitializer(String.format("%s.%s()", fieldManager.convertFieldToGetter(bundleClass.getFieldName()), imageMethod.getName())); }
private void writeImageOptionsAnnotation(Boolean flipRtl, RepeatStyle repeatStyle) { if (flipRtl != null || repeatStyle != null) { StringBuilder b = new StringBuilder("@ImageOptions("); if (null != flipRtl) { b.append("flipRtl=").append(flipRtl); if (repeatStyle != null) { b.append(", "); } } if (repeatStyle != null) { b.append(String.format("repeatStyle=%s.%s", repeatStyleType.getName(), repeatStyle.toString())); } b.append(")"); writer.write(b.toString()); } } }
private static String key(ImageResourceDeclaration image, boolean isExternal) { if (isExternal) { return "External: " + image.get(); } // test mirrored in prepare(), make sure to keep them in sync if (image.isPreventInlining() || image.getRepeatStyle() == RepeatStyle.Both) { return "Unbundled: " + image.get(); } return "Arranged: " + image.getRepeatStyle().toString(); }
private static String key(ImageResourceDeclaration image, boolean isExternal) { if (isExternal) { return "External: " + image.get(); } // test mirrored in prepare(), make sure to keep them in sync if (image.isPreventInlining() || image.getRepeatStyle() == RepeatStyle.Both) { return "Unbundled: " + image.get(); } return "Arranged: " + image.getRepeatStyle().toString(); }
private static String key(ImageResourceDeclaration image, boolean isExternal) { if (isExternal) { return "External: " + image.get(); } // test mirrored in prepare(), make sure to keep them in sync if (image.isPreventInlining() || image.getRepeatStyle() == RepeatStyle.Both) { return "Unbundled: " + image.get(); } return "Arranged: " + image.getRepeatStyle().toString(); }