Skip to content

Commit

Permalink
发布v1.0.0-alpha1
Browse files Browse the repository at this point in the history
  • Loading branch information
ghnor committed Sep 29, 2017
1 parent b6e8ed3 commit b9dc999
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 14 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

可能是Android平台上最快的图片压缩框架。

## 依赖

```xml
dependencies {
...

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.ghnor:flora:1.0.0-alpha1'
}
```

## 用法用例

* 异步压缩:
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand Down
21 changes: 21 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'

android {
compileSdkVersion 25
Expand All @@ -19,6 +20,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}

dependencies {
Expand All @@ -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"
}
}
6 changes: 3 additions & 3 deletions library/src/main/java/com/ghnor/flora/spec/Loader.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -29,9 +29,9 @@ public interface Loader {

BatchCompressEngine<List<FileDescriptor>, FileDescriptor> load(FileDescriptor... fileDescriptors);

SingleCompressEngine<Integer> load(@IdRes int resId);
SingleCompressEngine<Integer> load(@DrawableRes int resId);

BatchCompressEngine<List<Integer>, Integer> load(@IdRes int... resId);
BatchCompressEngine<List<Integer>, Integer> load(@DrawableRes int... resId);

SingleCompressEngine<InputStream> load(InputStream is);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class BitmapCompressOptions extends CompressOptions {
* By default,using 60.
* <p>
*
* @see android.graphics.BitmapFactory#inSampleSize
* @see android.graphics.BitmapFactory
*/
public int inSampleSize = DEFAULT_IN_SAMPLE_SIZE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class FileCompressOptions extends BitmapCompressOptions {
/**
* The max memory maxSize on the hard disk,unit of KB.
* <p>
* 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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -111,14 +111,14 @@ public BatchCompressEngine<List<FileDescriptor>, FileDescriptor> load(FileDescri
* @return
*/
@Override
public SingleCompressEngine<Integer> load(@IdRes int resId) {
public SingleCompressEngine<Integer> load(@DrawableRes int resId) {
SingleCompressEngine<Integer> engine = CompressEngineFactory.buildResourceSingle(resId, mCompressSpecCreator.create());
CompressTaskController.getInstance().addTask(mCompressTask.obtainTag(), engine);
return engine;
}

@Override
public BatchCompressEngine<List<Integer>, Integer> load(@IdRes int... resId) {
public BatchCompressEngine<List<Integer>, Integer> load(@DrawableRes int... resId) {
Integer[] resInteger = new Integer[resId.length];
for (int index = 0; index < resId.length; index++) {
resInteger[index] = resId[index];
Expand Down Expand Up @@ -217,7 +217,7 @@ public BatchCompressEngine<List<Bitmap>, Bitmap> load(Bitmap... bitmap) {
}

/**
* List<T>
* List
*
* @param list
* @return
Expand Down
10 changes: 7 additions & 3 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}

dependencies {
Expand All @@ -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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit b9dc999

Please sign in to comment.