Search in sources :

Example 1 with MapillaryPlugin

use of net.osmand.plus.plugins.mapillary.MapillaryPlugin in project Osmand by osmandapp.

the class DevelopmentSettingsFragment method onPreferenceClick.

@Override
public boolean onPreferenceClick(Preference preference) {
    String prefId = preference.getKey();
    if (SIMULATE_YOUR_LOCATION.equals(prefId)) {
        updateSimulationTitle.run();
        OsmAndLocationSimulation sim = app.getLocationProvider().getLocationSimulation();
        sim.startStopRouteAnimation(getActivity(), true, updateSimulationTitle);
        return true;
    } else if (SIMULATE_INITIAL_STARTUP.equals(prefId)) {
        app.getAppInitializer().resetFirstTimeRun();
        settings.FIRST_MAP_IS_DOWNLOADED.resetToDefault();
        settings.WEBGL_SUPPORTED.resetToDefault();
        settings.WIKI_ARTICLE_SHOW_IMAGES_ASKED.resetToDefault();
        MapillaryPlugin mapillaryPlugin = OsmandPlugin.getPlugin(MapillaryPlugin.class);
        if (mapillaryPlugin != null) {
            mapillaryPlugin.MAPILLARY_FIRST_DIALOG_SHOWN.resetToDefault();
        }
        app.showToastMessage(R.string.shared_string_ok);
        return true;
    } else if (AGPS_DATA_DOWNLOADED.equals(prefId)) {
        if (settings.isInternetConnectionAvailable(true)) {
            app.getLocationProvider().redownloadAGPS();
            preference.setSummary(getAgpsDataDownloadedSummary());
        }
        return true;
    } else if (settings.MEMORY_ALLOCATED_FOR_ROUTING.getId().equals(prefId)) {
        FragmentManager fragmentManager = getFragmentManager();
        if (fragmentManager != null) {
            AllocatedRoutingMemoryBottomSheet.showInstance(fragmentManager, preference.getKey(), this, getSelectedAppMode());
        }
    }
    return super.onPreferenceClick(preference);
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) OsmAndLocationSimulation(net.osmand.plus.OsmAndLocationSimulation) MapillaryPlugin(net.osmand.plus.plugins.mapillary.MapillaryPlugin)

Example 2 with MapillaryPlugin

use of net.osmand.plus.plugins.mapillary.MapillaryPlugin in project Osmand by osmandapp.

the class DashboardOnMap method setDashboardVisibility.

