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


Java IAndroidTarget.getName方法代码示例

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


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

示例1: getLabel

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
@NotNull
private static String getLabel(@NotNull IAndroidTarget target) {
  if (target.isPlatform()
      && target.getVersion().getApiLevel() <= SdkVersionInfo.HIGHEST_KNOWN_API) {
    if (target.getVersion().isPreview()) {
      return target.getVersion().getApiString() + ": " + target.getName();
    }
    String name = SdkVersionInfo.getAndroidName(target.getVersion().getApiLevel());
    if (name == null) {
      return "API " + Integer.toString(target.getVersion().getApiLevel());
    } else {
      return name;
    }
  } else {
    return AndroidSdkUtils.getTargetLabel(target);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FormFactorApiComboBox.java

示例2: getPresentableTargetName

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
@NotNull
public static String getPresentableTargetName(@NotNull IAndroidTarget target) {
  IAndroidTarget parentTarget = target.getParent();
  String name = target.getName();
  if (parentTarget != null) {
    name = name + " (" + parentTarget.getVersionName() + ')';
  }
  return name;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AndroidSdkUtils.java

示例3: chooseNameForNewLibrary

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
@NotNull
public static String chooseNameForNewLibrary(@NotNull IAndroidTarget target) {
  if (target.isPlatform()) {
    return SDK_NAME_PREFIX + target.getVersion().toString() + " Platform";
  }
  IAndroidTarget parentTarget = target.getParent();
  String name = SDK_NAME_PREFIX;
  if (parentTarget != null) {
    name = name + parentTarget.getVersionName() + ' ';
  }
  return name + target.getName();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AndroidSdkUtils.java

示例4: getRenderingTargetLabel

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
/**
 * Returns a suitable label to use to display the given rendering target
 *
 * @param target the target to produce a label for
 * @param brief  if true, generate a brief label (suitable for a toolbar
 *               button), otherwise a fuller name (suitable for a menu item)
 * @return the label
 */
public static String getRenderingTargetLabel(@Nullable IAndroidTarget target, boolean brief) {
  if (target == null) {
    return "<null>";
  }

  AndroidVersion version = target.getVersion();

  if (brief) {
    if (target.isPlatform()) {
      String codename = version.getCodename();
      if (codename != null && !codename.isEmpty()) {
        if (codename.equals("MNC")) {
          return "M";
        }
        // The target menu brief label is deliberately short; typically it's just a 2 digit
        // API number. If this is a preview platform we should display the codename, but only
        // if it's a really short codename; if not, just display the first letter (since Android
        // platforms are typically identified by a letter anyway).
        if (codename.length() <= 3) {
          return codename;
        } else {
          return Character.toString(codename.charAt(0));
        }
      }
      return Integer.toString(version.getApiLevel());
    }
    else {
      return target.getName() + ':' + Integer.toString(version.getApiLevel());
    }
  }

  return String.format("API %1$d: %2$s", version.getApiLevel(), target.getShortClasspathName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:TargetMenuAction.java

示例5: valueOf

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
@Nullable
@Override
public String valueOf(AvdInfo info) {
  IAndroidTarget target = info.getTarget();
  if (target == null) {
    return "N/A";
  }
  return target.getName();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AvdDisplayList.java

示例6: getTargetPresentableName

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
public static String getTargetPresentableName(@NotNull IAndroidTarget target) {
  return target.isPlatform() ? target.getName() : target.getName() + " (" + target.getVersionName() + ')';
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:AndroidSdkUtils.java

示例7: canRunOnDevice

import com.android.sdklib.IAndroidTarget; //导入方法依赖的package包/类
/**
 * Returns whether an application with the given requirements can be run on the given device.
 *
 * @param minSdkVersion    minSdkVersion specified by the application
 * @param projectTarget    android target corresponding to the targetSdkVersion
 * @param requiredFeatures required list of hardware features
 * @param device           the device to check compatibility against
 * @param avdTarget        the target platform corresponding to the AVD, if the device happens to be an emulator
 * @return a {@link com.intellij.util.ThreeState} indicating whether the application can be run on the device, and a reason if it isn't
 * compatible.
 */
@NotNull
public static LaunchCompatibility canRunOnDevice(@NotNull AndroidVersion minSdkVersion,
                                                 @NotNull IAndroidTarget projectTarget,
                                                 @NotNull EnumSet<IDevice.HardwareFeature> requiredFeatures,
                                                 @NotNull IDevice device,
                                                 @Nullable IAndroidTarget avdTarget) {
  // check if the device has the required minApi
  // note that in cases where targetSdk is a preview platform, gradle sets minsdk to be the same as targetsdk,
  // so as to only allow running on those systems
  AndroidVersion deviceVersion = DevicePropertyUtil.getDeviceVersion(device);
  if (!deviceVersion.canRun(minSdkVersion)) {
    String reason = String.format("minSdk(%1$s) %3$s deviceSdk(%2$s)",
                                  minSdkVersion,
                                  deviceVersion,
                                  minSdkVersion.getCodename() == null ? ">" : "!=");
    return new LaunchCompatibility(ThreeState.NO, reason);
  }

  // check if the device provides the required features
  for (IDevice.HardwareFeature feature : requiredFeatures) {
    if (!device.supportsFeature(feature)) {
      return new LaunchCompatibility(ThreeState.NO, "missing feature: " + feature);
    }
  }

  // Typically, we only need to check that features required by the apk are supported by the device, which is done above
  // In the case of watch though, we do an explicit check in the other direction: if the device is a watch, we don't want
  // non-watch apks to be installed on it.
  if (device.supportsFeature(IDevice.HardwareFeature.WATCH)) {
    if (!requiredFeatures.contains(IDevice.HardwareFeature.WATCH)) {
      return new LaunchCompatibility(ThreeState.NO, "missing uses-feature watch, non-watch apks cannot be launched on a watch");
    }
  }

  // we are done with checks for platform targets
  if (projectTarget.isPlatform()) {
    return YES;
  }

  // Add-ons specify a list of libraries. We need to check that the required libraries are available on the device.
  // See AddOnTarget#canRunOn
  List<IAndroidTarget.OptionalLibrary> additionaLibs = projectTarget.getAdditionalLibraries();
  if (additionaLibs.isEmpty()) {
    return YES;
  }

  if (avdTarget == null) {
    String targetName = projectTarget.getName();
    if (GOOGLE_APIS_TARGET_NAME.equals(targetName)) {
      // We'll assume that Google APIs are available on all devices.
      return YES;
    } else {
      // Unsure because we don't have an easy way of determining whether those libraries are on a device
      return new LaunchCompatibility(ThreeState.UNSURE, "unsure if device supports addon: " + targetName);
    }
  } else {
    // Note: A better way to do this is to actually look at the manifest for all of its requirements, and then look at the
    // device for all of its features, very much like the hardware feature check above. Just checking the AVD to see if it was
    // created with the same addon target is somewhat of a legacy method that we use for now..
    return isCompatibleAddonAvd(projectTarget, avdTarget);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:74,代码来源:LaunchCompatibility.java


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