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

  • 相关阅读:
    类变量、成员变量、实例变量、局部变量、静态变量、全局变量的解释
    String的属性和方法
    数组的扩容
    以下实例演示了如何通过 List 类的 Arrays.toString () 方法和 List 类的 list.Addall(array1.asList(array2) 方法将两个数组合并为一个数组
    数组获取最大值和最小值
    Java字符串反转
    IO-3
    IO-2
    IO流
    泛型、MAP集合
  • 原文地址:https://www.cnblogs.com/hfy717/p/14904719.html
Copyright © 2011-2022 走看看