本文整理汇总了Java中com.android.sdklib.AndroidVersion.equals方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidVersion.equals方法的具体用法?Java AndroidVersion.equals怎么用?Java AndroidVersion.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.sdklib.AndroidVersion
的用法示例。
在下文中一共展示了AndroidVersion.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: doesIdeAndroidSdkExist
import com.android.sdklib.AndroidVersion; //导入方法依赖的package包/类
/**
* @return {@code true} if an IntelliJ SDK with the default naming convention already exists for the given Android build target.
*/
private static boolean doesIdeAndroidSdkExist(@NotNull IAndroidTarget target) {
for (Sdk sdk : getEligibleAndroidSdks()) {
IAndroidTarget platformTarget = getTarget(sdk);
AndroidVersion version = target.getVersion();
AndroidVersion existingVersion = platformTarget.getVersion();
if (existingVersion.equals(version)) {
return true;
}
}
return false;
}