Exemplo n.º 1
0
  @Override
  public void searchPlugin(final int type) {

    String name = FeatherIntent.PluginType.getName(type);
    String packageName = FeatherIntent.PLUGIN_BASE_PACKAGE;
    if (null != name) {
      packageName = packageName + name + ".*";
    } else {
      packageName = packageName + "*";
    }

    searchOrDownloadPlugin(packageName, type, true);
  }
  public void searchOrDownloadPlugin(
      final String packageName, final int type, final boolean search) {
    logger.info("searchOrDownloadPlugin: " + packageName + ", search: " + search);

    Intent intent = new Intent(Intent.ACTION_VIEW);
    if (search) intent.setData(Uri.parse("market://search?q=" + packageName));
    else intent.setData(Uri.parse("market://details?id=" + packageName));

    try {

      String name = FeatherIntent.PluginType.getName(type);
      if (null != name) {
        HashMap<String, String> attrs = new HashMap<String, String>();
        attrs.put("assetType", name);
        Tracker.recordTag("content: addMoreClicked", attrs);
      }
      getBaseContext().startActivity(intent);
    } catch (ActivityNotFoundException e) {
      Toast.makeText(getBaseContext(), R.string.feather_activity_not_found, Toast.LENGTH_SHORT)
          .show();
      e.printStackTrace();
    }
  }