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


Java AndroidVersion.isPreview方法代码示例

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


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

示例1: getDescription

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
public static String getDescription(AndroidVersion version) {
  StringBuilder result = new StringBuilder();
  result.append("Android ");
  if (version.isPreview()) {
    result.append(version.getCodename());
    result.append(" Preview");
  }
  else {
    result.append(SdkVersionInfo.getVersionString(version.getApiLevel()));
    String codeName = SdkVersionInfo.getCodeName(version.getApiLevel());
    if (codeName != null) {
      result.append(" (");
      result.append(codeName);
      result.append(")");
    }
  }
  return result.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:SummaryTreeNode.java

示例2: getHighestApi

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
private static int getHighestApi(PsiElement element) {
  int max = SdkVersionInfo.HIGHEST_KNOWN_STABLE_API;
  AndroidFacet instance = AndroidFacet.getInstance(element);
  if (instance != null) {
    AndroidSdkData sdkData = instance.getSdkData();
    if (sdkData != null) {
      for (IAndroidTarget target : sdkData.getTargets()) {
        if (target.isPlatform()) {
          AndroidVersion version = target.getVersion();
          if (version.getApiLevel() > max && !version.isPreview()) {
            max = version.getApiLevel();
          }
        }
      }
    }
  }
  return max;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AndroidLintInspectionToolProvider.java

示例3: getTargetLabel

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
/**
 * For a given target, returns a brief user-facing string that describes the platform, including the API level, platform version number,
 * and codename. Does the right thing with pre-release platforms.
 */
@NotNull
public static String getTargetLabel(@NotNull IAndroidTarget target) {
  if (!target.isPlatform()) {
    return String.format("%1$s (API %2$s)", target.getFullName(), target.getVersion().getApiString());
  }
  AndroidVersion version = target.getVersion();
  if (version.isPreview()) {
    return String.format("API %d+: %s", target.getVersion().getApiLevel(), target.getName());
  }
  String name = SdkVersionInfo.getAndroidName(target.getVersion().getApiLevel());
  if (name != null) {
    return name;
  }
  String release = target.getProperty("ro.build.version.release"); //$NON-NLS-1$
  if (release != null) {
    return String.format("API %1$d: Android %2$s", version.getApiLevel(), release);
  }
  return String.format("API %1$d", version.getApiLevel());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AndroidSdkUtils.java

示例4: createShortDescription

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
/**
 * Returns a short description for an {@link IDescription}.
 */
private static String createShortDescription(String listDisplay, FullRevision revision, AndroidVersion version, boolean obsolete) {
  if (!listDisplay.isEmpty()) {
    return String.format("%1$s, revision %2$s%3$s", listDisplay, revision.toShortString(), obsolete ? " (Obsolete)" : "");
  }

  if (version.isPreview()) {
    return String
      .format("Documentation for Android '%1$s' Preview SDK, revision %2$s%3$s", version.getCodename(), revision.toShortString(),
              obsolete ? " (Obsolete)" : "");
  }
  else {
    return String
      .format("Documentation for Android SDK, API %1$d, revision %2$s%3$s", version.getApiLevel(), revision.toShortString(),
              obsolete ? " (Obsolete)" : "");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:RemoteDocPkgInfo.java

示例5: createShortDescription

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
/**
 * Returns a short description for an {@link IDescription}.
 */
private static String createShortDescription(String listDisplay, FullRevision revision, AndroidVersion version, boolean obsolete) {
  if (!listDisplay.isEmpty()) {
    return String.format("%1$s, revision %2$s%3$s", listDisplay, revision.toShortString(), obsolete ? " (Obsolete)" : "");
  }

  if (version.isPreview()) {
    return String
      .format("Sources for Android '%1$s' Preview SDK, revision %2$s%3$s", version.getCodename(), revision.toShortString(),
              obsolete ? " (Obsolete)" : "");
  }
  else {
    return String.format("Sources for Android SDK, API %1$d, revision %2$s%3$s", version.getApiLevel(), revision.toShortString(),
                         obsolete ? " (Obsolete)" : "");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:RemoteSourcePkgInfo.java

示例6: createListDescription

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
/**
 * Returns a description of this package that is suitable for a list display.
 * <p/>
 * {@inheritDoc}
 */
private static String createListDescription(String listDisplay, String versionName, AndroidVersion version, boolean obsolete) {
  if (!listDisplay.isEmpty()) {
    return String.format("%1$s%2$s", listDisplay, obsolete ? " (Obsolete)" : "");
  }

  String s;
  if (version.isPreview()) {
    s = String.format("SDK Platform Android %1$s Preview%2$s", versionName, obsolete ? " (Obsolete)" : "");  //$NON-NLS-2$
  }
  else {
    s = String.format("SDK Platform Android %1$s%2$s", versionName, obsolete ? " (Obsolete)" : "");      //$NON-NLS-2$
  }

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

示例7: createShortDescription

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
/**
 * Returns a short description for an {@link IDescription}.
 */
private static String createShortDescription(String listDisplay,
                                             FullRevision revision,
                                             String versionName,
                                             AndroidVersion version,
                                             boolean obsolete) {
  if (!listDisplay.isEmpty()) {
    return String.format("%1$s, revision %2$s%3$s", listDisplay, revision.toShortString(), obsolete ? " (Obsolete)" : "");
  }

  String s;
  if (version.isPreview()) {
    s = String.format("SDK Platform Android %1$s Preview, revision %2$s%3$s", versionName, revision.toShortString(),
                      obsolete ? " (Obsolete)" : "");  //$NON-NLS-2$
  }
  else {
    s = String
      .format("SDK Platform Android %1$s, API %2$d, revision %3$s%4$s", versionName, version.getApiLevel(), revision.toShortString(),
              obsolete ? " (Obsolete)" : "");      //$NON-NLS-2$
  }

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

示例8: canBeUpdatedBy

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * <hr>
 * Doc packages are a bit different since there can only be one doc installed at
 * the same time.
 * <p/>
 * We now consider that docs for different APIs are NOT updates, e.g. doc for API N+1
 * is no longer considered an update for doc API N.
 * However docs that have the same API version (API level + codename) are considered
 * updates if they have a higher revision number (so 15 rev 2 is an update for 15 rev 1,
 * but is not an update for 14 rev 1.)
 */
@Override
public UpdateInfo canBeUpdatedBy(Package replacementPackage) {
    // check they are the same kind of object
    if (!(replacementPackage instanceof DocPackage)) {
        return UpdateInfo.INCOMPATIBLE;
    }

    DocPackage replacementDoc = (DocPackage)replacementPackage;

    AndroidVersion replacementVersion = replacementDoc.getAndroidVersion();

    // Check if they're the same exact (api and codename)
    if (replacementVersion.equals(mVersion)) {
        // exact same version, so check the revision level
        if (replacementPackage.getRevision().compareTo(this.getRevision()) > 0) {
            return UpdateInfo.UPDATE;
        }
    } else {
        // not the same version? we check if they have the same api level and the new one
        // is a preview, in which case it's also an update (since preview have the api level
        // of the _previous_ version.)
        if (replacementVersion.getApiLevel() == mVersion.getApiLevel() &&
                replacementVersion.isPreview()) {
            return UpdateInfo.UPDATE;
        }
    }

    // not an upgrade but not incompatible either.
    return UpdateInfo.NOT_UPDATE;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:43,代码来源:DocPackage.java

示例9: findBestTarget

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
@Nullable
private static IAndroidTarget findBestTarget(@NotNull IAndroidTarget[] targets) {
  IAndroidTarget bestTarget = null;
  int maxApiLevel = -1;
  for (IAndroidTarget target : targets) {
    AndroidVersion version = target.getVersion();
    if (target.isPlatform() && !version.isPreview() && version.getApiLevel() > maxApiLevel) {
      bestTarget = target;
      maxApiLevel = version.getApiLevel();
    }
  }
  return bestTarget;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AndroidSdkUtils.java

示例10: getLatestPlatform

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
private static Platform getLatestPlatform(@NotNull ScopedStateStore store,
                                          Multimap<PkgType, RemotePkgInfo> remotePackages,
                                          boolean preview) {
  RemotePkgInfo latest = InstallComponentsPath.findLatestPlatform(remotePackages, preview);
  if (latest != null) {
    AndroidVersion version = latest.getPkgDesc().getAndroidVersion();
    String versionName = SdkVersionInfo.getAndroidName(version.getFeatureLevel());
    final String description = "Android platform libraries for targeting " + versionName + " platform";
    return new Platform(store, versionName, latest.getDownloadSize(), description, version, !version.isPreview());
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:Platform.java

示例11: getBuildApiString

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
/**
 * Computes a suitable build api string, e.g. for API level 18 the build
 * API string is "18".
 */
@NotNull
public static String getBuildApiString(@NotNull AndroidVersion version) {
  if (version.isPreview()) {
    return AndroidTargetHash.getPlatformHashString(version);
  }
  return version.getApiString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:TemplateMetadata.java

示例12: createListDescription

import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
/**
 * Returns a description of this package that is suitable for a list display.
 * <p/>
 */
private static String createListDescription(String listDisplay, AndroidVersion version, boolean obsolete) {
  if (!listDisplay.isEmpty()) {
    return String.format("%1$s%2$s", listDisplay, obsolete ? " (Obsolete)" : "");
  }

  if (version.isPreview()) {
    return String.format("Sources for Android '%1$s' Preview SDK%2$s", version.getCodename(), obsolete ? " (Obsolete)" : "");
  }
  else {
    return String.format("Sources for Android SDK%2$s", version.getApiLevel(), obsolete ? " (Obsolete)" : "");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RemoteSourcePkgInfo.java


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