コード例 #1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    ViewHolder holder = null;
    if (convertView == null) {
      holder = new ViewHolder();
      convertView = LayoutInflater.from(context).inflate(R.layout.grid_item_cat, null);
      holder.iv = (ImageView) convertView.findViewById(R.id.iv_item_cat);
      holder.tv = (TextView) convertView.findViewById(R.id.tv_item_cat);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    Item o = (Item) getItem(position);
    convertView.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub

          }
        });
    holder.iv.setImageResource(o.resid);
    holder.tv.setText(o.title);
    return convertView;
  }
コード例 #2
0
ファイル: MyAdapter.java プロジェクト: cc79128/Run2Fit_alpha
 @Override
 public View getView(int position, View view, ViewGroup arg2) {
   ViewHolder holder = null;
   if (holder == null) {
     holder = new ViewHolder();
     if (view == null) {
       view = inflater.inflate(R.layout.listviewitem, null);
     }
     holder.tv = (TextView) view.findViewById(R.id.item_tv);
     holder.cb = (CheckBox) view.findViewById(R.id.item_cb);
     holder.up = (ImageView) view.findViewById(R.id.imageView_up);
     view.setTag(holder);
   } else {
     holder = (ViewHolder) view.getTag();
   }
   HashMap<String, Object> map = list.get(position);
   if (map != null) {
     itemString = (String) map.get(keyString[0]);
     upString = (String) map.get(keyString[2]);
     holder.tv.setText(itemString);
     if (upString.equals("UPLOAD")) {
       Log.d("upload", "字串=upload");
       holder.up.setImageResource(R.drawable.upload_ok);
     } else {
       Log.d("upload", "字串不等於upload");
       holder.up.setImageResource(R.drawable.upload_not);
     }
   }
   holder.cb.setChecked(isSelected.get(position));
   return view;
 }
コード例 #3
0
  @Override
  public View getView(int position, View convertView, ViewGroup arg2) {
    // TODO Auto-generated method stub
    final ViewHolder holder;

    if (convertView == null) {
      holder = new ViewHolder();
      convertView =
          LayoutInflater.from(mContext).inflate(R.layout.adapter_listview_homepage, null, false);
      holder.tv = (TextView) convertView.findViewById(R.id.tv_tag);
      holder.gl = (MGridView) convertView.findViewById(R.id.my_gridview);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    holder.tv.setText(mList.get(position).getName());

    Homepage_GalleryAdapter adapter =
        new Homepage_GalleryAdapter(mContext, mList.get(position).getUserTags());

    LayoutParams params =
        new LayoutParams(
            mList.get(position).getUserTags().size() * (180 + 6), LayoutParams.WRAP_CONTENT);
    holder.gl.setLayoutParams(params);
    holder.gl.setColumnWidth(180);
    holder.gl.setHorizontalSpacing(6);
    holder.gl.setStretchMode(GridView.NO_STRETCH);
    holder.gl.setNumColumns(mList.get(position).getUserTags().size());

    holder.gl.setAdapter(adapter);
    return convertView;
  }
コード例 #4
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder viewHolder;
   if (convertView == null) {
     viewHolder = new ViewHolder();
     convertView = View.inflate(context, R.layout.setting_choosepicture_gridview_model, null);
     viewHolder.imageView =
         (ImageView) convertView.findViewById(R.id.settingChoosePictureModel_Iv);
     viewHolder.tv = (TextView) convertView.findViewById(R.id.settingChoosePictureModel_selectTv);
     convertView.setTag(viewHolder);
   } else {
     viewHolder = (ViewHolder) convertView.getTag();
   }
   // viewHolder.imageView.setScaleType(ScaleType.FIT_XY);
   // viewHolder.imageView.setLayoutParams(new LinearLayout.LayoutParams(screenW, screenH));
   // ��ͼƬԭʼ�ߴ磬�����Ժ�Ӧ��
   int[] parameter = {arrayList.get(position).getWidth(), arrayList.get(position).getHeight()};
   viewHolder.imageView.setTag(parameter);
   viewHolder.imageView.setImageBitmap(arrayList.get(position));
   if (onlyselectItem == 0) {
     viewHolder.tv.setVisibility(View.VISIBLE);
   }
   if (position == selectItem) {
     viewHolder.tv.setVisibility(View.VISIBLE);
   } else {
     viewHolder.tv.setVisibility(View.GONE);
   }
   if (arrayList.size() == 2) {
     if (position == 0) {
       viewHolder.tv.setVisibility(View.VISIBLE);
     }
   }
   return convertView;
 }
コード例 #5
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder holder = null;
   if (convertView == null) {
     convertView = mInflater.inflate(R.layout.item_recipe_category_gridview, null);
     holder = new ViewHolder();
     holder.tv = (TextView) convertView.findViewById(R.id.item_recipe_category_gridview_nameTv);
     convertView.setTag(holder);
   } else {
     holder = (ViewHolder) convertView.getTag();
   }
   holder.tv.setText(getItem(position).getName());
   return convertView;
 }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder = null;
      if (convertView == null) {
        convertView = LayoutInflater.from(context).inflate(R.layout.item_city, null);
        holder = new ViewHolder();
        holder.tv = (TextView) convertView.findViewById(R.id.city_tv);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      holder.tv.setText(ContantsUtil.cities[position]);
      return convertView;
    }
コード例 #7
0
 @Override
 public View getView(final int position, View convertView, ViewGroup parent) {
   ViewHolder viewHolder = null;
   if (convertView == null) {
     viewHolder = new ViewHolder();
     convertView = mInflater.inflate(R.layout.item_share_girdview, null);
     viewHolder.iv = (ImageView) convertView.findViewById(R.id.itemImage);
     viewHolder.tv = (TextView) convertView.findViewById(R.id.itemText);
     convertView.setTag(viewHolder);
   } else {
     viewHolder = (ViewHolder) convertView.getTag();
   }
   viewHolder.tv.setText(shareItems.get(position).get("name").toString());
   viewHolder.iv.setImageDrawable((Drawable) shareItems.get(position).get("icon"));
   return convertView;
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder vh = new ViewHolder();

    if (convertView == null) {
      convertView = lInflator.inflate(res, null);
      TextView tv = (TextView) convertView.findViewById(R.id.tvEnlace);
      vh.tv = tv;

      convertView.setTag(vh);
    } else {
      vh = (ViewHolder) convertView.getTag();
    }
    vh.tv.setText(values.get(position));

    return convertView;
  }
コード例 #9
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    final ViewHolder holder;
    if (convertView == null) {
      holder = new ViewHolder();
      convertView = this.inflater.inflate(R.layout.item_tag, null);
      holder.iv = (ImageView) convertView.findViewById(R.id.tag_view);
      holder.tv = (TextView) convertView.findViewById(R.id.tag_name);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    String logo = LeetCoderApplication.categories.get(position).size() + "";

    TextDrawable drawable = TextDrawable.builder().buildRound(logo, LeetCoderUtil.GetRandomColor());

    holder.iv.setImageDrawable(drawable);
    holder.tv.setText(LeetCoderApplication.categoriesTag.get(position));
    return convertView;
  }
コード例 #10
0
ファイル: StoreAdapter.java プロジェクト: yzbbanban/dangdang
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    Book book = books.get(position);
    ViewHolder holder;
    if (convertView == null) {
      holder = new ViewHolder();
      convertView = layoutInflater.inflate(R.layout.item_store, null);
      holder.iv = (ImageView) convertView.findViewById(R.id.iv_store_book);
      holder.tv = (TextView) convertView.findViewById(R.id.tv_store_book_name);
      convertView.setTag(holder);
    }
    holder = (ViewHolder) convertView.getTag();

    holder.tv.setText(book.getProductName());
    ImageListener imageListener =
        ImageLoader.getImageListener(holder.iv, R.drawable.touxiang, R.drawable.ic_launcher);
    String picUrl = "http://45.78.24.178:8080/dang/productImages/" + book.getProduct_pic();
    imageLoader.get(picUrl, imageListener);

    return convertView;
  }
コード例 #11
0
ファイル: TvBack.java プロジェクト: imace/stv-android
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
      ViewHolder holder;
      if (convertView == null) {
        LayoutInflater mInflater =
            (LayoutInflater) mCon.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        convertView = mInflater.inflate(R.layout.tvback_item, parent, false);

        holder = new ViewHolder();
        holder.iv = (ImageView) convertView.findViewById(R.id.tvback_item_image);
        holder.tv = (TextView) convertView.findViewById(R.id.tvback_item_name);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      Object obj = mListItem.get(position).get(KeyEnum.poster.toString());
      if (obj != null) {
        String poster = obj.toString();
        if (!ValidateUtil.isBlank(poster) && holder.iv != null) {
          downloader.download(poster, holder.iv);
        }
      } else {
        Log.w(TAG, "no poster idex=" + position);
      }

      obj = mListItem.get(position).get(KeyEnum.name.toString());
      if (obj != null) {
        holder.tv.setText(obj.toString());
      } else {
        holder.tv.setText("");
        Log.w(TAG, "no name idex=" + position);
      }

      return convertView;
    }
コード例 #12
0
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    final ViewHolder viewHolder;
    String path = list.get(position);
    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.grid_child_item, null);
      viewHolder = new ViewHolder();
      viewHolder.mImageView = (MyImageView) convertView.findViewById(R.id.child_image);
      viewHolder.mCheckBox = (CheckBox) convertView.findViewById(R.id.child_checkbox);
      viewHolder.tv = (TextView) convertView.findViewById(R.id.child_tv);
      viewHolder.mImageView.setOnMeasureListener(
          new MyImageView.OnMeasureListener() {

            @Override
            public void onMeasureSize(int width, int height) {
              mPoint.set(width, height);
            }
          });

      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
      viewHolder.mImageView.setImageResource(R.drawable.ic_launcher);
    }
    viewHolder.tv.setText("编号:" + Tool.getSaveTime(list.get(position).toString()));
    viewHolder.mImageView.setTag(path);
    viewHolder.mCheckBox.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
              viewHolder.mCheckBox.setButtonDrawable(R.mipmap.icon_select);
            } else {
              viewHolder.mCheckBox.setButtonDrawable(R.mipmap.icon_unselect);
            }
          }
        });

    viewHolder.mImageView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            //                Intent intent = new Intent(Intent.ACTION_VIEW);
            //                intent.setData(uri);
            //                context.startActivity(intent);
          }
        });

    viewHolder.mCheckBox.setChecked(
        mSelectMap.containsKey(position) ? mSelectMap.get(position) : false);
    Bitmap bitmap =
        LoacalImageLoader.getInstance()
            .loadNativeImage(
                path,
                mPoint,
                new LoacalImageLoader.NativeImageCallBack() {

                  @Override
                  public void onImageLoader(Bitmap bitmap, String path) {
                    ImageView mImageView = (ImageView) mGridView.findViewWithTag(path);
                    if (bitmap != null && mImageView != null) {
                      mImageView.setImageBitmap(bitmap);
                    }
                  }
                });

    if (bitmap != null) {
      viewHolder.mImageView.setImageBitmap(bitmap);
    } else {
      viewHolder.mImageView.setImageResource(R.drawable.ic_launcher);
    }

    return convertView;
  }