mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Make nearby map ready callback came
This commit is contained in:
parent
3bb801b62c
commit
b8b524f859
3 changed files with 17 additions and 13 deletions
|
|
@ -2,6 +2,7 @@ package fr.free.nrw.commons.nearby.mvp.contract;
|
|||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
|
||||
|
|
|
|||
|
|
@ -99,11 +99,12 @@ 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);
|
||||
//View view = inflater.inflate(R.layout.fragment_nearby_map, container, false);
|
||||
setHasOptionsMenu(false);
|
||||
initViews();
|
||||
// this.mapView = setupMapView(savedInstanceState);
|
||||
return view;
|
||||
this.mapView = setupMapView(savedInstanceState);
|
||||
|
||||
return mapView;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -159,7 +160,7 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
|
|||
Log.d("deneme2", "setuo map view is called");
|
||||
Timber.d("setting up map view");
|
||||
boolean isDarkTheme = applicationKvStore.getBoolean("theme", false);
|
||||
/*MapboxMapOptions options = new MapboxMapOptions()
|
||||
MapboxMapOptions options = new MapboxMapOptions()
|
||||
.compassGravity(Gravity.BOTTOM | Gravity.LEFT)
|
||||
.compassMargins(new int[]{12, 0, 0, 24})
|
||||
.styleUrl(isDarkTheme ? Style.DARK : Style.OUTDOORS)
|
||||
|
|
@ -167,9 +168,9 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
|
|||
.attributionEnabled(false)
|
||||
.camera(new CameraPosition.Builder()
|
||||
.zoom(ZOOM_LEVEL)
|
||||
.build());*/
|
||||
|
||||
MapView mapView = getView().findViewById(R.id.mapView);
|
||||
.build());
|
||||
/*
|
||||
MapView mapView = view.findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(new OnMapReadyCallback() {
|
||||
@Override
|
||||
|
|
@ -182,15 +183,16 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
|
|||
);
|
||||
|
||||
return mapView;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*if (!getParentFragment().getActivity().isFinishing()) {
|
||||
if (!getParentFragment().getActivity().isFinishing()) {
|
||||
MapView mapView = new MapView(getParentFragment().getActivity(), options);
|
||||
// create map
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(mapboxMap -> {
|
||||
LocalizationPlugin localizationPlugin = new LocalizationPlugin(mapView, mapboxMap);
|
||||
Log.d("deneme2","nearby map is ready");
|
||||
/*LocalizationPlugin localizationPlugin = new LocalizationPlugin(mapView, mapboxMap);
|
||||
|
||||
try {
|
||||
localizationPlugin.matchMapLanguageWithDeviceDefault();
|
||||
|
|
@ -201,11 +203,11 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
|
|||
this.mapboxMap = mapboxMap;
|
||||
viewsAreReadyCallback.nearbyMapViewReady();
|
||||
//addMapMovementListeners();
|
||||
//updateMapSignificantlyForCurrentLocation();
|
||||
//updateMapSignificantlyForCurrentLocation();*/
|
||||
});
|
||||
return mapView;
|
||||
}
|
||||
return null;*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ public class NearbyParentFragmentPresenter
|
|||
*/
|
||||
@Override
|
||||
public void nearbyMapViewReady() {
|
||||
Log.d("deneme2","Nearby view ready method is called");
|
||||
Timber.d("Nearby map view is created and ready");
|
||||
updateMapAndList(LOCATION_SIGNIFICANTLY_CHANGED, null);
|
||||
// TODO: document this prpoblem, if updateMapAndList is not called at checkGPS then this method never called, setup map view never ends
|
||||
|
|
@ -118,7 +119,7 @@ public class NearbyParentFragmentPresenter
|
|||
//nearbyParentFragmentView.checkGps(locationServiceManager);
|
||||
// We will know when we went offline and online again
|
||||
nearbyParentFragmentView.addNetworkBroadcastReceiver();
|
||||
nearbyMapFragmentView.setupMapView(null);
|
||||
//nearbyMapFragmentView.setupMapView(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue