@Nullable public FolderConfiguration getFolderConfigByName(String name) { synchronized (myConfigurations) { for (LayoutDeviceConfiguration config : myConfigurations) { if (config.getName().equals(name)) { return config.getConfiguration(); } } } return null; }
void removeConfig(String name) { synchronized (myConfigurations) { for (LayoutDeviceConfiguration config : myConfigurations) { if (config.getName().equals(name)) { myConfigurations.remove(config); seal(); return; } } } }
@NotNull private LayoutDeviceConfiguration doAddConfig( @NotNull String name, @NotNull FolderConfiguration config) { for (LayoutDeviceConfiguration c : myConfigurations) { if (c.getName().equals(name)) { myConfigurations.remove(c); break; } } final LayoutDeviceConfiguration newConfiguration = new LayoutDeviceConfiguration(this, name, config); myConfigurations.add(newConfiguration); return newConfiguration; }
void addConfigs(List<LayoutDeviceConfiguration> configs) { synchronized (myConfigurations) { for (LayoutDeviceConfiguration config : configs) { for (LayoutDeviceConfiguration c : myConfigurations) { if (c.getName().equals(config.getName())) { myConfigurations.remove(c); break; } } myConfigurations.add(config); } seal(); } }
void saveTo(Document doc, Element parentNode) { final Element deviceNode = createNode(doc, parentNode, "device"); deviceNode.setAttribute("name", myName); final Element defaultNode = createNode(doc, deviceNode, "default"); if (!Float.isNaN(mXDpi)) { final Element xdpiNode = createNode(doc, defaultNode, "xdpi"); xdpiNode.setTextContent(Float.toString(mXDpi)); } if (!Float.isNaN(mYDpi)) { final Element xdpiNode = createNode(doc, defaultNode, "ydpi"); xdpiNode.setTextContent(Float.toString(mYDpi)); } synchronized (myConfigurations) { for (LayoutDeviceConfiguration config : myConfigurations) { saveConfigurations(doc, deviceNode, config.getName(), config.getConfiguration()); } } }