Search in sources :

Example 1 with PhotoInfo

use of cn.finalteam.galleryfinal.model.PhotoInfo in project GalleryFinal by pengjianbo.

the class ChoosePhotoListAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    DisplayImageOptions options = new DisplayImageOptions.Builder().showImageOnFail(R.drawable.ic_gf_default_photo).showImageForEmptyUri(R.drawable.ic_gf_default_photo).showImageOnLoading(R.drawable.ic_gf_default_photo).build();
    ImageView ivPhoto = (ImageView) mInflater.inflate(R.layout.adapter_photo_list_item, null);
    setHeight(ivPhoto);
    PhotoInfo photoInfo = mList.get(position);
    ImageLoader.getInstance().displayImage("file:/" + photoInfo.getPhotoPath(), ivPhoto, options);
    return ivPhoto;
}
Also used : PhotoInfo(cn.finalteam.galleryfinal.model.PhotoInfo) ImageView(android.widget.ImageView) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Example 2 with PhotoInfo

use of cn.finalteam.galleryfinal.model.PhotoInfo in project GalleryFinal by pengjianbo.

the class PhotoPreviewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mThemeConfig = GalleryFinal.getGalleryTheme();
    if (mThemeConfig == null) {
        resultFailureDelayed(getString(R.string.please_reopen_gf), true);
    } else {
        setContentView(R.layout.gf_activity_photo_preview);
        findViews();
        setListener();
        setTheme();
        mPhotoList = (List<PhotoInfo>) getIntent().getSerializableExtra(PHOTO_LIST);
        mPhotoPreviewAdapter = new PhotoPreviewAdapter(this, mPhotoList);
        mVpPager.setAdapter(mPhotoPreviewAdapter);
    }
}
Also used : PhotoInfo(cn.finalteam.galleryfinal.model.PhotoInfo) PhotoPreviewAdapter(cn.finalteam.galleryfinal.adapter.PhotoPreviewAdapter)

Example 3 with PhotoInfo

use of cn.finalteam.galleryfinal.model.PhotoInfo in project GalleryFinal by pengjianbo.

the class PhotoSelectActivity method photoItemClick.

private void photoItemClick(View view, int position) {
    PhotoInfo info = mCurPhotoList.get(position);
    if (!GalleryFinal.getFunctionConfig().isMutiSelect()) {
        mSelectPhotoList.clear();
        mSelectPhotoList.add(info);
        String ext = FilenameUtils.getExtension(info.getPhotoPath());
        if (GalleryFinal.getFunctionConfig().isEditPhoto() && (ext.equalsIgnoreCase("png") || ext.equalsIgnoreCase("jpg") || ext.equalsIgnoreCase("jpeg"))) {
            toPhotoEdit();
        } else {
            ArrayList<PhotoInfo> list = new ArrayList<>();
            list.add(info);
            resultData(list);
        }
        return;
    }
    boolean checked = false;
    if (!mSelectPhotoList.contains(info)) {
        if (GalleryFinal.getFunctionConfig().isMutiSelect() && mSelectPhotoList.size() == GalleryFinal.getFunctionConfig().getMaxSize()) {
            toast(getString(R.string.select_max_tips));
            return;
        } else {
            mSelectPhotoList.add(info);
            checked = true;
        }
    } else {
        try {
            for (Iterator<PhotoInfo> iterator = mSelectPhotoList.iterator(); iterator.hasNext(); ) {
                PhotoInfo pi = iterator.next();
                if (pi != null && TextUtils.equals(pi.getPhotoPath(), info.getPhotoPath())) {
                    iterator.remove();
                    break;
                }
            }
        } catch (Exception e) {
        }
        checked = false;
    }
    refreshSelectCount();
    PhotoListAdapter.PhotoViewHolder holder = (PhotoListAdapter.PhotoViewHolder) view.getTag();
    if (holder != null) {
        if (checked) {
            holder.mIvCheck.setBackgroundColor(GalleryFinal.getGalleryTheme().getCheckSelectedColor());
        } else {
            holder.mIvCheck.setBackgroundColor(GalleryFinal.getGalleryTheme().getCheckNornalColor());
        }
    } else {
        mPhotoListAdapter.notifyDataSetChanged();
    }
}
Also used : PhotoInfo(cn.finalteam.galleryfinal.model.PhotoInfo) PhotoListAdapter(cn.finalteam.galleryfinal.adapter.PhotoListAdapter) ArrayList(java.util.ArrayList)

