package com.dahe.pass.utils;

import android.app.Activity;
import android.content.pm.ActivityInfo;

import androidx.fragment.app.FragmentActivity;

import com.dahe.mylibrary.R;
import com.dahe.mylibrary.adapter.GridImageAdapter;
import com.dahe.mylibrary.weight.GlideEngine;
import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.entity.LocalMedia;
import com.luck.picture.lib.listener.OnResultCallbackListener;

import java.util.ArrayList;

public class SelectPhotoUtils5 {



    private Activity ctx;
    private OnResultCallbackListener listener;
    private GridImageAdapter mAdapter;

    private static class SingletonHolder {
        private static final SelectPhotoUtils5 INSTANCE = new SelectPhotoUtils5();
    }

    private SelectPhotoUtils5() {
    }

    public static final SelectPhotoUtils5 getInstance() {
        return SingletonHolder.INSTANCE;
    }

    public void showPic(FragmentActivity activity, String path){
        ArrayList<LocalMedia> localMedias = new ArrayList<>();
        LocalMedia localMedia1 = new LocalMedia();
        localMedia1.setPath(path);
        localMedias.add(localMedia1);
        PictureSelector.create(activity)
                .themeStyle(R.style.picture_default_style) // xml设置主题
//                                .setPictureStyle(mPictureParameterStyle)// 动态自定义相册主题
                //.setPictureWindowAnimationStyle(animationStyle)// 自定义页面启动动画
                .setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)// 设置相册Activity方向，不设置默认使用系统
                .isNotPreviewDownload(true)// 预览图片长按是否可以下载
                //.bindCustomPlayVideoCallback(new MyVideoSelectedPlayCallback(getContext()))// 自定义播放回调控制，用户可以使用自己的视频播放界面
                .imageEngine(GlideEngine.createGlideEngine())// 外部传入图片加载引擎，必传项
                .openExternalPreview(0, localMedias);
    }
}
