@Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View view = null;
    if (convertView == null) {
      LayoutInflater inflator = context.getLayoutInflater();
      view = inflator.inflate(R.layout.filter_color_listview_row, parent, false);
      final ViewHolder viewHolder = new ViewHolder();
      viewHolder.checkbox = (CheckBox) view.findViewById(R.id.check_color);
      viewHolder.text = (TextView) view.findViewById(R.id.label_color);
      viewHolder.textcolor = (TextView) view.findViewById(R.id.color_display_txt);
      viewHolder.checkbox.setOnCheckedChangeListener(
          new CompoundButton.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              Model element = (Model) viewHolder.checkbox.getTag();
              element.setSelected(buttonView.isChecked());
            }
          });
      view.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View arg0) {
              // TODO Auto-generated method stub
              viewHolder.checkbox.setChecked(!viewHolder.checkbox.isChecked());
            }
          });
      view.setTag(viewHolder);
      viewHolder.checkbox.setTag(list.get(position));
    } else {
      view = convertView;
      ((ViewHolder) view.getTag()).checkbox.setTag(list.get(position));
    }
    ViewHolder holder = (ViewHolder) view.getTag();

    holder.text.setTextSize(5 * context.getResources().getDisplayMetrics().density);
    holder.checkbox.setChecked(list.get(position).isSelected());
    JSONArray object;
    try {
      object = new JSONArray(list.get(position).getName());
      final float scale = context.getResources().getDisplayMetrics().density;
      GradientDrawable gd = new GradientDrawable();
      gd.setColor(
          Color.parseColor(
              object.getString(
                  1))); // Changes this drawbale to use a single color instead of a gradient
      gd.setCornerRadius((int) (2 * scale + 0.5f));
      gd.setStroke((int) (2 * scale + 0.5f), Color.parseColor("#000000"));
      holder.textcolor.setBackgroundDrawable(gd);

      holder.text.setText(object.getString(0));
      // holder.textcolor.setBackgroundColor(Color.parseColor(object.getString(1)));
    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return view;
  }
Пример #2
1
  @Override
  public View getView(final int position, View convertView, final ViewGroup parent) {
    final ViewHolder viewHolder;

    if (convertView == null) {

      LayoutInflater vi = (LayoutInflater) base.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      convertView = vi.inflate(R.layout.item_reminder, parent, false);

      viewHolder = new ViewHolder();
      convertView.setTag(viewHolder);

      viewHolder.title = (TextView) convertView.findViewById(R.id.textViewReminderTitle);
      viewHolder.text = (TextView) convertView.findViewById(R.id.textViewReminderText);
      viewHolder.time = (TextView) convertView.findViewById(R.id.textViewReminderTime);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }

    String s = reminderList.get(position);

    String[] tokens = s.split(",");

    viewHolder.index = position;
    viewHolder.title.setText(tokens[1]);
    viewHolder.text.setText(tokens[2]);
    viewHolder.time.setText(tokens[3]);

    return convertView;
  }
Пример #3
0
    @Override
    public View getChildView(
        int groupPosition,
        final int childPosition,
        boolean isLastChild,
        View convertView,
        ViewGroup parent) {

      ViewHolder holder;
      ViewHolder amount;
      ViewHolder when;

      if (convertView == null) {

        convertView =
            inf.inflate(R.layout.wallets_teens_fragment_receive_list_detail, parent, false);
        holder = new ViewHolder();

        holder.text = (TextView) convertView.findViewById(R.id.notes);

        convertView.setTag(holder);

        amount = new ViewHolder();
        amount.text = (TextView) convertView.findViewById(R.id.amount);

        amount.text.setText(transactions_amounts[groupPosition][childPosition].toString());

        when = new ViewHolder();
        when.text = (TextView) convertView.findViewById(R.id.when);

        when.text.setText(transactions_whens[groupPosition][childPosition].toString());

        // asigned tagId at icons action
        ImageView icon_receive_form_contact =
            (ImageView) convertView.findViewById(R.id.icon_receive_form_contact);
        icon_receive_form_contact.setTag(
            "ReceiveFromContactActivity|" + groupPosition + "-" + childPosition);

        ImageView send_message = (ImageView) convertView.findViewById(R.id.icon_chat_over_trx);
        send_message.setTag("ChatOverTrxActivity|" + groupPosition + "|" + childPosition);

      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      holder.text.setText(getChild(groupPosition, childPosition).toString());

      return convertView;
    }
Пример #4
0
  public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder;

    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.farmer_list_item, null);

      holder = new ViewHolder();
      holder.text = (TextView) convertView.findViewById(R.id.farmer);
      holder.text_date = (TextView) convertView.findViewById(R.id.textView_date);

      convertView.setTag(holder);
    } else {

      holder = (ViewHolder) convertView.getTag();
    }

    holder.text.setText(
        filteredData.get(position).getFirstNAme()
            + "  "
            + filteredData.get(position).getOtherNames());
    /*holder.text.setTag(filteredData.get(position).getId());*/

    holder.text_date.setText(filteredData.get(position).getDateCreated() + "");

    return convertView;
  }
Пример #5
0
    /**
     * Make a view to hold each row.
     *
     * @see android.widget.ListAdapter#getView(int, android.view.View, android.view.ViewGroup)
     */
    public View getView(int position, View convertView, ViewGroup parent) {
      // A ViewHolder keeps references to children views to avoid
      // unneccessary calls to findViewById() on each row.
      ViewHolder holder;

      // When convertView is not null, we can reuse it directly, there
      // is
      // no need to reinflate it. We only inflate a new View when the
      // convertView supplied by ListView is null.
      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.list_item_icon_text, null);
        // Creates a ViewHolder and store references to the two
        // children
        // views we want to bind data to.
        holder = new ViewHolder();
        holder.text = (TextView) convertView.findViewById(R.id.text);
        holder.icon = (ImageView) convertView.findViewById(R.id.icon);

        convertView.setTag(holder);
      } else {
        // Get the ViewHolder back to get fast access to the
        // TextView
        // and the ImageView.
        holder = (ViewHolder) convertView.getTag();
      }

      Bitmap icon = strImg.get(itemsD.get(position).getCategory());

      // Bind the data efficiently with the holder.
      holder.text.setText(itemsD.get(position).getTitle());
      holder.icon.setImageBitmap(icon);
      return convertView;
    }
Пример #6
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
      holder = new ViewHolder();
      convertView = inflater.inflate(R.layout.page, parent, false);

      holder.text = (TextView) convertView.findViewById(R.id.text);
      holder.firstPage = (Button) convertView.findViewById(R.id.first_page);
      holder.lastPage = (Button) convertView.findViewById(R.id.last_page);

      holder.firstPage.setOnClickListener(this);
      holder.lastPage.setOnClickListener(this);

      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.text.setText("" + position);
    convertView.setBackgroundColor(getColor(position));

    return convertView;
  }
 private void setViewHolder(View view) {
   ViewHolder vh = new ViewHolder();
   vh.text = (TextView) view.findViewById(R.id.cell_name_textview);
   vh.imageButton = (ImageButton) view.findViewById(R.id.cell_trash_button);
   vh.needInflate = false;
   view.setTag(vh);
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
      holder = new ViewHolder();
      convertView = inflater.inflate(R.layout.item_main_listview, parent, false);
      holder.text = (TextView) convertView.findViewById(R.id.tv_fragment_lv_item);
      holder.img = (NetworkImageView) convertView.findViewById(R.id.iv_fragment_lv_item);

      mImageLoader = MySingleton.getInstance(mContext).getImageLoader();
      convertView.setTag(holder);

    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.text.setText(getItem(position).getItem_title());
    holder.img.setImageUrl(
        getItem(position).getImg_add() + getItem(position).getImg_names()[0], mImageLoader);
    // Set the URL of the image that should be loaded into this view, and
    // specify the ImageLoader that will be used to make the request.
    Log.i(TAG, "image url: " + img_add.get(position));

    holder.img.getLayoutParams().height = img_size;
    holder.img.getLayoutParams().width = img_size;

    return convertView;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    final ViewHolder holder;
    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.list_item_google_cards_travel, parent, false);
      holder = new ViewHolder();
      holder.image = (ImageView) convertView.findViewById(R.id.list_item_google_cards_travel_image);
      holder.categoryName =
          (TextView) convertView.findViewById(R.id.list_item_google_cards_travel_category_name);
      holder.title = (TextView) convertView.findViewById(R.id.list_item_google_cards_travel_title);
      holder.text = (TextView) convertView.findViewById(R.id.list_item_google_cards_travel_text);
      holder.explore =
          (TextView) convertView.findViewById(R.id.list_item_google_cards_travel_explore);
      holder.share = (TextView) convertView.findViewById(R.id.list_item_google_cards_travel_share);
      holder.explore.setOnClickListener(this);
      holder.share.setOnClickListener(this);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    item = getItem(position);
    ImageUtil.displayImage(holder.image, item.getmImageURL(), null);
    holder.title.setText(item.getName());
    holder.text.setText(item.getmDescription());
    holder.explore.setTag(position);
    holder.categoryName.setText(item.getCategory());
    holder.share.setTag(position);

    return convertView;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    ContactListActivity1 con = null;
    View view = null;
    LayoutInflater inflater = _context.getLayoutInflater();
    view = inflater.inflate(R.layout.contactlistitem, null);
    final ViewHolder viewHolder = new ViewHolder();
    viewHolder.text = (TextView) view.findViewById(R.id.txtDisplayName);
    viewHolder.imageview = (ImageView) view.findViewById(R.id.contact_image);
    viewHolder.setContact(_contacts.get(position));

    view.setTag(viewHolder);

    boolean blnFound = con.invisibilty.contains(position);
    if (blnFound) {
      System.out.println("Disable the position number::" + position);
      viewHolder.text.setVisibility(View.INVISIBLE);
      viewHolder.imageview.setVisibility(View.INVISIBLE);
    }

    // if(invisibilty.get(position)!=position){convertView.setVisibility(View.GONE);}

    return view;
  }
Пример #11
0
    public View getView(int position, View convertView, ViewGroup parent) {

      ViewHolder holder;
      /*if (convertView == null) {*/
      if (iWidth == 1920 && iHeight == 1128)
        convertView = mInflater.inflate(R.layout.outlinebig, null);
      else if (iWidth == 1024 && iHeight == 720)
        convertView = mInflater.inflate(R.layout.outlinemid, null);
      else convertView = mInflater.inflate(R.layout.outlinesmall, null);

      holder = new ViewHolder();
      holder.text = (TextView) convertView.findViewById(R.id.text);
      holder.icon = (ImageView) convertView.findViewById(R.id.icon);
      convertView.setTag(holder);
      /*} else {
      	holder = (ViewHolder) convertView.getTag();
      }*/

      int level = mfilelist.get(position).getLevel();
      holder.icon.setPadding(
          25 * (level + 1), holder.icon.getPaddingTop(), 0, holder.icon.getPaddingBottom());
      holder.text.setText(mfilelist.get(position).getOutlineTitle());
      if (mfilelist.get(position).isMhasChild()
          && (mfilelist.get(position).isExpanded() == false)) {
        holder.icon.setImageBitmap(mIconCollapse);
      } else if (mfilelist.get(position).isMhasChild()
          && (mfilelist.get(position).isExpanded() == true)) {
        holder.icon.setImageBitmap(mIconExpand);
      } else if (!mfilelist.get(position).isMhasChild()) {
        holder.icon.setImageBitmap(mIconCollapse);
        holder.icon.setVisibility(View.INVISIBLE);
      }
      return convertView;
    }
    // A view to hold each row in the list
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      // A ViewHolder keeps references to children views to avoid
      // unneccessary calls
      // to findViewById() on each row.
      ViewHolder holder;

      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.listviewrow, null);

        holder = new ViewHolder();
        holder.text = (TextView) convertView.findViewById(R.id.headline);
        convertView.setTag(holder);

      } else {
        holder = (ViewHolder) convertView.getTag();
      }
      // Bind the data efficiently with the holder.
      // System.out.println("The holder is: " + holder.toString());
      holder.text.setText(data[position]);

      // Set the background color depending of odd/even colorPos result
      int colorPos = position % colors.length;
      convertView.setBackgroundColor(colors[colorPos]);

      return convertView;
    }
  public View getView(int position, View convertView, ViewGroup parent) {

    view = convertView;
    if (view == null) {
      viewHolder = new ViewHolder();
      view = inflater.inflate(R.layout.list_view_item_tracker_all_routes, null);
      viewHolder.text = (TextView) view.findViewById(R.id.textV_tracker_all_route_title);
      viewHolder.textSub = (TextView) view.findViewById(R.id.textV_tracker_all_route_sub_title);
      viewHolder.imgV = (Button) view.findViewById(R.id.img_tracker_all_routes_numbering);

      view.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) view.getTag();
    }

    viewHolder.text.setText(listOfAllRoutes.get(position).get(2));
    viewHolder.textSub.setText(listOfAllRoutes.get(position).get(8));

    if (listOfAllRoutes.get(position).get(0).equalsIgnoreCase("rail")) {
      viewHolder.imgV.setBackgroundDrawable(
          MyApplication.listOfImage.get(listOfAllRoutes.get(position).get(1)));
      viewHolder.imgV.setText("");
    } else {
      viewHolder.imgV.setBackgroundResource(R.drawable.bus_stop_icon_bkg);
      viewHolder.imgV.setText(listOfAllRoutes.get(position).get(1));
    }

    return view;
  }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder = null;

      if (convertView == null) {
        convertView =
            getActivity().getLayoutInflater().inflate(R.layout.simple_list_item_with_icon, null);
        holder = new ViewHolder();
        holder.title = (TextView) convertView.findViewById(R.id.title);
        holder.title.setTypeface(tfb);
        holder.text = (TextView) convertView.findViewById(R.id.text);
        holder.text.setTypeface(tf);
        holder.icon = (ImageView) convertView.findViewById(R.id.icon);

        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      ForecastItem o = items.get(position);

      holder.title.setText(o.getDay());
      holder.text.setText(o.getForecastText());
      holder.icon.setImageResource(o.getWeatherIcon());

      return convertView;
    }