Example 4 with PhotoInfo

use of cn.finalteam.galleryfinal.model.PhotoInfo in project GalleryFinal by pengjianbo.

the class PhotoSelectActivity method takeResult.

@Override
protected void takeResult(PhotoInfo photoInfo) {
    Message message = mHanlder.obtainMessage();
    message.obj = photoInfo;
    message.what = HANLDER_TAKE_PHOTO_EVENT;
    if (!GalleryFinal.getFunctionConfig().isMutiSelect()) {
        //单选
        mSelectPhotoList.clear();
        mSelectPhotoList.add(photoInfo);
        if (GalleryFinal.getFunctionConfig().isEditPhoto()) {
            //裁剪
            mHasRefreshGallery = true;
            toPhotoEdit();
        } else {
            ArrayList<PhotoInfo> list = new ArrayList<>();
            list.add(photoInfo);
            resultData(list);
        }
        mHanlder.sendMessageDelayed(message, 100);
    } else {
        //多选
        mSelectPhotoList.add(photoInfo);
        mHanlder.sendMessageDelayed(message, 100);
    }
}
Also used : PhotoInfo(cn.finalteam.galleryfinal.model.PhotoInfo) Message(android.os.Message) ArrayList(java.util.ArrayList)

Example 5 with PhotoInfo

use of cn.finalteam.galleryfinal.model.PhotoInfo in project GalleryFinal by pengjianbo.

the class FolderListAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(FolderViewHolder holder, int position) {
    PhotoFolderInfo photoFolderInfo = getDatas().get(position);
    String path = "";
    PhotoInfo photoInfo = photoFolderInfo.getCoverPhoto();
    if (photoInfo != null) {
        path = photoInfo.getPhotoPath();
    }
    holder.mIvCover.setImageResource(R.drawable.ic_gf_default_photo);
    Drawable defaultDrawable = mActivity.getResources().getDrawable(R.drawable.ic_gf_default_photo);
    GalleryFinal.getCoreConfig().getImageLoader().displayImage(mActivity, path, holder.mIvCover, defaultDrawable, 200, 200);
    holder.mTvFolderName.setText(photoFolderInfo.getFolderName());
    int size = 0;
    if (photoFolderInfo.getPhotoList() != null) {
        size = photoFolderInfo.getPhotoList().size();
    }
    holder.mTvPhotoCount.setText(mActivity.getString(R.string.folder_photo_size, size));
    if (GalleryFinal.getCoreConfig().getAnimation() > 0) {
        holder.mView.startAnimation(AnimationUtils.loadAnimation(mActivity, GalleryFinal.getCoreConfig().getAnimation()));
    }
    holder.mIvFolderCheck.setImageResource(GalleryFinal.getGalleryTheme().getIconCheck());
    if (mSelectFolder == photoFolderInfo || (mSelectFolder == null && position == 0)) {
        holder.mIvFolderCheck.setVisibility(View.VISIBLE);
        holder.mIvFolderCheck.setColorFilter(GalleryFinal.getGalleryTheme().getCheckSelectedColor());
    } else {
        holder.mIvFolderCheck.setVisibility(View.GONE);
    }
}
Also used : PhotoInfo(cn.finalteam.galleryfinal.model.PhotoInfo) Drawable(android.graphics.drawable.Drawable) PhotoFolderInfo(cn.finalteam.galleryfinal.model.PhotoFolderInfo)

Aggregations

PhotoInfo (cn.finalteam.galleryfinal.model.PhotoInfo)19 File (java.io.File)9 ArrayList (java.util.ArrayList)5 Drawable (android.graphics.drawable.Drawable)4 PhotoFolderInfo (cn.finalteam.galleryfinal.model.PhotoFolderInfo)4 Intent (android.content.Intent)3 IOException (java.io.IOException)3 Message (android.os.Message)2 PhotoTempModel (cn.finalteam.galleryfinal.model.PhotoTempModel)2 Cursor (android.database.Cursor)1 Bitmap (android.graphics.Bitmap)1 ImageView (android.widget.ImageView)1 PhotoEditListAdapter (cn.finalteam.galleryfinal.adapter.PhotoEditListAdapter)1 PhotoListAdapter (cn.finalteam.galleryfinal.adapter.PhotoListAdapter)1 PhotoPreviewAdapter (cn.finalteam.galleryfinal.adapter.PhotoPreviewAdapter)1 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)1 HashMap (java.util.HashMap)1