当前位置: 首页>>代码示例>>Java>>正文


Java ResourceFolderType.LAYOUT属性代码示例

本文整理汇总了Java中com.android.resources.ResourceFolderType.LAYOUT属性的典型用法代码示例。如果您正苦于以下问题:Java ResourceFolderType.LAYOUT属性的具体用法?Java ResourceFolderType.LAYOUT怎么用?Java ResourceFolderType.LAYOUT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.android.resources.ResourceFolderType的用法示例。


在下文中一共展示了ResourceFolderType.LAYOUT属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appliesTo

@Override
public boolean appliesTo(@NonNull ResourceFolderType folderType) {
    return folderType == ResourceFolderType.VALUES
            || folderType == ResourceFolderType.COLOR
            || folderType == ResourceFolderType.DRAWABLE
            || folderType == ResourceFolderType.LAYOUT;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ResourceCycleDetector.java

示例2: appliesTo

@Override
public boolean appliesTo(@NonNull ResourceFolderType folderType) {
    return folderType == ResourceFolderType.LAYOUT
            || folderType == ResourceFolderType.MENU
            || folderType == ResourceFolderType.ANIM
            || folderType == ResourceFolderType.ANIMATOR
            || folderType == ResourceFolderType.DRAWABLE
            || folderType == ResourceFolderType.COLOR;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ExtraTextDetector.java

示例3: isUnknownCustomView

private static boolean isUnknownCustomView(XmlTag tag) {
  PsiFile file = tag.getContainingFile();
  if (file != null) {
    ResourceFolderType type = ResourceHelper.getFolderType(file);
    if (type == ResourceFolderType.LAYOUT && tag.getName().indexOf('.') != -1) {
      return true;
    }
  }

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AndroidElementNotAllowedInspection.java

示例4: forkResourceFile

/**
 * Create a variation (copy) of a given resource file (of a given type).
 *
 * @param xmlFile     the XML resource file to fork
 * @param myNewFolder the resource folder to create, or null to ask the user
 * @param open        if true, open the file after creating it
 */
public static void forkResourceFile(@NotNull final XmlFile xmlFile, @Nullable String myNewFolder, boolean open) {
  VirtualFile file = xmlFile.getVirtualFile();
  if (file == null) {
    return;
  }
  Module module = AndroidPsiUtils.getModuleSafely(xmlFile);
  if (module == null) {
    return;
  }
  ResourceFolderType folderType = ResourceHelper.getFolderType(xmlFile);
  if (folderType == null || folderType == ResourceFolderType.VALUES) {
    return;
  }
  Configuration configuration = null;
  if (folderType == ResourceFolderType.LAYOUT) {
    AndroidFacet facet = AndroidFacet.getInstance(module);
    if (facet != null) {
      configuration = facet.getConfigurationManager().getConfiguration(file);
    }
  }

  // Suppress: IntelliJ claims folderType can be null here, but it can't (and inserting assert folderType != null is correctly
  // identified as redundant)
  //noinspection ConstantConditions
  forkResourceFile(module, folderType, file, xmlFile, myNewFolder, configuration, open);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:OverrideResourceAction.java

示例5: getLayoutEditor

/**
 * Returns a fixture around the layout editor, <b>if</b> the currently edited file
 * is a layout file and it is currently showing the layout editor tab or the parameter
 * requests that it be opened if necessary
 *
 * @param switchToTabIfNecessary if true, switch to the design tab if it is not already showing
 * @return a layout editor fixture, or null if the current file is not a layout file or the
 *     wrong tab is showing
 */
@Nullable
public LayoutEditorFixture getLayoutEditor(boolean switchToTabIfNecessary) {
  VirtualFile currentFile = getCurrentFile();
  if (ResourceHelper.getFolderType(currentFile) != ResourceFolderType.LAYOUT) {
    return null;
  }

  if (switchToTabIfNecessary) {
    selectEditorTab(Tab.DESIGN);
  }

  return execute(new GuiQuery<LayoutEditorFixture>() {
    @Override
    @Nullable
    protected LayoutEditorFixture executeInEDT() throws Throwable {
      FileEditorManager manager = FileEditorManager.getInstance(myFrame.getProject());
      FileEditor[] editors = manager.getSelectedEditors();
      if (editors.length == 0) {
        return null;
      }
      FileEditor selected = editors[0];
      if (!(selected instanceof AndroidDesignerEditor)) {
        return null;
      }

      return new LayoutEditorFixture(robot, (AndroidDesignerEditor)selected);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:EditorFixture.java

示例6: formatFile

private static void formatFile(@NonNull XmlFormatPreferences prefs, File file,
        boolean stdout) {
    if (file.isDirectory()) {
        File[] files = file.listFiles();
        if (files != null) {
            for (File child : files) {
                formatFile(prefs, child, stdout);
            }
        }
    } else if (file.isFile() && SdkUtils.endsWithIgnoreCase(file.getName(), DOT_XML)) {
        XmlFormatStyle style = null;
        if (file.getName().equals(SdkConstants.ANDROID_MANIFEST_XML)) {
            style = XmlFormatStyle.MANIFEST;
        } else {
            File parent = file.getParentFile();
            if (parent != null) {
                String parentName = parent.getName();
                ResourceFolderType folderType = ResourceFolderType.getFolderType(parentName);
                if (folderType == ResourceFolderType.LAYOUT) {
                    style = XmlFormatStyle.LAYOUT;
                } else if (folderType == ResourceFolderType.VALUES) {
                    style = XmlFormatStyle.RESOURCE;
                }
            }
        }

        try {
            String xml = Files.toString(file, Charsets.UTF_8);
            Document document = XmlUtils.parseDocumentSilently(xml, true);
            if (document == null) {
                System.err.println("Could not parse " + file);
                System.exit(1);
                return;
            }

            if (style == null) {
                style = XmlFormatStyle.get(document);
            }
            boolean endWithNewline = xml.endsWith("\n");
            int firstNewLine = xml.indexOf('\n');
            String lineSeparator = firstNewLine > 0 && xml.charAt(firstNewLine - 1) == '\r' ?
                    "\r\n" : "\n";
            String formatted = XmlPrettyPrinter.prettyPrint(document, prefs, style,
                    lineSeparator, endWithNewline);
            if (stdout) {
                System.out.println(formatted);
            } else {
                Files.write(formatted, file, Charsets.UTF_8);
            }
        } catch (IOException e) {
            System.err.println("Could not read " + file);
            System.exit(1);
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:55,代码来源:XmlPrettyPrinter.java

示例7: appliesTo

@Override
public boolean appliesTo(ResourceFolderType folderType) {
    return ResourceFolderType.LAYOUT == folderType;
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:4,代码来源:QMUIXmlVectorDrawableDetector.java

示例8: appliesTo

@Override
public boolean appliesTo(@NonNull ResourceFolderType folderType) {
    return folderType == ResourceFolderType.LAYOUT;
}
 
开发者ID:inaka,项目名称:lewis,代码行数:4,代码来源:LayoutIdFormat.java

示例9: appliesTo

@Override
public boolean appliesTo(@NonNull ResourceFolderType folderType) {
    return folderType == ResourceFolderType.LAYOUT || folderType == ResourceFolderType.MENU;
}
 
开发者ID:inaka,项目名称:lewis,代码行数:4,代码来源:HardcodedTextDetectorModified.java

示例10: appliesTo

@Override
public boolean appliesTo(@NonNull ResourceFolderType folderType) {
    return folderType == ResourceFolderType.LAYOUT || folderType == ResourceFolderType.VALUES;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:WrongIdDetector.java

示例11: appliesTo

@Override
public boolean appliesTo(@NonNull ResourceFolderType folderType) {
    // Look in both layouts (at attribute values) and in value files (at style definitions)
    return folderType == ResourceFolderType.LAYOUT || folderType == ResourceFolderType.VALUES;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:PxUsageDetector.java

示例12: appliesTo

@Override
public boolean appliesTo(@NonNull ResourceFolderType folderType) {
    // Look in both layouts (at attribute values) and in value files (style and dimension
    // definitions)
    return folderType == ResourceFolderType.LAYOUT || folderType == ResourceFolderType.VALUES;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:NegativeMarginDetector.java

示例13: needSave

public static boolean needSave(@Nullable ResourceFolderType type) {
  // Only layouts are delegates to the IProjectCallback#getParser where we can supply a
  // parser directly from the live document; others read contents from disk via layoutlib.
  // TODO: Work on adding layoutlib support for this.
  return type != ResourceFolderType.LAYOUT;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:LayoutPullParserFactory.java


注:本文中的com.android.resources.ResourceFolderType.LAYOUT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。