dev
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.impl.amap.location.ALocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-19
|
||||
* <p>
|
||||
*/
|
||||
public class MogoLocationClient implements IMogoLocationClient {
|
||||
|
||||
private static volatile MogoLocationClient sInstance;
|
||||
|
||||
private MogoLocationClient( Context context ) {
|
||||
mDelegate = ALocationClient.getInstance( context );
|
||||
}
|
||||
|
||||
public static MogoLocationClient getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoLocationClient.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoLocationClient( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private IMogoLocationClient mDelegate;
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start( long interval ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.start( interval );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.addLocationListener( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.removeLocationListener( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLocation getLastKnowLocation() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getLastKnowLocation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user