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;
}
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);
}
}
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();
}
}
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);
}
}
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);
}
}
Aggregations