本文整理汇总了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();
}
示例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;
}
示例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());
}
示例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)" : "");
}
}
示例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)" : "");
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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)" : "");
}
}