Search in sources :

Example 16 with LocalMedia

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);
                }
            }
        }
    }
}
Also used : LocalMedia(com.ningcui.mylibrary.viewLib.Imagepicker.entity.LocalMedia)

Example 17 with LocalMedia

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);
        }
    }
}
Also used : LocalMedia(com.ningcui.mylibrary.viewLib.Imagepicker.entity.LocalMedia)

Example 18 with LocalMedia

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();
    }
}
Also used : LocalMediaFolder(com.ningcui.mylibrary.viewLib.Imagepicker.entity.LocalMediaFolder) LocalMedia(com.ningcui.mylibrary.viewLib.Imagepicker.entity.LocalMedia)

Aggregations

LocalMedia (com.ningcui.mylibrary.viewLib.Imagepicker.entity.LocalMedia)18 View (android.view.View)4 RecyclerView (android.support.v7.widget.RecyclerView)3 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 ArrayList (java.util.ArrayList)3 Bundle (android.os.Bundle)2 File (java.io.File)2 Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1 Nullable (android.support.annotation.Nullable)1 GridImageAdapter (com.litingzhe.justandroid.someOther.imagePicker.adapter.GridImageAdapter)1 FullyGridLayoutManager (com.litingzhe.justandroid.someOther.imagePicker.utils.FullyGridLayoutManager)1 LocalMediaFolder (com.ningcui.mylibrary.viewLib.Imagepicker.entity.LocalMediaFolder)1 RxPermissions (com.ningcui.mylibrary.viewLib.Imagepicker.permissions.RxPermissions)1 Disposable (io.reactivex.disposables.Disposable)1 PhotoView (uk.co.senab.photoview.PhotoView)1 PhotoViewAttacher (uk.co.senab.photoview.PhotoViewAttacher)1