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

  • 相关阅读:
    C# .net 中文简体繁体转换
    关于html+js将值传输到后端C#的问题(删减版)
    Error mapping types
    Vs编译时RazorTagHelper
    Sum All Numbers in a Range-freecodecamp算法题目
    Caesars Cipher-freecodecamp算法题目
    Where do I belong-freecodecamp算法题目
    Seek and Destroy-freecodecamp算法题目
    Falsy Bouncer-freecodecamp算法题目
    Mutations-freecodecamp算法题目
  • 原文地址:https://www.cnblogs.com/hfy717/p/14904719.html
Copyright © 2011-2022 走看看