QiniuImageLoader
??????? ????API????????????????????????
PS: ???????????????????????API?????(?????)?
I. ??
1. ???( library
):
new QiniuImageLoader(context, url)
.centerCrop() // ????
.formatWebp() // ???????webp
.sizeR(R.dimen.target_width) // ?????????????
.addOpBlur(40, 20) // ????????????(radius=40, sigma=20)
.addRotate(60) // ??????60?
.createQiniuUrl();
// ??????url // ????????????????????????????? new QiniuImageLoader(context, url)
.wR(R.dimen.max_width)
.createQiniuUrl();
2. ?? Picasso??????( utils-picasso
)
?????????????????????????
??????picasso??????????????picasso
// ?????????????????? PicassoLoader.setGlobalPlaceHolder(R.drawable.default_place_holder, R.drawable.default_avatar_place_holder);
/** * ??????com.squareup.picasso.Target??? * ??????Activity?????????????(?Activity#onResume?? *
??target?????Activity?????????) */ PicassoLoader.setGlobalTargetProvider(defaultTargetProvider);
PicassoLoader.display7Niu(imageview1, MOCK_DATA_URL)
.target(target) // ???????????Target
.attach();
// ???imageview1? PicassoLoader.display7Niu(imageview2, MOCK_DATA_URL)
.centerCrop() // ????
.wR(R.dimen.max_width) // ??????????????????????????
.addOpBlur(40, 20) // ????????????(radius=40, sigma=20)
.attach();
// ???imageview2?
II. ??
1.0.2???? jitpack.io repository:
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
}
dependencies {
// ???
compile 'com.github.lingochamp.QiniuImageLoader:library:1.0.3'
// ???: ??????picasso??????????????????
compile 'com.github.lingochamp.QiniuImageLoader:utils-picasso:1.0.3'
}
III. ??????API
???????????????API???????????
????????? QiniuImageLoader??
#createQiniuUrl
?? ???????imageMogr2?????????:
/auto-orient
/thumbnail/<imageSizeGeometry>
/gravity/<gravityType>
/crop/<imageSizeAndOffsetGeometry>
/format/<destinationImageFormat>
/blur/<radius>x<sigma>
/rotate/<rotateDegree>
IV. ???
??????????????api????????????????????????????URL??????
??Android???????????????????????????????????????????????????????????????????????:
- ????????????????????????(?????????????????????????)????????????????????(picasso?fresco?glide?bala.bala.)
- ????OOM(565?Activity????largeHeep?nodpi??????)
- ?????????cache??????????????????????????base64?????????????REST?????????????????????????????????????????
???????????????????,?????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???????:
- ?????????????????????????????????
- ?????????webp????????????????30%~70%(????)
- ???????????????/?/??(????????????????????)??????????????????????????????????
- ?????(????????centerCrop?fitXY?)???????????????cpu????
V. ??
1. ???
?? | ??? | ?? |
---|---|---|
size/w/h | ??????? | ???????????? GL10.GL_MAX_TEXTURE_SIZE |
mode | FIT_XY | ????? |
format | webp | ??????,webp????png?30%~70%???????????? |
Op | ???? | ?????? |
2. ????
????library??
??? | url | ?? |
---|---|---|
CenterCrop | /1/w/<Width>/h/<Height> | ?????????? <Width> ????? <Height> ???????????????????????? <Width>x<Height> ????????????????????????????????????? w ?????? h????????????????? |
FitXY | /2/w/<Width>/h/<Height> | ?????????? <Width> ????? <Height> ????????????????? w ?????????????????? h ??????????????? |
ForceOrigin | /1/w/<Width>/h/<Height> | ???????? |
3. ??????
- webp (???)
- jpg
- gif
- png
- origin
4. ??????
- rotate
- blur
??????
1. library
:
???? | ?? |
---|---|
w(width:int)/wR(@DimenRes) | ?????? |
h(width:int)/hR(@DimenRes) | ?????? |
size(size:int)/sizeR(@DimenRes) | ?????? |
screenW(void) | ??????????? |
halfScreenW(void) | ?????????????? |
wTimesN2H(n:float) | ??????n? |
fitXY(void) | ???FitXY?? |
centerCrop(void) | ???CenterCrop?? |
forceOrigin(void) | ????????? GL10.GL_MAX_TEXTURE_SIZE |
formatJpg(void) | ????jpg?? |
formatOrigin(void) | ??????? |
formatPng(void) | ????png?? |
formatWebp(void) | ????webp?? |
addOpBlur(radius:int, sigma:int) | ???????????? |
addOpRotate(rotateDegree:int) | ?????????? |
attach(void) | ???????ImageView????????(????????????????attachNoClear(void) |
2. utils-picasso
utils-picasso
???library
?libarry
????????utils-picasso
??????utils-picasso
???????????
??????
// ???????????????????? PicassoLoader.setGlobalPlaceHolder(defaultPlaceHolder:int, defaultAvatarPlaceHolder:int) // ???????Target??? PicassoLoader.setGlobalTargetProvider(@Nullable provider:TargetProvider)
???????
???? | ?? |
---|---|
avatar(void) | ????????????? |
defaultD(defaultDrawable:Drawable)/defaultD(@DrawableRes) | ????? |
target(target:com.squareup.picasso.Target) | ??picasso?Target |
transformation(transformation:com.squareup.picasso.Transformation) | ??Transformation |
attachWidthNoClear(void) | ??Picasso???????ImageView???????????????? |
attachCallback(attachCallback:com.squareup.picasso.Callback) | ??picasso?Callback |
fetch(void) | ??????? |
???
?wifi????????????
??????????webp?????????????????????????????? ?????????api??????jpg??????????????????? ???????????????????????(???????)
LICENSE
Copyright (c) 2015 LingoChamp Inc. Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.