Пример #15
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.file_row, null);
      holder = new ViewHolder();
      holder.text = (TextView) convertView.findViewById(R.id.text);
      holder.icon = (ImageView) convertView.findViewById(R.id.icon);

      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    File f = new File(paths.get(position).toString());
    if (items.get(position).toString().equals("b1")) {
      holder.text.setText("Back to root directory");
      holder.icon.setImageBitmap(mIcon1);
    } else if (items.get(position).toString().equals("b2")) {
      holder.text.setText("Back to paranet directory");
      holder.icon.setImageBitmap(mIcon2);
    } else {
      holder.text.setText(f.getName());
      if (f.isDirectory()) {
        holder.icon.setImageBitmap(mIcon3);
      } else if (f.getName().endsWith("arff") || (f.getName().endsWith("model"))) {
        holder.icon.setImageBitmap(mIcon4);
      }
    }
    return convertView;
  }
Пример #16
0
  @Override
  public View getChildView(
      int groupPosition,
      final int childPosition,
      boolean isLastChild,
      View rowView,
      ViewGroup parent) {

    if (rowView == null) {
      LayoutInflater inflater = context.getLayoutInflater();
      rowView = inflater.inflate(R.layout.adapter_listview_about, null);
      // configure view holder
      ViewHolder viewHolder = new ViewHolder();
      viewHolder.image = (ImageView) rowView.findViewById(R.id.img);
      viewHolder.text = (TextView) rowView.findViewById(R.id.txt);
      viewHolder.text2 = (TextView) rowView.findViewById(R.id.description);
      rowView.setTag(viewHolder);
    }

    DeveloperBean developer = childData.get(headers.get(groupPosition)).get(childPosition);

    ViewHolder holder = (ViewHolder) rowView.getTag();

    holder.image.setImageDrawable(developer.getImage());
    holder.text.setText(developer.getTitle());
    holder.text2.setText(developer.getDescription());

    return rowView;
  }
Пример #17
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      final ViewHolder holder;

      if (convertView == null || convertView instanceof TextView) {
        convertView = inflater.inflate(R.layout.rbm_item, null);

        holder = new ViewHolder();
        holder.image = (ImageView) convertView.findViewById(R.id.list_img_chevron);
        holder.text = (TextView) convertView.findViewById(R.id.rbm_item_text);

        convertView.setTag(holder);

      } else {

        holder = (ViewHolder) convertView.getTag();
      }
      String str = menulist[position];
      // 设置内容
      String ss[] = str.split(",");
      // holder.image.setImageResource();
      holder.text.setText(ss[1]);
      System.out.println("menulist " + ss[1]);
      return convertView;
    }
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    itemPosition = position;
    if (convertView == null) {
      convertView = myInflater.inflate(R.layout.main, null);

      holder = new ViewHolder();
      holder.text = (TextView) convertView.findViewById(R.id.list_text);
      holder.description = (TextView) convertView.findViewById(R.id.description_text);

      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.text.setPadding(20, 8, 0, 0);
    holder.description.setPadding(20, 40, 0, 0);

    holder.text.setText(mixListView.getDataSourceMenu().get(position));
    holder.description.setText(mixListView.getDataSourceDescription().get(position));

    int colorPos = position % bgcolors.length;
    convertView.setBackgroundColor(bgcolors[colorPos]);
    holder.text.setTextColor(textcolors[colorPos]);
    holder.description.setTextColor(descriptioncolors[colorPos]);

    return convertView;
  }
Пример #19
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View rowView = convertView;

    if (rowView == null) {
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      rowView = inflater.inflate(R.layout.goal_row, parent, false);

      // configure view holder
      final ViewHolder viewHolder = new ViewHolder();
      viewHolder.text = (TextView) rowView.findViewById(R.id.label);
      viewHolder.checkbox = (CheckBox) rowView.findViewById(R.id.check);
      viewHolder.checkbox.setOnCheckedChangeListener(
          new CompoundButton.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              Goal element = (Goal) viewHolder.checkbox.getTag();
              element.setCompleted(buttonView.isChecked());
              context.sendBroadcast(new Intent(HomeActivity.BROADCAST_SAVE));
            }
          });
      rowView.setTag(viewHolder);
    }

    // fill data
    ViewHolder holder = (ViewHolder) rowView.getTag();
    Goal goal = values.get(position);
    holder.text.setText(goal.getText());
    holder.checkbox.setTag(goal);
    holder.checkbox.setChecked(goal.getCompleted());

    return rowView;
  }
Пример #20
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.auto_icon_item, null);
      holder = new ViewHolder();
      holder.text = (TextView) convertView.findViewById(R.id.text);
      holder.image = (ImageView) convertView.findViewById(R.id.image);

      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    AutoIconItem item = mItems.get(position);

    holder.text.setText(item.keyword);

    if (item.icon != null) {
      int iconId =
          mContext
              .getResources()
              .getIdentifier(item.icon, "drawable", "com.groupagendas.groupagenda");
      holder.image.setImageResource(iconId);
    }

    return convertView;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub

    View vi = convertView;
    ViewHolder holder;

    if (convertView == null) {

      /** **** Inflate tabitem.xml file for each row ( Defined below ) ****** */
      vi = inflater.inflate(R.layout.listview_row, null);

      /** **** View Holder Object to contain tabitem.xml file elements ***** */
      holder = new ViewHolder();
      holder.text = (TextView) vi.findViewById(R.id.text);
      holder.text1 = (TextView) vi.findViewById(R.id.text1);
      holder.image = (ImageView) vi.findViewById(R.id.image);

      /** ********** Set holder with LayoutInflater *********** */
      vi.setTag(holder);
    } else holder = (ViewHolder) vi.getTag();

    holder.text.setText("Company " + position);
    holder.text1.setText("company description " + position);
    ImageView image = holder.image;

    // DisplayImage function from ImageLoader Class
    imageLoader.DisplayImage(data[position], image);

    /** ****** Set Item Click Listner for LayoutInflater for each row ********** */
    vi.setOnClickListener(new OnItemClickListener(position));
    return vi;
  }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder;
      if (convertView == null) {
        convertView = mLayoutInflater.inflate(R.layout.row, parent, false);

        holder = new ViewHolder();

        holder.text = (TextView) convertView.findViewById(R.id.row_txt);
        holder.image = (ImageView) convertView.findViewById(R.id.image);

        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }
      if (!mListItems.isEmpty()) {
        ChatMessage chatMessage = mListItems.get(position);
        if (chatMessage != null) {
          holder.text.setText(chatMessage.message);

          holder.image.setImageResource(
              R.drawable.icon); // Here we can use some custom graphic for each user
        }
      }
      return convertView;
    }
