Skip to content

Commit

Permalink
🔨 Removed shapeSizeByFixedSize attr
Browse files Browse the repository at this point in the history
  • Loading branch information
Flyge committed Sep 3, 2017
1 parent ef075f0 commit a111d33
Show file tree
Hide file tree
Showing 17 changed files with 255 additions and 263 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ sketchImageView.displayInstalledAppIcon("com.tencent.qq", 210);

基础功能:
* [SketchImageView 详细使用说明](docs/wiki/sketch_image_view.md)
* [配置 Options](docs/wiki/options_config.md)
* [管理 Options](docs/wiki/options_manage.md)
* [Options & Helper](docs/wiki/options_and_helper.md)
* [管理多个 Options](docs/wiki/options_manage.md)
* [只加载图片到内存或只下载图片到本地](docs/wiki/load_and_download.md)
* [播放 GIF 图片](docs/wiki/display_gif_image.md)
* [手势缩放、旋转图片](docs/wiki/zoom.md)
Expand All @@ -161,7 +161,6 @@ sketchImageView.displayInstalledAppIcon("com.tencent.qq", 210);
* [移动网络下暂停下载图片,节省流量](docs/wiki/pause_download.md)
* [列表滑动时暂停加载图片,提升流畅度](docs/wiki/pause_load.md)
* [显示 APK 或已安装 APP 的图标](docs/wiki/display_apk_or_app_icon.md)
* [通过 ImagePreprocessor 显示特殊文件中的图片(例如视频、MP3)](docs/wiki/pre_process_image.md)
* [通过 MemoryCacheStateImage 先显示较模糊的图片,然后再显示清晰的图片](docs/wiki/memory_cache_state_image.md)

更多:
Expand Down
5 changes: 2 additions & 3 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ sketchImageView.displayInstalledAppIcon("com.tencent.qq", 210);

Basic functions:
* [SketchImageView Detailed Instructions](docs/wiki/sketch_image_view.md)
* [Config Options](docs/wiki/options_config.md)
* [Manage Options](docs/wiki/options_manage.md)
* [Options & Helper](docs/wiki/options_and_helper.md)
* [Manage Multiple Options](docs/wiki/options_manage.md)
* [Just load the picture into memory or just download the picture to the local](docs/wiki/load_and_download.md)
* [Play gif image](docs/wiki/display_gif_image.md)
* [Gesture zoom, rotate the picture](docs/wiki/zoom.md)
Expand All @@ -161,7 +161,6 @@ To further enhance the user experience:
* [Mobile network to suspend downloading pictures, save traffic](docs/wiki/pause_download.md)
* [Pause loading of images while sliding the list to improve fluency](docs/wiki/pause_load.md)
* [Display APK or installed APP icon](docs/wiki/display_apk_or_app_icon.md)
* [Displaying images in special files with Image Preprocessor (eg video, MP3)](docs/wiki/pre_process_image.md)
* [Through the MemoryCache StateImage first show more vague picture, and then display a clear picture](docs/wiki/memory_cache_state_image.md)

More:
Expand Down
2 changes: 2 additions & 0 deletions docs/logs/log_2.5.0_temp.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ bugs:
* :fire: 移除 ErrorCause.SOURCE_BITMAP_RECYCLED
* :fire: 移除 DownloadListener、LoadListener、DisplayListener 的 onStarted() 方法
* :fire: 移除 resizeByFixedSize 属性,Resize.byViewFixedSize() 代替,详情参考 [resize]
* :fire: 移除 shapeSizeByFixedSize 属性,ShapeSize.byViewFixedSize() 代替,详情参考 [shape_size]

重构:
* :hammer: file:// 格式的 uri 已产生的磁盘缓存将全部作废,因为其磁盘缓存 key 去掉了 file://
Expand Down Expand Up @@ -65,4 +66,5 @@ wiki待办:

[了解 Sketch 日志]: ../wiki/log.md
[resize]: ../wiki/resize.md
[shape_size]: ../wiki/shape_size.md

2 changes: 1 addition & 1 deletion docs/wiki/display_gif_image.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Sketch默认不解码gif图,只会通过BitmapFactory读取其第一帧作为
```
sketImageView.getOptions().setDecodeGifImage(true);
```
属性配置请参考[配置各种属性.md](options_config.md)
属性配置请参考[配置各种属性.md](options_and_helper.md)

注意:
>* Sketch会根据mimeType判断是否是gif图,因此不用担心识别不了伪装成jpg的gif图
Expand Down
2 changes: 1 addition & 1 deletion docs/wiki/load_and_download.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SketchImageView就是使用的 Sketch.display() 方法

每一种方法都有专用的Options、Listener、Helper

* Options:用来定制请求,[点击了解更多](options_config.md)
* Options:用来定制请求,[点击了解更多](options_and_helper.md)
* Listener:用来监控请求的状态,[点击了解更多](listener.md)
* Helper:用来组织请求并提交请求

Expand Down
141 changes: 141 additions & 0 deletions docs/wiki/options_and_helper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Options & Helper

* Options:用于批量设置请求属性
* Helper: 用于设置请求属性并提交请求

Sketch 的 display()、load()、download() 方法([参考 load_android_download.md])都有对应的 Options 和 Helper,如下:

|Type|Options|Helper|
|:---|:---|:---|
|Sketch.display()|DisplayOptions|DisplayHelper|
|Sketch.load()|LoadOptions|LoadHelper|
|Sketch.download()|DownloadOptions|DownloadHelper|

### Options 支持属性:

`('-'代表不支持,非'-'代表支持并且默认值是什么)`

|Attr|DownloadOptions|LoadOptions|DisplayOptions|
|:---|:---|:---|:---|
|requestLevel|NET|NET|NET|
|cacheInDiskDisabled|false|false|false|
|maxSize|-|屏幕的宽高|优先考虑ImageView的layout_width和layout_height|
|resize|-|null|null|
|forceUseResize|-|false|false|
|processor|-|null|null|
|decodeGifImage|-|false|false|
|lowQualityImage|-|false|false|
|bitmapConfig|-|null|null|
|inPreferQualityOverSpeed|-|false|false|
|thumbnailMode|-|false|false|
|cacheProcessedImageInDisk|-|false|false|
|bitmapPoolDisabled|-|false|false|
|correctImageOrientationDisabled|-|false|false|
|cacheInMemoryDisabled|-|-|false|
|displayer|-|-|DefaultImageDisplayer|
|loadingImage|-|-|null|
|errorImage|-|-|null|
|pauseDownloadImage|-|-|null|
|imageShaper|-|-|null|
|shapeSize|-|-|null|

详解:

* requestLevel: 指定请求的处理深度-[参考 RequestLevel]
* cacheInDiskDisabled: 禁用磁盘缓存-[参考 disk_cache.md]
* maxSize: 限制读取到内存的图片的尺寸-[参考 max_size.md]
* resize: 修改图片的尺寸-[参考 resize.md]
* forceUseResize: 强制使用 resize-[参考 resize.md]
* processor: 处理图片-[参考 process_image.md]
* decodeGifImage: 解码 GIF 图片,开启后可播放 GIF 图片-[参考 display_gif_image.md]
* lowQualityImage: 解码图片时优先使用低质量的 Bitmap.Config,例如 JPEG 图片将使用 ARGB_565 解码,具体请查看 [ImageType]
* bitmapConfig: 强制指定解码图片时使用的 Bitmap.Config,KITKAT 以上版本不能使用 ARGB_4444
* inPreferQualityOverSpeed: 解码时质量优先,可提高图片质量,但会降低解码速度,当你要频繁的对一张图片进行读取然后写出的时候一定要设置优先考虑质量
* thumbnailMode: 开启缩略图模式-[参考 thumbnail_mode.md]
* cacheProcessedImageInDisk: 为了加快速度,将经过复杂出路的图片保存到磁盘缓存中,下次就直接读取-[参考 cache_processed_image_in_disk.md.md]
* bitmapPoolDisabled: 禁用BitmapPool-[参考 bitmap_pool.md]
* correctImageOrientationDisabled: 禁用纠正图片方向功能-[参考 correct_image_orientation.md.md]
* cacheInMemoryDisabled: 禁用内存缓存
* displayer: 使用专门的显示效果来显示图片-[参考 displayer.md]
* loadingImage: 设置正在加载时显示的图片
* errorImage: 设置加载失败时显示的图片
* pauseDownloadImage: 设置暂停下载时显示的图片
* imageShaper: 设置图片以什么形状显示-[参考 imag_shaper.md]
* shapeSize: 设置图片以多大尺寸显示-[参考 shape_size.md]

