use of com.ningcui.mylibrary.viewLib.Imagepicker.entity.LocalMedia in project JustAndroid by chinaltz.
the class PicturePreviewActivity method isPreviewEggs.
/**
* 这里没实际意义,好处是预览图片时 滑动到屏幕一半以上可看到下一张图片是否选中了
*
* @param previewEggs 是否显示预览友好体验
* @param positionOffsetPixels 滑动偏移量
*/
private void isPreviewEggs(boolean previewEggs, int position, int positionOffsetPixels) {
if (previewEggs) {
if (images.size() > 0 && images != null) {
LocalMedia media;
int num;
if (positionOffsetPixels < screenWidth / 2) {
media = images.get(position);
check.setSelected(isSelected(media));
if (checkNumMode) {
num = media.getNum();
check.setText(num + "");
notifyCheckChanged(media);
onImageChecked(position);
}
} else {
media = images.get(position + 1);
check.setSelected(isSelected(media));
if (checkNumMode) {
num = media.getNum();
check.setText(num + "");
notifyCheckChanged(media);
onImageChecked(position + 1);
}
}
}
}
}
use of com.ningcui.mylibrary.viewLib.Imagepicker.entity.LocalMedia in project JustAndroid by chinaltz.
the class PicturePreviewActivity method initViewPageAdapterData.
private void initViewPageAdapterData() {
tv_title.setText(position + 1 + "/" + images.size());
adapter = new SimpleFragmentAdapter(getSupportFragmentManager());
viewPager.setAdapter(adapter);
viewPager.setCurrentItem(position);
onSelectNumChange(false);
onImageChecked(position);
if (images.size() > 0) {
LocalMedia media = images.get(position);
index = media.getPosition();
if (checkNumMode) {
tv_img_num.setSelected(true);
check.setText(media.getNum() + "");
notifyCheckChanged(media);
}
}
}
use of com.ningcui.mylibrary.viewLib.Imagepicker.entity.LocalMedia in project JustAndroid by chinaltz.
the class FolderPopWindow method notifyDataCheckedStatus.
/**
* 设置选中状态
*/
public void notifyDataCheckedStatus(List<LocalMedia> medias) {
try {
// 获取选中图片
List<LocalMediaFolder> folders = adapter.getFolderData();
for (LocalMediaFolder folder : folders) {
folder.setCheckedNum(0);
}
if (medias.size() > 0) {
for (LocalMediaFolder folder : folders) {
// 记录当前相册下有多少张是选中的
int num = 0;
List<LocalMedia> images = folder.getImages();
for (LocalMedia media : images) {
String path = media.getPath();
for (LocalMedia m : medias) {
if (path.equals(m.getPath())) {
num++;
folder.setCheckedNum(num);
}
}
}
}
}
adapter.bindFolderData(folders);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations