Ejemplo n.º 1
0
 @Nullable
 public FolderConfiguration getFolderConfigByName(String name) {
   synchronized (myConfigurations) {
     for (LayoutDeviceConfiguration config : myConfigurations) {
       if (config.getName().equals(name)) {
         return config.getConfiguration();
       }
     }
   }
   return null;
 }
Ejemplo n.º 2
0
 void removeConfig(String name) {
   synchronized (myConfigurations) {
     for (LayoutDeviceConfiguration config : myConfigurations) {
       if (config.getName().equals(name)) {
         myConfigurations.remove(config);
         seal();
         return;
       }
     }
   }
 }
Ejemplo n.º 3
0
 @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;
 }
Ejemplo n.º 4
0
 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();
   }
 }
Ejemplo n.º 5
0
  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());
      }
    }
  }