update
This commit is contained in:
@@ -128,6 +128,8 @@ dependencies {
|
||||
|
||||
//鲁班
|
||||
api rootProject.ext.dependencies["Luban"]
|
||||
//图片加载器,可以压缩图
|
||||
api rootProject.ext.dependencies["imageloader"]
|
||||
|
||||
//一个Picker控件,选择日期,城市用
|
||||
api files('libs/AndroidPicker-1.5.6.jar')
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.yunbao.common.glide;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
|
||||
import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
|
||||
import com.nostra13.universalimageloader.core.assist.ImageSize;
|
||||
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
|
||||
|
||||
import jp.wasabeef.glide.transformations.BlurTransformation;
|
||||
|
||||
public class ImageLoadUtils {
|
||||
|
||||
public static void initImageLoader(Context context) {
|
||||
ImageLoader imageLoader = ImageLoader.getInstance();
|
||||
ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(context)
|
||||
.diskCache(new UnlimitedDiskCache(context.getCacheDir()))
|
||||
.diskCacheSize(50 * 1024 * 1024)
|
||||
.diskCacheFileCount(100)
|
||||
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
|
||||
.memoryCacheSize(2 * 1024 * 1024)
|
||||
.build();
|
||||
imageLoader.init(configuration);
|
||||
}
|
||||
|
||||
private static ImageLoader getLoader() {
|
||||
return ImageLoader.getInstance();
|
||||
}
|
||||
|
||||
private static DisplayImageOptions getDisplayImageOptions() {
|
||||
return new DisplayImageOptions.Builder()
|
||||
.bitmapConfig(Bitmap.Config.RGB_565)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static void loadUrl(String url, int width, int height, ImageView imageView) {
|
||||
//ImageSize size = new ImageSize(width, height);
|
||||
//getLoader().displayImage(url,imageView,size);
|
||||
|
||||
}
|
||||
public static void loadUrlToBlur(Context context,String url,int width,int height,ImageView imageView){
|
||||
getLoader().loadImage(url,new ImageSize(width,height),getDisplayImageOptions(),new SimpleImageLoadingListener(){
|
||||
@Override
|
||||
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
||||
super.onLoadingComplete(imageUri, view, loadedImage);
|
||||
Glide.with(context).asBitmap().load(loadedImage)
|
||||
.skipMemoryCache(false)
|
||||
.apply(RequestOptions.bitmapTransform( new BlurTransformation(25)))
|
||||
.into(imageView);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import com.opensource.svgaplayer.SVGACallback;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
|
||||
public class SVGAViewUtils {
|
||||
public static void playEndClear(SVGAImageView svga){
|
||||
svga.setCallback(new SVGACallback() {
|
||||
@Override
|
||||
public void onPause() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinished() {
|
||||
svga.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRepeat() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStep(int i, double v) {
|
||||
|
||||
}
|
||||
});
|
||||
svga.startAnimation();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user