Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.mogo.service;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 对外服务模块路径
|
||||
* <p>
|
||||
* <p>
|
||||
* 使用方式:
|
||||
* <p>
|
||||
* Arouter.getInstance().path("").navigate()
|
||||
*/
|
||||
public class MogoServicePaths {
|
||||
|
||||
/**
|
||||
* 地图服务接口路径
|
||||
*/
|
||||
public static final String PATH_MAP_SERVICE = "/mogo/services/map";
|
||||
|
||||
/**
|
||||
* 图片接口
|
||||
*/
|
||||
public static final String PATH_IMAGE_LOADER = "/mogo/utils/imageloader";
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.service.imageloader;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 图片下载接口
|
||||
*/
|
||||
public interface IMogoImageLoaderListener {
|
||||
|
||||
void onStart();
|
||||
|
||||
// void onProcess( int completedSize, int totalSize );
|
||||
|
||||
void onCompleted( Bitmap bitmap );
|
||||
|
||||
void onFailure( Exception e );
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.service.imageloader;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 图片接口
|
||||
*/
|
||||
public interface IMogoImageloader extends IProvider {
|
||||
|
||||
void init( Context context );
|
||||
|
||||
void displayImage( String url, MogoImageView imageView );
|
||||
|
||||
void displayImage( String url, MogoImageView imageView, int width, int height );
|
||||
|
||||
void displayImage( String url, MogoImageView imageView, int width, int height, final IMogoImageLoaderListener listener );
|
||||
|
||||
void displayImage( String url, MogoImageView imageView, final IMogoImageLoaderListener listener );
|
||||
|
||||
void downloadImage( Context context, String url, IMogoImageLoaderListener listener );
|
||||
|
||||
void destroy();
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package com.mogo.service.imageloader;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
||||
import com.facebook.drawee.view.GenericDraweeView;
|
||||
import com.mogo.service.R;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 封装 facebook GenericDraweeView,实现占位图、失败占位图、形状、边框、模糊等效果
|
||||
*/
|
||||
public class MogoImageView extends GenericDraweeView {
|
||||
|
||||
private int mPlaceHolder;
|
||||
private int mFailureHolder;
|
||||
private int mOverlayImageId;
|
||||
private int mShape;
|
||||
private int mRadius;
|
||||
private int mTopLeftRadius;
|
||||
private int mTopRightRadius;
|
||||
private int mBottomLeftRadius;
|
||||
private int mBottomRightRadius;
|
||||
private int mBorderWidth;
|
||||
private int mBorderColor;
|
||||
private int mBlurRadius;
|
||||
private boolean mIsBlur;
|
||||
|
||||
public static final int SHAPE_NORMAL = 0;
|
||||
public static final int SHAPE_CIRCLE = 1;
|
||||
public static final int SHAPE_ROUND = 2;
|
||||
|
||||
public MogoImageView( Context context ) {
|
||||
this( context, null, 0 );
|
||||
}
|
||||
|
||||
public MogoImageView( Context context, AttributeSet attrs ) {
|
||||
this( context, attrs, 0 );
|
||||
}
|
||||
|
||||
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 );
|
||||
arrays.recycle();
|
||||
}
|
||||
|
||||
public void setRadius( float radius ) {
|
||||
this.mRadius = ( int ) radius;
|
||||
}
|
||||
|
||||
public void setRadius( int[] radius ) {
|
||||
if ( radius != null && radius.length == 8 ) {
|
||||
mTopLeftRadius = radius[0] >= radius[1] ? radius[0] : radius[1];
|
||||
mTopRightRadius = radius[2] >= radius[3] ? radius[2] : radius[3];
|
||||
mBottomRightRadius = radius[4] >= radius[5] ? radius[4] : radius[5];
|
||||
mBottomLeftRadius = radius[6] >= radius[7] ? radius[6] : radius[7];
|
||||
}
|
||||
}
|
||||
|
||||
public void setShape( int shape ) {
|
||||
this.mShape = shape;
|
||||
}
|
||||
|
||||
public void setBorderWidth( int width ) {
|
||||
this.mBorderWidth = width;
|
||||
}
|
||||
|
||||
public void setBorderColor( int color ) {
|
||||
this.mBorderColor = color;
|
||||
}
|
||||
|
||||
public void setPlaceHolder( int placeHolder ) {
|
||||
this.mPlaceHolder = placeHolder;
|
||||
}
|
||||
|
||||
public void setFailureHolder( int failureHolder ) {
|
||||
this.mFailureHolder = failureHolder;
|
||||
}
|
||||
|
||||
public void setOverlayImageId( @DrawableRes int overlayImageId ) {
|
||||
this.mOverlayImageId = overlayImageId;
|
||||
}
|
||||
|
||||
public void setBlur( boolean isBlur ) {
|
||||
this.mIsBlur = isBlur;
|
||||
}
|
||||
|
||||
public void setBlurRadius( int blurRadius ) {
|
||||
this.mBlurRadius = blurRadius;
|
||||
}
|
||||
|
||||
public int getPlaceHolder() {
|
||||
return mPlaceHolder;
|
||||
}
|
||||
|
||||
public int getFailureHolder() {
|
||||
return mFailureHolder;
|
||||
}
|
||||
|
||||
public int getOverlayImageId() {
|
||||
return mOverlayImageId;
|
||||
}
|
||||
|
||||
public int getShape() {
|
||||
return mShape;
|
||||
}
|
||||
|
||||
public float[] getRadii() {
|
||||
if ( mTopLeftRadius != 0 || mTopRightRadius != 0 || mBottomRightRadius != 0 || mBottomLeftRadius != 0 ) {
|
||||
float[] radii = {mTopLeftRadius, mTopLeftRadius, mTopRightRadius, mTopRightRadius,
|
||||
mBottomRightRadius, mBottomRightRadius, mBottomLeftRadius, mBottomLeftRadius};
|
||||
return radii;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getRadius() {
|
||||
return mRadius;
|
||||
}
|
||||
|
||||
public int getBorderWidth() {
|
||||
return mBorderWidth;
|
||||
}
|
||||
|
||||
public int getBorderColor() {
|
||||
return mBorderColor;
|
||||
}
|
||||
|
||||
public boolean isBlur() {
|
||||
return mIsBlur;
|
||||
}
|
||||
|
||||
public int getBlurRadius() {
|
||||
return mBlurRadius;
|
||||
}
|
||||
|
||||
public String getParams() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append( mIsBlur ).append( mBlurRadius )
|
||||
.append( mShape ).append( mRadius )
|
||||
.append( mBorderWidth ).append( mBorderColor );
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解决共享动画无效的问题
|
||||
*
|
||||
* @param matrix
|
||||
*/
|
||||
public void animateTransform( Matrix matrix ) {
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.mogo.service.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.search.IMogoGeoSearch;
|
||||
import com.mogo.map.search.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.query.MogoInputtipsQuery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 地图对外地接口
|
||||
*/
|
||||
public interface IMogoMapService extends IProvider {
|
||||
|
||||
/**
|
||||
* 获取定位服务实例
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
IMogoLocationClient getSingletonLocationClient( Context context );
|
||||
|
||||
/**
|
||||
* 添加marker
|
||||
*
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
IMogoMarker addMarker( MogoMarkerOptions options );
|
||||
|
||||
/**
|
||||
* 添加多个marker
|
||||
*
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
List< IMogoMarker > addMarkers( ArrayList< MogoMarkerOptions > options, boolean moveToCenter );
|
||||
|
||||
/**
|
||||
* 获取关键字搜索地址服务
|
||||
*
|
||||
* @param context
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
IMogoInputtipsSearch getInputtipsSearch( Context context, MogoInputtipsQuery query );
|
||||
|
||||
/**
|
||||
* 地理编码或逆地理编码服务
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
IMogoGeoSearch getGeoSearch( Context context );
|
||||
}
|
||||
Reference in New Issue
Block a user