diff --git a/DataExtractionOSM/src/net/osmand/ToDoConstants.java b/DataExtractionOSM/src/net/osmand/ToDoConstants.java
index a451b8f036..e3231fa30a 100644
--- a/DataExtractionOSM/src/net/osmand/ToDoConstants.java
+++ b/DataExtractionOSM/src/net/osmand/ToDoConstants.java
@@ -16,7 +16,8 @@ public class ToDoConstants {
// Polish UI with new building address search ...(Better completely new address search)
// Search for city in all indexes
// Test GeoIndexActivity
- // TODO images in the map index ?
+ // TODO images in the map index ?
+ // Plugin OsmEditingPlugin Send GPX files
// == Osmand application (TODO 127) ==
diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml
index c30ebc27ce..793f416541 100644
--- a/OsmAnd/AndroidManifest.xml
+++ b/OsmAnd/AndroidManifest.xml
@@ -64,9 +64,9 @@
-
+
-
+
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index d8c6bb1893..3a86f4acae 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -1,7 +1,9 @@
+ This plugin enables development features (animate routing) and display additional information such as rendering time.
+ Osmand Development
Plugins
- Touch a plugin item to activate it. Application restart is needed to take an effect.
+ Touch a plugin item to activate it. To take an effect application restart may require.
Plugins enable extra functionality builtin in the application such as Tracking, Tile Maps, Battery Saving features, Accessibility and many others.
Plugins
Changes in 0.8.0 :
diff --git a/OsmAnd/res/xml/settings_pref.xml b/OsmAnd/res/xml/settings_pref.xml
index 45d13407e7..de3632a07d 100644
--- a/OsmAnd/res/xml/settings_pref.xml
+++ b/OsmAnd/res/xml/settings_pref.xml
@@ -94,30 +94,12 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
index 15f9424bb4..b99e7215bb 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
@@ -7,8 +7,12 @@ import java.util.Set;
import org.apache.commons.logging.Log;
+import android.preference.PreferenceScreen;
+
import net.osmand.LogUtil;
import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.activities.SettingsActivity;
+import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.plus.views.OsmandMapTileView;
@@ -38,6 +42,8 @@ public abstract class OsmandPlugin {
public static void initPlugins(OsmandApplication app) {
OsmandSettings settings = app.getSettings();
installedPlugins.add(new OsmEditingPlugin(app));
+ installedPlugins.add(new OsmandDevelopmentPlugin(app));
+
Set enabledPlugins = settings.getEnabledPlugins();
for (OsmandPlugin plugin : installedPlugins) {
if (enabledPlugins.contains(plugin.getId())) {
@@ -52,17 +58,23 @@ public abstract class OsmandPlugin {
}
}
+ public static boolean enablePlugin(OsmandApplication app, OsmandPlugin plugin, boolean enable) {
+ if (enable) {
+ if (!plugin.init(app)) {
+ return false;
+ }
+ activePlugins.add(plugin);
+ } else {
+ activePlugins.remove(plugin);
+ }
+ app.getSettings().enablePlugin(plugin.getId(), enable);
+ return true;
+ }
+
/**
* ????
*/
- public abstract void updateLayers(OsmandMapTileView mapView);
-
- public static void refreshLayers(OsmandMapTileView mapView) {
- for (OsmandPlugin plugin : activePlugins) {
- plugin.updateLayers(mapView);
- }
- }
-
+ public void updateLayers(OsmandMapTileView mapView) {};
public abstract void registerLayers(MapActivity activity);
@@ -74,10 +86,17 @@ public abstract class OsmandPlugin {
public void mapActivityDestroy(MapActivity activity) { }
+ public void settingsActivityCreate(SettingsActivity activity, PreferenceScreen screen) {}
- public abstract void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter);
+ public void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter) {}
- public abstract void registerMapContextMenuActions(MapActivity mapActivity, double latitude, double longitude, ContextMenuAdapter adapter, Object selectedObj);
+ public void registerMapContextMenuActions(MapActivity mapActivity, double latitude, double longitude, ContextMenuAdapter adapter, Object selectedObj) {}
+
+ public static void refreshLayers(OsmandMapTileView mapView) {
+ for (OsmandPlugin plugin : activePlugins) {
+ plugin.updateLayers(mapView);
+ }
+ }
public static List getAvailablePlugins(){
return installedPlugins;
@@ -122,6 +141,13 @@ public abstract class OsmandPlugin {
}
+ public static void onSettingsActivityCreate(SettingsActivity activity, PreferenceScreen screen) {
+ for (OsmandPlugin plugin : activePlugins) {
+ plugin.settingsActivityCreate(activity, screen);
+ }
+ }
+
+
public static void createLayers(OsmandMapTileView mapView, MapActivity activity) {
for (OsmandPlugin plugin : activePlugins) {
plugin.registerLayers(activity);
@@ -139,4 +165,5 @@ public abstract class OsmandPlugin {
plugin.registerLayerContextMenuActions(mapView, adapter);
}
}
+
}
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index 664b13bfc8..1c8f6eb9e9 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -545,8 +545,6 @@ public class OsmandSettings {
public final OsmandPreference OFFLINE_POI_EDITION =
new BooleanPreference("offline_poi_edition", false, true);
- public static final String LOCAL_OPENSTREETMAP_POINTS = "local_openstreetmap_points";
-
// this value string is synchronized with settings_pref.xml preference name
public final CommonPreference DAYNIGHT_MODE =
diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java
index e3f584d91b..7ba86620e8 100644
--- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java
@@ -13,13 +13,13 @@ import java.util.Set;
import net.osmand.Algoritms;
import net.osmand.GPXUtilities.WptPt;
import net.osmand.IProgress;
-import net.osmand.OpenstreetmapRemoteUtil;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.ResourceManager;
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexInfo;
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
+import net.osmand.plus.osmedit.OpenstreetmapRemoteUtil;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
@@ -442,6 +442,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
if (!isCancelled()) {
String warning = null;
File file = new File(info.getPathToData());
+ // FIXME should be plugin functionality and do not use remote util directly
warning = new OpenstreetmapRemoteUtil(LocalIndexesActivity.this, null).uploadGPXFile(tagstring, description, visibility, file);
total++;
if (warning == null) {
diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java b/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java
index 79aa77e835..d8219eb9ad 100644
--- a/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java
@@ -17,6 +17,7 @@ import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
+import android.widget.Toast;
public class PluginsActivity extends OsmandListActivity {
@@ -45,14 +46,16 @@ public class PluginsActivity extends OsmandListActivity {
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
OsmandPlugin item = getListAdapter().getItem(position);
- boolean enable = true;
- if(restartPlugins.contains(item.getId())) {
- restartPlugins.remove(item.getId());
- enable = false;
- } else {
- restartPlugins.add(item.getId());
+ boolean enable = !restartPlugins.contains(item.getId());
+
+ boolean ok = OsmandPlugin.enablePlugin(((OsmandApplication) getApplication()), item, enable);
+ if (ok) {
+ if (!enable) {
+ restartPlugins.remove(item.getId());
+ } else {
+ restartPlugins.add(item.getId());
+ }
}
- ((OsmandApplication) getApplication()).getSettings().enablePlugin(item.getId(), enable);
getListAdapter().notifyDataSetInvalidated();
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java
index 94f79b77c8..11bbdf31ba 100644
--- a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java
@@ -19,6 +19,7 @@ import net.osmand.map.TileSourceManager;
import net.osmand.map.TileSourceManager.TileSourceTemplate;
import net.osmand.plus.NavigationService;
import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.CommonPreference;
import net.osmand.plus.OsmandSettings.DayNightMode;
@@ -67,11 +68,13 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
public static final int SCREEN_NAVIGATION_SETTINGS = 2;
public static final int SCREEN_MONITORING_SETTINGS = 3;
+ public static final String SCREEN_ID_GENERAL_SETTINGS = "general_settings";
+ public static final String SCREEN_ID_NAVIGATION_SETTINGS = "routing_settings";
+ public static final String SCREEN_ID_MONITORING_SETTINGS = "monitor_settings";
+
private static final String MORE_VALUE = "MORE_VALUE";
private Preference saveCurrentTrack;
- private Preference testVoiceCommands;
- private Preference localOpenstreetmapPoints;
private Preference bidforfix;
private Preference plugins;
@@ -102,7 +105,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
private Map> listPrefValues = new LinkedHashMap>();
- private CheckBoxPreference registerBooleanPreference(OsmandPreference b, PreferenceScreen screen){
+ public CheckBoxPreference registerBooleanPreference(OsmandPreference b, PreferenceScreen screen){
CheckBoxPreference p = (CheckBoxPreference) screen.findPreference(b.getId());
p.setOnPreferenceChangeListener(this);
screenPreferences.put(b.getId(), p);
@@ -110,14 +113,14 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
return p;
}
- private void registerSeekBarPreference(OsmandPreference b, PreferenceScreen screen){
+ public void registerSeekBarPreference(OsmandPreference b, PreferenceScreen screen){
SeekBarPreference p = (SeekBarPreference) screen.findPreference(b.getId());
p.setOnPreferenceChangeListener(this);
screenPreferences.put(b.getId(), p);
seekBarPreferences.put(b.getId(), b);
}
- private void registerListPreference(OsmandPreference b, PreferenceScreen screen, String[] names, T[] values){
+ public void registerListPreference(OsmandPreference b, PreferenceScreen screen, String[] names, T[] values){
ListPreference p = (ListPreference) screen.findPreference(b.getId());
p.setOnPreferenceChangeListener(this);
LinkedHashMap vals = new LinkedHashMap();
@@ -130,14 +133,34 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
}
}
- private void registerEditTextPreference(OsmandPreference b, PreferenceScreen screen){
+ public void registerEditTextPreference(OsmandPreference b, PreferenceScreen screen){
EditTextPreference p = (EditTextPreference) screen.findPreference(b.getId());
p.setOnPreferenceChangeListener(this);
screenPreferences.put(b.getId(), p);
editTextPreferences.put(b.getId(), b);
}
- private void registerTimeListPreference(OsmandPreference b, PreferenceScreen screen, int[] seconds, int[] minutes, int coeff){
+ public EditTextPreference createEditTextPreference(OsmandPreference b, int title, int summary){
+ EditTextPreference p = new EditTextPreference(this);
+ p.setTitle(title);
+ p.setSummary(summary);
+ p.setOnPreferenceChangeListener(this);
+ screenPreferences.put(b.getId(), p);
+ editTextPreferences.put(b.getId(), b);
+ return p;
+ }
+
+ public CheckBoxPreference createCheckBoxPreference(OsmandPreference b, int title, int summary){
+ CheckBoxPreference p = new CheckBoxPreference(this);
+ p.setTitle(title);
+ p.setSummary(summary);
+ p.setOnPreferenceChangeListener(this);
+ screenPreferences.put(b.getId(), p);
+ booleanPreferences.put(b.getId(), b);
+ return p;
+ }
+
+ public void registerTimeListPreference(OsmandPreference b, PreferenceScreen screen, int[] seconds, int[] minutes, int coeff){
int minutesLength = minutes == null? 0 : minutes.length;
int secondsLength = seconds == null? 0 : seconds.length;
Integer[] ints = new Integer[secondsLength + minutesLength];
@@ -181,6 +204,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
// BidForFixHelper bidForFixHelper = getMyApplication().getBidForFix();
// bidForFixHelper.generatePreferenceList(screen, getString(R.string.support_new_features), this);
+ OsmandPlugin.onSettingsActivityCreate(this, screen);
registerBooleanPreference(osmandSettings.SHOW_VIEW_ANGLE,screen);
registerBooleanPreference(osmandSettings.USE_TRACKBALL_FOR_MOVEMENTS,screen);
@@ -191,17 +215,13 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
registerBooleanPreference(osmandSettings.USE_HIGH_RES_MAPS,screen);
registerBooleanPreference(osmandSettings.USE_ENGLISH_NAMES,screen);
registerBooleanPreference(osmandSettings.AUTO_ZOOM_MAP,screen);
- // try without AUTO_FOLLOW_ROUTE_NAV (see forum discussion 'Simplify our navigation preference menu')
- //registerBooleanPreference(osmandSettings.AUTO_FOLLOW_ROUTE_NAV,screen);
registerBooleanPreference(osmandSettings.SAVE_TRACK_TO_GPX,screen);
registerBooleanPreference(osmandSettings.LIVE_MONITORING,screen);
- registerBooleanPreference(osmandSettings.DEBUG_RENDERING_INFO,screen);
registerBooleanPreference(osmandSettings.FAST_ROUTE_MODE,screen);
registerBooleanPreference(osmandSettings.USE_OSMAND_ROUTING_SERVICE_ALWAYS,screen);
registerBooleanPreference(osmandSettings.USE_INTERNET_TO_DOWNLOAD_TILES,screen);
registerBooleanPreference(osmandSettings.MAP_VECTOR_DATA,screen);
registerBooleanPreference(osmandSettings.TRANSPARENT_MAP_THEME,screen);
- registerBooleanPreference(osmandSettings.TEST_ANIMATE_ROUTING,screen);
registerBooleanPreference(osmandSettings.SHOW_ALTITUDE_INFO,screen);
registerBooleanPreference(osmandSettings.FLUORESCENT_OVERLAYS,screen);
registerBooleanPreference(osmandSettings.SHOW_RULER,screen);
@@ -212,9 +232,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
nativeCheckbox.setEnabled(false);
}
- registerEditTextPreference(osmandSettings.USER_NAME, screen);
- registerEditTextPreference(osmandSettings.USER_PASSWORD, screen);
- registerBooleanPreference(osmandSettings.OFFLINE_POI_EDITION, screen);
+
registerEditTextPreference(osmandSettings.LIVE_MONITORING_URL, screen);
@@ -368,14 +386,10 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
localIndexes.setOnPreferenceClickListener(this);
saveCurrentTrack =(Preference) screen.findPreference(OsmandSettings.SAVE_CURRENT_TRACK);
saveCurrentTrack.setOnPreferenceClickListener(this);
- testVoiceCommands =(Preference) screen.findPreference("test_voice_commands");
- testVoiceCommands.setOnPreferenceClickListener(this);
routeServiceEnabled =(CheckBoxPreference) screen.findPreference(OsmandSettings.SERVICE_OFF_ENABLED);
routeServiceEnabled.setOnPreferenceChangeListener(this);
applicationDir = (EditTextPreference) screen.findPreference(OsmandSettings.EXTERNAL_STORAGE_DIR);
applicationDir.setOnPreferenceChangeListener(this);
- localOpenstreetmapPoints = (Preference) screen.findPreference(OsmandSettings.LOCAL_OPENSTREETMAP_POINTS);
- localOpenstreetmapPoints.setOnPreferenceClickListener(this);
bidforfix = (Preference) screen.findPreference("bidforfix");
bidforfix.setOnPreferenceClickListener(this);
plugins = (Preference) screen.findPreference("plugins");
@@ -396,11 +410,11 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
int s = intent.getIntExtra(INTENT_KEY_SETTINGS_SCREEN, 0);
String pref = null;
if(s == SCREEN_GENERAL_SETTINGS){
- pref = "general_settings";
+ pref = SCREEN_ID_GENERAL_SETTINGS;
} else if(s == SCREEN_NAVIGATION_SETTINGS){
- pref = "routing_settings";
+ pref = SCREEN_ID_NAVIGATION_SETTINGS;
} else if(s == SCREEN_MONITORING_SETTINGS){
- pref = "monitor_settings";
+ pref = SCREEN_ID_MONITORING_SETTINGS;
}
if(pref != null){
Preference toOpen = screen.findPreference(pref);
@@ -849,9 +863,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
if(preference.getKey().equals(OsmandSettings.LOCAL_INDEXES)){
startActivity(new Intent(this, LocalIndexesActivity.class));
return true;
- } else if(preference == testVoiceCommands){
- startActivity(new Intent(this, TestVoiceActivity.class));
- return true;
} else if(preference == saveCurrentTrack){
SavingTrackHelper helper = new SavingTrackHelper(this);
if (helper.hasDataToSave()) {
@@ -860,9 +871,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
helper.close();
}
return true;
- } else if(preference == localOpenstreetmapPoints){
- startActivity(new Intent(this, LocalOpenstreetmapActivity.class));
- return true;
} else if(preference == bidforfix){
startActivity(new Intent(this, OsmandBidForFixActivity.class));
return true;
diff --git a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java
new file mode 100644
index 0000000000..d1e2c0064b
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java
@@ -0,0 +1,76 @@
+package net.osmand.plus.development;
+
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.OsmandPlugin;
+import net.osmand.plus.OsmandSettings;
+import net.osmand.plus.R;
+import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.activities.SettingsActivity;
+import android.content.Intent;
+import android.preference.CheckBoxPreference;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
+import android.preference.PreferenceCategory;
+import android.preference.PreferenceScreen;
+
+public class OsmandDevelopmentPlugin extends OsmandPlugin {
+ private static final String ID = "osmand.development";
+ private OsmandSettings settings;
+ private OsmandApplication app;
+
+ public OsmandDevelopmentPlugin(OsmandApplication app) {
+ this.app = app;
+ }
+
+ @Override
+ public boolean init(OsmandApplication app) {
+ settings = app.getSettings();
+ return true;
+ }
+
+ @Override
+ public String getId() {
+ return ID;
+ }
+ @Override
+ public String getDescription() {
+ return app.getString(R.string.osmand_development_plugin_description);
+ }
+ @Override
+ public String getName() {
+ return app.getString(R.string.osmand_development_plugin_name);
+ }
+ @Override
+ public void registerLayers(MapActivity activity) {
+ }
+
+
+ @Override
+ public void settingsActivityCreate(final SettingsActivity activity, PreferenceScreen screen) {
+ PreferenceScreen general = (PreferenceScreen) screen.findPreference(SettingsActivity.SCREEN_ID_GENERAL_SETTINGS);
+
+ PreferenceCategory cat = new PreferenceCategory(app);
+ cat.setTitle(R.string.debugging_and_development);
+ general.addPreference(cat);
+
+ CheckBoxPreference dbg = activity.createCheckBoxPreference(settings.DEBUG_RENDERING_INFO,
+ R.string.trace_rendering, R.string.trace_rendering_descr);
+ cat.addPreference(dbg);
+ CheckBoxPreference animate = activity.createCheckBoxPreference(settings.TEST_ANIMATE_ROUTING,
+ R.string.animate_routing, R.string.simulate_route_progression_manually);
+ cat.addPreference(animate);
+
+ Preference pref = new Preference(app);
+ pref.setTitle(R.string.test_voice_prompts);
+ pref.setSummary(R.string.play_commands_of_currently_selected_voice);
+ pref.setKey("test_voice_commands");
+ pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ activity.startActivity(new Intent(activity, TestVoiceActivity.class));
+ return true;
+ }
+ });
+ cat.addPreference(pref);
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/activities/TestVoiceActivity.java b/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java
similarity index 99%
rename from OsmAnd/src/net/osmand/plus/activities/TestVoiceActivity.java
rename to OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java
index 14e843606a..f978c26778 100644
--- a/OsmAnd/src/net/osmand/plus/activities/TestVoiceActivity.java
+++ b/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java
@@ -1,7 +1,7 @@
/**
*
*/
-package net.osmand.plus.activities;
+package net.osmand.plus.development;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.OsmandApplication;
diff --git a/OsmAnd/src/net/osmand/AbstractOpenstreetmapUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/AbstractOpenstreetmapUtil.java
similarity index 98%
rename from OsmAnd/src/net/osmand/AbstractOpenstreetmapUtil.java
rename to OsmAnd/src/net/osmand/plus/osmedit/AbstractOpenstreetmapUtil.java
index fadbedae56..9ee6a6ab5a 100644
--- a/OsmAnd/src/net/osmand/AbstractOpenstreetmapUtil.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/AbstractOpenstreetmapUtil.java
@@ -1,4 +1,5 @@
-package net.osmand;
+package net.osmand.plus.osmedit;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java
index 901d94b76a..1a53945d61 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java
@@ -7,9 +7,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import net.osmand.OpenstreetmapLocalUtil;
-import net.osmand.OpenstreetmapRemoteUtil;
-import net.osmand.OpenstreetmapUtil;
import net.osmand.OsmAndFormatter;
import net.osmand.access.AccessibleToast;
import net.osmand.data.Amenity;
diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalOpenstreetmapActivity.java b/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java
similarity index 97%
rename from OsmAnd/src/net/osmand/plus/activities/LocalOpenstreetmapActivity.java
rename to OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java
index 25fcef3ec5..de9c1ee675 100644
--- a/OsmAnd/src/net/osmand/plus/activities/LocalOpenstreetmapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java
@@ -1,4 +1,4 @@
-package net.osmand.plus.activities;
+package net.osmand.plus.osmedit;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -7,18 +7,15 @@ import java.util.List;
import java.util.Map;
import net.osmand.LogUtil;
-import net.osmand.OpenstreetmapPoint;
-import net.osmand.OpenstreetmapRemoteUtil;
-import net.osmand.OpenstreetmapUtil;
import net.osmand.access.AccessibleToast;
import net.osmand.osm.EntityInfo;
import net.osmand.osm.Node;
import net.osmand.plus.AmenityIndexRepositoryOdb;
-import net.osmand.plus.OpenstreetmapsDbHelper;
-import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.ProgressDialogImplementation;
import net.osmand.plus.R;
+import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.activities.OsmandExpandableListActivity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
@@ -199,7 +196,7 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity {
}
}
- return new Integer(uploaded);
+ return Integer.valueOf(uploaded);
}
@Override
diff --git a/OsmAnd/src/net/osmand/OpenstreetmapLocalUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java
similarity index 97%
rename from OsmAnd/src/net/osmand/OpenstreetmapLocalUtil.java
rename to OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java
index 0ccb6551b7..bf42e3e25d 100644
--- a/OsmAnd/src/net/osmand/OpenstreetmapLocalUtil.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java
@@ -1,7 +1,9 @@
-package net.osmand;
+package net.osmand.plus.osmedit;
import java.util.Map;
+
+import net.osmand.LogUtil;
import net.osmand.data.Amenity;
import net.osmand.data.AmenityType;
import net.osmand.osm.EntityInfo;
@@ -9,7 +11,6 @@ import net.osmand.osm.MapRenderingTypes;
import net.osmand.osm.MapUtils;
import net.osmand.osm.Node;
import net.osmand.osm.OSMSettings.OSMTagKey;
-import net.osmand.plus.OpenstreetmapsDbHelper;
import org.apache.commons.logging.Log;
diff --git a/OsmAnd/src/net/osmand/OpenstreetmapPoint.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapPoint.java
similarity index 98%
rename from OsmAnd/src/net/osmand/OpenstreetmapPoint.java
rename to OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapPoint.java
index 89f589a104..e7870bec1c 100644
--- a/OsmAnd/src/net/osmand/OpenstreetmapPoint.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapPoint.java
@@ -1,4 +1,4 @@
-package net.osmand;
+package net.osmand.plus.osmedit;
import java.io.Serializable;
diff --git a/OsmAnd/src/net/osmand/OpenstreetmapRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java
similarity index 99%
rename from OsmAnd/src/net/osmand/OpenstreetmapRemoteUtil.java
rename to OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java
index 33e164f49e..c031e6fa27 100644
--- a/OsmAnd/src/net/osmand/OpenstreetmapRemoteUtil.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java
@@ -1,4 +1,4 @@
-package net.osmand;
+package net.osmand.plus.osmedit;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -18,6 +18,10 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
+import net.osmand.Algoritms;
+import net.osmand.Base64;
+import net.osmand.LogUtil;
+import net.osmand.Version;
import net.osmand.access.AccessibleToast;
import net.osmand.data.Amenity;
import net.osmand.osm.Entity;
diff --git a/OsmAnd/src/net/osmand/OpenstreetmapUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapUtil.java
similarity index 93%
rename from OsmAnd/src/net/osmand/OpenstreetmapUtil.java
rename to OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapUtil.java
index 66c6f96e1b..58162c8908 100644
--- a/OsmAnd/src/net/osmand/OpenstreetmapUtil.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapUtil.java
@@ -1,4 +1,4 @@
-package net.osmand;
+package net.osmand.plus.osmedit;
import net.osmand.data.Amenity;
import net.osmand.osm.EntityInfo;
diff --git a/OsmAnd/src/net/osmand/plus/OpenstreetmapsDbHelper.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapsDbHelper.java
similarity index 98%
rename from OsmAnd/src/net/osmand/plus/OpenstreetmapsDbHelper.java
rename to OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapsDbHelper.java
index b688768e42..ec490534cf 100644
--- a/OsmAnd/src/net/osmand/plus/OpenstreetmapsDbHelper.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapsDbHelper.java
@@ -1,11 +1,9 @@
-package net.osmand.plus;
+package net.osmand.plus.osmedit;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import net.osmand.OpenstreetmapPoint;
-import net.osmand.OpenstreetmapRemoteUtil;
import net.osmand.osm.Node;
import net.osmand.osm.OSMSettings.OSMTagKey;
import android.content.Context;
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java
index a33dcdd9c8..4eaa2e9851 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java
@@ -1,5 +1,13 @@
package net.osmand.plus.osmedit;
+import android.content.Intent;
+import android.preference.CheckBoxPreference;
+import android.preference.EditTextPreference;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
+import android.preference.PreferenceCategory;
+import android.preference.PreferenceScreen;
+import android.text.InputType;
import net.osmand.data.Amenity;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
@@ -8,6 +16,7 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.views.OsmandMapTileView;
public class OsmEditingPlugin extends OsmandPlugin {
@@ -54,7 +63,37 @@ public class OsmEditingPlugin extends OsmandPlugin {
poiActions = new EditingPOIActivity(activity);
activity.addDialogProvider(poiActions);
activity.addDialogProvider(osmBugsLayer);
+ }
+
+ @Override
+ public void settingsActivityCreate(final SettingsActivity activity, PreferenceScreen screen) {
+ PreferenceScreen general = (PreferenceScreen) screen.findPreference(SettingsActivity.SCREEN_ID_GENERAL_SETTINGS);
+ PreferenceCategory cat = new PreferenceCategory(app);
+ cat.setTitle(R.string.osm_settings);
+ general.addPreference(cat);
+ EditTextPreference userName = activity.createEditTextPreference(settings.USER_NAME, R.string.user_name, R.string.user_name_descr);
+ cat.addPreference(userName);
+ userName.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
+ EditTextPreference pwd = activity.createEditTextPreference(settings.USER_PASSWORD, R.string.user_password, R.string.user_password_descr);
+ cat.addPreference(pwd);
+
+ CheckBoxPreference poiEdit = activity.createCheckBoxPreference(settings.OFFLINE_POI_EDITION,
+ R.string.offline_poi_edition, R.string.offline_poi_edition_descr);
+ cat.addPreference(poiEdit);
+
+ Preference pref = new Preference(app);
+ pref.setTitle(R.string.local_openstreetmap_settings);
+ pref.setSummary(R.string.local_openstreetmap_settings_descr);
+ pref.setKey("local_openstreetmap_points");
+ pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ activity.startActivity(new Intent(activity, LocalOpenstreetmapActivity.class));
+ return true;
+ }
+ });
+ cat.addPreference(pref);
}
public EditingPOIActivity getPoiActions() {