├── README.md ├── androidstudio_version ├── .gitignore ├── .idea │ ├── .name │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── vcs.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── qiao │ │ │ └── imageselector │ │ │ ├── ImageAdapter.java │ │ │ ├── MainActivity.java │ │ │ └── old │ │ │ ├── DemoActivity.java │ │ │ └── ImageBrowserActivity.java │ │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-v19 │ │ └── styles.xml │ │ ├── values-v21 │ │ └── styles.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── qiao │ │ │ ├── activity │ │ │ └── ContainerActivity.java │ │ │ ├── adapter │ │ │ ├── BaseAdapter.java │ │ │ ├── ImageCursorAdapter.java │ │ │ └── RecyclerViewCursorAdapter.java │ │ │ ├── bean │ │ │ ├── Bucket.java │ │ │ └── SelectorParamContext.java │ │ │ ├── fragment │ │ │ ├── ImageBrowserFragment.java │ │ │ └── ImageSelectorFragment.java │ │ │ ├── photoview │ │ │ ├── ImageOption.java │ │ │ ├── PhotoView.java │ │ │ └── RotateGestureDetector.java │ │ │ ├── util │ │ │ ├── AnimUtil.java │ │ │ ├── ImageLoadUtil.java │ │ │ ├── MediaHelper.java │ │ │ └── Util.java │ │ │ └── view │ │ │ ├── ActionSheet.java │ │ │ ├── BucketView.java │ │ │ ├── ImageItemView.java │ │ │ ├── MaskView.java │ │ │ └── PageImageView.java │ │ └── res │ │ ├── anim │ │ ├── translate_down.xml │ │ └── translate_up_current.xml │ │ ├── drawable-hdpi │ │ ├── actionsheet_button1_normal.9.png │ │ ├── actionsheet_button1_press.9.png │ │ ├── arrow_down.png │ │ ├── bucket_border_bg.png │ │ ├── ic_launcher.png │ │ └── pic_default.png │ │ ├── drawable-xhdpi │ │ ├── actionsheet_button_bottom_n.9.png │ │ ├── actionsheet_button_bottom_p.9.png │ │ ├── actionsheet_button_center_n.9.png │ │ ├── actionsheet_button_center_p.9.png │ │ ├── actionsheet_button_single_n.9.png │ │ ├── actionsheet_button_single_p.9.png │ │ ├── actionsheet_button_top_n.9.png │ │ ├── actionsheet_button_top_p.9.png │ │ ├── arrow_up.png │ │ ├── btn_back_nor.png │ │ ├── btn_back_sel.png │ │ ├── ic_launcher.png │ │ ├── image_checked.png │ │ ├── next_indicator.png │ │ ├── picker_browser_n.9.png │ │ └── picker_browser_p.9.png │ │ ├── drawable │ │ ├── actionsheet_button1.xml │ │ ├── actionsheet_button_bottom.xml │ │ ├── actionsheet_button_center.xml │ │ ├── actionsheet_button_single.xml │ │ ├── actionsheet_button_top.xml │ │ ├── btn_back_selector.xml │ │ ├── btn_green_shape_selector.xml │ │ └── picker_browser.xml │ │ ├── layout │ │ ├── activity_image_browser.xml │ │ ├── bucket_item.xml │ │ ├── checked_image_item.xml │ │ ├── empty_linear_layout.xml │ │ └── fragment_image_selector.xml │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── pre-lollipop-activity-transition │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── kogitune │ │ │ └── pre_lollipop_activity_transition │ │ │ └── ApplicationTest.java │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── kogitune │ │ └── activity_transition │ │ ├── ActivityTransition.java │ │ ├── ActivityTransitionLauncher.java │ │ ├── BuildConfigUtils.java │ │ ├── ExitActivityTransition.java │ │ ├── core │ │ ├── MoveData.java │ │ ├── TransitionAnimation.java │ │ ├── TransitionBundleFactory.java │ │ └── TransitionData.java │ │ └── fragment │ │ ├── ExitFragmentTransition.java │ │ ├── FragmentTransition.java │ │ └── FragmentTransitionLauncher.java └── settings.gradle ├── eclipse_version_1.0 ├── .classpath ├── .project ├── .settings │ └── org.eclipse.jdt.core.prefs ├── AndroidManifest.xml ├── README.md ├── bin │ ├── AndroidManifest.xml │ ├── ImageSelector.apk │ ├── classes.dex │ ├── classes │ │ └── com │ │ │ └── qiao │ │ │ ├── activity │ │ │ ├── DemoActivity.class │ │ │ ├── ImageBrowserActivity$1.class │ │ │ ├── ImageBrowserActivity$ImagePagerAdapter$1.class │ │ │ ├── ImageBrowserActivity$ImagePagerAdapter.class │ │ │ ├── ImageBrowserActivity.class │ │ │ ├── ImageSelectorActivty$1.class │ │ │ ├── ImageSelectorActivty$2.class │ │ │ ├── ImageSelectorActivty$3.class │ │ │ ├── ImageSelectorActivty$4.class │ │ │ ├── ImageSelectorActivty$5.class │ │ │ ├── ImageSelectorActivty$6$1.class │ │ │ ├── ImageSelectorActivty$6.class │ │ │ ├── ImageSelectorActivty$7.class │ │ │ ├── ImageSelectorActivty$8$1.class │ │ │ ├── ImageSelectorActivty$8.class │ │ │ ├── ImageSelectorActivty$9.class │ │ │ └── ImageSelectorActivty.class │ │ │ ├── adapter │ │ │ ├── BaseAdapter.class │ │ │ ├── ImageCursorAdapter$1.class │ │ │ └── ImageCursorAdapter.class │ │ │ ├── bean │ │ │ ├── Bucket.class │ │ │ └── SelectorParamContext.class │ │ │ ├── fragment │ │ │ ├── ImageBrowserFragment$1.class │ │ │ ├── ImageBrowserFragment$ImagePagerAdapter$1.class │ │ │ ├── ImageBrowserFragment$ImagePagerAdapter.class │ │ │ ├── ImageBrowserFragment.class │ │ │ ├── ImageSelectorFragment$1.class │ │ │ ├── ImageSelectorFragment$2.class │ │ │ ├── ImageSelectorFragment$3.class │ │ │ ├── ImageSelectorFragment$4.class │ │ │ ├── ImageSelectorFragment$5.class │ │ │ ├── ImageSelectorFragment$6$1.class │ │ │ ├── ImageSelectorFragment$6.class │ │ │ ├── ImageSelectorFragment$7.class │ │ │ ├── ImageSelectorFragment$8$1.class │ │ │ ├── ImageSelectorFragment$8.class │ │ │ ├── ImageSelectorFragment$9.class │ │ │ └── ImageSelectorFragment.class │ │ │ ├── imageselector │ │ │ ├── BuildConfig.class │ │ │ ├── R$anim.class │ │ │ ├── R$attr.class │ │ │ ├── R$drawable.class │ │ │ ├── R$id.class │ │ │ ├── R$layout.class │ │ │ ├── R$string.class │ │ │ ├── R$style.class │ │ │ └── R.class │ │ │ ├── util │ │ │ ├── AnimUtil$OnAnimationEndListener.class │ │ │ ├── AnimUtil$OnAnimationRepeatListener.class │ │ │ ├── AnimUtil$OnAnimationStartListener.class │ │ │ ├── AnimUtil.class │ │ │ ├── ImageLoadUtil$1$1.class │ │ │ ├── ImageLoadUtil$1.class │ │ │ ├── ImageLoadUtil$2.class │ │ │ ├── ImageLoadUtil$3.class │ │ │ ├── ImageLoadUtil$4.class │ │ │ ├── ImageLoadUtil$ImageLoadListener.class │ │ │ ├── ImageLoadUtil$ImageSize.class │ │ │ ├── ImageLoadUtil$ImgBeanHolder.class │ │ │ ├── ImageLoadUtil$Type.class │ │ │ ├── ImageLoadUtil.class │ │ │ ├── MediaHelper.class │ │ │ └── Util.class │ │ │ └── view │ │ │ ├── ActionSheet$1.class │ │ │ ├── ActionSheet$2.class │ │ │ ├── ActionSheet$3.class │ │ │ ├── ActionSheet$4.class │ │ │ ├── ActionSheet$5.class │ │ │ ├── ActionSheet$6.class │ │ │ ├── ActionSheet$Action1.class │ │ │ ├── ActionSheet$Func.class │ │ │ ├── ActionSheet.class │ │ │ ├── BucketView.class │ │ │ ├── CheckedImageView.class │ │ │ ├── MaskView$1.class │ │ │ ├── MaskView$2.class │ │ │ ├── MaskView$MaskListener.class │ │ │ ├── MaskView.class │ │ │ └── PageImageView.class │ ├── dexedLibs │ │ ├── android-support-v4-5312ceeeac931ab61a0b0bfddd54180e.jar │ │ ├── android-support-v4-bc12fc50ee1df56c4b748bd198ebe9f0.jar │ │ ├── photoview-0d4f067b5a018540d959e0cb20817194.jar │ │ └── photoview-36c07f5315d83923e4b8d17ea1f113e1.jar │ ├── jarlist.cache │ ├── res │ │ └── crunch │ │ │ ├── drawable-hdpi │ │ │ ├── actionsheet_button1_normal.9.png │ │ │ ├── actionsheet_button1_press.9.png │ │ │ ├── arrow_down.png │ │ │ ├── bucket_border_bg.png │ │ │ ├── ic_launcher.png │ │ │ └── pic_default.png │ │ │ └── drawable-xhdpi │ │ │ ├── actionsheet_button_bottom_n.9.png │ │ │ ├── actionsheet_button_bottom_p.9.png │ │ │ ├── actionsheet_button_center_n.9.png │ │ │ ├── actionsheet_button_center_p.9.png │ │ │ ├── actionsheet_button_single_n.9.png │ │ │ ├── actionsheet_button_single_p.9.png │ │ │ ├── actionsheet_button_top_n.9.png │ │ │ ├── actionsheet_button_top_p.9.png │ │ │ ├── arrow_up.png │ │ │ ├── btn_back_nor.png │ │ │ ├── btn_back_sel.png │ │ │ ├── ic_launcher.png │ │ │ ├── image_checked.png │ │ │ ├── next_indicator.png │ │ │ ├── picker_browser_n.9.png │ │ │ └── picker_browser_p.9.png │ └── resources.ap_ ├── gen │ └── com │ │ └── qiao │ │ └── imageselector │ │ ├── BuildConfig.java │ │ └── R.java ├── ic_launcher-web.png ├── libs │ ├── android-support-v4.jar │ └── photoview.jar ├── lint.xml ├── proguard-project.txt ├── project.properties ├── res │ ├── anim │ │ ├── translate_down.xml │ │ └── translate_up_current.xml │ ├── drawable-hdpi │ │ ├── actionsheet_button1_normal.9.png │ │ ├── actionsheet_button1_press.9.png │ │ ├── arrow_down.png │ │ ├── bucket_border_bg.png │ │ ├── ic_launcher.png │ │ └── pic_default.png │ ├── drawable-xhdpi │ │ ├── actionsheet_button_bottom_n.9.png │ │ ├── actionsheet_button_bottom_p.9.png │ │ ├── actionsheet_button_center_n.9.png │ │ ├── actionsheet_button_center_p.9.png │ │ ├── actionsheet_button_single_n.9.png │ │ ├── actionsheet_button_single_p.9.png │ │ ├── actionsheet_button_top_n.9.png │ │ ├── actionsheet_button_top_p.9.png │ │ ├── arrow_up.png │ │ ├── btn_back_nor.png │ │ ├── btn_back_sel.png │ │ ├── ic_launcher.png │ │ ├── image_checked.png │ │ ├── next_indicator.png │ │ ├── picker_browser_n.9.png │ │ └── picker_browser_p.9.png │ ├── drawable │ │ ├── actionsheet_button1.xml │ │ ├── actionsheet_button_bottom.xml │ │ ├── actionsheet_button_center.xml │ │ ├── actionsheet_button_single.xml │ │ ├── actionsheet_button_top.xml │ │ ├── btn_back_selector.xml │ │ ├── btn_green_shape_selector.xml │ │ └── picker_browser.xml │ ├── layout │ │ ├── activity_image_browser.xml │ │ ├── activity_image_selector.xml │ │ ├── bucket_item.xml │ │ └── checked_image_item.xml │ └── values │ │ ├── strings.xml │ │ └── styles.xml └── src │ └── com │ └── qiao │ ├── activity │ ├── DemoActivity.java │ ├── ImageBrowserActivity.java │ └── ImageSelectorActivty.java │ ├── adapter │ ├── BaseAdapter.java │ └── ImageCursorAdapter.java │ ├── bean │ ├── Bucket.java │ └── SelectorParamContext.java │ ├── fragment │ ├── ImageBrowserFragment.java │ └── ImageSelectorFragment.java │ ├── util │ ├── AnimUtil.java │ ├── ImageLoadUtil.java │ ├── MediaHelper.java │ └── Util.java │ └── view │ ├── ActionSheet.java │ ├── BucketView.java │ ├── CheckedImageView.java │ ├── MaskView.java │ └── PageImageView.java └── screenShot ├── ImageDemo.gif ├── device-1.png ├── device-2.png └── device-3.png /README.md: -------------------------------------------------------------------------------- 1 | # ImageSelector 2 | 本地选图控件,支持单选、多选和预览。注:实例中提供的图片质量(这里只提供选项,并没有实际压缩操作) 3 | 4 | ``v2.0`` **android studio** 5 | 6 | ![android studio](https://raw.githubusercontent.com/Qiaoidea/ImageSelector/master/screenShot/ImageDemo.gif) 7 | 8 | - 1.修改AsyncTask查询图库为 CurSorLoader; 9 | - 2.更改ImageView显示方式,支持缩放、旋转; 10 | - 3.使用AppCompact、RecyclerView替换GridView; 11 | - 4.变更大图打开方式,添加过渡动画; 12 | 13 | 14 | ``1.0`` eclipse 15 | 16 |

