mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Pass curLatLng on location update to fragment, in a bundle
This commit is contained in:
parent
d2d7d607fb
commit
066df7b695
1 changed files with 14 additions and 4 deletions
|
|
@ -260,6 +260,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
locationManager.addLocationListener(this);
|
locationManager.addLocationListener(this);
|
||||||
|
locationManager.registerLocationManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -335,6 +336,11 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
.subscribe(this::populatePlaces);
|
.subscribe(this::populatePlaces);
|
||||||
} else if (locationChangeType
|
} else if (locationChangeType
|
||||||
.equals(LocationServiceManager.LocationChangeType.LOCATION_SLIGHTLY_CHANGED)) {
|
.equals(LocationServiceManager.LocationChangeType.LOCATION_SLIGHTLY_CHANGED)) {
|
||||||
|
Gson gson = new GsonBuilder()
|
||||||
|
.registerTypeAdapter(Uri.class, new UriSerializer())
|
||||||
|
.create();
|
||||||
|
String gsonCurLatLng = gson.toJson(curLatLang);
|
||||||
|
bundle.putString("CurLatLng", gsonCurLatLng);
|
||||||
updateMapFragment();
|
updateMapFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -362,10 +368,11 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
setListFragment();
|
setListFragment();
|
||||||
|
|
||||||
hideProgressBar();
|
hideProgressBar();
|
||||||
|
lockNearbyView(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lockNearbyView(boolean lock) {
|
private void lockNearbyView(boolean lock) {
|
||||||
if (lock) {
|
/*if (lock) {
|
||||||
lockNearbyView = true;
|
lockNearbyView = true;
|
||||||
locationManager.unregisterLocationManager();
|
locationManager.unregisterLocationManager();
|
||||||
locationManager.removeLocationListener(this);
|
locationManager.removeLocationListener(this);
|
||||||
|
|
@ -373,7 +380,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
lockNearbyView = false;
|
lockNearbyView = false;
|
||||||
locationManager.registerLocationManager();
|
locationManager.registerLocationManager();
|
||||||
locationManager.addLocationListener(this);
|
locationManager.addLocationListener(this);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideProgressBar() {
|
private void hideProgressBar() {
|
||||||
|
|
@ -387,8 +394,11 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMapFragment() {
|
private void updateMapFragment() {
|
||||||
getMapFragment().setArguments(bundle);
|
NearbyMapFragment nearbyMapFragment = getMapFragment();
|
||||||
getMapFragment().updateMapWithLocationChanges();
|
if (nearbyMapFragment != null) {
|
||||||
|
nearbyMapFragment.setArguments(bundle);
|
||||||
|
nearbyMapFragment.updateMapWithLocationChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue