Skip to content

Commit

Permalink
Update version and README, details:
Browse files Browse the repository at this point in the history
1. make input limit work
2. find error by each sub-hunter
3. add Exact and Fuzzy option for bitmap hunting
4. make request tag always start with 'sobitmap:request:'
5. add support-annotations from AndroidSDK for avoiding wrong parameters
6. try to take the rounded up inSampleSize value
7. restruct sample UI
8. add testcase for sample, actually sobitmap

Signed-off-by: Kevin Liu <airk908@gmail.com>
  • Loading branch information
lkv1988 committed Apr 8, 2015
1 parent 47676b6 commit a7c560d
Show file tree
Hide file tree
Showing 34 changed files with 1,350 additions and 642 deletions.
57 changes: 33 additions & 24 deletions README.md
@@ -1,15 +1,15 @@
# SoBitmap
SoBitmap is a bitmap decode library for Android. Users can custom the max input memory size,
the max output bitmap memory size and the picture size in pixel he can accept, then SoBitmap
will do its best for producing the right bitmap for you. And of course, users have no need to
warry about the OOM exception, SoBitmap have handled it inside.
SoBitmap is not an ImageLoader, it born for process single bitmap. Some conditions, we want a image displayed in some limit, such as the max size, the memory cost and its format. SoBitmap handle these all for you, then release you to concern the real important things. You can totally use SoBitmap as a black box, the only things you need care are the input configuration and the output bitmap.

# Feature

- Support local file and network stream
- Custom option include max input\output and picture size, and the step of picture's quality, and bitmap compress format(JPG, PNG, WEBP)
- Use okhttp as the httpclient for downloading
- All callback happen in UI thread, no need to warry about it
- support local file, MediaStore and network stream
- support two config way:

1. exact limit include max input, max output, and compress quality down step
2. fuzzy limit that you only need set a level or just by default.
- use okhttp as httpclient for downloading, I think we can trust it(Shall we have a choice about it?)
- all callback heppen in UI thread, so relax about it

# Usage

Expand All @@ -30,33 +30,43 @@ dependencies {
### Permissions

```
<!-- if SoBitmap need to load image from network -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- if your want use external storage for cache -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
```

### Min SDK

Api-9 (Android2.3)
API9 (Android2.3)

### Custom display option

#####Exactly
```
Options options = new Options.Builder()
.maxOutput(50) // max output in 50KB
.maxSize(1024) //max picture size in pixel
.format(Bitmap.CompressFormat.PNG)
.build();
SoBitmap.getInstance(this).setDefaultOption(options);
Options.ExactOptionsBuilder builder = new Options.ExactOptionsBuilder();
builder.step(10)
.format(Bitmap.CompressFormat.JPEG)
.maxOutput(200)
.maxInput(10 * 1000)
.maxSize(5000);
Options ops = builder.build();
```

>The default option:
- MAX input 5MB
- MAX output 300KB
- STEP 15
- SIZE max screen size * 2
- Compress format JPEG
#####Fuzzy
```
Options.FuzzyOptionsBuilder builder = new Options.FuzzyOptionsBuilder();
builder.maxSize(5000)
.format(Bitmap.CompressFormat.PNG)
.level(Options.QualityLevel.HIGH);
Options ops = builder.build();
```

#####Change the default option
```
SoBitmap.getInstance(context).setDefaultOption(myCustomOps);
```

### Hunting bitmap

Expand All @@ -74,9 +84,8 @@ SoBitmap.getInstance(this).hunt(uri, new Callback() {
});
```

# *TODO List*:
# *TODO*:

- MediaStore support
- Multi thread speed up the decoding duration

# License
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Expand Up @@ -6,7 +6,6 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
@@ -1,5 +1,5 @@
VERSION_NAME=0.1.4-SNAPSHOT
VERSION_CODE=5
VERSION_NAME=0.1.5-SNAPSHOT
VERSION_CODE=6

GROUP=com.github.airk000

Expand Down
5 changes: 2 additions & 3 deletions sample/build.gradle
Expand Up @@ -5,7 +5,7 @@ android {
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.github.airk.tool.sobitmap.simple"
applicationId "com.github.airk.tool.sobitmap.sample"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
Expand All @@ -25,7 +25,6 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:recyclerview-v7:22.0.0'
compile 'com.jakewharton:butterknife:6.1.0'
compile project(':sobitmap')
}

This file was deleted.

0 comments on commit a7c560d

Please sign in to comment.