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


Java SdkConstants类代码示例

本文整理汇总了Java中com.android.SdkConstants的典型用法代码示例。如果您正苦于以下问题:Java SdkConstants类的具体用法?Java SdkConstants怎么用?Java SdkConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: visitAttribute

import com.android.SdkConstants; //导入依赖的package包/类
@Override
public void visitAttribute(XmlContext context, Attr attribute) {
    super.visitAttribute(context, attribute);

    String value = attribute.getValue();
    if (Utils.stringIsEmpty(value)) return;

    //onClick 属性被赋值
    Element element = attribute.getOwnerElement();
    boolean has = element.hasAttributeNS(SdkConstants.ANDROID_URI, SdkConstants.ATTR_ID);
    if (!has) {

        Location location = context.getLocation(attribute);
        context.report(ISSUE_MISSING_ID, location, "the view with onClick attribute set should has id attribute");
    }
}
 
开发者ID:jessie345,项目名称:CustomLintRules,代码行数:17,代码来源:AutoPointLayoutOnclickDetector.java

示例2: LocalDirInfo

import com.android.SdkConstants; //导入依赖的package包/类
/**
 * Creates a new immutable {@link LocalDirInfo}.
 *
 * @param fileOp The {@link FileOp} to use for all file-based interactions.
 * @param dir The platform/addon directory of the target. It should be a directory.
 */
