mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Request permission for nearby places if fragment is loaded and tab is selected
This commit is contained in:
parent
aa7fb84313
commit
d858813a01
3 changed files with 6 additions and 2 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue