Esempio n. 1
0
 /** @throws FacebookException if the GraphObject doesn't have an ID. */
 String getIdOfGraphObject(T graphObject) {
   if (graphObject.asMap().containsKey(ID)) {
     Object obj = graphObject.getProperty(ID);
     if (obj instanceof String) {
       return (String) obj;
     }
   }
   throw new FacebookException("Received an object without an ID.");
 }
    private void fillView(int position, @NotNull ViewGroup result) {
      final T mathEntity = getItem(position);

      final TextView text = (TextView) result.findViewById(R.id.math_entity_text);
      text.setText(String.valueOf(mathEntity));

      final String mathEntityDescription =
          descriptionGetter.getDescription(getContext(), mathEntity.getName());

      final TextView description = (TextView) result.findViewById(R.id.math_entity_description);
      if (!StringUtils.isEmpty(mathEntityDescription)) {
        description.setVisibility(View.VISIBLE);
        description.setText(mathEntityDescription);
      } else {
        description.setVisibility(View.GONE);
      }
    }
Esempio n. 3
0
  protected String getSectionKeyOfGraphObject(T graphObject) {
    String result = null;

    if (groupByField != null) {
      result = (String) graphObject.getProperty(groupByField);
      if (result != null && result.length() > 0) {
        result = result.substring(0, 1).toUpperCase();
      }
    }

    return (result != null) ? result : "";
  }
Esempio n. 4
0
  protected URI getPictureUriOfGraphObject(T graphObject) {
    String uri = null;
    Object o = graphObject.getProperty(PICTURE);
    if (o instanceof String) {
      uri = (String) o;
    } else if (o instanceof JSONObject) {
      ItemPicture itemPicture = GraphObject.Factory.create((JSONObject) o).cast(ItemPicture.class);
      ItemPictureData data = itemPicture.getData();
      if (data != null) {
        uri = data.getUrl();
      }
    }

    if (uri != null) {
      try {
        return new URI(uri);
      } catch (URISyntaxException e) {
      }
    }
    return null;
  }
Esempio n. 5
0
 protected CharSequence getTitleOfGraphObject(T graphObject) {
   return (String) graphObject.getProperty(NAME);
 }