mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
use SupportMapFragment instead
This commit is contained in:
parent
f3694e3647
commit
3890ea578b
2 changed files with 18 additions and 18 deletions
|
|
@ -188,7 +188,7 @@ public class MainActivity extends AuthenticatedActivity implements FragmentManag
|
||||||
isContributionsFragmentVisible = false;
|
isContributionsFragmentVisible = false;
|
||||||
updateMenuItem();
|
updateMenuItem();
|
||||||
// Do all permission and GPS related tasks on tab selected, not on create
|
// Do all permission and GPS related tasks on tab selected, not on create
|
||||||
((NearbyParentFragment)contributionsActivityPagerAdapter.getItem(1)).nearbyParentFragmentPresenter.onTabSelected();
|
//((NearbyParentFragment)contributionsActivityPagerAdapter.getItem(1)).nearbyParentFragmentPresenter.onTabSelected();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tabLayout.getTabAt(CONTRIBUTIONS_TAB_POSITION).select();
|
tabLayout.getTabAt(CONTRIBUTIONS_TAB_POSITION).select();
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ import static fr.free.nrw.commons.location.LocationServiceManager.LocationChange
|
||||||
*/
|
*/
|
||||||
public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
implements WikidataEditListener.WikidataP18EditListener,
|
implements WikidataEditListener.WikidataP18EditListener,
|
||||||
NearbyParentFragmentContract.View {
|
NearbyParentFragmentContract.View, OnMapReadyCallback {
|
||||||
|
|
||||||
@BindView(R.id.progressBar)
|
@BindView(R.id.progressBar)
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
|
|
@ -98,9 +98,9 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
|
|
||||||
private NearbyParentFragmentContract.UserActions userActions;
|
private NearbyParentFragmentContract.UserActions userActions;
|
||||||
|
|
||||||
private NearbyMapFragment2 nearbyMapFragment;
|
private SupportMapFragment nearbyMapFragment;
|
||||||
private NearbyListFragment nearbyListFragment;
|
private NearbyListFragment nearbyListFragment;
|
||||||
private static final String TAG_RETAINED_MAP_FRAGMENT = NearbyMapFragment2.class.getSimpleName();
|
private static final String TAG_RETAINED_MAP_FRAGMENT = SupportMapFragment.class.getSimpleName();
|
||||||
private static final String TAG_RETAINED_LIST_FRAGMENT = NearbyListFragment.class.getSimpleName();
|
private static final String TAG_RETAINED_LIST_FRAGMENT = NearbyListFragment.class.getSimpleName();
|
||||||
public NearbyParentFragmentPresenter nearbyParentFragmentPresenter;
|
public NearbyParentFragmentPresenter nearbyParentFragmentPresenter;
|
||||||
|
|
||||||
|
|
@ -168,7 +168,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
*/
|
*/
|
||||||
public void childMapFragmentAttached() {
|
public void childMapFragmentAttached() {
|
||||||
nearbyParentFragmentPresenter = new NearbyParentFragmentPresenter
|
nearbyParentFragmentPresenter = new NearbyParentFragmentPresenter
|
||||||
(this, nearbyMapFragment, locationManager);
|
(this, null, locationManager);
|
||||||
Timber.d("Child fragment attached");
|
Timber.d("Child fragment attached");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -240,8 +240,8 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
/**
|
/**
|
||||||
* Returns the map fragment added to child fragment manager previously, if exists.
|
* Returns the map fragment added to child fragment manager previously, if exists.
|
||||||
*/
|
*/
|
||||||
private NearbyMapFragment2 getMapFragment() {
|
private SupportMapFragment getMapFragment() {
|
||||||
NearbyMapFragment2 existingFragment = (NearbyMapFragment2) getChildFragmentManager()
|
SupportMapFragment existingFragment = (SupportMapFragment) getChildFragmentManager()
|
||||||
.findFragmentByTag(TAG_RETAINED_MAP_FRAGMENT);
|
.findFragmentByTag(TAG_RETAINED_MAP_FRAGMENT);
|
||||||
if (existingFragment == null) {
|
if (existingFragment == null) {
|
||||||
existingFragment = setMapFragment();
|
existingFragment = setMapFragment();
|
||||||
|
|
@ -249,7 +249,8 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
return existingFragment;
|
return existingFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
private NearbyMapFragment2 setMapFragment() {
|
private SupportMapFragment setMapFragment() {
|
||||||
|
Log.d("deneme2","setMapFragment is called");
|
||||||
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
|
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
|
||||||
// Build mapboxMap
|
// Build mapboxMap
|
||||||
MapboxMapOptions options = new MapboxMapOptions();
|
MapboxMapOptions options = new MapboxMapOptions();
|
||||||
|
|
@ -259,22 +260,16 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
// Create map fragment
|
// Create map fragment
|
||||||
NearbyMapFragment2 nearbyMapFragment = NearbyMapFragment2.newInstance(options);
|
SupportMapFragment nearbyMapFragment = SupportMapFragment.newInstance(options);
|
||||||
|
|
||||||
//NearbyMapFragment2 nearbyMapFragment = new NearbyMapFragment2();
|
//NearbyMapFragment2 nearbyMapFragment = new NearbyMapFragment2();
|
||||||
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(new OnMapReadyCallback() {
|
nearbyMapFragment.getMapAsync(this);
|
||||||
@Override
|
/*if (nearbyMapFragment.getMapboxMap()!=null){
|
||||||
public void onMapReady(@NonNull MapboxMap mapboxMap) {
|
|
||||||
Log.d("deneme2","onMapReady");
|
|
||||||
nearbyMapFragment.viewsAreReadyCallback.nearbyMapViewReady();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (nearbyMapFragment.getMapboxMap()!=null){
|
|
||||||
|
|
||||||
}
|
}*/
|
||||||
return nearbyMapFragment;
|
return nearbyMapFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -421,4 +416,9 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
public boolean isBottomSheetExpanded() {
|
public boolean isBottomSheetExpanded() {
|
||||||
return bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED;
|
return bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMapReady(MapboxMap mapboxMap) {
|
||||||
|
Log.d("deneme2","on map ready");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue