Ejemplo n.º 1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      convertView =
          LayoutInflater.from(mContext)
              .inflate(Res.getLayoutID("plugin_camera_select_folder"), null);
      holder = new ViewHolder();
      holder.backImage = (ImageView) convertView.findViewById(Res.getWidgetID("file_back"));
      holder.imageView = (ImageView) convertView.findViewById(Res.getWidgetID("file_image"));
      holder.choose_back = (ImageView) convertView.findViewById(Res.getWidgetID("choose_back"));
      holder.folderName = (TextView) convertView.findViewById(Res.getWidgetID("name"));
      holder.fileNum = (TextView) convertView.findViewById(Res.getWidgetID("filenum"));
      holder.imageView.setAdjustViewBounds(true);
      //			LinearLayout.LayoutParams lp = new
      // LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,dipToPx(65));
      //			lp.setMargins(50, 0, 50,0);
      //			holder.imageView.setLayoutParams(lp);
      holder.imageView.setScaleType(ImageView.ScaleType.FIT_XY);
      convertView.setTag(holder);
    } else holder = (ViewHolder) convertView.getTag();
    String path;
    if (AlbumActivity.contentList.get(position).imageList != null) {

      // path = photoAbsolutePathList.get(position);
      // 封面图片路径
      path = AlbumActivity.contentList.get(position).imageList.get(0).imagePath;
      // 给folderName设置值为文件夹名称
      // holder.folderName.setText(fileNameList.get(position));
      holder.folderName.setText(AlbumActivity.contentList.get(position).bucketName);

      // 给fileNum设置文件夹内图片数量
      // holder.fileNum.setText("" + fileNum.get(position));
      holder.fileNum.setText("" + AlbumActivity.contentList.get(position).count);

    } else path = "android_hybrid_camera_default";
    if (path.contains("android_hybrid_camera_default"))
      holder.imageView.setImageResource(Res.getDrawableID("plugin_camera_no_pictures"));
    else {
      //			holder.imageView.setImageBitmap(
      // AlbumActivity.contentList.get(position).imageList.get(0).getBitmap());
      final ImageItem item = AlbumActivity.contentList.get(position).imageList.get(0);
      holder.imageView.setTag(item.imagePath);
      cache.displayBmp(holder.imageView, item.thumbnailPath, item.imagePath, callback);
    }
    // 为封面添加监听
    holder.imageView.setOnClickListener(
        new ImageViewClickListener(position, mIntent, holder.choose_back));

    return convertView;
  }
Ejemplo n.º 2
0
  //    private ArrayList<ImageItem> dataList;
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GlobalVariables.Typr = 0;
    Res.init(this);
    getPhotos = new GetPhotos();
    File sd = Environment.getExternalStorageDirectory();
    String path = sd.getPath() + "/citycircle/Cache";
    File file = new File(path);
    if (!file.exists()) file.mkdir();

    tempFile = new File(file, getPhotos.getPhotoFileName());
    dialog = MyDialog.createLoadingDialog(ReplyPhoto.this, "正在上传...");
    bimap = BitmapFactory.decodeResource(getResources(), R.mipmap.icon_addpic_unfocused);
    PublicWay.activityList.add(this);
    parentView = getLayoutInflater().inflate(R.layout.activity_selectimg, null);
    setContentView(parentView);
    location = (LocationApplication) getApplication();
    mLocClient = ((LocationApplication) getApplication()).mLocationClient;
    url = GlobalVariables.urlstr + "Quan.getCategory";
    Init();
    getclass(0);
  }