dev
This commit is contained in:
@@ -2,19 +2,24 @@ package com.mogo.service.imageloader;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 图片下载接口
|
||||
*/
|
||||
@Keep
|
||||
public interface IMogoImageLoaderListener {
|
||||
|
||||
@Keep
|
||||
void onStart();
|
||||
|
||||
// void onProcess( int completedSize, int totalSize );
|
||||
|
||||
// void onProcess( int completedSize, int totalSize );
|
||||
@Keep
|
||||
void onCompleted( Bitmap bitmap );
|
||||
|
||||
@Keep
|
||||
void onFailure( Exception e );
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.mogo.service.imageloader;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/**
|
||||
@@ -10,19 +12,27 @@ import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
* <p>
|
||||
* 图片接口
|
||||
*/
|
||||
@Keep
|
||||
public interface IMogoImageloader extends IProvider {
|
||||
|
||||
@Keep
|
||||
void init( Context context );
|
||||
|
||||
@Keep
|
||||
void displayImage( String url, MogoImageView imageView );
|
||||
|
||||
@Keep
|
||||
void displayImage( String url, MogoImageView imageView, int width, int height );
|
||||
|
||||
@Keep
|
||||
void displayImage( String url, MogoImageView imageView, int width, int height, final IMogoImageLoaderListener listener );
|
||||
|
||||
@Keep
|
||||
void displayImage( String url, MogoImageView imageView, final IMogoImageLoaderListener listener );
|
||||
|
||||
@Keep
|
||||
void downloadImage( Context context, String url, IMogoImageLoaderListener listener );
|
||||
|
||||
@Keep
|
||||
void destroy();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.graphics.Matrix;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.facebook.drawee.view.GenericDraweeView;
|
||||
import com.mogo.service.R;
|
||||
@@ -17,6 +18,7 @@ import com.mogo.service.R;
|
||||
* <p>
|
||||
* 封装 facebook GenericDraweeView,实现占位图、失败占位图、形状、边框、模糊等效果
|
||||
*/
|
||||
@Keep
|
||||
public class MogoImageView extends GenericDraweeView {
|
||||
|
||||
private int mPlaceHolder;
|
||||
@@ -48,19 +50,19 @@ public class MogoImageView extends GenericDraweeView {
|
||||
public MogoImageView( Context context, AttributeSet attrs, int theme ) {
|
||||
super( context, attrs, theme );
|
||||
TypedArray arrays = context.obtainStyledAttributes( attrs, R.styleable.MogoImageView );
|
||||
mPlaceHolder = arrays.getResourceId( R.styleable.MogoImageView_placeHolder, 0 );
|
||||
mFailureHolder = arrays.getResourceId( R.styleable.MogoImageView_failureHolder, 0 );
|
||||
mOverlayImageId = arrays.getResourceId( R.styleable.MogoImageView_overlayImageId, 0 );
|
||||
mShape = arrays.getInt( R.styleable.MogoImageView_shape, SHAPE_NORMAL );
|
||||
mRadius = arrays.getDimensionPixelSize( R.styleable.MogoImageView_radius, 0 );
|
||||
mTopLeftRadius = arrays.getDimensionPixelSize( R.styleable.MogoImageView_topLeftRadius, 0 );
|
||||
mTopRightRadius = arrays.getDimensionPixelSize( R.styleable.MogoImageView_topRightRadius, 0 );
|
||||
mBottomLeftRadius = arrays.getDimensionPixelSize( R.styleable.MogoImageView_bottomLeftRadius, 0 );
|
||||
mBottomRightRadius = arrays.getDimensionPixelSize( R.styleable.MogoImageView_bottomRightRadius, 0 );
|
||||
mBorderWidth = arrays.getDimensionPixelSize( R.styleable.MogoImageView_shapeBorderWidth, 0 );
|
||||
mBorderColor = arrays.getColor( R.styleable.MogoImageView_borderColor, Color.WHITE );
|
||||
mIsBlur = arrays.getBoolean( R.styleable.MogoImageView_isBlur, false );
|
||||
mBlurRadius = arrays.getInt( R.styleable.MogoImageView_blurRadius, 25 );
|
||||
mPlaceHolder = arrays.getResourceId( R.styleable.MogoImageView_miv_placeHolder, 0 );
|
||||
mFailureHolder = arrays.getResourceId( R.styleable.MogoImageView_miv_failureHolder, 0 );
|
||||
mOverlayImageId = arrays.getResourceId( R.styleable.MogoImageView_miv_overlayImageId, 0 );
|
||||
mShape = arrays.getInt( R.styleable.MogoImageView_miv_shape, SHAPE_NORMAL );
|
||||
mRadius = arrays.getDimensionPixelSize( R.styleable.MogoImageView_miv_radius, 0 );
|
||||
mTopLeftRadius = arrays.getDimensionPixelSize( R.styleable.MogoImageView_miv_topLeftRadius, 0 );
|
||||
mTopRightRadius = arrays.getDimensionPixelSize( R.styleable.MogoImageView_miv_topRightRadius, 0 );
|
||||
mBottomLeftRadius = arrays.getDimensionPixelSize( R.styleable.MogoImageView_miv_bottomLeftRadius, 0 );
|
||||
mBottomRightRadius = arrays.getDimensionPixelSize( R.styleable.MogoImageView_miv_bottomRightRadius, 0 );
|
||||
mBorderWidth = arrays.getDimensionPixelSize( R.styleable.MogoImageView_miv_shapeBorderWidth, 0 );
|
||||
mBorderColor = arrays.getColor( R.styleable.MogoImageView_miv_borderColor, Color.WHITE );
|
||||
mIsBlur = arrays.getBoolean( R.styleable.MogoImageView_miv_isBlur, false );
|
||||
mBlurRadius = arrays.getInt( R.styleable.MogoImageView_miv_blurRadius, 25 );
|
||||
arrays.recycle();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user