예제 #1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
      holder = new ViewHolder();
      convertView = LayoutInflater.from(mContext).inflate(R.layout.hx_choose_griditem, null);
      convertView.setLayoutParams(
          new GridView.LayoutParams(
              DensityUtil.dip2px(mContext, 100), DensityUtil.dip2px(mContext, 100)));
      holder.tv_duration = (TextView) convertView.findViewById(R.id.chatting_length_iv);
      holder.tv_size = (TextView) convertView.findViewById(R.id.chatting_size_iv);
      holder.videoImage = (ImageView) convertView.findViewById(R.id.imageView);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    if (position == 0) {
      holder.videoImage.setImageResource(R.drawable.hx_default_image);

    } else {
      final VideoEntity videoEntity = getItem(position);

      holder.tv_duration.setText(videoEntity.duration + "");
      holder.tv_size.setText(videoEntity.size + "");
      holder.videoImage.setImageResource(R.drawable.hx_default_image);
      holder.videoImage.setTag(position);
      asyncImageLoader.loadImage(position, videoEntity.filePath, imageLoadListener);
    }
    return convertView;
  }
예제 #2
0
 private void init() {
   paint = new Paint(Paint.ANTI_ALIAS_FLAG);
   paint.setColor(Color.DKGRAY);
   paint.setTextAlign(Align.CENTER);
   paint.setTextSize(DensityUtil.sp2px(context, 10));
 }