ImagePicker
???
??????????????????????????????????????????19.5M?10000*5000px?
???????
??
- subsampling-scale-image-view
- y????????
????
Gradle
1.?Project?build.gradle ???????
// JitPack???? maven {
url "https://jitpack.io"
}
???
allprojects {
repositories {
jcenter()
// JitPack????
maven {
url "https://jitpack.io"
}
}
}
2.?app????build.gradle?????
//SImagePicker compile 'com.github.martin90s:ImagePicker:v1.3.2'
????
1.?????????Application?oncreate????
SImagePicker.init(new PickerConfig.Builder().setAppContext(this)
.setImageLoader(new FrescoImageLoader())
.setToolbaseColor(getColor(R.color.colorPrimary))
.build());
2.????????????
SImagePicker
.from(MainActivity.this)
.maxCount(9)
.rowCount(3)
.pickMode(SImagePicker.MODE_IMAGE)
.fileInterceptor(new SingleFileLimitInterceptor())
.forResult(REQUEST_CODE_IMAGE);
????
1.?????????????PickerConfig,??????SImagePicker???????
???? | ???? |
---|---|
setImageLoader(ImageLoader) | ?????????demo??????Fresco?Glide??ImageLoader,???? |
setToolbarColor(int) | Picker?????????App?primaryColor |
setAppContext(Context) | Picker?????Context???ApplicationContext?? |
2.??????????SImagePicker???????????????????
???? | ???? |
---|---|
from(Activity or Fragment) | ?????????Activity??Fragment??????????onActivityResult()???????????????????????????data.getStringArrayListExtra(PhotoPickerActivity.EXTRA_RESULT_SELECTION); ?????????data.getBooleanExtra(PhotoPickerActivity.EXTRA_RESULT_ORIGINAL, false); |
| | maxCount(int) | ?????????????????1.??????????9????9 | | rowCount(int) | ???????????? | | setSelected(List) | ?????????? | | pickMode(int) | ?????????????????????????????????????????????????? | | cropFilePath(String) | ????????????? | | showCamera(boolen) | ????????? | | pickText(int) | Picker????????????????????????? | | fileInterceptor(FileChooseInterceptor) | ???????????????????????????????????????????????????? | |forResult(int requestCode) | ????????????requestCode
##????
?????????Fragment??Activity?
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_CODE_IMAGE) {
final ArrayList<String> pathList =
data.getStringArrayListExtra(PhotoPickerActivity.EXTRA_RESULT_SELECTION);
final boolean original =
data.getBooleanExtra(PhotoPickerActivity.EXTRA_RESULT_ORIGINAL, false);
}
}
##TODO
- ???????????????????????????SubsamplingView??????????????????????
- Glide???glide???????????????????????????
##????
- ????? [email protected]