Update plugin structure

This commit is contained in:
Victor Shcherb 2012-05-23 21:42:45 +02:00
parent 355234e155
commit 80d6e6ea82
20 changed files with 225 additions and 90 deletions

View file

@ -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) ==

View file

@ -64,9 +64,9 @@
<data android:scheme="geo"></data>
</intent-filter>
</activity>
<activity android:name="net.osmand.plus.activities.TestVoiceActivity"></activity>
<activity android:name="net.osmand.plus.development.TestVoiceActivity"></activity>
<activity android:name="net.osmand.plus.activities.LocalIndexesActivity" android:label="@string/local_index_descr_title"></activity>
<activity android:name="net.osmand.plus.activities.LocalOpenstreetmapActivity" android:label="@string/local_openstreetmap_descr_title"></activity>
<activity android:name="net.osmand.plus.osmedit.LocalOpenstreetmapActivity" android:label="@string/local_openstreetmap_descr_title"></activity>
<service android:process="net.osmand.plus" android:label="@string/process_navigation_service" android:name="net.osmand.plus.NavigationService">
<intent-filter><action android:name="net.osmand.plus.NavigationService"></action></intent-filter>

View file

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="osmand_development_plugin_description">This plugin enables development features (animate routing) and display additional information such as rendering time.</string>
<string name="osmand_development_plugin_name">Osmand Development</string>
<string name="plugins_screen">Plugins</string>
<string name="select_plugin_to_activate">Touch a plugin item to activate it. Application restart is needed to take an effect.</string>
<string name="select_plugin_to_activate">Touch a plugin item to activate it. To take an effect application restart may require.</string>
<string name="prefs_plugins_descr">Plugins enable extra functionality builtin in the application such as Tracking, Tile Maps, Battery Saving features, Accessibility and many others.</string>
<string name="prefs_plugins">Plugins</string>
<string name="tip_recent_changes_0_8_0_t">Changes in 0.8.0 :

View file

@ -94,30 +94,12 @@
<CheckBoxPreference android:key="use_high_res_maps" android:title="@string/use_high_res_maps" android:summary="@string/use_high_res_maps_descr"></CheckBoxPreference>
<ListPreference android:key="preferred_locale" android:title="@string/preferred_locale" android:summary="@string/preferred_locale_descr"></ListPreference>
<ListPreference android:key="default_metric_system" android:title="@string/unit_of_length" android:summary="@string/unit_of_length_descr"></ListPreference>
<CheckBoxPreference android:key="native_rendering" android:title="@string/native_rendering" android:summary="@string/vector_maps_may_display_faster_on_some_devices"></CheckBoxPreference>
<ListPreference android:key="audio_stream" android:title="@string/choose_audio_stream"
android:summary="@string/choose_audio_stream_descr"></ListPreference>
<CheckBoxPreference android:key="use_trackball_for_movements" android:title="@string/use_trackball" android:summary="@string/use_trackball_descr"></CheckBoxPreference>
<EditTextPreference android:title="@string/application_dir" android:key="external_storage_dir"></EditTextPreference>
</PreferenceCategory>
<PreferenceCategory android:title="@string/osm_settings">
<!--
<CheckBoxPreference android:key="show_osm_bugs" android:title="@string/show_osm_bugs"
android:summary="@string/show_osm_bugs_descr"></CheckBoxPreference>
-->
<EditTextPreference android:title="@string/user_name" android:summary="@string/user_name_descr" android:key="user_name"></EditTextPreference>
<EditTextPreference android:title="@string/user_password" android:password="true" android:summary="@string/user_password_descr"
android:key="user_password"></EditTextPreference>
<CheckBoxPreference android:summary="@string/offline_poi_edition_descr" android:title="@string/offline_poi_edition"
android:key="offline_poi_edition"></CheckBoxPreference>
<Preference android:title="@string/local_openstreetmap_settings" android:key="local_openstreetmap_points" android:summary="@string/local_openstreetmap_settings_descr"></Preference>
</PreferenceCategory>
<PreferenceCategory android:title="@string/debugging_and_development">
<CheckBoxPreference android:key="native_rendering" android:title="@string/native_rendering" android:summary="@string/vector_maps_may_display_faster_on_some_devices"></CheckBoxPreference>
<CheckBoxPreference android:summary="@string/trace_rendering_descr" android:title="@string/trace_rendering"
android:key="debug_rendering"></CheckBoxPreference>
<CheckBoxPreference android:key="animate_routing" android:title="@string/animate_routing" android:summary="@string/simulate_route_progression_manually"></CheckBoxPreference>
<Preference android:key="test_voice_commands" android:summary="@string/play_commands_of_currently_selected_voice" android:title="@string/test_voice_prompts"></Preference>
</PreferenceCategory>
</PreferenceScreen>
<Preference android:title="@string/prefs_plugins" android:summary="@string/prefs_plugins_descr" android:key="plugins"/>

View file

@ -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<String> 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<OsmandPlugin> 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);
}
}
}

View file

@ -545,8 +545,6 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> 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<DayNightMode> DAYNIGHT_MODE =

View file

@ -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) {

View file

@ -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();
}

View file

@ -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<String, Map<String, ?>> listPrefValues = new LinkedHashMap<String, Map<String, ?>>();
private CheckBoxPreference registerBooleanPreference(OsmandPreference<Boolean> b, PreferenceScreen screen){
public CheckBoxPreference registerBooleanPreference(OsmandPreference<Boolean> 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<Integer> b, PreferenceScreen screen){
public void registerSeekBarPreference(OsmandPreference<Integer> b, PreferenceScreen screen){
SeekBarPreference p = (SeekBarPreference) screen.findPreference(b.getId());
p.setOnPreferenceChangeListener(this);
screenPreferences.put(b.getId(), p);
seekBarPreferences.put(b.getId(), b);
}
private <T> void registerListPreference(OsmandPreference<T> b, PreferenceScreen screen, String[] names, T[] values){
public <T> void registerListPreference(OsmandPreference<T> b, PreferenceScreen screen, String[] names, T[] values){
ListPreference p = (ListPreference) screen.findPreference(b.getId());
p.setOnPreferenceChangeListener(this);
LinkedHashMap<String, Object> vals = new LinkedHashMap<String, Object>();
@ -130,14 +133,34 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
}
}
private void registerEditTextPreference(OsmandPreference<String> b, PreferenceScreen screen){
public void registerEditTextPreference(OsmandPreference<String> 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<Integer> b, PreferenceScreen screen, int[] seconds, int[] minutes, int coeff){
public EditTextPreference createEditTextPreference(OsmandPreference<String> 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<Boolean> 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<Integer> 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;

View file

@ -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);
}
}

View file

@ -1,7 +1,7 @@
/**
*
*/
package net.osmand.plus.activities;
package net.osmand.plus.development;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.OsmandApplication;

View file

@ -1,4 +1,5 @@
package net.osmand;
package net.osmand.plus.osmedit;
import java.util.ArrayList;
import java.util.List;

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -1,4 +1,4 @@
package net.osmand;
package net.osmand.plus.osmedit;
import java.io.Serializable;

View file

@ -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;

View file

@ -1,4 +1,4 @@
package net.osmand;
package net.osmand.plus.osmedit;
import net.osmand.data.Amenity;
import net.osmand.osm.EntityInfo;

View file

@ -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;

View file

@ -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() {