diff --git a/README.md b/README.md index 1604061..ab0484d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,17 @@ 可能是Android平台上最快的图片压缩框架。 +## 依赖 + +```xml +dependencies { + ... + + compile 'com.android.support:appcompat-v7:25.3.1' + compile 'com.ghnor:flora:1.0.0-alpha1' +} +``` + ## 用法用例 * 异步压缩: diff --git a/build.gradle b/build.gradle index c2eea8e..17d2494 100644 --- a/build.gradle +++ b/build.gradle @@ -9,6 +9,8 @@ buildscript { // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files + + classpath 'com.novoda:bintray-release:0.4.0' } } diff --git a/library/build.gradle b/library/build.gradle index d68e355..461e8fa 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.android.library' +apply plugin: 'com.novoda.bintray-release' android { compileSdkVersion 25 @@ -19,6 +20,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + lintOptions { + abortOnError false + } } dependencies { @@ -29,3 +33,20 @@ dependencies { provided 'com.android.support:appcompat-v7:25.3.1' testCompile 'junit:junit:4.12' } + +publish { + userOrg = 'ghnor'//bintray.com用户名 + groupId = 'com.ghnor'//jcenter上的路径 + artifactId = 'flora'//项目名称 + publishVersion = '1.0.0-alpha1'//版本号 + desc = 'Picture compression libray on the Android platform'//描述,不重要 + website = 'https://github.com/ghnor/Flora'//网站,不重要 +} + +tasks.withType(Javadoc) { + options{ + encoding "UTF-8" + charSet 'UTF-8' + links "http://docs.oracle.com/javase/7/docs/api" + } +} \ No newline at end of file diff --git a/library/src/main/java/com/ghnor/flora/spec/Loader.java b/library/src/main/java/com/ghnor/flora/spec/Loader.java index a3d5742..19b90fc 100644 --- a/library/src/main/java/com/ghnor/flora/spec/Loader.java +++ b/library/src/main/java/com/ghnor/flora/spec/Loader.java @@ -1,7 +1,7 @@ package com.ghnor.flora.spec; import android.graphics.Bitmap; -import android.support.annotation.IdRes; +import android.support.annotation.DrawableRes; import com.ghnor.flora.core.BatchCompressEngine; import com.ghnor.flora.core.SingleCompressEngine; @@ -29,9 +29,9 @@ public interface Loader { BatchCompressEngine, FileDescriptor> load(FileDescriptor... fileDescriptors); - SingleCompressEngine load(@IdRes int resId); + SingleCompressEngine load(@DrawableRes int resId); - BatchCompressEngine, Integer> load(@IdRes int... resId); + BatchCompressEngine, Integer> load(@DrawableRes int... resId); SingleCompressEngine load(InputStream is); diff --git a/library/src/main/java/com/ghnor/flora/spec/options/BitmapCompressOptions.java b/library/src/main/java/com/ghnor/flora/spec/options/BitmapCompressOptions.java index ec7c0d5..cb90226 100644 --- a/library/src/main/java/com/ghnor/flora/spec/options/BitmapCompressOptions.java +++ b/library/src/main/java/com/ghnor/flora/spec/options/BitmapCompressOptions.java @@ -22,7 +22,7 @@ public class BitmapCompressOptions extends CompressOptions { * By default,using 60. *

* - * @see android.graphics.BitmapFactory#inSampleSize + * @see android.graphics.BitmapFactory */ public int inSampleSize = DEFAULT_IN_SAMPLE_SIZE; } diff --git a/library/src/main/java/com/ghnor/flora/spec/options/FileCompressOptions.java b/library/src/main/java/com/ghnor/flora/spec/options/FileCompressOptions.java index 7e1f245..f2a6f9e 100644 --- a/library/src/main/java/com/ghnor/flora/spec/options/FileCompressOptions.java +++ b/library/src/main/java/com/ghnor/flora/spec/options/FileCompressOptions.java @@ -18,7 +18,7 @@ public class FileCompressOptions extends BitmapCompressOptions { /** * The max memory maxSize on the hard disk,unit of KB. *

- * If the value less than or equal to zero,{@link com.ghnor.imagecompressor.spec.CompressSpec} will be automatically set. + * If the value less than or equal to zero,{@link com.ghnor.flora.spec.CompressSpec} will be automatically set. */ public float maxSize; } diff --git a/library/src/main/java/com/ghnor/flora/task/CompressTaskBuilder.java b/library/src/main/java/com/ghnor/flora/task/CompressTaskBuilder.java index 7a3da60..0f11c91 100644 --- a/library/src/main/java/com/ghnor/flora/task/CompressTaskBuilder.java +++ b/library/src/main/java/com/ghnor/flora/task/CompressTaskBuilder.java @@ -2,7 +2,7 @@ import android.graphics.Bitmap; import android.net.Uri; -import android.support.annotation.IdRes; +import android.support.annotation.DrawableRes; import com.ghnor.flora.core.BatchCompressEngine; import com.ghnor.flora.core.CompressEngineFactory; @@ -111,14 +111,14 @@ public BatchCompressEngine, FileDescriptor> load(FileDescri * @return */ @Override - public SingleCompressEngine load(@IdRes int resId) { + public SingleCompressEngine load(@DrawableRes int resId) { SingleCompressEngine engine = CompressEngineFactory.buildResourceSingle(resId, mCompressSpecCreator.create()); CompressTaskController.getInstance().addTask(mCompressTask.obtainTag(), engine); return engine; } @Override - public BatchCompressEngine, Integer> load(@IdRes int... resId) { + public BatchCompressEngine, Integer> load(@DrawableRes int... resId) { Integer[] resInteger = new Integer[resId.length]; for (int index = 0; index < resId.length; index++) { resInteger[index] = resId[index]; @@ -217,7 +217,7 @@ public BatchCompressEngine, Bitmap> load(Bitmap... bitmap) { } /** - * List + * List * * @param list * @return diff --git a/sample/build.gradle b/sample/build.gradle index 8af3510..12870ac 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -17,6 +17,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + lintOptions { + abortOnError false + } } dependencies { @@ -32,9 +35,10 @@ dependencies { compile 'com.shizhefei:LargeImageView:1.0.8' compile 'cn.finalteam.rxgalleryfinal:library:1.0.8' compile 'com.github.bumptech.glide:glide:3.7.0' - debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.2' - releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.2' + debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4' + releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4' testCompile 'junit:junit:4.12' - compile project(':library') +// compile project(':library') + compile 'com.ghnor:flora:1.0.0-alpha1' } diff --git a/sample/src/main/java/com/ghnor/flora/sample/SingleActivity.java b/sample/src/main/java/com/ghnor/flora/sample/SingleActivity.java index 65f58f1..cca8634 100644 --- a/sample/src/main/java/com/ghnor/flora/sample/SingleActivity.java +++ b/sample/src/main/java/com/ghnor/flora/sample/SingleActivity.java @@ -6,7 +6,6 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; -import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; @@ -137,7 +136,7 @@ private void testResource() { try { Resources resources = getApplication().getResources(); Bitmap originBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.test2); - InputStream is = resources.openRawResource(R.drawable.test2, new TypedValue()); + final InputStream is = getResources().getAssets().open("test2.jpg"); setupSourceInfo(originBitmap, is.available()); is.close();