opt
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
package com.mogo.map.uicontroller;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
||||
import com.mogo.map.IDestroyable;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-13
|
||||
* <p>
|
||||
* 设置自车图标
|
||||
*/
|
||||
public class CarCursorOption implements Cloneable, IDestroyable {
|
||||
|
||||
private CarCursorOption() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车图标资源
|
||||
*/
|
||||
@DrawableRes
|
||||
private int mCarCursorRes = 0;
|
||||
|
||||
/**
|
||||
* 自车图标图片,优先使用
|
||||
*/
|
||||
private Bitmap mCarCursorBmp;
|
||||
|
||||
/**
|
||||
* 导航图标资源
|
||||
*/
|
||||
@DrawableRes
|
||||
private int mNaviCursorRes = 0;
|
||||
|
||||
public int getCarCursorRes() {
|
||||
return mCarCursorRes;
|
||||
}
|
||||
|
||||
public void setCarCursorRes( int carCursorRes ) {
|
||||
this.mCarCursorRes = carCursorRes;
|
||||
}
|
||||
|
||||
public Bitmap getCarCursorBmp() {
|
||||
return mCarCursorBmp;
|
||||
}
|
||||
|
||||
public void setCarCursorBmp( Bitmap carCursorBmp ) {
|
||||
this.mCarCursorBmp = carCursorBmp;
|
||||
}
|
||||
|
||||
public int getNaviCursorRes() {
|
||||
return mNaviCursorRes;
|
||||
}
|
||||
|
||||
public void setNaviCursorRes( int naviCursorRes ) {
|
||||
this.mNaviCursorRes = naviCursorRes;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private CarCursorOption target;
|
||||
|
||||
public Builder() {
|
||||
target = new CarCursorOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车图标资源
|
||||
*/
|
||||
public Builder carCursorRes( @DrawableRes int redId ) {
|
||||
target.mCarCursorRes = redId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车图标图片,优先使用
|
||||
*/
|
||||
public Builder carCursorBmp( Bitmap bmp ) {
|
||||
target.mCarCursorBmp = bmp;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航图标资源
|
||||
*
|
||||
* @param naviCursorRes
|
||||
* @return
|
||||
*/
|
||||
public Builder naviCursorRes( int naviCursorRes ) {
|
||||
target.mNaviCursorRes = naviCursorRes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CarCursorOption build() {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarCursorOption clone() throws CloneNotSupportedException {
|
||||
CarCursorOption option = ( CarCursorOption ) super.clone();
|
||||
if ( mCarCursorBmp != null && !mCarCursorBmp.isRecycled() ) {
|
||||
try {
|
||||
option.mCarCursorBmp = Bitmap.createBitmap( mCarCursorBmp );
|
||||
} catch ( Exception e ) {
|
||||
option.mCarCursorBmp = null;
|
||||
}
|
||||
}
|
||||
option.mCarCursorRes = mCarCursorRes;
|
||||
option.mNaviCursorRes = mNaviCursorRes;
|
||||
return option;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if ( mCarCursorBmp != null && !mCarCursorBmp.isRecycled() ) {
|
||||
mCarCursorBmp.recycle();
|
||||
}
|
||||
mCarCursorBmp = null;
|
||||
mCarCursorRes = 0;
|
||||
mNaviCursorRes = 0;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import android.location.Location;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
@@ -56,7 +58,6 @@ public interface IMogoMapUIController {
|
||||
void showMyLocation( boolean visible );
|
||||
|
||||
/**
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
void showMyLocation( View view );
|
||||
@@ -183,7 +184,15 @@ public interface IMogoMapUIController {
|
||||
|
||||
/**
|
||||
* 锁车状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isCarLocked();
|
||||
|
||||
/**
|
||||
* 配置自车图标样式
|
||||
*
|
||||
* @param option
|
||||
*/
|
||||
void setCarCursorOption( CarCursorOption option );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user