From 71f7f9b5d3647ffa825cbce4efde1af2e2c6a2f3 Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Tue, 10 Nov 2015 11:09:04 +0200 Subject: [PATCH] This resolves #1893 --- OsmAnd/res/values-sv/strings.xml | 24 ++++--- .../src/net/osmand/plus/AppInitializer.java | 1 + .../net/osmand/plus/OsmandApplication.java | 66 ++++++++++--------- .../plus/mapcontextmenu/MenuController.java | 1 - .../controllers/OsmBugMenuController.java | 1 - .../plus/osmedit/AdvancedEditPoiFragment.java | 2 +- .../plus/osmedit/EditPoiDialogFragment.java | 51 +++++++------- .../net/osmand/plus/osmedit/OsmBugsLayer.java | 4 -- 8 files changed, 75 insertions(+), 75 deletions(-) diff --git a/OsmAnd/res/values-sv/strings.xml b/OsmAnd/res/values-sv/strings.xml index 935583e31a..e6b6a9fa51 100644 --- a/OsmAnd/res/values-sv/strings.xml +++ b/OsmAnd/res/values-sv/strings.xml @@ -1,4 +1,5 @@ - + + För att låsa upp skärmen tryck på låsikonen Välj land Välj stad @@ -1751,7 +1752,7 @@ Höjdgräns Smart omräkning av rutt Räkna om endast början av rutten för långa resor - + Ange tillåten fordonshöjd på rutter Dela ut min position Logga ut @@ -1859,8 +1860,8 @@ Kontaktinformation Konfigurera panelen Skicka in POI - - + + Antal rader i panelen: %1$s Ange typ av POI. Favoriter @@ -1951,9 +1952,8 @@ Kartvisning Söka på kartan Att planera en resa - - - + + Installation och problemlösning Tekniska artiklar Versioner @@ -1961,14 +1961,12 @@ Skapat en OSM POI Skapat en OSM-bugg Baskarta över världen (täcker hela världen med låg zoomningsgrad) saknas eller är gammal. Hämta gärna denna karta till din enhet. -Skicka + Skicka Teckenförklaring -Uppdatera - - - + Uppdatera + Återkoppling Läs mer Nyheter Dölj föreslagna objekt - + diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java index 456648d08a..170ab4e95e 100644 --- a/OsmAnd/src/net/osmand/plus/AppInitializer.java +++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java @@ -7,6 +7,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; + import net.osmand.IProgress; import net.osmand.IndexConstants; import net.osmand.PlatformUtil; diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 7fa08fb590..53e1383f87 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -1,12 +1,30 @@ package net.osmand.plus; -import java.io.BufferedWriter; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileWriter; -import java.io.PrintStream; -import java.lang.Thread.UncaughtExceptionHandler; -import java.util.Locale; +import android.app.Activity; +import android.app.AlarmManager; +import android.app.AlertDialog; +import android.app.AlertDialog.Builder; +import android.app.Application; +import android.app.PendingIntent; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Configuration; +import android.os.AsyncTask; +import android.os.Build; +import android.os.Handler; +import android.os.Message; +import android.text.format.DateFormat; +import android.util.TypedValue; +import android.view.View; +import android.view.accessibility.AccessibilityManager; +import android.widget.CheckBox; +import android.widget.LinearLayout; +import android.widget.LinearLayout.LayoutParams; +import android.widget.TextView; +import android.widget.Toast; import net.osmand.PlatformUtil; import net.osmand.access.AccessibilityPlugin; @@ -34,31 +52,15 @@ import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.voice.CommandPlayer; import net.osmand.router.RoutingConfiguration; import net.osmand.util.Algorithms; -import android.app.Activity; -import android.app.AlarmManager; -import android.app.AlertDialog; -import android.app.AlertDialog.Builder; -import android.app.Application; -import android.app.PendingIntent; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager.NameNotFoundException; -import android.content.res.Configuration; -import android.os.AsyncTask; -import android.os.Build; -import android.os.Handler; -import android.os.Message; -import android.text.format.DateFormat; -import android.util.TypedValue; -import android.view.View; -import android.view.accessibility.AccessibilityManager; -import android.widget.CheckBox; -import android.widget.LinearLayout; -import android.widget.LinearLayout.LayoutParams; -import android.widget.TextView; -import android.widget.Toast; + +import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileWriter; +import java.io.PrintStream; +import java.lang.Thread.UncaughtExceptionHandler; +import java.util.Locale; + import btools.routingapp.BRouterServiceConnection; import btools.routingapp.IBRouterService; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index fdcda44c0c..ce3e77a304 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -29,7 +29,6 @@ import net.osmand.plus.mapcontextmenu.controllers.PointDescriptionMenuController import net.osmand.plus.mapcontextmenu.controllers.TargetPointMenuController; import net.osmand.plus.mapcontextmenu.controllers.WptPtMenuController; import net.osmand.plus.mapcontextmenu.other.ShareMenu; -import net.osmand.plus.osmedit.OsmBugsLayer; import net.osmand.plus.osmedit.OsmBugsLayer.OpenStreetNote; import net.osmand.plus.osmedit.OsmPoint; import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/OsmBugMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/OsmBugMenuController.java index cda113c055..42e4081249 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/OsmBugMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/OsmBugMenuController.java @@ -12,7 +12,6 @@ import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuController; import net.osmand.plus.osmedit.OsmBugsLayer.OpenStreetNote; import net.osmand.plus.osmedit.OsmEditingPlugin; -import net.osmand.util.Algorithms; public class OsmBugMenuController extends MenuController { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java index eafefe8ad8..06b1a4b241 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java @@ -105,7 +105,7 @@ public class AdvancedEditPoiFragment extends Fragment @Override public void onTagsChanged(String anyTag) { LOG.debug("onTagsChanged(" + "anyTag=" + anyTag + ")"); - final String value = getData().getTagValues().get(anyTag); + String value = getData().getTagValues().get(anyTag); if (Algorithms.objectEquals(anyTag, OSMSettings.OSMTagKey.NAME.getValue())) { nameTextView.setText(value); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index 24d7d0a0f1..b1270aea91 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -76,6 +76,7 @@ public class EditPoiDialogFragment extends DialogFragment { private static final String KEY_AMENITY_NODE = "key_amenity_node"; private static final String KEY_AMENITY = "key_amenity"; private static final String TAGS_LIST = "tags_list"; + private static final String IS_ADDING_POI = "is_adding_poi"; private EditPoiData editPoiData; private ViewPager viewPager; @@ -124,12 +125,15 @@ public class EditPoiDialogFragment extends DialogFragment { boolean isLightTheme = settings.OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME; if (savedInstanceState != null) { + @SuppressWarnings("unchecked") Map mp = (Map) savedInstanceState.getSerializable(TAGS_LIST); editPoiData.updateTags(mp); } + boolean isAddingPoi = getArguments().getBoolean(IS_ADDING_POI); + Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar); - toolbar.setTitle(R.string.poi_create_title); + toolbar.setTitle(isAddingPoi ? R.string.poi_create_title : R.string.poi_edit_title); toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override @@ -364,27 +368,6 @@ public class EditPoiDialogFragment extends DialogFragment { super.onSaveInstanceState(outState); } - - public static EditPoiDialogFragment createAddPoiInstance(double latitude, double longitude, - OsmandApplication application) { - Node node = new Node(latitude, longitude, -1); - Amenity amenity; - amenity = new Amenity(); - amenity.setType(application.getPoiTypes().getOtherPoiCategory()); - amenity.setSubType(""); - amenity.setAdditionalInfo(OSMSettings.OSMTagKey.OPENING_HOURS.getValue(), ""); - return createInstance(node, amenity); - } - - public static EditPoiDialogFragment createInstance(Node node, Amenity amenity) { - EditPoiDialogFragment editPoiDialogFragment = new EditPoiDialogFragment(); - Bundle args = new Bundle(); - args.putSerializable(KEY_AMENITY_NODE, node); - args.putSerializable(KEY_AMENITY, amenity); - editPoiDialogFragment.setArguments(args); - return editPoiDialogFragment; - } - public EditPoiData getEditPoiData() { return editPoiData; } @@ -510,6 +493,28 @@ public class EditPoiDialogFragment extends DialogFragment { return (OsmandApplication) getActivity().getApplication(); } + public static EditPoiDialogFragment createAddPoiInstance(double latitude, double longitude, + OsmandApplication application) { + Node node = new Node(latitude, longitude, -1); + Amenity amenity; + amenity = new Amenity(); + amenity.setType(application.getPoiTypes().getOtherPoiCategory()); + amenity.setSubType(""); + amenity.setAdditionalInfo(OSMSettings.OSMTagKey.OPENING_HOURS.getValue(), ""); + return createInstance(node, amenity, true); + } + + public static EditPoiDialogFragment createInstance(Node node, Amenity amenity, + boolean isAddingPoi) { + EditPoiDialogFragment editPoiDialogFragment = new EditPoiDialogFragment(); + Bundle args = new Bundle(); + args.putSerializable(KEY_AMENITY_NODE, node); + args.putSerializable(KEY_AMENITY, amenity); + args.putBoolean(IS_ADDING_POI, isAddingPoi); + editPoiDialogFragment.setArguments(args); + return editPoiDialogFragment; + } + public static void showEditInstance(final Amenity amenity, final AppCompatActivity activity) { final OsmandSettings settings = ((OsmandApplication) activity.getApplication()) @@ -531,7 +536,7 @@ public class EditPoiDialogFragment extends DialogFragment { protected void onPostExecute(Node n) { if (n != null) { EditPoiDialogFragment fragment = - EditPoiDialogFragment.createInstance(n, amenity); + EditPoiDialogFragment.createInstance(n, amenity, false); fragment.show(activity.getSupportFragmentManager(), TAG); } else { AccessibleToast.makeText(activity, diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java index 144db14a79..d803c04b21 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java @@ -12,7 +12,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.util.Xml; import android.view.View; -import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.Toast; @@ -24,8 +23,6 @@ import net.osmand.data.PointDescription; import net.osmand.data.QuadRect; import net.osmand.data.RotatedTileBox; import net.osmand.osm.io.NetworkUtils; -import net.osmand.plus.ContextMenuAdapter; -import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; @@ -46,7 +43,6 @@ import java.io.InputStreamReader; import java.io.Serializable; import java.net.URLConnection; import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider, DialogProvider {