zoukankan      html  css  js  c++  java
  • 团队博客

    PictureSelector的学习及测试

    implementation 'com.github.LuckSiege.PictureSelector:picture_library:v2.5.8'
    PictureSelector.create(this)
       .openGallery(PictureMimeType.ofImage())
       .loadImageEngine(GlideEngine.createGlideEngine()) // 请参考Demo GlideEngine.java
       .forResult(PictureConfig.CHOOSE_REQUEST);
       
        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            if (resultCode == RESULT_OK) {
                switch (requestCode) {
                    case PictureConfig.CHOOSE_REQUEST:
                        // 结果回调
                        List<LocalMedia> selectList = PictureSelector.obtainMultipleResult(data);
                        break;
                    default:
                        break;
                }            
            }
    PictureSelector.create(this)
       .openGallery(PictureMimeType.ofAll())
       .loadImageEngine(GlideEngine.createGlideEngine())
       .forResult(new OnResultCallbackListener<LocalMedia>() {
           @Override
           public void onResult(List<LocalMedia> result) {
                // 结果回调
           }
     
           @Override
           public void onCancel() {
                // 取消
           }
         });
    PictureSelector.create(this)
       .openCamera(PictureMimeType.ofImage())
       .loadImageEngine(GlideEngine.createGlideEngine()) // 请参考Demo GlideEngine.java
       .forResult(PictureConfig.REQUEST_CAMERA);  
       
        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            if (resultCode == RESULT_OK) {
                switch (requestCode) {
                    case PictureConfig.REQUEST_CAMERA:
                        // 结果回调
                        List<LocalMedia> selectList = PictureSelector.obtainMultipleResult(data);
                        break;
                    default:
                        break;
                }            
            }
    PictureSelector.create(this)
       .openCamera(PictureMimeType.ofImage())
       .loadImageEngine(GlideEngine.createGlideEngine())
       .forResult(new OnResultCallbackListener<LocalMedia>() {
           @Override
           public void onResult(List<LocalMedia> result) {
                // 结果回调
           }
     
           @Override
           public void onCancel() {
                // 取消
           }
         });

    https://github.com/LuckSiege/PictureSelector

  • 相关阅读:
    053518
    Ubuntu 20.04, 19.10 or 19.04出现libqtgui4 : Depends: libpng120 (>= 1.2.134) but it is not installed
    Ubuntu下安装最新OpenJdk1.8
    c#_FFMPEG使用心得(推流与拉流)
    [WPF 自定义控件]简单的表单布局控件
    WPF调用图片路径,或资源图片
    WPF中的数据模板(DataTemplate)
    MahApps.Metro 官方文档
    MahApps.Metro 图标
    WPF简单导航框架(Window与Page互相调用)
  • 原文地址:https://www.cnblogs.com/hfy717/p/14904719.html
Copyright © 2011-2022 走看看