diff --git a/compresshelper/src/main/java/com/nanchen/compresshelper/CompressHelper.java b/compresshelper/src/main/java/com/nanchen/compresshelper/CompressHelper.java index 3fce1bd..4405e25 100644 --- a/compresshelper/src/main/java/com/nanchen/compresshelper/CompressHelper.java +++ b/compresshelper/src/main/java/com/nanchen/compresshelper/CompressHelper.java @@ -4,12 +4,8 @@ import android.graphics.Bitmap; import android.net.Uri; - import java.io.File; -import rx.Observable; -import rx.functions.Func0; - /** * 压缩方法工具类 * @@ -19,7 +15,6 @@ */ public class CompressHelper { - private static volatile CompressHelper INSTANCE; private Context context; /** * 最大宽度,默认为720 @@ -61,17 +56,6 @@ private CompressHelper(Context context) { destinationDirectoryPath = context.getCacheDir().getPath() + File.pathSeparator + FileUtil.FILES_PATH; } - public static CompressHelper getDefault(Context context) { - if (INSTANCE == null) { - synchronized (CompressHelper.class) { - if (INSTANCE == null) { - INSTANCE = new CompressHelper(context); - } - } - } - return INSTANCE; - } - /** * 压缩成文件 * @param file 原始文件 @@ -92,24 +76,6 @@ public Bitmap compressToBitmap(File file) { return ImageUtil.getScaledBitmap(context, Uri.fromFile(file), maxWidth, maxHeight, bitmapConfig); } - public Observable compressToFileAsObservable(final File file) { - return Observable.defer(new Func0>() { - @Override - public Observable call() { - return Observable.just(compressToFile(file)); - } - }); - } - - public Observable compressToBitmapAsObservable(final File file) { - return Observable.defer(new Func0>() { - @Override - public Observable call() { - return Observable.just(compressToBitmap(file)); - } - }); - } - /** * 采用建造者模式,设置Builder