public LocalDirInfo(@NonNull IFileOp fileOp, @NonNull File dir) {
    mFileOp = fileOp;
    mDir = dir;
    mDirModifiedTS = mFileOp.lastModified(dir);

    // Capture some info about the source.properties file if it exists.
    // We use propsModifiedTS == 0 to mean there is no props file.
    long propsChecksum = 0;
    long propsModifiedTS = 0;
    File props = new File(dir, SdkConstants.FN_SOURCE_PROP);
    if (mFileOp.isFile(props)) {
        propsModifiedTS = mFileOp.lastModified(props);
        propsChecksum = getFileChecksum(props);
    }
    mPropsModifiedTS = propsModifiedTS;
    mPropsChecksum = propsChecksum;
    mDirChecksum = getDirChecksum(mDir);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:25,代码来源:LocalDirInfo.java

示例3: createLegacyBuildTools

import com.android.SdkConstants; //导入依赖的package包/类
@NonNull
private BuildToolInfo createLegacyBuildTools(@NonNull LocalPlatformToolPkgInfo ptInfo) {
    File platformTools = new File(getLocation(), SdkConstants.FD_PLATFORM_TOOLS);
    File platformToolsLib = ptInfo.getLocalDir();
    File platformToolsRs = new File(platformTools, SdkConstants.FN_FRAMEWORK_RENDERSCRIPT);

    return new BuildToolInfo(
            ptInfo.getDesc().getFullRevision(),
            platformTools,
            new File(platformTools, SdkConstants.FN_AAPT),
            new File(platformTools, SdkConstants.FN_AIDL),
            new File(platformTools, SdkConstants.FN_DX),
            new File(platformToolsLib, SdkConstants.FN_DX_JAR),
            new File(platformTools, SdkConstants.FN_RENDERSCRIPT),
            new File(platformToolsRs, SdkConstants.FN_FRAMEWORK_INCLUDE),
            new File(platformToolsRs, SdkConstants.FN_FRAMEWORK_INCLUDE_CLANG),
            null,
            null,
            null,
            null,
            new File(platformTools, SdkConstants.FN_ZIPALIGN));
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:23,代码来源:LocalSdk.java

示例4: scanDoc

import com.android.SdkConstants; //导入依赖的package包/类
/**
 * Try to find a docs package at the given location.
 * Returns null if not found.
 */
private LocalDocPkgInfo scanDoc(File docFolder) {
    // Can we find some properties?
    Properties props = parseProperties(new File(docFolder, SdkConstants.FN_SOURCE_PROP));
    MajorRevision rev = PackageParserUtils.getPropertyMajor(props, PkgProps.PKG_REVISION);
    if (rev == null) {
        return null;
    }

    try {
        AndroidVersion vers = new AndroidVersion(props);
        LocalDocPkgInfo info = new LocalDocPkgInfo(this, docFolder, props, vers, rev);

        // To start with, a doc folder should have an "index.html" to be acceptable.
        // We don't actually check the content of the file.
        if (!mFileOp.isFile(new File(docFolder, "index.html"))) {
            info.appendLoadError("Missing index.html");
        }
        return info;

    } catch (AndroidVersionException e) {
        return null; // skip invalid or missing android version.
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:28,代码来源:LocalSdk.java

示例5: scanBuildTools

import com.android.SdkConstants; //导入依赖的package包/类
private void scanBuildTools(File collectionDir, Collection<LocalPkgInfo> outCollection) {
    // The build-tool root folder contains a list of per-revision folders.
    for (File buildToolDir : mFileOp.listFiles(collectionDir)) {
        if (!shouldVisitDir(PkgType.PKG_BUILD_TOOLS, buildToolDir)) {
            continue;
        }

        Properties props = parseProperties(new File(buildToolDir, SdkConstants.FN_SOURCE_PROP));
        FullRevision rev = PackageParserUtils.getPropertyFull(props, PkgProps.PKG_REVISION);
        if (rev == null) {
            continue; // skip, no revision
        }

        BuildToolInfo btInfo = new BuildToolInfo(rev, buildToolDir);
        LocalBuildToolPkgInfo pkgInfo =
            new LocalBuildToolPkgInfo(this, buildToolDir, props, rev, btInfo);
        outCollection.add(pkgInfo);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:20,代码来源:LocalSdk.java

示例6: scanSources

import com.android.SdkConstants; //导入依赖的package包/类
private void scanSources(File collectionDir, Collection<LocalPkgInfo> outCollection) {
    // The build-tool root folder contains a list of per-revision folders.
    for (File platformDir : mFileOp.listFiles(collectionDir)) {
        if (!shouldVisitDir(PkgType.PKG_SOURCE, platformDir)) {
            continue;
        }

        Properties props = parseProperties(new File(platformDir, SdkConstants.FN_SOURCE_PROP));
        MajorRevision rev = PackageParserUtils.getPropertyMajor(props, PkgProps.PKG_REVISION);
        if (rev == null) {
            continue; // skip, no revision
        }

        try {
            AndroidVersion vers = new AndroidVersion(props);

            LocalSourcePkgInfo pkgInfo =
                new LocalSourcePkgInfo(this, platformDir, props, vers, rev);
            outCollection.add(pkgInfo);
        } catch (AndroidVersionException e) {
            continue; // skip invalid or missing android version.
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:25,代码来源:LocalSdk.java

示例7: getDefaultSkin

import com.android.SdkConstants; //导入依赖的package包/类
@Nullable
@Override
public File getDefaultSkin() {
    // only one skin? easy.
    if (mSkins.length == 1) {
        return mSkins[0];
    }

    // look for the skin name in the platform props
    String skinName = mProperties.get(SdkConstants.PROP_SDK_DEFAULT_SKIN);
    if (skinName == null) {
        // otherwise try to find a good default.
        if (mVersion.getApiLevel() >= 4) {
            // at this time, this is the default skin for all older platforms that had 2+ skins.
            skinName = "WVGA800";                                       //$NON-NLS-1$
        } else {
            skinName = "HVGA"; // this is for 1.5 and earlier.          //$NON-NLS-1$
        }
    }

    return new File(getFile(IAndroidTarget.SKINS), skinName);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:23,代码来源:PlatformTarget.java

示例8: getInstallFolder

import com.android.SdkConstants; //导入依赖的package包/类
/**
 * Computes a potential installation folder if an archive of this package were
 * to be installed right away in the given SDK root.
 * <p/>
 * A platform package is typically installed in SDK/platforms/android-"version".
 * However if we can find a different directory under SDK/platform that already
 * has this platform version installed, we'll use that one.
 *
 * @param osSdkRoot The OS path of the SDK root folder.
 * @param sdkManager An existing SDK manager to list current platforms and addons.
 * @return A new {@link File} corresponding to the directory to use to install this package.
 */
@Override
public File getInstallFolder(String osSdkRoot, SdkManager sdkManager) {

    // First find if this platform is already installed. If so, reuse the same directory.
    for (IAndroidTarget target : sdkManager.getTargets()) {
        if (target.isPlatform() && target.getVersion().equals(mVersion)) {
            return new File(target.getLocation());
        }
    }

    File platforms = new File(osSdkRoot, SdkConstants.FD_PLATFORMS);
    File folder = new File(platforms,
            String.format("android-%s", getAndroidVersion().getApiString())); //$NON-NLS-1$

    return folder;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:29,代码来源:PlatformPackage.java

示例9: checkIfInitFailed

import com.android.SdkConstants; //导入依赖的package包/类
/**
 * Check if any error occurred during initialization.
 * If it did, display an error message.
 *
 * @return True if an error occurred, false if we should continue.
 */
public boolean checkIfInitFailed() {
    if (mAvdManagerInitError != null) {
        String example;
        if (SdkConstants.currentPlatform() == SdkConstants.PLATFORM_WINDOWS) {
            example = "%USERPROFILE%";     //$NON-NLS-1$
        } else {
            example = "~";                 //$NON-NLS-1$
        }

        String error = String.format(
            "The AVD manager normally uses the user's profile directory to store " +
            "AVD files. However it failed to find the default profile directory. " +
            "\n" +
            "To fix this, please set the environment variable ANDROID_SDK_HOME to " +
            "a valid path such as \"%s\".",
            example);

        displayInitError(error);

        return true;
    }
    return false;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:30,代码来源:UpdaterData.java

示例10: build

import com.android.SdkConstants; //导入依赖的package包/类
public void build(@NonNull CommandLineLauncher launcher)
        throws IOException, InterruptedException {

    // get the env var
    Map<String, String> env = Maps.newHashMap();
    if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_DARWIN) {
        env.put("DYLD_LIBRARY_PATH", mBuildToolInfo.getLocation().getAbsolutePath());
    } else if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_LINUX) {
        env.put("LD_LIBRARY_PATH", mBuildToolInfo.getLocation().getAbsolutePath());
    }

    doMainCompilation(launcher, env);

    if (mSupportMode) {
        createSupportFiles(launcher, env);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:18,代码来源:RenderScriptProcessor.java

示例11: createSupportFiles

import com.android.SdkConstants; //导入依赖的package包/类
private void createSupportFiles(@NonNull CommandLineLauncher launcher,
        @NonNull Map<String, String> env) throws IOException, InterruptedException {
    // get the generated BC files.
    File rawFolder = new File(mResOutputDir, SdkConstants.FD_RES_RAW);

    SourceSearcher searcher = new SourceSearcher(Collections.singletonList(rawFolder), EXT_BC);
    FileGatherer fileGatherer = new FileGatherer();
    searcher.search(fileGatherer);

    for (File bcFile : fileGatherer.getFiles()) {
        String name = bcFile.getName();
        String objName = name.replaceAll("\\.bc", ".o");
        String soName = "librs." + name.replaceAll("\\.bc", ".so");

        for (Abi abi : ABIS) {
            File objFile = createSupportObjFile(bcFile, abi, objName, launcher, env);
            createSupportLibFile(objFile, abi, soName, launcher, env);
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:21,代码来源:RenderScriptProcessor.java

示例12: isDevicesExtra

import com.android.SdkConstants; //导入依赖的package包/类
private boolean isDevicesExtra(@NonNull File item) {
    File properties = new File(item, SdkConstants.FN_SOURCE_PROP);
    try {
        BufferedReader propertiesReader = new BufferedReader(new FileReader(properties));
        try {
            String line;
            while ((line = propertiesReader.readLine()) != null) {
                Matcher m = PATH_PROPERTY_PATTERN.matcher(line);
                if (m.matches()) {
                    return true;
                }
            }
        } finally {
            propertiesReader.close();
        }
    } catch (IOException ignore) {
    }
    return false;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:20,代码来源:DeviceManager.java

示例13: getFolderName

import com.android.SdkConstants; //导入依赖的package包/类
/**
 * Returns the name of a folder with the configuration.
 */
@NonNull
public String getFolderName(@NonNull ResourceFolderType folder) {
    StringBuilder result = new StringBuilder(folder.getName());

    for (ResourceQualifier qualifier : mQualifiers) {
        if (qualifier != null) {
            String segment = qualifier.getFolderSegment();
            if (segment != null && !segment.isEmpty()) {
                result.append(SdkConstants.RES_QUALIFIER_SEP);
                result.append(segment);
            }
        }
    }

    return result.toString();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:20,代码来源:FolderConfiguration.java

示例14: getUniqueKey

import com.android.SdkConstants; //导入依赖的package包/类
/**
 * Returns the folder configuration as a unique key
 */
@NonNull
public String getUniqueKey() {
  StringBuilder result = new StringBuilder(100);

  for (ResourceQualifier qualifier : mQualifiers) {
    if (qualifier != null) {
      String segment = qualifier.getFolderSegment();
      if (segment != null && !segment.isEmpty()) {
        result.append(SdkConstants.RES_QUALIFIER_SEP);
        result.append(segment);
      }
    }
  }

  return result.toString();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:20,代码来源:FolderConfiguration.java

示例15: processFolder

import com.android.SdkConstants; //导入依赖的package包/类
/**
 * Processes a folder and adds it to the list of existing folders.
 * @param folder the folder to process
 * @return the ResourceFolder created from this folder, or null if the process failed.
 */
@Nullable
public ResourceFolder processFolder(@NonNull IAbstractFolder folder) {
    ensureInitialized();

    // split the name of the folder in segments.
    String[] folderSegments = folder.getName().split(SdkConstants.RES_QUALIFIER_SEP);

    // get the enum for the resource type.
    ResourceFolderType type = ResourceFolderType.getTypeByName(folderSegments[0]);

    if (type != null) {
        // get the folder configuration.
        FolderConfiguration config = FolderConfiguration.getConfig(folderSegments);

        if (config != null) {
            return add(type, config, folder);
        }
    }

    return null;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:27,代码来源:ResourceRepository.java


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