Пример #1
0
  public String getCategoryDescription() {
    String description = "";

    ArrayList<String> nameList = new ArrayList<String>();
    if (getChildCategoryIdList().size() > 0) {
      for (Long id : getChildCategoryIdList()) {
        CPDecksContentCategory subcategory = CPDecksContentManager.getContentCategory(id);
        if (subcategory != null) {
          nameList.add(subcategory.getTitle());
        }
      }
    } else {
      for (Long id : getContentIdList()) {
        CPDecksContent content = CPDecksContentManager.getContent(id);
        if (content != null & content.getTarget() != null && !content.getTarget().isEmpty()) {
          nameList.add(content.getTarget());
        }
      }
    }
    if (nameList.size() > 0) {
      String delim = "";
      for (String name : nameList) {
        description += delim + name;
        delim = "; ";
      }
    } else {
      description = "<EMPTY>";
    }

    return description;
  }
Пример #2
0
 public int getCategoryContentCount() {
   int count = getContentIdList().size();
   for (Long id : getChildCategoryIdList()) {
     CPDecksContentCategory subcategory = CPDecksContentManager.getContentCategory(id);
     if (subcategory != null) {
       count += subcategory.getCategoryContentCount();
     }
   }
   return count;
 }
Пример #3
0
  public String getImageUrl() {
    if (mImageUrl == null || mImageUrl.isEmpty()) {
      for (Long id : getContentIdList()) {
        CPDecksContent content = CPDecksContentManager.getContent(id);
        if (content != null && content.getImageUrl() != null && !content.getImageUrl().isEmpty()) {
          return content.getImageUrl();
        }
      }
      for (Long id : getChildCategoryIdList()) {
        CPDecksContentCategory subcategory = CPDecksContentManager.getContentCategory(id);
        if (subcategory != null
            && subcategory.getImageUrl() != null
            && !subcategory.getImageUrl().isEmpty()) {
          return subcategory.getImageUrl();
        }
      }
    }

    return mImageUrl;
  }
Пример #4
0
 public int compareTo(CPDecksContentCategory category) {
   if (category == null) {
     return -1;
   }
   return getTitle().compareTo(category.getTitle());
 }