From ee0147464e1568978f9b7dafe31c4c2e0a925ad6 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Tue, 24 Mar 2015 22:01:04 +0100 Subject: [PATCH] Small changes --- .../plus/activities/MapActivityActions.java | 2 +- .../osmand/plus/dashboard/DashboardOnMap.java | 58 +++++++++---------- .../osmedit/EditingPOIDialogProvider.java | 4 +- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 4fcae3f704..794af7761a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -818,7 +818,7 @@ public class MapActivityActions implements DialogProvider { @Override public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, int pos, boolean isChecked) { Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization() - .getDownloadActivity()); + .getPluginsActivity()); // causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); mapActivity.startActivity(newIntent); return true; diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java index 384a3faf46..f73b6ab67f 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java @@ -1,5 +1,28 @@ package net.osmand.plus.dashboard; +import java.lang.ref.WeakReference; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import net.osmand.data.LatLon; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.OsmandSettings.CommonPreference; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.audionotes.DashAudioVideoNotesFragment; +import net.osmand.plus.development.DashSimulateFragment; +import net.osmand.plus.development.OsmandDevelopmentPlugin; +import net.osmand.plus.download.DownloadActivity; +import net.osmand.plus.helpers.ScreenOrientationHelper; +import net.osmand.plus.monitoring.DashTrackFragment; +import net.osmand.plus.osmedit.DashOsmEditsFragment; +import net.osmand.plus.osmo.DashOsMoFragment; +import net.osmand.plus.parkingpoint.DashParkingFragment; +import net.osmand.plus.routing.RoutingHelper; +import net.osmand.plus.views.DownloadedRegionsLayer; +import net.osmand.plus.views.OsmandMapTileView; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; @@ -7,7 +30,6 @@ import android.os.Build; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; -import android.support.v7.widget.Toolbar; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.View; @@ -30,32 +52,6 @@ import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCal import com.github.ksoichiro.android.observablescrollview.ScrollState; import com.software.shell.fab.ActionButton; -import net.osmand.data.LatLon; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.OsmandSettings.CommonPreference; -import net.osmand.plus.R; -import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.audionotes.DashAudioVideoNotesFragment; -import net.osmand.plus.development.DashSimulateFragment; -import net.osmand.plus.development.OsmandDevelopmentPlugin; -import net.osmand.plus.download.DownloadActivity; -import net.osmand.plus.helpers.ScreenOrientationHelper; -import net.osmand.plus.monitoring.DashTrackFragment; -import net.osmand.plus.osmedit.DashOsmEditsFragment; -import net.osmand.plus.osmo.DashOsMoFragment; -import net.osmand.plus.parkingpoint.DashParkingFragment; -import net.osmand.plus.routing.RoutingHelper; -import net.osmand.plus.views.DownloadedRegionsLayer; -import net.osmand.plus.views.OsmandMapTileView; - -import java.lang.ref.WeakReference; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import gnu.trove.map.hash.TIntObjectHashMap; - /** * Created by Denis * on 03.03.15. @@ -115,7 +111,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks { updateTopButton(sy); } }); - if (listView instanceof ObservableListView) { + if (ScreenOrientationHelper.isOrientationPortrait(mapActivity)) { ((ObservableListView) listView).setScrollViewCallbacks(this); mFlexibleSpaceImageHeight = mapActivity.getResources().getDimensionPixelSize( R.dimen.dashboard_map_top_padding); @@ -440,11 +436,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks { if(!cond) { fragmentTransaction.remove(manager.findFragmentByTag(tag)); } else if(frag instanceof DashBaseFragment){ - ((DashBaseFragment) frag).onOpenDash(); + if(((DashBaseFragment) frag).getView() != null) { + ((DashBaseFragment) frag).onOpenDash(); + } } } } catch (Exception e) { - getMyApplication().showToastMessage("Error showing dashboard"); + getMyApplication().showToastMessage("Error showing dashboard " + tag); e.printStackTrace(); } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIDialogProvider.java b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIDialogProvider.java index 9372585081..9595dfc1b1 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIDialogProvider.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIDialogProvider.java @@ -103,7 +103,7 @@ public class EditingPOIDialogProvider implements DialogProvider { this.plugin = plugin; poiTypes = uiContext.getMyApplication().getPoiTypes(); - allTranslatedSubTypes = poiTypes.getAllTranslatedNames(false); + allTranslatedSubTypes = poiTypes.getAllTranslatedNames(true); settings = ((OsmandApplication) uiContext.getApplication()).getSettings(); if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)) { this.openstreetmapUtil = new OpenstreetmapLocalUtil(activity); @@ -557,7 +557,7 @@ public class EditingPOIDialogProvider implements DialogProvider { private Map getSubCategoriesMap(PoiCategory poiCategory) { Map subCategories = new LinkedHashMap<>(poiTypes.getAllTranslatedNames(poiCategory, false)); - for (Map.Entry s : poiTypes.getAllTranslatedNames(false).entrySet()) { + for (Map.Entry s : poiTypes.getAllTranslatedNames(true).entrySet()) { if (!subCategories.containsKey(s.getKey())) { subCategories.put(s.getKey(), s.getValue()); }