Merge remote-tracking branch 'origin/dev_custom_map' into dev_custom_map
# Conflicts: # .idea/misc.xml
This commit is contained in:
@@ -26,6 +26,7 @@ import java.util.Set;
|
||||
public class ALocationClient implements IMogoLocationClient {
|
||||
|
||||
private static final String TAG = "LocationClient";
|
||||
private final Context mContext;
|
||||
|
||||
private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
|
||||
private MogoLocation mLastLocation;
|
||||
@@ -34,12 +35,7 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
private boolean mIsDestroyed = false;
|
||||
|
||||
public ALocationClient( Context context ) {
|
||||
mClient = new AMapLocationClient( context );
|
||||
mClient.setLocationListener( mListener );
|
||||
mLastLocation = ObjectUtils.fromAMap( mClient.getLastKnownLocation() );
|
||||
if ( mLastLocation == null ) {
|
||||
mLastLocation = new MogoLocation();
|
||||
}
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
private AMapLocationClient mClient;
|
||||
@@ -51,11 +47,12 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
|
||||
@Override
|
||||
public void start( long interval ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
if ( mClient == null ) {
|
||||
mClient = new AMapLocationClient( mContext );
|
||||
mClient.setLocationListener( mListener );
|
||||
mLastLocation = ObjectUtils.fromAMap( mClient.getLastKnownLocation() );
|
||||
}
|
||||
if ( mClient != null ) {
|
||||
if ( !mClient.isStarted() ) {
|
||||
AMapLocationClientOption option = new AMapLocationClientOption();
|
||||
option.setLocationMode( AMapLocationClientOption.AMapLocationMode.Hight_Accuracy );
|
||||
option.setNeedAddress( true );
|
||||
@@ -109,6 +106,9 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
destroyWarming();
|
||||
return null;
|
||||
}
|
||||
if ( mLastLocation == null ) {
|
||||
mLastLocation = new MogoLocation();
|
||||
}
|
||||
return mLastLocation;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
aMapLocation.getLongitude() == 0.0D ) {
|
||||
return;
|
||||
}
|
||||
Trace.beginSection("timer.onLocationChanged");
|
||||
Trace.beginSection( "timer.onLocationChanged" );
|
||||
mLastLocation = ObjectUtils.fromAMap( aMapLocation );
|
||||
synchronized ( sListeners ) {
|
||||
Iterator< IMogoLocationListener > listenerIterator = sListeners.iterator();
|
||||
|
||||
Reference in New Issue
Block a user