Options 支持的属性 Helper 中都有对应的方法,只是方法名不一样(没有set)

#### 使用Options:

Sketch.display()、Sketch.load()、Sketch.download()都会返回其专属的Helper,Helper中也都会有专门的方法配置这些属性,例如:

```java
// 显示
Sketch.with(context).display("http://t.cn/RShdS1f", sketchImageView)
.loadingImage(R.drawable.image_loading)
.displayer(new TransitionImageDisplayer())
...
.commit();

// 加载
Sketch.with(context).load("http://t.cn/RShdS1f", new LoadListener() {...})
.maxSize(300, 400)
.bitmapConfig()
...
.commit();

// 下载
Sketch.with(context).download("http://t.cn/RShdS1f", new DownloadListener(){...})
.disableCacheInDisk()
...
.commit();
```

各大Helper和SketchImageView还都支持批量设置Options

```java
// 批量配置显示属性
DisplayOptions displayOptions = new DisplayOptions();
displayOptions.set***;

Sketch.with(context).display("http://t.cn/RShdS1f", sketchImageView)
.options(displayOptions)
.commit();

SketchImageView sketchImageView = ...;
sketchImageView.setOptions(displayOptions);

// 批量配置加载属性
LoadOptions loadOptions = new LoadOptions();
loadOptions.set***;

Sketch.with(context).load("http://t.cn/RShdS1f", new LoadListener() {...})
.options(loadOptions)
.commit();

// 批量配置下载属性
DownloadOptions downloadOptions = new DownloadOptions();
downloadOptions.set***;

Sketch.with(context).download("http://t.cn/RShdS1f", new DownloadListener(){...})
.options(downloadOptions)
.commit();
```

``使用options方法和使用专用方法设置同一个属性时并不会冲突,就看谁最后执行``

[参考 RequestLevel]: ../../sketch/src/main/java/com/xiaopan/sketch/request/RequestLevel.java
[参考 load_android_download.md]: load_android_download.md
[参考 disk_cache.md]: disk_cache.md
[参考 thumbnail_mode.md]: thumbnail_mode.md
[ImageType]: ../../sketch/src/main/java/com/xiaopan/sketch/decode/ImageType.java
[参考 max_size.md]: max_size.md
[参考 resize.md]: resize.md
[参考 process_image.md]: process_image.md
[参考 display_gif_image.md]: display_gif_image.md
[参考 cache_processed_image_in_disk.md.md]: cache_processed_image_in_disk.md.md
[参考 bitmap_pool.md]: bitmap_pool.md
[参考 correct_image_orientation.md.md]: correct_image_orientation.md.md
[参考 displayer.md]: displayer.md
[参考 imag_shaper.md]: imag_shaper.md
[参考 shape_size.md]: shape_size.md
165 changes: 0 additions & 165 deletions docs/wiki/options_config.md

This file was deleted.

Loading

0 comments on commit a111d33

Please sign in to comment.