mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Implement NearbyMapContract.View on our new SupportMapFragment
This commit is contained in:
parent
8324e5dc2d
commit
be42568c3e
2 changed files with 151 additions and 4 deletions
|
|
@ -35,6 +35,7 @@ public class NearbyTestLayersFragment extends Fragment implements NearbyParentFr
|
||||||
@Inject
|
@Inject
|
||||||
LocationServiceManager locationManager;
|
LocationServiceManager locationManager;
|
||||||
NearbyParentFragmentPresenter nearbyParentFragmentPresenter;
|
NearbyParentFragmentPresenter nearbyParentFragmentPresenter;
|
||||||
|
SupportMapFragment mapFragment;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
|
@ -53,7 +54,6 @@ public class NearbyTestLayersFragment extends Fragment implements NearbyParentFr
|
||||||
Mapbox.getInstance(getActivity(), getString(R.string.mapbox_commons_app_token));
|
Mapbox.getInstance(getActivity(), getString(R.string.mapbox_commons_app_token));
|
||||||
|
|
||||||
// Create supportMapFragment
|
// Create supportMapFragment
|
||||||
SupportMapFragment mapFragment;
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
|
|
||||||
// Create fragment
|
// Create fragment
|
||||||
|
|
@ -84,7 +84,7 @@ public class NearbyTestLayersFragment extends Fragment implements NearbyParentFr
|
||||||
mapboxMap.setStyle(Style.SATELLITE, new Style.OnStyleLoaded() {
|
mapboxMap.setStyle(Style.SATELLITE, new Style.OnStyleLoaded() {
|
||||||
@Override
|
@Override
|
||||||
public void onStyleLoaded(@NonNull Style style) {
|
public void onStyleLoaded(@NonNull Style style) {
|
||||||
//NearbyTestLayersFragment.this.childMapFragmentAttached();
|
NearbyTestLayersFragment.this.childMapFragmentAttached();
|
||||||
|
|
||||||
Log.d("NearbyTests","Fragment inside fragment with map works");
|
Log.d("NearbyTests","Fragment inside fragment with map works");
|
||||||
// Map is set up and the style has loaded. Now you can add data or make other map adjustments
|
// Map is set up and the style has loaded. Now you can add data or make other map adjustments
|
||||||
|
|
@ -103,7 +103,7 @@ public class NearbyTestLayersFragment extends Fragment implements NearbyParentFr
|
||||||
public void childMapFragmentAttached() {
|
public void childMapFragmentAttached() {
|
||||||
Log.d("denemeTest","this:"+this);
|
Log.d("denemeTest","this:"+this);
|
||||||
nearbyParentFragmentPresenter = new NearbyParentFragmentPresenter
|
nearbyParentFragmentPresenter = new NearbyParentFragmentPresenter
|
||||||
(this, null, locationManager);
|
(this, mapFragment, locationManager);
|
||||||
Timber.d("Child fragment attached");
|
Timber.d("Child fragment attached");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package fr.free.nrw.commons.nearby;
|
package fr.free.nrw.commons.nearby;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
|
@ -10,6 +11,7 @@ import android.view.ViewGroup;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.mapbox.mapboxsdk.maps.MapFragment;
|
import com.mapbox.mapboxsdk.maps.MapFragment;
|
||||||
import com.mapbox.mapboxsdk.maps.MapView;
|
import com.mapbox.mapboxsdk.maps.MapView;
|
||||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||||
|
|
@ -22,6 +24,9 @@ import java.util.List;
|
||||||
|
|
||||||
import dagger.android.support.DaggerFragment;
|
import dagger.android.support.DaggerFragment;
|
||||||
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
|
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
|
||||||
|
import fr.free.nrw.commons.location.LatLng;
|
||||||
|
import fr.free.nrw.commons.nearby.mvp.contract.NearbyMapContract;
|
||||||
|
import fr.free.nrw.commons.nearby.mvp.contract.NearbyParentFragmentContract;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support Fragment wrapper around a map view.
|
* Support Fragment wrapper around a map view.
|
||||||
|
|
@ -37,7 +42,9 @@ import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
|
||||||
*
|
*
|
||||||
* @see #getMapAsync(OnMapReadyCallback)
|
* @see #getMapAsync(OnMapReadyCallback)
|
||||||
*/
|
*/
|
||||||
public class SupportMapFragment extends CommonsDaggerSupportFragment implements OnMapReadyCallback {
|
public class SupportMapFragment extends CommonsDaggerSupportFragment
|
||||||
|
implements OnMapReadyCallback,
|
||||||
|
NearbyMapContract.View{
|
||||||
|
|
||||||
private final List<OnMapReadyCallback> mapReadyCallbackList = new ArrayList<>();
|
private final List<OnMapReadyCallback> mapReadyCallbackList = new ArrayList<>();
|
||||||
private MapFragment.OnMapViewReadyCallback mapViewReadyCallback;
|
private MapFragment.OnMapViewReadyCallback mapViewReadyCallback;
|
||||||
|
|
@ -224,5 +231,145 @@ public class SupportMapFragment extends CommonsDaggerSupportFragment implements
|
||||||
onMapReadyCallback.onMapReady(mapboxMap);
|
onMapReadyCallback.onMapReady(mapboxMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showSearchThisAreaButton() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showInformationBottomSheet() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initViews() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMapMarkers(LatLng latLng, List<Place> placeList) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMapToTrackPosition(LatLng curLatLng) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setListeners() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MapView setupMapView(Bundle savedInstanceState) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCurrentLocationMarker(LatLng curLatLng) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSearchThisAreaButtonVisibility(boolean visible) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCurrentLocationMarkerVisible() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addNearbyMarkersToMapBoxMap(List<NearbyBaseMarker> baseMarkerOptions) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prepareViewsForSheetPosition() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hideFABs() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showFABs() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addAnchorToBigFABs(FloatingActionButton floatingActionButton, int anchorID) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeAnchorFromFABs(FloatingActionButton fab) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addAnchorToSmallFABs(FloatingActionButton floatingActionButton, int anchorID) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void passInfoToSheet(Place place) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateBookmarkButtonImage(Place place) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openWebView(Uri link) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void animateFABs(boolean isFabOpen) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeFabs(boolean isFabOpen) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMarker(boolean isBookmarked, Place place) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LatLng getCameraTarget() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MapboxMap getMapboxMap() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void viewsAreAssignedToPresenter(NearbyParentFragmentContract.ViewsAreReadyCallback viewsAreReadyCallback) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addOnCameraMoveListener(MapboxMap.OnCameraMoveListener onCameraMoveListener) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showPlaces() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue