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


Java Device.getId方法代码示例

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


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

示例1: getDefaultDevice

import com.android.sdklib.devices.Device; //导入方法依赖的package包/类
@Nullable
public Device getDefaultDevice() {
  if (myDefaultDevice == null) {
    // Note that this may not be the device actually used in new layouts; the ConfigMatcher
    // has a PhoneComparator which sorts devices for a best match
    List<Device> devices = getDevices();
    if (!devices.isEmpty()) {
      Device device = devices.get(0);
      for (Device d : devices) {
        String name = d.getId();
        if (name.equals("Nexus 4")) {
          device = d;
          break;
        } else if (name.equals("Galaxy Nexus")) {
          device = d;
        }
      }

      myDefaultDevice = device;
    }
  }

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

示例2: createDevices

import com.android.sdklib.devices.Device; //导入方法依赖的package包/类
/**
 * Create the given devices
 */
public void createDevices(@NotNull List<Device> devices) {
  if (!initIfNecessary()) {
    return;
  }
  for (Device device : devices) {
    // Find a unique ID for this new device
    String deviceIdBase = device.getId();
    String deviceNameBase = device.getDisplayName();
    int i = 2;
    while (isUserDevice(device)) {
      String id = String.format(Locale.getDefault(), "%1$s_%2$d", deviceIdBase, i);
      String name = String.format(Locale.getDefault(), "%1$s_%2$d", deviceNameBase, i);
      device = cloneDeviceWithNewIdAndName(device, id, name);
    }
    ourDeviceManager.addUserDevice(device);
  }
  ourDeviceManager.saveUserDevices();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DeviceManagerConnection.java

示例3: nexusRank

import com.android.sdklib.devices.Device; //导入方法依赖的package包/类
/**
 * Returns the rank of the given nexus device. This can be used to order
 * the devices chronologically.
 *
 * @param device the device to look up the rank for
 * @return the rank of the device
 */
public static int nexusRank(Device device) {
    String id = device.getId();
    if (id.equals("Nexus One")) {      //$NON-NLS-1$
        return 1;
    }
    if (id.equals("Nexus S")) {        //$NON-NLS-1$
        return 2;
    }
    if (id.equals("Galaxy Nexus")) {   //$NON-NLS-1$
        return 3;
    }
    if (id.equals("Nexus 7")) {        //$NON-NLS-1$
        return 4; // 2012 version
    }
    if (id.equals("Nexus 10")) {       //$NON-NLS-1$
        return 5;
    }
    if (id.equals("Nexus 4")) {        //$NON-NLS-1$
        return 6;
    }
    if (id.equals("Nexus 7 2013")) {   //$NON-NLS-1$
        return 7;
    }
    if (id.equals("Nexus 5")) {        //$NON-NLS-1$
      return 8;
    }
    if (id.equals("Nexus 9")) {        //$NON-NLS-1$
        return 9;
    }
    if (id.equals("Nexus 6")) {        //$NON-NLS-1$
        return 10;
    }

    return 100; // devices released in the future?
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:HardwareConfigHelper.java

示例4: selectDevice

import com.android.sdklib.devices.Device; //导入方法依赖的package包/类
public void selectDevice(@NotNull Device device) {
  // Manually move the given device to the front of the eligibility queue
  String id = device.getId();
  List<String> deviceIds = getStateManager().getProjectState().getDeviceIds();
  deviceIds.remove(id);
  deviceIds.add(0, id);

  // Only store a limited number of recent devices
  while (deviceIds.size() > 10) {
    deviceIds.remove(deviceIds.size() - 1);
  }

  myStateVersion++;
  for (Configuration configuration : myCache.values()) {
    // TODO: Null out the themes too if using a system theme (e.g. where the theme was not chosen
    // by the activity or manifest default, but inferred based on the device and API level).
    // For example, if you switch from an Android Wear device (where the default is DeviceDefault) to
    // a Nexus 5 (where the default is currently Theme.Holo) we should recompute the theme for the
    // configuration too!
    boolean updateTheme = false;
    String theme = configuration.getTheme();
    if (theme != null && theme.startsWith(ANDROID_STYLE_RESOURCE_PREFIX)) {
      updateTheme = true;
      configuration.startBulkEditing();
      configuration.setTheme(null);
    }

    configuration.updated(CFG_DEVICE);

    if (updateTheme) {
      configuration.finishBulkEditing();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:ConfigurationManager.java


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