Sketch Image Loader
English version of the README.md
Sketch ? Android ??????????????????????????????? GIF??????????????????????????????????
?? APP
???????? ????
?????
?? URI ??
. ??http://
?https://
?asset://
?content://
?file:///sdcard/sample.jpg
?/sdcard/sample.jpg
?drawable://
?data:image/
?data:img/
?android.resource://
?apk.icon://
?app.icon://
? URI??? UriModel ???????? URI?? gif ??
. ??? android-gif-drawable 1.2.6 ??????? gif ????????
. ?????????? PhotoView ???????????????????????????????
. ?????????????????????????????
. ?? LruMemoryCache?LruDiskCache ?????????????? LruBitmapPool ?? Bitmap???? GC ??????????????
. ???????????????????????????? JPEG ????????? APK ? APP ??
. ?????? APK ???????????????????APP????? Base64 ??
. ???? Base64 ???????????
. ??????ListView?RecyclerView??????????????? setTag() ?????????? Bitmap
??? maxSize ?????????????????? ImageView? layout_width ? layout_height ???????? TransitionDrawable ??
. ??????????????? TransitionDrawable ?????????????????
. ?? display() ????????????????? load() ?????????????? download() ???????????????????
. ???????????????????????????????? Bitmap.Config
. ????? MimeType ??????? Bitmap.Config???????????? JPEG ????????? Bitmap.Config.RGB_565 ???????????
. ???? URI ???HTTP????????????????????????
??? URI
Type | Scheme |
---|---|
File in network | http://, https:// |
File in SDCard | /, file:// |
Content Resolver | content:// |
Asset Resource | asset:// |
Drawable Resource | drawable:// |
Base64 | data:image/, data:/img/ |
APK Icon | apk.icon:// |
APP Icon | app.icon:// |
Android Resource | android.resource:// |
????? URI ???????
???????
Image Format | Supported Version |
---|---|
jpeg | |
png | |
gif | |
bmp | |
webp |
????
?? Sketch
1.? app ? build.gradle ??? dependencies ???????
compile 'me.panpf:sketch:$sketch_version'
????? $sketch_version
?????? (??"v")
?????? GIF ??? sketch-gif ???
compile 'me.panpf:sketch-gif:$sketch_gif_version'
????? $sketch_gif_version
?????? (??"v")
Android Studio ????? AAR ????????????
2.?????? Android 3.2 ???????????? Application ???????????Android 4.0 ??????? Context ??????
public class MyApplication extends Application {
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
Sketch.with(getBaseContext()).onTrimMemory(level);
}
}
@Override
public void onLowMemory() {
super.onLowMemory();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
Sketch.with(getBaseContext()).onLowMemory();
}
}
}
?? SketchImageView ????
SketchImageView sketchImageView = (SketchImageView) findViewById(R.id.image_main);
sketchImageView.displayImage("http://t.cn/RShdS1f");
- ???? URI ?????? URI ???????
- ?? SketchImageView ??????? SketchImageView ????
??
?????
- URI ???????
- SketchImageView ????
- ?? Options ????
- ?? GIF ??
- ?????????
- ????????
- ?? ShapeSize ???????????
- ?? ImageShaper ???????????
- ?? ImageProcessor ????????
- ?? ImageDisplayer ??????????
- ?? MaxSize ???????????????
- ?? Resize ?????????
- ?? StateImage ???????????
- ????????????????
???????
- ?? TransitionImageDisplayer ??????????????
- ?? thumbnailMode ???????????
- ?? cacheProcessedImageInDisk ????????????????????
- ?? MemoryCacheStateImage ????????????????????????
- ??????????? WIFI ????????????
- ?????????????????????
???
- UriModel ????? URI
- ???? Options
- ???????
- ???? Options
- ????????
- ?? APK ???? APP ???
- ????????
- ?? Bitmap ?? GC ???????
- ?????? Bitmap ??????
- ??????????????????
- ?? HTTP ??
- ????
- ?? Sketch ???
- ??
- ??????? Sketch
- ?????Proguard?
????
- koral-- - android-gif-drawable
- chrisbanes - PhotoView
- bumptech - glide?BitmapPool?
???
License
Copyright (C) 2013 Peng fei Pan <[email protected]> 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.