将foudations包下的mogo-utils模块下的代码迁移到core包下的mogo-core-utils模块下 注:远程依赖库网约车模块目前使用的是foudations包下的mogo-utils模块下Logger, 目前看项目中无该网约车模块功能,暂时注释掉该模块
95 lines
2.1 KiB
Java
95 lines
2.1 KiB
Java
package com.mogo.map;
|
|
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import android.util.AttributeSet;
|
|
import android.widget.FrameLayout;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
|
/**
|
|
* @author congtaowang
|
|
* @since 2019-12-18
|
|
* <p>
|
|
* 对地图的基本抽象
|
|
*/
|
|
public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle {
|
|
|
|
private static final String TAG = "MogoBaseMapView";
|
|
|
|
protected IMogoMapView mMapView;
|
|
|
|
public MogoBaseMapView( Context context ) {
|
|
this( context, null );
|
|
}
|
|
|
|
public MogoBaseMapView( Context context, @Nullable AttributeSet attrs ) {
|
|
this( context, attrs, 0 );
|
|
}
|
|
|
|
public MogoBaseMapView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
|
|
super( context, attrs, defStyleAttr );
|
|
init( context );
|
|
}
|
|
|
|
private void init( Context context ) {
|
|
addMapView( context );
|
|
if (mMapView != null){
|
|
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
|
|
}
|
|
}
|
|
|
|
protected abstract void addMapView( Context context );
|
|
|
|
@Override
|
|
public void onCreate( Bundle bundle ) {
|
|
if ( mMapView != null ) {
|
|
mMapView.onCreate( bundle );
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onResume() {
|
|
if ( mMapView != null ) {
|
|
mMapView.onResume();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onPause() {
|
|
if ( mMapView != null ) {
|
|
mMapView.onPause();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onDestroy() {
|
|
if ( mMapView != null ) {
|
|
mMapView.onDestroy();
|
|
}
|
|
MogoMap.getInstance().clear();
|
|
}
|
|
|
|
@Override
|
|
public void onSaveInstanceState( Bundle outState ) {
|
|
if ( mMapView != null ) {
|
|
mMapView.onSaveInstanceState( outState );
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onLowMemory() {
|
|
if ( mMapView != null ) {
|
|
mMapView.onLowMemory();
|
|
}
|
|
}
|
|
|
|
public IMogoMap getMap() {
|
|
if ( mMapView != null ) {
|
|
return mMapView.getMap();
|
|
}
|
|
return null;
|
|
}
|
|
}
|