Пример #23
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    final String textString = (String) getItem(position);
    ViewHolder holder;
    int type = types[position];
    if (convertView == null || ((ViewHolder) convertView.getTag()).type != type) {
      holder = new ViewHolder();
      if (type == TYPE_CANCEL) {
        convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout_cancel, null);
      } else if (type == TYPE_BUTTON) {
        convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout, null);
      } else if (type == TYPE_TITLE) {
        convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout_title, null);
      } else if (type == TYPE_EXIT) {
        convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout_special, null);
      }

      // holder.view = (LinearLayout) convertView.findViewById(R.id.popup_layout);
      holder.text = (TextView) convertView.findViewById(R.id.popup_text);
      holder.type = type;

      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.text.setText(textString);
    return convertView;
  }
Пример #24
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    final String textString = (String) getItem(position);
    ViewHolder holder;
    int type = types[position];
    if (convertView == null || ((ViewHolder) convertView.getTag()).position != position) {
      holder = new ViewHolder();
      if (type == TYPE_CANCEL) { //
        convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout_cancel, null);
        holder.text = (TextView) convertView.findViewById(R.id.popup_text);
      } else if (type == TYPE_BUTTON) { //
        convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout, null);
        holder.text = (TextView) convertView.findViewById(R.id.popup_text);
        if (changeLenth == 1) {
          holder.text.setBackgroundResource(R.drawable.white_btn_n);
        } else if (changeLenth >= 2) {
          if (position == 0) {
            holder.text.setBackgroundResource(R.drawable.pop_top);
          } else if (position == changeLenth - 1) {
            holder.text.setBackgroundResource(R.drawable.pop_bottom);
          } else {
            holder.text.setBackgroundResource(R.drawable.pop_center);
          }
        }
      } else if (type == TYPE_TITLE || type == TYPE_EXIT) { //
        convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout_title, null);
        holder.text = (TextView) convertView.findViewById(R.id.popup_text);
      } /*else if (type == TYPE_EXIT) {
        	convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout_special, null);
        }*/
      holder.position = position;
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.text.setText(textString);
    return convertView;
  }
