Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
64d8d788a3
11 changed files with 139 additions and 96 deletions
|
@ -6,7 +6,6 @@ import java.io.InputStream;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
|
@ -77,14 +76,11 @@ public class MapPoiTypes {
|
|||
return otherCategory;
|
||||
}
|
||||
|
||||
public Map<String, PoiType> getAllTranslatedNames(boolean onlyTranslation) {
|
||||
public Map<String, PoiType> getAllTranslatedNames() {
|
||||
Map<String, PoiType> translation = new TreeMap<String, PoiType>();
|
||||
for(PoiCategory pc : categories) {
|
||||
for(PoiType pt : pc.getPoiTypes()) {
|
||||
translation.put(pt.getTranslation(), pt);
|
||||
if (!onlyTranslation) {
|
||||
translation.put(Algorithms.capitalizeFirstLetterAndLowercase(pt.getKeyName().replace('_', ' ')), pt);
|
||||
}
|
||||
}
|
||||
}
|
||||
return translation;
|
||||
|
@ -95,7 +91,8 @@ public class MapPoiTypes {
|
|||
for (PoiType pt : pc.getPoiTypes()) {
|
||||
translation.put(pt.getTranslation(), pt);
|
||||
if (!onlyTranslation) {
|
||||
translation.put(pt.getKeyName(), pt);
|
||||
// translation.put(pt.getKeyName(), pt);
|
||||
translation.put(Algorithms.capitalizeFirstLetterAndLowercase(pt.getKeyName().replace('_', ' ')), pt);
|
||||
}
|
||||
}
|
||||
return translation;
|
||||
|
|
|
@ -240,7 +240,6 @@
|
|||
|
||||
<activity android:name="net.osmand.plus.development.TestVoiceActivity" />
|
||||
<activity android:name="net.osmand.plus.download.DownloadActivity" android:label="" />
|
||||
<activity android:name="net.osmand.plus.osmedit.LocalOpenstreetmapActivity" android:label="@string/local_openstreetmap_act_title" />
|
||||
|
||||
<!-- keep android:process on a separate line !! -->
|
||||
<service
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
|
@ -61,6 +60,16 @@
|
|||
android:text="" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/OsmTagValue"
|
||||
android:layout_span="2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<Button
|
||||
|
@ -159,7 +168,6 @@
|
|||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
|
@ -204,6 +212,7 @@
|
|||
android:id="@+id/addTag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:minWidth="150dp"
|
||||
android:text="@string/btn_add_tag"
|
||||
android:visibility="gone" />
|
||||
|
@ -212,6 +221,7 @@
|
|||
android:id="@+id/advancedMode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:minWidth="150dp"
|
||||
android:text="@string/btn_advanced_mode" />
|
||||
</LinearLayout>
|
||||
|
@ -221,8 +231,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:text="@string/poi_dialog_other_tags_message" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
|
@ -9,6 +9,8 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="osm_changes_added_to_local_edits">OSM changes added to local changes</string>
|
||||
<string name="mark_to_delete">Mark to delete</string>
|
||||
<string name="osmo_grop_name_length_alert">Group name should be at least 3 symbols long!</string>
|
||||
<string name="local_osm_changes_upload_all_confirm">You are going to upload %1$d changes to OSM. Are you sure?</string>
|
||||
<string name="confirmation_to_clear_history">Do you want to clear the whole history?</string>
|
||||
|
@ -154,7 +156,7 @@
|
|||
<string name="audionotes_plugin_name">Audio/video notes</string>
|
||||
<string name="audionotes_plugin_description">The Audio/video notes plugin provides the functionality to take audio/photography/video notes during a trip, using either a button on the map screen, or directly the context menu for any position on the map.</string>
|
||||
<string name="osmand_parking_plugin_name">Parking Position</string>
|
||||
<string name="osmand_parking_plugin_description">This plugin was developed to use OsmAnd to easily memorize the location of your parked car.</string>
|
||||
<string name="osmand_parking_plugin_description">Parking position plugin let you easily memorize when the car was parked and how much time left if the parking is limited by time. You can find your parking place and time on the card of the dashboard and on the map widget. \n It adds notification to the calendar in case you want to get a reminder about it.</string>
|
||||
<string name="osmand_distance_planning_plugin_name">Distance calculator & planning tool</string>
|
||||
<string name="osmand_distance_planning_plugin_description">This plugin provides a map screen widget allowing to create paths by tapping on the map, or use or modify existing GPX files, to plan a trip and measure the distance between points. The results can be saved as a GPX file, which can later be used for guidance.</string>
|
||||
<string name="accessibility_preferences">Accessibility</string>
|
||||
|
@ -1441,13 +1443,13 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
</string>
|
||||
<string name="update_poi_does_not_change_indexes">POI changes inside application do not affect downloaded map files, changes are saved to local file instead.</string>
|
||||
<string name="local_openstreetmap_uploading">Uploading …</string>
|
||||
<string name="local_openstreetmap_were_uploaded">{0} POI/Bugs were uploaded</string>
|
||||
<string name="local_openstreetmap_were_uploaded">{0} POI/Notes were uploaded</string>
|
||||
<string name="local_openstreetmap_uploadall">Upload all</string>
|
||||
<string name="local_openstreetmap_upload">Upload modification to OSM</string>
|
||||
<string name="local_openstreetmap_delete">Delete modification</string>
|
||||
<string name="local_openstreetmap_descr_title">Asynchronous OSM editing:</string>
|
||||
<string name="local_openstreetmap_settings">Locally saved OSM POIs/Bugs</string>
|
||||
<string name="local_openstreetmap_settings_descr">Show and manage OSM POIs/Bugs noted in local database</string>
|
||||
<string name="local_openstreetmap_settings">Locally saved OSM POIs/Notes</string>
|
||||
<string name="local_openstreetmap_settings_descr">Show and manage OSM POIs/Notes noted in local database</string>
|
||||
<string name="live_monitoring_interval_descr">Specify online tracking interval</string>
|
||||
<string name="live_monitoring_interval">Online tracking interval</string>
|
||||
<string name="live_monitoring_url_descr">Specify the web address with parameter syntax: lat={0}, lon={1}, timestamp={2}, hdop={3}, altitude={4}, speed={5}, bearing={6}</string>
|
||||
|
@ -1846,7 +1848,7 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
<string name="thanks_yandex_traffic">Thanks to Yandex for traffic information.</string>
|
||||
<string name="layer_yandex_traffic">Yandex traffic</string>
|
||||
<string name="layer_route">Route</string>
|
||||
<string name="layer_osm_bugs">OSM bugs (online)</string>
|
||||
<string name="layer_osm_bugs">OSM Notes (online)</string>
|
||||
<string name="layer_transport">Transport stops</string>
|
||||
<string name="layer_poi">POI…</string>
|
||||
<string name="layer_map">Map source…</string>
|
||||
|
@ -1990,8 +1992,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
<string name="update_tile">Update map</string>
|
||||
<string name="reload_tile">Reload tile</string>
|
||||
<string name="mark_point">Target</string>
|
||||
<string name="show_osm_bugs_descr">Show OpenStreetBugs on map</string>
|
||||
<string name="show_osm_bugs">Show OpenStreetBugs</string>
|
||||
<string name="use_english_names_descr">Select between native and English names</string>
|
||||
<string name="use_english_names">Use English names in maps</string>
|
||||
<string name="app_settings">Application settings</string>
|
||||
|
|
|
@ -756,7 +756,7 @@ public class OsmandSettings {
|
|||
new StringPreference("user_password", "").makeGlobal();
|
||||
|
||||
// this value boolean is synchronized with settings_pref.xml preference offline POI/Bugs edition
|
||||
public final OsmandPreference<Boolean> OFFLINE_EDITION = new BooleanPreference("offline_edition", true).makeGlobal();
|
||||
public final OsmandPreference<Boolean> OFFLINE_EDITION = new BooleanPreference("offline_osm_editing", true).makeGlobal();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final CommonPreference<DayNightMode> DAYNIGHT_MODE =
|
||||
|
|
|
@ -11,9 +11,6 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.PointDescription;
|
||||
|
@ -23,7 +20,6 @@ import net.osmand.plus.OsmAndFormatter;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.osmedit.LocalOpenstreetmapActivity;
|
||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.TurnPathHelper;
|
||||
|
@ -33,8 +29,19 @@ import android.content.Intent;
|
|||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,6 +16,7 @@ import android.text.TextWatcher;
|
|||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
@ -28,7 +29,6 @@ import android.widget.TableLayout;
|
|||
import android.widget.TableRow;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
|
@ -63,12 +63,13 @@ import java.util.TreeSet;
|
|||
public class EditingPOIDialogProvider implements DialogProvider {
|
||||
|
||||
private final Activity activity;
|
||||
private final OpenstreetmapUtil openstreetmapUtil;
|
||||
private final OpenstreetmapUtil openstreetmapUtilToLoad;
|
||||
private final OsmEditingPlugin plugin;
|
||||
private OpenstreetmapUtil openstreetmapUtil;
|
||||
private OpenstreetmapUtil openstreetmapUtilToLoad;
|
||||
private AutoCompleteTextView typeText;
|
||||
private EditText nameText;
|
||||
private Button typeButton;
|
||||
private TextView osmTagValue;
|
||||
private Button openHoursButton;
|
||||
private EditText openingHours;
|
||||
private EditText commentText;
|
||||
|
@ -95,30 +96,36 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
private static Bundle dialogBundle = new Bundle();
|
||||
private OsmandSettings settings;
|
||||
private MapPoiTypes poiTypes;
|
||||
private boolean isLocalEdit;
|
||||
private Map<String, PoiType> allTranslatedSubTypes;
|
||||
|
||||
|
||||
public EditingPOIDialogProvider(MapActivity uiContext, OsmEditingPlugin plugin){
|
||||
public EditingPOIDialogProvider(MapActivity uiContext, OsmEditingPlugin plugin) {
|
||||
this.activity = uiContext;
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
poiTypes = uiContext.getMyApplication().getPoiTypes();
|
||||
allTranslatedSubTypes = poiTypes.getAllTranslatedNames(true);
|
||||
settings = ((OsmandApplication) uiContext.getApplication()).getSettings();
|
||||
private void prepareProvider() {
|
||||
poiTypes = ((OsmandApplication) activity.getApplication()).getPoiTypes();
|
||||
allTranslatedSubTypes = poiTypes.getAllTranslatedNames();
|
||||
settings = ((OsmandApplication) activity.getApplication()).getSettings();
|
||||
isLocalEdit = true;
|
||||
if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)) {
|
||||
this.openstreetmapUtil = new OpenstreetmapLocalUtil(activity);
|
||||
if (settings.isInternetConnectionAvailable(true)) {
|
||||
this.openstreetmapUtilToLoad = new OpenstreetmapRemoteUtil(activity);
|
||||
} else {
|
||||
this.openstreetmapUtilToLoad = openstreetmapUtil;
|
||||
}
|
||||
this.openstreetmapUtilToLoad = openstreetmapUtil;
|
||||
} else if(!settings.isInternetConnectionAvailable(true)) {
|
||||
this.openstreetmapUtil = new OpenstreetmapLocalUtil(activity);
|
||||
this.openstreetmapUtilToLoad = new OpenstreetmapRemoteUtil(activity);
|
||||
} else {
|
||||
isLocalEdit = false;
|
||||
this.openstreetmapUtil = new OpenstreetmapRemoteUtil(activity);
|
||||
this.openstreetmapUtilToLoad= openstreetmapUtil;
|
||||
this.openstreetmapUtilToLoad = openstreetmapUtil;
|
||||
}
|
||||
}
|
||||
|
||||
public void showEditDialog(final Amenity editA){
|
||||
prepareProvider();
|
||||
new AsyncTask<Void, Void, Node>() {
|
||||
|
||||
@Override
|
||||
|
@ -138,6 +145,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
|
||||
public void showCreateDialog(double latitude, double longitude){
|
||||
prepareProvider();
|
||||
Node n = new Node(latitude, longitude, -1);
|
||||
n.putTag(OSMTagKey.OPENING_HOURS.getValue(), ""); //$NON-NLS-1$
|
||||
showPOIDialog(DIALOG_CREATE_POI, n, poiTypes.getOtherPoiCategory(), "");
|
||||
|
@ -151,6 +159,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
|
||||
public void showDeleteDialog(final Amenity a){
|
||||
prepareProvider();
|
||||
new AsyncTask<Void, Void, Node>() {
|
||||
protected Node doInBackground(Void[] params) {
|
||||
return openstreetmapUtil.loadNode(a);
|
||||
|
@ -183,9 +192,14 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
final EditText comment = new EditText(activity);
|
||||
comment.setText(R.string.poi_remove_title);
|
||||
ll.addView(comment);
|
||||
final CheckBox closeChangeset = new CheckBox(activity);
|
||||
closeChangeset.setText(R.string.close_changeset);
|
||||
ll.addView(closeChangeset);
|
||||
final CheckBox closeChangeset ;
|
||||
if (!isLocalEdit) {
|
||||
closeChangeset = new CheckBox(activity);
|
||||
closeChangeset.setText(R.string.close_changeset);
|
||||
ll.addView(closeChangeset);
|
||||
} else {
|
||||
closeChangeset = null;
|
||||
}
|
||||
builder.setView(ll);
|
||||
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
builder.setPositiveButton(R.string.shared_string_delete, new DialogInterface.OnClickListener(){
|
||||
|
@ -193,10 +207,17 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
public void onClick(DialogInterface dialog, int which) {
|
||||
Node n = (Node) args.getSerializable(KEY_AMENITY_NODE);
|
||||
String c = comment.getText().toString();
|
||||
commitNode(OsmPoint.Action.DELETE, n, openstreetmapUtil.getEntityInfo(), c, closeChangeset.isSelected(), new Runnable(){
|
||||
commitNode(OsmPoint.Action.DELETE, n, openstreetmapUtil.getEntityInfo(), c,
|
||||
closeChangeset == null ? false : closeChangeset.isSelected(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.poi_remove_success), Toast.LENGTH_LONG).show();
|
||||
if (isLocalEdit) {
|
||||
AccessibleToast.makeText(
|
||||
activity,R.string.osm_changes_added_to_local_edits,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
AccessibleToast.makeText(activity, R.string.poi_remove_success, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
if(activity instanceof MapActivity){
|
||||
((MapActivity) activity).getMapView().refreshMap(true);
|
||||
}
|
||||
|
@ -231,13 +252,15 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
final TableRow newTagRow = new TableRow(activity);
|
||||
TableRow.LayoutParams tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||
tlp.leftMargin = 5;
|
||||
tlp.gravity = Gravity.CENTER;
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
newTagRow.setLayoutParams(tlp);
|
||||
|
||||
final AutoCompleteTextView tag = new AutoCompleteTextView(activity);
|
||||
final AutoCompleteTextView value = new AutoCompleteTextView(activity);
|
||||
final Button delete = new Button(activity);
|
||||
|
||||
tag.setDropDownWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
value.setDropDownWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
tag.setLayoutParams(tlp);
|
||||
if(tg != null) {
|
||||
tag.setText(tg);
|
||||
|
@ -273,7 +296,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
});
|
||||
tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.FILL_PARENT);
|
||||
tlp.leftMargin = 5;
|
||||
tlp.gravity = Gravity.CENTER;
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
value.setLayoutParams(tlp);
|
||||
if(vl != null) {
|
||||
value.setText(vl);
|
||||
|
@ -308,7 +331,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
});
|
||||
tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||
tlp.gravity = Gravity.CENTER;
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
tlp.rightMargin = 5;
|
||||
delete.setLayoutParams(tlp);
|
||||
delete.setText("X");
|
||||
|
@ -346,6 +369,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
openingHours = ((EditText)view.findViewById(R.id.OpeningHours));
|
||||
typeText = ((AutoCompleteTextView)view.findViewById(R.id.Type));
|
||||
typeButton = ((Button)view.findViewById(R.id.TypeButton));
|
||||
osmTagValue = ((TextView) view.findViewById(R.id.OsmTagValue));
|
||||
openHoursButton = ((Button)view.findViewById(R.id.OpenHoursButton));
|
||||
typeText = ((AutoCompleteTextView)view.findViewById(R.id.Type));
|
||||
typeText.setThreshold(1);
|
||||
|
@ -355,6 +379,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
streetNameText = ((EditText)view.findViewById(R.id.StreetName));
|
||||
websiteText = ((EditText)view.findViewById(R.id.Website));
|
||||
closeChange = ((CheckBox) view.findViewById(R.id.CloseChangeset));
|
||||
closeChange.setVisibility(isLocalEdit ? View.GONE : View.VISIBLE);
|
||||
|
||||
|
||||
TextView linkToOsmDoc = (TextView) view.findViewById(R.id.LinkToOsmDoc);
|
||||
|
@ -370,7 +395,9 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
final Node n = (Node) args.getSerializable(KEY_AMENITY_NODE);
|
||||
dlg.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
dlg.setPositiveButton(R.string.default_buttons_commit, new DialogInterface.OnClickListener() {
|
||||
dlg.setPositiveButton(
|
||||
isLocalEdit ? R.string.shared_string_save :
|
||||
R.string.default_buttons_commit, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Resources resources = view.getResources();
|
||||
|
@ -378,10 +405,10 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
.getString(R.string.poi_action_change);
|
||||
OsmPoint.Action action = n.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
|
||||
String subType = typeText.getText().toString();
|
||||
if(allTranslatedSubTypes.get(subType.trim()) != null) {
|
||||
if (allTranslatedSubTypes.get(subType.trim()) != null) {
|
||||
PoiType pt = allTranslatedSubTypes.get(subType);
|
||||
n.putTag(pt.getOsmTag() , pt.getOsmValue());
|
||||
if(pt.getOsmTag2() != null) {
|
||||
n.putTag(pt.getOsmTag(), pt.getOsmValue());
|
||||
if (pt.getOsmTag2() != null) {
|
||||
n.putTag(pt.getOsmTag2(), pt.getOsmValue2());
|
||||
}
|
||||
} else {
|
||||
|
@ -423,21 +450,47 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
commitNode(action, n, openstreetmapUtil.getEntityInfo(), commentText.getText().toString(), closeChange.isSelected(),
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AccessibleToast.makeText(activity, MessageFormat.format(activity.getResources().getString(R.string.poi_action_succeded_template), msg),
|
||||
Toast.LENGTH_LONG).show();
|
||||
if (activity instanceof MapActivity) {
|
||||
((MapActivity) activity).getMapView().refreshMap(true);
|
||||
}
|
||||
activity.removeDialog(dialogID);
|
||||
}
|
||||
public void run() {
|
||||
if (isLocalEdit) {
|
||||
AccessibleToast.makeText(
|
||||
activity,R.string.osm_changes_added_to_local_edits,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
AccessibleToast.makeText(
|
||||
activity,
|
||||
MessageFormat.format(
|
||||
activity.getResources().getString(
|
||||
R.string.poi_action_succeded_template), msg),
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
if (activity instanceof MapActivity) {
|
||||
((MapActivity) activity).getMapView().refreshMap(true);
|
||||
}
|
||||
activity.removeDialog(dialogID);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
preparePOIDialog(view, args);
|
||||
attachListeners(view, a, n);
|
||||
updateOsmTagValue(a);
|
||||
return dlg;
|
||||
}
|
||||
|
||||
private void updateOsmTagValue(final Amenity a) {
|
||||
String subType = typeText.getText().toString();
|
||||
String s = "OSM ";
|
||||
if (allTranslatedSubTypes.get(subType.trim()) != null) {
|
||||
PoiType pt = allTranslatedSubTypes.get(subType);
|
||||
s = pt.getOsmTag() + "=" + pt.getOsmValue();
|
||||
if (pt.getOsmTag2() != null) {
|
||||
s += " " + pt.getOsmTag2() + "=" + pt.getOsmValue2();
|
||||
}
|
||||
} else {
|
||||
s += a.getType().getDefaultTag() + "=" + subType;
|
||||
}
|
||||
osmTagValue.setText(s);
|
||||
}
|
||||
|
||||
private void attachListeners(final View dlg, final Amenity a, final Node n) {
|
||||
// DO NOT show on focus with empty text predefined list of subcategories - problems when rotating
|
||||
|
@ -472,7 +525,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
typeButton.setText(st.getCategory().getTranslation());
|
||||
updateSubTypesAdapter(st.getCategory());
|
||||
}
|
||||
|
||||
updateOsmTagValue(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -557,7 +610,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
|
||||
private Map<String, PoiType> getSubCategoriesMap(PoiCategory poiCategory) {
|
||||
Map<String, PoiType> subCategories = new LinkedHashMap<>(poiTypes.getAllTranslatedNames(poiCategory, false));
|
||||
for (Map.Entry<String, PoiType> s : poiTypes.getAllTranslatedNames(true).entrySet()) {
|
||||
for (Map.Entry<String, PoiType> s : poiTypes.getAllTranslatedNames().entrySet()) {
|
||||
if (!subCategories.containsKey(s.getKey())) {
|
||||
subCategories.put(s.getKey(), s.getValue());
|
||||
}
|
||||
|
@ -572,6 +625,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
typeText.setText(a.getSubType());
|
||||
typeButton.setText(a.getType().getTranslation());
|
||||
updateSubTypesAdapter(a.getType());
|
||||
updateOsmTagValue(a);
|
||||
}
|
||||
|
||||
|
||||
|
@ -712,6 +766,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
|
||||
@Override
|
||||
public void onPrepareDialog(int id, Dialog dialog) {
|
||||
prepareProvider();
|
||||
Bundle args = dialogBundle;
|
||||
switch (id) {
|
||||
case DIALOG_DELETE_POI:
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.ActionBarProgressActivity;
|
||||
|
||||
|
||||
public class LocalOpenstreetmapActivity extends ActionBarProgressActivity {
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((OsmandApplication) getApplication()).applyTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.local_openstreetmap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
switch (itemId) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -47,7 +47,9 @@ public class OsmBugsDbHelper extends SQLiteOpenHelper {
|
|||
if (db != null) {
|
||||
db.execSQL(
|
||||
"INSERT INTO " + OSMBUGS_TABLE_NAME + " (" + OSMBUGS_COL_ID + ", " + OSMBUGS_COL_TEXT + ", " + OSMBUGS_COL_LAT + ","
|
||||
+ OSMBUGS_COL_LON + "," + OSMBUGS_COL_ACTION + "," + OSMBUGS_COL_AUTHOR + ")" + " VALUES (?, ?, ?, ?, ?, ?)", new Object[] { p.getId(), p.getText(), p.getLatitude(), p.getLongitude(), OsmPoint.stringAction.get(p.getAction()), p.getAuthor() }); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ OSMBUGS_COL_LON + "," + OSMBUGS_COL_ACTION + "," + OSMBUGS_COL_AUTHOR + ")" + " VALUES (?, ?, ?, ?, ?, ?)",
|
||||
new Object[] { p.getId(), p.getText(), p.getLatitude(), p.getLongitude(),
|
||||
OsmPoint.stringAction.get(p.getAction()), p.getAuthor() }); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -113,7 +113,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
}
|
||||
|
||||
public EditingPOIDialogProvider getPoiActions(MapActivity activity) {
|
||||
if(poiActions == null) {
|
||||
if (poiActions == null) {
|
||||
poiActions = new EditingPOIDialogProvider(activity, this);
|
||||
}
|
||||
return poiActions;
|
||||
|
@ -287,17 +287,17 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
localOsmEdits.registerObject(point.getLatitude(), point.getLongitude(), point);
|
||||
}
|
||||
|
||||
public void collectLocalOsmEdits(){
|
||||
public void collectLocalOsmEdits() {
|
||||
localOsmEdits.clear();
|
||||
OpenstreetmapsDbHelper dbpoi = new OpenstreetmapsDbHelper(app);
|
||||
OsmBugsDbHelper dbbug = new OsmBugsDbHelper(app);
|
||||
|
||||
List<OpenstreetmapPoint> l1 = dbpoi.getOpenstreetmapPoints();
|
||||
List<OsmNotesPoint> l2 = dbbug.getOsmbugsPoints();
|
||||
for (OsmPoint point : l1){
|
||||
for (OsmPoint point : l1) {
|
||||
localOsmEdits.registerObject(point.getLatitude(), point.getLongitude(), point);
|
||||
}
|
||||
for (OsmPoint point : l2){
|
||||
for (OsmPoint point : l2) {
|
||||
localOsmEdits.registerObject(point.getLatitude(), point.getLongitude(), point);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.SettingsBaseActivity;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
|
@ -40,7 +42,12 @@ public class SettingsOsmEditingActivity extends SettingsBaseActivity {
|
|||
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
startActivity(new Intent(SettingsOsmEditingActivity.this, LocalOpenstreetmapActivity.class));
|
||||
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||
final Intent favorites = new Intent(SettingsOsmEditingActivity.this,
|
||||
appCustomization.getFavoritesActivity());
|
||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.OSM_EDITS_TAB);
|
||||
startActivity(favorites);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue