mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Make recenter button work when list sheet is expanded
This commit is contained in:
parent
45d6f56630
commit
ee57f84fea
3 changed files with 12 additions and 12 deletions
|
|
@ -317,6 +317,7 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment
|
|||
MarkerOptions currentLocationMarkerOptions = new MarkerOptions()
|
||||
.position(new com.mapbox.mapboxsdk.geometry.LatLng(curLatLng.getLatitude(), curLatLng.getLongitude()));
|
||||
currentLocationMarkerOptions.setIcon(icon); // Set custom icon
|
||||
Marker currentLocationMarker = mapboxMap.addMarker(currentLocationMarkerOptions);
|
||||
|
||||
List<com.mapbox.mapboxsdk.geometry.LatLng> circle = UiUtils.createCircleArray(curLatLng.getLatitude(), curLatLng.getLongitude(),
|
||||
curLatLng.getAccuracy() * 2, 100);
|
||||
|
|
|
|||
|
|
@ -188,17 +188,16 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
private boolean isNetworkErrorOccurred = false;
|
||||
private Snackbar snackbar;
|
||||
FragmentTransaction transaction;
|
||||
View view;
|
||||
private View view;
|
||||
|
||||
public NearbyParentFragmentPresenter nearbyParentFragmentPresenter;
|
||||
boolean isDarkTheme;
|
||||
boolean isFabOpen;
|
||||
boolean isBottomListSheetExpanded;
|
||||
private boolean isDarkTheme;
|
||||
private boolean isFabOpen;
|
||||
private Marker selectedMarker;
|
||||
private Place selectedPlace;
|
||||
|
||||
private final double CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT = 0.06;
|
||||
private final double CAMERA_TARGET_SHIFT_FACTOR_LANDSCAPE = 0.04;
|
||||
private final double CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT = 0.005;
|
||||
private final double CAMERA_TARGET_SHIFT_FACTOR_LANDSCAPE = 0.004;
|
||||
|
||||
NearbyMapFragment nearbyMapFragment;
|
||||
|
||||
|
|
@ -769,21 +768,21 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
|
||||
if (ViewUtil.isPortrait(getActivity())){
|
||||
position = new CameraPosition.Builder()
|
||||
.target(isBottomListSheetExpanded ?
|
||||
.target(isListBottomSheetExpanded() ?
|
||||
new LatLng(curLatLng.getLatitude() - CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT,
|
||||
curLatLng.getLongitude())
|
||||
: new LatLng(curLatLng.getLatitude(), curLatLng.getLongitude(), 0)) // Sets the new camera position
|
||||
.zoom(isBottomListSheetExpanded ?
|
||||
.zoom(isListBottomSheetExpanded() ?
|
||||
ZOOM_LEVEL
|
||||
: nearbyMapFragment.getMapboxMap().getCameraPosition().zoom) // Same zoom level
|
||||
.build();
|
||||
}else {
|
||||
position = new CameraPosition.Builder()
|
||||
.target(isBottomListSheetExpanded ?
|
||||
.target(isListBottomSheetExpanded() ?
|
||||
new LatLng(curLatLng.getLatitude() - CAMERA_TARGET_SHIFT_FACTOR_LANDSCAPE,
|
||||
curLatLng.getLongitude())
|
||||
: new LatLng(curLatLng.getLatitude(), curLatLng.getLongitude(), 0)) // Sets the new camera position
|
||||
.zoom(isBottomListSheetExpanded ?
|
||||
.zoom(isListBottomSheetExpanded() ?
|
||||
ZOOM_LEVEL
|
||||
: nearbyMapFragment.getMapboxMap().getCameraPosition().zoom) // Same zoom level
|
||||
.build();
|
||||
|
|
@ -808,7 +807,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
NearbyMarker nearbyMarker = (NearbyMarker) marker;
|
||||
Place place = nearbyMarker.getNearbyBaseMarker().getPlace();
|
||||
passInfoToSheet(place);
|
||||
bottomSheetListBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||
hideBottomSheet();
|
||||
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class UiUtils {
|
|||
*
|
||||
* @return List List of LatLng points of the circle.
|
||||
*/
|
||||
public static List<LatLng> createCircleArray(
|
||||
public static List<com.mapbox.mapboxsdk.geometry.LatLng> createCircleArray(
|
||||
double centerLat, double centerLong, float radius, int nodes) {
|
||||
List<com.mapbox.mapboxsdk.geometry.LatLng> circle = new ArrayList<>();
|
||||
float radiusKilometer = radius / 1000;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue