Search in sources :

Example 1 with FirstUsageWizardFragment

use of net.osmand.plus.firstusage.FirstUsageWizardFragment in project Osmand by osmandapp.

the class MapActivity method newDownloadIndexes.

// DownloadEvents
@Override
public void newDownloadIndexes() {
    FirstUsageWizardFragment wizardFragment = getFirstUsageWizardFragment();
    if (wizardFragment != null) {
        wizardFragment.newDownloadIndexes();
    }
    WeakReference<MapContextMenuFragment> fragmentRef = getContextMenu().findMenuFragment();
    if (fragmentRef != null) {
        fragmentRef.get().newDownloadIndexes();
    }
    if (dashboardOnMap.isVisible()) {
        dashboardOnMap.onNewDownloadIndexes();
    }
    refreshMap();
}
Also used : FirstUsageWizardFragment(net.osmand.plus.firstusage.FirstUsageWizardFragment) MapContextMenuFragment(net.osmand.plus.mapcontextmenu.MapContextMenuFragment)

Example 2 with FirstUsageWizardFragment

use of net.osmand.plus.firstusage.FirstUsageWizardFragment in project Osmand by osmandapp.

the class MapActivity method downloadHasFinished.

@Override
public void downloadHasFinished() {
    FirstUsageWizardFragment wizardFragment = getFirstUsageWizardFragment();
    if (wizardFragment != null) {
        wizardFragment.downloadHasFinished();
    }
    WeakReference<MapContextMenuFragment> fragmentRef = getContextMenu().findMenuFragment();
    if (fragmentRef != null) {
        fragmentRef.get().downloadHasFinished();
    }
    if (dashboardOnMap.isVisible()) {
        dashboardOnMap.onDownloadHasFinished();
    }
    refreshMap();
}
Also used : FirstUsageWizardFragment(net.osmand.plus.firstusage.FirstUsageWizardFragment) MapContextMenuFragment(net.osmand.plus.mapcontextmenu.MapContextMenuFragment)

Example 3 with FirstUsageWizardFragment

use of net.osmand.plus.firstusage.FirstUsageWizardFragment in project Osmand by osmandapp.

the class MapActivity method onRequestPermissionsResult.

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull final int[] grantResults) {
    if (grantResults.length > 0) {
        OsmandPlugin.onRequestPermissionsResult(requestCode, permissions, grantResults);
        MapControlsLayer mcl = mapView.getLayerByClass(MapControlsLayer.class);
        if (mcl != null) {
            mcl.onRequestPermissionsResult(requestCode, permissions, grantResults);
        }
        if (requestCode == DownloadActivity.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE && grantResults.length > 0 && permissions.length > 0 && Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permissions[0])) {
            permissionAsked = true;
            permissionGranted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
        } else if (requestCode == FirstUsageWizardFragment.FIRST_USAGE_REQUEST_WRITE_EXTERNAL_STORAGE_PERMISSION && grantResults.length > 0 && permissions.length > 0 && Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permissions[0])) {
            new Timer().schedule(new TimerTask() {

                @Override
                public void run() {
                    FirstUsageWizardFragment wizardFragment = getFirstUsageWizardFragment();
                    if (wizardFragment != null) {
                        wizardFragment.processStoragePermission(grantResults[0] == PackageManager.PERMISSION_GRANTED);
                    }
                }
            }, 1);
        } else if (requestCode == FirstUsageWizardFragment.FIRST_USAGE_LOCATION_PERMISSION) {
            new Timer().schedule(new TimerTask() {

                @Override
                public void run() {
                    FirstUsageWizardFragment wizardFragment = getFirstUsageWizardFragment();
                    if (wizardFragment != null) {
                        wizardFragment.processLocationPermission(grantResults[0] == PackageManager.PERMISSION_GRANTED);
                    }
                }
            }, 1);
        }
    }
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
Also used : MapControlsLayer(net.osmand.plus.views.MapControlsLayer) Timer(java.util.Timer) TimerTask(java.util.TimerTask) FirstUsageWizardFragment(net.osmand.plus.firstusage.FirstUsageWizardFragment)

Example 4 with FirstUsageWizardFragment

use of net.osmand.plus.firstusage.FirstUsageWizardFragment in project Osmand by osmandapp.

the class MapActivity method downloadInProgress.

@Override
public void downloadInProgress() {
    FirstUsageWizardFragment wizardFragment = getFirstUsageWizardFragment();
    if (wizardFragment != null) {
        wizardFragment.downloadInProgress();
    }
    WeakReference<MapContextMenuFragment> fragmentRef = getContextMenu().findMenuFragment();
    if (fragmentRef != null) {
        fragmentRef.get().downloadInProgress();
    }
    if (dashboardOnMap.isVisible()) {
        dashboardOnMap.onDownloadInProgress();
    }
}
Also used : FirstUsageWizardFragment(net.osmand.plus.firstusage.FirstUsageWizardFragment) MapContextMenuFragment(net.osmand.plus.mapcontextmenu.MapContextMenuFragment)

Example 5 with FirstUsageWizardFragment

use of net.osmand.plus.firstusage.FirstUsageWizardFragment in project Osmand by osmandapp.

the class MapActivity method isFirstScreenShowing.

public boolean isFirstScreenShowing() {
    FirstUsageWelcomeFragment welcomeFragment = (FirstUsageWelcomeFragment) getSupportFragmentManager().findFragmentByTag(FirstUsageWelcomeFragment.TAG);
    FirstUsageWizardFragment wizardFragment = (FirstUsageWizardFragment) getSupportFragmentManager().findFragmentByTag(FirstUsageWizardFragment.TAG);
    return welcomeFragment != null && !welcomeFragment.isDetached() || wizardFragment != null && !wizardFragment.isDetached();
}
Also used : FirstUsageWelcomeFragment(net.osmand.plus.firstusage.FirstUsageWelcomeFragment) FirstUsageWizardFragment(net.osmand.plus.firstusage.FirstUsageWizardFragment)

Aggregations

FirstUsageWizardFragment (net.osmand.plus.firstusage.FirstUsageWizardFragment)5 MapContextMenuFragment (net.osmand.plus.mapcontextmenu.MapContextMenuFragment)3 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 FirstUsageWelcomeFragment (net.osmand.plus.firstusage.FirstUsageWelcomeFragment)1 MapControlsLayer (net.osmand.plus.views.MapControlsLayer)1