Request permission for nearby places if fragment is loaded and tab is selected

This commit is contained in:
neslihanturan 2019-09-02 15:13:56 +03:00
parent aa7fb84313
commit d858813a01
3 changed files with 6 additions and 2 deletions

View file

@ -110,6 +110,7 @@ public class NearbyTestFragmentLayersActivity extends AuthenticatedActivity {
case NEARBY_TAB_POSITION:
Timber.d("Nearby tab selected");
tabLayout.getTabAt(NEARBY_TAB_POSITION).select();
((NearbyTestLayersFragment)contributionsActivityPagerAdapter.getItem(1)).nearbyParentFragmentPresenter.onTabSelected();
break;
default:
tabLayout.getTabAt(CONTRIBUTIONS_TAB_POSITION).select();

View file

@ -114,8 +114,8 @@ public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment imple
nearbyParentFragmentPresenter = new NearbyParentFragmentPresenter
(this, mapFragment, locationManager);
Timber.d("Child fragment attached");
// TODO: find out why location manager is null
checkPermissionsAndPerformAction(this::registerLocationUpdates);
nearbyParentFragmentPresenter.nearbyFragmentsAreReady();
//checkPermissionsAndPerformAction(this::registerLocationUpdates);
}
@Override
@ -178,6 +178,7 @@ public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment imple
@Override
public void checkPermissionsAndPerformAction(Runnable runnable) {
Log.d("denemeTest","checkPermissionsAndPerformAction is called");
PermissionUtils.checkPermissionsAndPerformAction(getActivity(),
Manifest.permission.ACCESS_FINE_LOCATION,
runnable,

View file

@ -67,6 +67,7 @@ public class NearbyParentFragmentPresenter
@Override
public void onTabSelected() {
Timber.d("Nearby tab selected");
Log.d("denemeTest","Nearby tab selected");
onTabSelected = true;
// The condition for initialize operations is both having views ready and tab is selected
if (nearbyViewsAreReady) {
@ -81,6 +82,7 @@ public class NearbyParentFragmentPresenter
@Override
public void nearbyFragmentsAreReady() {
Timber.d("Nearby fragments are ready to be used by presenter");
Log.d("denemeTest","nearbyFragmentsAreReady");
nearbyViewsAreReady = true;
// The condition for initialize operations is both having views ready and tab is selected
if (onTabSelected) {