예제 #1
0
 public SparseIntArray buildFlistIndex(ArrayList<Flist> myFlistList) {
   SparseIntArray myPositionMap = new SparseIntArray();
   Integer position = 0;
   for (Flist myCat : myFlistList) {
     myPositionMap.put(myCat.getID(), position);
     position++;
   }
   return myPositionMap;
 }
예제 #2
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      ViewHolder holder = null;
      // Log.v("ConvertView", String.valueOf(position));
      // Log.v("AddEditCatActivity", "convertView" + convertView);

      if (convertView == null) {
        LayoutInflater vi =
            (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        // TODO: Should I set null to parent? It errors if I do but I can't call the one below if i
        // do.
        convertView = vi.inflate(R.layout.fragment_flist_list_view, null);

        holder = new ViewHolder();
        holder.flist_list_text_view =
            (TextView) convertView.findViewById(R.id.flist_list_text_view);
        holder.flist_list_text_view_type =
            (TextView) convertView.findViewById(R.id.flist_list_text_view_type);

        convertView.setTag(holder);

        View.OnClickListener flistClickListener;
        flistClickListener =
            new View.OnClickListener() {
              public void onClick(View v) {
                TextView tv = (TextView) v;
                Flist flist = (Flist) tv.getTag();
                // showList(category.getID());
                // Log.v("CategoryViewFragment.MyCatListCustomAdapter", "category.getID(): " +
                // category.getID());
                sFlistCallback.onFlistSelected(flist.getID());
              }
            };
        holder.flist_list_text_view.setOnClickListener(flistClickListener);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      Flist category = flistList.get(position);
      // TODO: Make a function in ListManager to get and hold the category type names in memory
      int categoryTypeID = category.getType();
      // String categoryDescription = category.getDescription();
      String categoryName = category.getName();
      String categoryType = "(L)";
      // if (category.getFilterID() == 0) {
      //	categoryType = "(C)";
      // }
      String categoryTypeName = myListMan.getTypeName(categoryTypeID);

      // Log.v("MyCatListCustomAdapter", "categoryTypeID:" + categoryTypeID);
      // Log.v("MyCatListCustomAdapter", "category.getDescription(): " + category.getDescription());
      // Log.v("MyCatListCustomAdapter", "myListMan.getCategoryTypeName(): " +
      // myListMan.getTypeName(categoryTypeID));

      holder.flist_list_text_view.setText(categoryType + " " + categoryName);
      holder.flist_list_text_view_type.setText("(" + categoryTypeName + ")");
      holder.flist_list_text_view.setTag(category);
      // TODO: Link this to type type editing activity later
      holder.flist_list_text_view_type.setTag(category);

      return convertView;
    }