public void setDashboardVisibility(boolean visible, DashboardType type, DashboardType prevItem, boolean animation, int[] animationCoordinates) {
    if (visible == this.visible && type == visibleType || !AndroidUtils.isActivityNotDestroyed(mapActivity)) {
        return;
    }
    mapActivity.getRoutingHelper().removeListener(this);
    nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
    this.previousVisibleType = prevItem;
    this.visible = visible;
    ApplicationMode currentAppMode = getMyApplication().getSettings().APPLICATION_MODE.get();
    boolean appModeChanged = currentAppMode != previousAppMode;
    boolean refresh = this.visibleType == type && !appModeChanged;
    previousAppMode = currentAppMode;
    visibleType = type;
    DashboardOnMap.staticVisible = visible;
    DashboardOnMap.staticVisibleType = type;
    mapActivity.enableDrawer();
    removeFragment(MapillaryFiltersFragment.TAG);
    removeFragment(TerrainFragment.TAG);
    if (visible) {
        mapActivity.dismissCardDialog();
        mapActivity.dismissTrackMenu();
        mapActivity.getContextMenu().hideMenues();
        mapViewLocation = mapActivity.getMapLocation();
        mapRotation = mapActivity.getMapRotate();
        mapLinkedToLocation = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
        mapActivity.getMapViewTrackingUtilities().setDashboard(this);
        mapActivity.disableDrawer();
        dashboardView.setVisibility(View.VISIBLE);
        if (isActionButtonVisible()) {
            setActionButton(visibleType);
            actionButton.setVisibility(View.VISIBLE);
        } else {
            hideActionButton();
            if (visibleType == DashboardType.CONFIGURE_MAP) {
                int btnSizePx = mapActivity.getResources().getDimensionPixelSize(R.dimen.map_small_button_size);
                compassButton = mapActivity.getMapLayers().getMapControlsLayer().moveCompassButton(dashboardView, getActionButtonLayoutParams(btnSizePx), nightMode);
            }
        }
        updateDownloadBtn();
        View listViewLayout = dashboardView.findViewById(R.id.dash_list_view_layout);
        ScrollView scrollView = dashboardView.findViewById(R.id.main_scroll);
        if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.MAPILLARY || visibleType == DashboardType.CYCLE_ROUTES || visibleType == DashboardType.HIKING_ROUTES || visibleType == DashboardType.TRAVEL_ROUTES || visibleType == DashboardType.TERRAIN) {
            FragmentManager fragmentManager = mapActivity.getSupportFragmentManager();
            if (visibleType == DashboardType.DASHBOARD) {
                addOrUpdateDashboardFragments();
            } else if (visibleType == DashboardType.MAPILLARY) {
                MapillaryFiltersFragment.showInstance(fragmentManager);
            } else if (visibleType == DashboardType.CYCLE_ROUTES) {
                CycleRoutesFragment.showInstance(fragmentManager);
            } else if (visibleType == DashboardType.HIKING_ROUTES) {
                HikingRoutesFragment.showInstance(fragmentManager);
            } else if (visibleType == DashboardType.TRAVEL_ROUTES) {
                TravelRoutesFragment.showInstance(fragmentManager);
            } else {
                TerrainFragment.showInstance(fragmentManager);
            }
            scrollView.setVisibility(View.VISIBLE);
            scrollView.scrollTo(0, 0);
            listViewLayout.setVisibility(View.GONE);
            onScrollChanged(scrollView.getScrollY(), false, false);
        } else {
            scrollView.setVisibility(View.GONE);
            listViewLayout.setVisibility(View.VISIBLE);
            if (refresh) {
                refreshContent(false);
            } else {
                listView.scrollTo(0, 0);
                listView.clearParams();
                onScrollChanged(listView.getScrollY(), false, false);
                updateListAdapter();
            }
            updateListBackgroundHeight();
            applyDayNightMode();
        }
        mapActivity.findViewById(R.id.toolbar_back).setVisibility(isBackButtonVisible() ? View.VISIBLE : View.GONE);
        mapActivity.getMapLayers().getMapControlsLayer().hideMapControls();
        updateToolbarActions();
        open(animation, animationCoordinates);
        updateLocation(true, true, false);
        mapActivity.getRoutingHelper().addListener(this);
    } else {
        mapActivity.getMapViewTrackingUtilities().setDashboard(null);
        hide(animation);
        mapActivity.getMapLayers().getMapControlsLayer().showMapControlsIfHidden();
        hideActionButton();
        for (WeakReference<DashBaseFragment> df : fragList) {
            if (df.get() != null) {
                df.get().onCloseDash();
            }
        }
        MapillaryPlugin plugin = OsmandPlugin.getPlugin(MapillaryPlugin.class);
        if (plugin != null && plugin.SHOW_MAPILLARY.get() && !plugin.MAPILLARY_FIRST_DIALOG_SHOWN.get()) {
            MapillaryFirstDialogFragment fragment = new MapillaryFirstDialogFragment();
            fragment.show(mapActivity.getSupportFragmentManager(), MapillaryFirstDialogFragment.TAG);
            plugin.MAPILLARY_FIRST_DIALOG_SHOWN.set(true);
        }
    }
    mapActivity.updateStatusBarColor();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) ScrollView(android.widget.ScrollView) MapillaryFirstDialogFragment(net.osmand.plus.plugins.mapillary.MapillaryFirstDialogFragment) ApplicationMode(net.osmand.plus.settings.backend.ApplicationMode) ImageView(android.widget.ImageView) ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ObservableListView(com.github.ksoichiro.android.observablescrollview.ObservableListView) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) AbsListView(android.widget.AbsListView) ScrollView(android.widget.ScrollView) SuppressLint(android.annotation.SuppressLint) MapillaryPlugin(net.osmand.plus.plugins.mapillary.MapillaryPlugin)

Example 3 with MapillaryPlugin

use of net.osmand.plus.plugins.mapillary.MapillaryPlugin in project Osmand by osmandapp.

the class ShowHideMapillaryAction method execute.

@Override
public void execute(@NonNull MapActivity mapActivity) {
    MapillaryPlugin plugin = OsmandPlugin.getPlugin(MapillaryPlugin.class);
    if (plugin != null) {
        plugin.SHOW_MAPILLARY.set(!plugin.SHOW_MAPILLARY.get());
        plugin.updateLayers(mapActivity, mapActivity);
    }
}
Also used : MapillaryPlugin(net.osmand.plus.plugins.mapillary.MapillaryPlugin)

Example 4 with MapillaryPlugin

use of net.osmand.plus.plugins.mapillary.MapillaryPlugin in project Osmand by osmandapp.

the class OsmandPlugin method initPlugins.

public static void initPlugins(@NonNull OsmandApplication app) {
    Set<String> enabledPlugins = app.getSettings().getEnabledPlugins();
    allPlugins.clear();
    allPlugins.add(new WikipediaPlugin(app));
    allPlugins.add(new OsmandRasterMapsPlugin(app));
    allPlugins.add(new OsmandMonitoringPlugin(app));
    checkMarketPlugin(app, new SRTMPlugin(app));
    checkMarketPlugin(app, new NauticalMapsPlugin(app));
    checkMarketPlugin(app, new SkiMapsPlugin(app));
    allPlugins.add(new AudioVideoNotesPlugin(app));
    checkMarketPlugin(app, new ParkingPositionPlugin(app));
    allPlugins.add(new OsmEditingPlugin(app));
    allPlugins.add(new OpenPlaceReviewsPlugin(app));
    allPlugins.add(new MapillaryPlugin(app));
    allPlugins.add(new AccessibilityPlugin(app));
    allPlugins.add(new OsmandDevelopmentPlugin(app));
    loadCustomPlugins(app);
    registerAppInitializingDependedProperties(app);
    enablePluginsByDefault(app, enabledPlugins);
    activatePlugins(app, enabledPlugins);
}
Also used : SRTMPlugin(net.osmand.plus.plugins.srtm.SRTMPlugin) AudioVideoNotesPlugin(net.osmand.plus.plugins.audionotes.AudioVideoNotesPlugin) OpenPlaceReviewsPlugin(net.osmand.plus.plugins.openplacereviews.OpenPlaceReviewsPlugin) OsmandMonitoringPlugin(net.osmand.plus.plugins.monitoring.OsmandMonitoringPlugin) OsmEditingPlugin(net.osmand.plus.plugins.osmedit.OsmEditingPlugin) MapillaryPlugin(net.osmand.plus.plugins.mapillary.MapillaryPlugin) SkiMapsPlugin(net.osmand.plus.plugins.skimaps.SkiMapsPlugin) ParkingPositionPlugin(net.osmand.plus.plugins.parking.ParkingPositionPlugin) OsmandDevelopmentPlugin(net.osmand.plus.plugins.development.OsmandDevelopmentPlugin) NauticalMapsPlugin(net.osmand.plus.plugins.openseamaps.NauticalMapsPlugin) WikipediaPlugin(net.osmand.plus.wikipedia.WikipediaPlugin) AccessibilityPlugin(net.osmand.plus.plugins.accessibility.AccessibilityPlugin) OsmandRasterMapsPlugin(net.osmand.plus.plugins.rastermaps.OsmandRasterMapsPlugin)

Aggregations

MapillaryPlugin (net.osmand.plus.plugins.mapillary.MapillaryPlugin)4 FragmentManager (androidx.fragment.app.FragmentManager)2 SuppressLint (android.annotation.SuppressLint)1 View (android.view.View)1 AbsListView (android.widget.AbsListView)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ScrollView (android.widget.ScrollView)1 TextView (android.widget.TextView)1 ObservableListView (com.github.ksoichiro.android.observablescrollview.ObservableListView)1 ObservableScrollView (com.github.ksoichiro.android.observablescrollview.ObservableScrollView)1 OsmAndLocationSimulation (net.osmand.plus.OsmAndLocationSimulation)1 AccessibilityPlugin (net.osmand.plus.plugins.accessibility.AccessibilityPlugin)1 AudioVideoNotesPlugin (net.osmand.plus.plugins.audionotes.AudioVideoNotesPlugin)1 OsmandDevelopmentPlugin (net.osmand.plus.plugins.development.OsmandDevelopmentPlugin)1 MapillaryFirstDialogFragment (net.osmand.plus.plugins.mapillary.MapillaryFirstDialogFragment)1 OsmandMonitoringPlugin (net.osmand.plus.plugins.monitoring.OsmandMonitoringPlugin)1 OpenPlaceReviewsPlugin (net.osmand.plus.plugins.openplacereviews.OpenPlaceReviewsPlugin)1 NauticalMapsPlugin (net.osmand.plus.plugins.openseamaps.NauticalMapsPlugin)1 OsmEditingPlugin (net.osmand.plus.plugins.osmedit.OsmEditingPlugin)1