@Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      ImageView imageView;
      if (convertView == null) {
        imageView = new ImageView(PicContainerActivity.this);
        imageView.setLayoutParams(
            new GridView.LayoutParams(IMAGE_VIEW_WIDTH, IMAGE_VIEW_WIDTH)); //
        imageView.setAdjustViewBounds(false);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setPadding(8, 8, 8, 8);
      } else {
        imageView = (ImageView) convertView;
      }

      if (!readonly && position == imageFileUriList.size()) {
        imageView.setImageResource(R.drawable.add_camera);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                showPopupWindow(v);
              }
            });
      } else {
        final FileEntity image = (FileEntity) this.getItem(position);
        imageView.setBackgroundResource(0);
        if (image.getFileUri() != null) {
          imageView.setImageBitmap(
              FileHelper.decodeFile(image.getFileUri(), true, IMAGE_VIEW_WIDTH, IMAGE_VIEW_WIDTH));
        } else {
          ImageLoader.getInstance().displayImage(image.getAliasName(), imageView, true);
        }

        imageView.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                Intent intent = new Intent(PicContainerActivity.this, ImagePreviewActivity.class);
                intent.putExtra(ImagePreviewActivity.IMAGE_SRC_KEY, image);
                intent.putExtra(ImagePreviewActivity.IMAGE_INDEX_IN_CONTAINER, position);
                intent.putExtra(ImagePreviewActivity.IMAGE_DELETE_FLAG, !readonly);

                PicContainerActivity.this.startActivityForResult(
                    intent, PREVIEW_IMAGE_ACTIVITY_REQUEST_CODE);
              }
            });
      }
      return imageView;
    }
 protected void clean() {
   // 清理临时的图片文件
   if (imageFileUriList != null && !imageFileUriList.isEmpty()) {
     for (FileEntity file : imageFileUriList) {
       String fileUrl = file.getFileUri();
       if (fileUrl != null && fileUrl.length() > 0) {
         FileHelper.deleteCacheFile(fileUrl);
       }
     }
   }
   imageFileUriList.clear();
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_preview);

    ActionBar actionBar = this.getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    Intent intent = this.getIntent();
    imageFile = (FileEntity) intent.getExtras().getSerializable(IMAGE_SRC_KEY);
    imageIndex = intent.getExtras().getInt(IMAGE_INDEX_IN_CONTAINER);
    showDeleteMenuItem = intent.getExtras().getBoolean(IMAGE_DELETE_FLAG);
    // showByLocalFile = intent.getExtras().getBoolean(SHOW_BY_LOCAL_FILE);
    showByLocalFile = imageFile.getFileUri() != null;

    ImageView view = (ImageView) this.findViewById(R.id.image_preview_id);
    if (showByLocalFile) {
      view.setImageURI(Uri.parse(imageFile.getFileUri()));
    } else {
      ImageLoader.getInstance().displayImage(imageFile.getAliasName(), view, false);
    }
  }