17 | Screenshot 18 |    19 | Screenshot 20 |    21 | Screenshot 22 |

23 | 24 | # 如何使用 25 | ## 一、使用Activity方式 26 | ### 导入 27 | 1. 可以单独将此项目作为库(isLibrary)或者直接将java src和res文件拷贝至项目中,在 AndroidManifest.xml 中配置 28 | 29 | ``` 30 | 31 | 32 | ``` 33 | 34 | ### 使用 35 | 2. 使用指向ImageSelectorActivity的Intent ,传入参数为 SelectorParamContext 36 | 37 | ``` 38 | public class SelectorParamContext implements Serializable{ 39 | 40 | protected int maxCount;//最大选图数量 41 | protected boolean hasQulityMenu;//是否有图片清晰度选项 42 | protected boolean isHighQulity;//是否高清 43 | protected boolean isMult;//是否多选 44 | protected ArrayList selectedFile; //选中图片path 45 | ``` 46 | 47 | ## 二、使用Fragment方式 48 | 1. 在你的页面添加Fragment,详情参见DemoActivity。用法同上。只是不用再AndroidManifest.xml 中配置 49 | 50 | 51 | ## 示例: 52 | 53 | ``` 54 | /** 55 | *选图时调用 56 | **/ 57 | public void startImageSelector(){ 58 | Intent intent = new Intent(YourActivity , ImageSelectorActivity.class); 59 | SelectorParamContext params = new SelectorParamContext(); 60 | params.setMult(true); 61 | params.setMaxCount(9); 62 | params.setHasQulityMenu(true); 63 | startActivityForResult(intent, requestCode); 64 | } 65 | 66 | /** 67 | *返回对象也为 SelectorParamContext 68 | **/ 69 | @Override 70 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 71 | 72 | if (resultCode == Activity.RESULT_OK) { 73 | SelectorParamContext params = (SelectorParamContext)data.getSerializableExtra(SelectorParamContext.TAG_SELECTOR); 74 | //你的处理逻辑 75 | } 76 | } 77 | ``` 78 | -------------------------------------------------------------------------------- /androidstudio_version/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /androidstudio_version/.idea/.name: -------------------------------------------------------------------------------- 1 | androidstudio_version -------------------------------------------------------------------------------- /androidstudio_version/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /androidstudio_version/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /androidstudio_version/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /androidstudio_version/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | -------------------------------------------------------------------------------- /androidstudio_version/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /androidstudio_version/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /androidstudio_version/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /androidstudio_version/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /androidstudio_version/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /androidstudio_version/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.qiao.imageselector" 9 | minSdkVersion 9 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | compile project(':library') 25 | compile 'com.android.support:recyclerview-v7:23.1.1' 26 | compile project(':pre-lollipop-activity-transition') 27 | } 28 | -------------------------------------------------------------------------------- /androidstudio_version/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\AndroidSDK/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /androidstudio_version/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /androidstudio_version/app/src/main/java/com/qiao/imageselector/ImageAdapter.java: -------------------------------------------------------------------------------- 1 | package com.qiao.imageselector; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.FrameLayout; 10 | import android.widget.ImageView; 11 | 12 | import com.kogitune.activity_transition.ActivityTransitionLauncher; 13 | import com.qiao.activity.ContainerActivity; 14 | import com.qiao.fragment.ImageBrowserFragment; 15 | import com.qiao.util.ImageLoadUtil; 16 | 17 | import java.util.ArrayList; 18 | 19 | /** 20 | * Created by yuweichen on 15/12/10. 21 | */ 22 | public class ImageAdapter extends RecyclerView.Adapter{ 23 | private Context context; 24 | private ArrayList images = new ArrayList<>(); 25 | private int widget; 26 | public ImageAdapter(Context context){ 27 | this.context = context; 28 | widget = context.getResources().getDisplayMetrics().widthPixels / 3; 29 | } 30 | 31 | @Override 32 | public ImageHolder onCreateViewHolder(ViewGroup parent, int viewType) { 33 | return new ImageHolder(new ImageView(context)); 34 | } 35 | 36 | @Override 37 | public void onBindViewHolder(ImageHolder holder, int position) { 38 | holder.setData(getItem(position)); 39 | } 40 | 41 | public void addData(ArrayList images){ 42 | this.images.addAll(images); 43 | notifyDataSetChanged(); 44 | } 45 | 46 | public void clearAdapter(){ 47 | this.images.clear(); 48 | notifyDataSetChanged(); 49 | } 50 | 51 | public String getItem(int position){ 52 | return this.images.get(position); 53 | } 54 | 55 | @Override 56 | public int getItemCount() { 57 | return images.size(); 58 | } 59 | 60 | class ImageHolder extends RecyclerView.ViewHolder{ 61 | private ImageView imageView; 62 | public ImageHolder(View itemView) { 63 | super(itemView); 64 | imageView = (ImageView) itemView; 65 | FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(widget, ViewGroup.LayoutParams.WRAP_CONTENT); 66 | params.setMargins(3,3,3,3); 67 | imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); 68 | imageView.setLayoutParams(params); 69 | } 70 | 71 | public void setData(final String imagePath){ 72 | ImageLoadUtil.getInstance().loadImage(imagePath, imageView); 73 | imageView.setOnClickListener(new View.OnClickListener() { 74 | @Override 75 | public void onClick(View v) { 76 | // final Intent intent = new Intent(context, ImageBrowserActivity.class); 77 | final Intent intent = ContainerActivity.makeIntent(context, ImageBrowserFragment.class); 78 | intent.putExtra("currIndex",images.indexOf(imagePath)); 79 | intent.putStringArrayListExtra("dataList",images); 80 | ActivityTransitionLauncher 81 | .with((Activity) context) 82 | .from(v) 83 | .launch(intent); 84 | } 85 | }); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /androidstudio_version/app/src/main/java/com/qiao/imageselector/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.qiao.imageselector; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.support.v7.widget.StaggeredGridLayoutManager; 8 | import android.view.View; 9 | import android.widget.Toast; 10 | 11 | import com.qiao.activity.ContainerActivity; 12 | import com.qiao.bean.SelectorParamContext; 13 | import com.qiao.fragment.ImageSelectorFragment; 14 | import com.qiao.imageselector.demo.R; 15 | 16 | import java.util.ArrayList; 17 | 18 | public class MainActivity extends AppCompatActivity { 19 | public static final int PICK_REQUEST_CODE = 10086; 20 | 21 | RecyclerView recyclerView; 22 | ImageAdapter imageAdapter; 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.activity_main); 27 | 28 | recyclerView = (RecyclerView) findViewById(R.id.recyclerview); 29 | recyclerView.setLayoutManager(new StaggeredGridLayoutManager(3,StaggeredGridLayoutManager.VERTICAL)); 30 | 31 | imageAdapter = new ImageAdapter(this); 32 | recyclerView.setAdapter(imageAdapter); 33 | } 34 | 35 | public void clickPick(View view){ 36 | /** 37 | *选图时调用 38 | **/ 39 | Intent intent = ContainerActivity.makeIntent(this, ImageSelectorFragment.class); 40 | SelectorParamContext params = new SelectorParamContext(); 41 | params.setMult(true); 42 | params.setMaxCount(9); 43 | params.setHasQulityMenu(true); 44 | startActivityForResult(intent, PICK_REQUEST_CODE); 45 | } 46 | 47 | @Override 48 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 49 | super.onActivityResult(requestCode, resultCode, data); 50 | if(resultCode!=RESULT_OK){ 51 | return; 52 | } 53 | 54 | if(requestCode==PICK_REQUEST_CODE){ 55 | SelectorParamContext params = (SelectorParamContext)data.getParcelableExtra(SelectorParamContext.TAG_SELECTOR); 56 | //你的处理逻辑 57 | ArrayList pick = params.getSelectedFile(); 58 | Toast.makeText(this,"pick size:"+pick.size(),Toast.LENGTH_SHORT).show(); 59 | imageAdapter.clearAdapter(); 60 | imageAdapter.addData(pick); 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /androidstudio_version/app/src/main/java/com/qiao/imageselector/old/DemoActivity.java: -------------------------------------------------------------------------------- 1 | package com.qiao.imageselector.old; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentActivity; 6 | import android.support.v4.app.FragmentManager; 7 | import android.support.v4.app.FragmentTransaction; 8 | import android.view.View; 9 | import android.widget.FrameLayout; 10 | 11 | import com.qiao.fragment.ImageSelectorFragment; 12 | 13 | public class DemoActivity extends FragmentActivity{ 14 | protected View containerView; 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | containerView = new FrameLayout(this); 20 | containerView.setId(android.R.id.content); 21 | setContentView(containerView); 22 | 23 | initFragment(); 24 | } 25 | 26 | private void initFragment() { 27 | Fragment fragment = new ImageSelectorFragment(); 28 | FragmentManager fm = getSupportFragmentManager(); 29 | FragmentTransaction ft = fm.beginTransaction(); 30 | ft.add(android.R.id.content, fragment); 31 | ft.commitAllowingStateLoss(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /androidstudio_version/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 |