示例#1
0
  public static ComponentName getCategoryComponentName(Context context, String[] keywords) {
    ComponentName componentName = null;
    if (keywords != null) {
      List<AppItemInfo> apps = LauncherModel.getInstance().getApps();
      for (String keyword : keywords) {
        for (AppItemInfo info : apps) {
          ResolveInfo ri = info.getResolveInfo();
          if (ri.activityInfo.name.toLowerCase().contains(keyword)) {
            componentName = new ComponentName(ri.activityInfo.packageName, ri.activityInfo.name);
            break;
          }
          if (componentName != null) {
            break;
          }
        }
      }
    }

    return componentName;
  }
示例#2
0
 public int compare(AppItemInfo o1, AppItemInfo o2) {
   return Collator.getInstance().compare(o1.getLabel(), o2.getLabel());
 }