Пример #25
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder;

      if (convertView == null) {
        holder = new ViewHolder();
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_layout, null);
        holder.text = (TextView) convertView.findViewById(R.id.text);
        holder.image = (WebImageView) convertView.findViewById(R.id.image);
        holder.box = (CheckBox) convertView.findViewById(R.id.favorite);
        convertView.setTag(holder);
      }

      final Event item = getItem(position);
      holder = (ViewHolder) convertView.getTag();
      convertView.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              v.setBackgroundColor(Color.RED);
              onItemClicked(item);
            }
          });
      Spanned html_text =
          Html.fromHtml(
              item.getTitle()
                  + "<br/><small>"
                  + item.getVenue().getCity()
                  + ", "
                  + item.getVenue().getCountry()
                  + "<br/>"
                  + EventDate.getDuration(item)
                  + "</small>");
      holder.text.setText(html_text);
      holder.image.setImageWithURL(getContext(), item.getImageURL(ImageSize.MEDIUM));

      final EventBookmark e =
          Entity.query(EventBookmark.class).where("name").eq(item.getTitle()).execute();
      if (e == null) holder.box.setChecked(false);
      else holder.box.setChecked(true);

      holder.box.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              bookmark(v, item, e);
            }
          });

      return convertView;
    }
    /**
     * Make a view to hold each row.
     *
     * @see android.widget.ListAdapter#getView(int, android.view.View, android.view.ViewGroup)
     */
    public View getView(int position, View convertView, ViewGroup parent) {
      // A ViewHolder keeps references to children views to avoid unneccessary calls
      // to findViewById() on each row.
      ViewHolder holder;

      // When convertView is not null, we can reuse it directly, there is no need
      // to reinflate it. We only inflate a new View when the convertView supplied
      // by ListView is null.
      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.list_item_icon_text, null);

        // Creates a ViewHolder and store references to the two children views
        // we want to bind data to.
        holder = new ViewHolder();
        holder.text = (TextView) convertView.findViewById(R.id.text);
        holder.icon = (ImageView) convertView.findViewById(R.id.icon);
        holder.permission = (ImageView) convertView.findViewById(R.id.permission);
        holder.permissionText = (TextView) convertView.findViewById(R.id.TextViewPermission);

        convertView.setTag(holder);
      } else {
        // Get the ViewHolder back to get fast access to the TextView
        // and the ImageView.
        holder = (ViewHolder) convertView.getTag();
      }

      // Bind the data efficiently with the holder.
      holder.text.setText(LABELS[position]);
      holder.icon.setImageBitmap(ICONS[position]);

      if (PERMISSIONS[position] == ConfigurationDatabase.PERMISSION_UNKNOWN) {
        PERMISSIONS[position] = PERMISSION_DEFAULT;
      }

      if (PERMISSIONS[position] == ConfigurationDatabase.PERMISSION_ALLOW) {
        holder.permission.setImageBitmap(mBitmapAllow);
        holder.permissionText.setText(PERMISSION_STRING_ALLOW);
      } else if (PERMISSIONS[position] == ConfigurationDatabase.PERMISSION_DISALLOW) {
        holder.permission.setImageBitmap(mBitmapDisallow);
        holder.permissionText.setText(PERMISSION_STRING_DISALLOW);
      } else if (PERMISSIONS[position] == ConfigurationDatabase.PERMISSION_ASK) {
        holder.permission.setImageBitmap(mBitmapAsk);
        holder.permissionText.setText(PERMISSION_STRING_ASK);
      }

      holder.icon.setImageBitmap(ICONS[position]);

      return convertView;
    }
Пример #27
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
      holder = new ViewHolder();
      convertView = inflater.inflate(R.layout.test_list_item_layout, parent, false);
      holder.text = (TextView) convertView.findViewById(R.id.txtHeader);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    holder.text.setText(countries[position]);
    return convertView;
  }
Пример #28
0
 @Override
 public View getGroupView(
     int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
   ViewHolder holder;
   if (convertView == null) {
     convertView = inf.inflate(R.layout.list_group, parent, false);
     holder = new ViewHolder();
     holder.text = (TextView) convertView.findViewById(R.id.lblListHeader);
     convertView.setTag(holder);
   } else {
     holder = (ViewHolder) convertView.getTag();
   }
   holder.text.setText(getGroup(groupPosition).toString());
   return convertView;
 }
Пример #29
0
 /**
  * 是配置
  *
  * @param position 1
  * @param convertView 1
  * @param parent 1
  * @return 1
  */
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   // ViewHolder通常出现在适配器里,为的是listview滚动的时候快速设置值,而不必每次都重新创建很多对象,从而提升性能
   ViewHolder holder;
   if (convertView == null) {
     holder = new ViewHolder();
     convertView = mInflater.inflate(R.layout.test_list_item_layout, parent, false);
     holder.text = (TextView) convertView.findViewById(R.id.text);
     convertView.setTag(holder);
   } else {
     holder = (ViewHolder) convertView.getTag();
   }
   // 设置值
   holder.text.setText(mCountries[position]);
   return convertView;
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
      convertView = inflater.inflate(R.layout.simple_text_item, null);

      holder = new ViewHolder();
      holder.text = (TextView) convertView.findViewById(R.id.simple_text_text_view);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.text.setText(items.get(position).getTitle());
    return convertView;
  }