Remove nearby/NearbyMapFragment

This commit is contained in:
neslihanturan 2019-07-15 13:42:43 +03:00
parent e1806c24a1
commit c0075ca6cb
3 changed files with 24 additions and 1089 deletions

View file

@ -24,7 +24,6 @@ import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.annotations.MarkerOptions;
import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.MapboxMapOptions; import com.mapbox.mapboxsdk.maps.MapboxMapOptions;
@ -157,7 +156,7 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
public MapView setupMapView(Bundle savedInstanceState) { public MapView setupMapView(Bundle savedInstanceState) {
Timber.d("setting up map view"); Timber.d("setting up map view");
boolean isDarkTheme = applicationKvStore.getBoolean("theme", false); boolean isDarkTheme = applicationKvStore.getBoolean("theme", false);
MapboxMapOptions options = new MapboxMapOptions() /*MapboxMapOptions options = new MapboxMapOptions()
.compassGravity(Gravity.BOTTOM | Gravity.LEFT) .compassGravity(Gravity.BOTTOM | Gravity.LEFT)
.compassMargins(new int[]{12, 0, 0, 24}) .compassMargins(new int[]{12, 0, 0, 24})
.styleUrl(isDarkTheme ? Style.DARK : Style.OUTDOORS) .styleUrl(isDarkTheme ? Style.DARK : Style.OUTDOORS)
@ -165,7 +164,7 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
.attributionEnabled(false) .attributionEnabled(false)
.camera(new CameraPosition.Builder() .camera(new CameraPosition.Builder()
.zoom(ZOOM_LEVEL) .zoom(ZOOM_LEVEL)
.build()); .build());*/
/* /*
MapView mapView = view.findViewById(R.id.mapView); MapView mapView = view.findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState); mapView.onCreate(savedInstanceState);
@ -183,7 +182,7 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
*/ */
if (!getParentFragment().getActivity().isFinishing()) { /*if (!getParentFragment().getActivity().isFinishing()) {
MapView mapView = new MapView(getParentFragment().getActivity(), options); MapView mapView = new MapView(getParentFragment().getActivity(), options);
// create map // create map
mapView.onCreate(savedInstanceState); mapView.onCreate(savedInstanceState);
@ -200,10 +199,10 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
this.mapboxMap = mapboxMap; this.mapboxMap = mapboxMap;
viewsAreReadyCallback.nearbyMapViewReady(); viewsAreReadyCallback.nearbyMapViewReady();
//addMapMovementListeners(); //addMapMovementListeners();
//updateMapSignificantlyForCurrentLocation();*/ //updateMapSignificantlyForCurrentLocation();
}); });*/
return mapView; //return mapView;
} //}
return null; return null;
} }

View file

@ -26,6 +26,7 @@ import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.MapboxMapOptions; import com.mapbox.mapboxsdk.maps.MapboxMapOptions;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.maps.Style;
import com.mapbox.mapboxsdk.maps.SupportMapFragment; import com.mapbox.mapboxsdk.maps.SupportMapFragment;
import javax.inject.Inject; import javax.inject.Inject;
@ -265,7 +266,22 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
fragmentTransaction.replace(R.id.container, nearbyMapFragment, TAG_RETAINED_MAP_FRAGMENT); fragmentTransaction.replace(R.id.container, nearbyMapFragment, TAG_RETAINED_MAP_FRAGMENT);
fragmentTransaction.commitAllowingStateLoss(); fragmentTransaction.commitAllowingStateLoss();
nearbyMapFragment.getMapAsync(this); //nearbyMapFragment.getMapAsync(this);
nearbyMapFragment.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() {
@Override
public void onStyleLoaded(@NonNull Style style) {
// Map is set up and the style has loaded. Now you can add
// data or make other map adjustments
}
});
}
});
/*if (nearbyMapFragment.getMapboxMap()!=null){ /*if (nearbyMapFragment.getMapboxMap()!=null){
}*/ }*/