コード例 #1
0
    public View getView(int position, View convertView, ViewGroup parent) {
      Vector categories = model.getVector(KEY_V_ALL_CATEGORIES);
      if (categories == null || position >= categories.size() + 1) {
        return convertView;
      }

      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.add_place_category_item, null);
      }
      CheckedTextView categoryItem = (CheckedTextView) convertView;

      if (position == 0) {
        categoryItem.setText(R.string.addplace_category_label_none);
        categoryItem.setCompoundDrawablesWithIntrinsicBounds(
            R.drawable.list_icon_folder_disabled, 0, 0, 0);
      } else {
        FavoriteCatalog category = (FavoriteCatalog) categories.elementAt(position - 1);
        categoryItem.setCompoundDrawablesWithIntrinsicBounds(
            R.drawable.list_icon_folder_unfocused, 0, 0, 0);
        String categoryName;
        if (category.isReceivedCatalog()) {
          categoryName =
              ResourceManager.getInstance()
                  .getCurrentBundle()
                  .getString(IStringCommon.RES_RECEIVED_CATEGORY, IStringCommon.FAMILY_COMMON);
        } else {
          categoryName = category.getName();
        }
        categoryItem.setText(categoryName);
      }
      return convertView;
    }