mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Add a view to nearby map ragment and insert map view as an item inside it
This commit is contained in:
parent
c84ecd1b9c
commit
c8b1ebb7fe
3 changed files with 34 additions and 4 deletions
|
|
@ -28,6 +28,7 @@ import com.mapbox.mapboxsdk.constants.Style;
|
|||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMapOptions;
|
||||
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
|
||||
import com.mapbox.mapboxsdk.plugins.localization.LocalizationPlugin;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -98,10 +99,11 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Timber.d("onCreateView called");
|
||||
View view = inflater.inflate(R.layout.fragment_nearby_map, container, false);
|
||||
setHasOptionsMenu(false);
|
||||
initViews();
|
||||
this.mapView = setupMapView(savedInstanceState);
|
||||
return mapView;
|
||||
// this.mapView = setupMapView(savedInstanceState);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -165,7 +167,22 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
|
|||
.zoom(ZOOM_LEVEL)
|
||||
.build());
|
||||
|
||||
if (!getParentFragment().getActivity().isFinishing()) {
|
||||
MapView mapView = getView().findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(new OnMapReadyCallback() {
|
||||
@Override
|
||||
public void onMapReady(MapboxMap mapboxMap) {
|
||||
NearbyMapFragment.this.mapboxMap = mapboxMap;
|
||||
viewsAreReadyCallback.nearbyMapViewReady();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return mapView;
|
||||
|
||||
|
||||
|
||||
/*if (!getParentFragment().getActivity().isFinishing()) {
|
||||
MapView mapView = new MapView(getParentFragment().getActivity(), options);
|
||||
// create map
|
||||
mapView.onCreate(savedInstanceState);
|
||||
|
|
@ -185,7 +202,7 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
|
|||
});
|
||||
return mapView;
|
||||
}
|
||||
return null;
|
||||
return null;*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ public class NearbyParentFragmentPresenter
|
|||
//nearbyParentFragmentView.checkGps(locationServiceManager);
|
||||
// We will know when we went offline and online again
|
||||
nearbyParentFragmentView.addNetworkBroadcastReceiver();
|
||||
nearbyMapFragmentView.setupMapView(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
12
app/src/main/res/layout/fragment_nearby_map.xml
Normal file
12
app/src/main/res/layout/fragment_nearby_map.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue