From 39482e3ea6eb3d8322c9f2079fd0a33216bc06f7 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 4 Jul 2015 17:28:42 +0300 Subject: [PATCH] Fix crash & change app theme --- .../osmand/access/AccessibilityPlugin.java | 5 -- OsmAnd/src/net/osmand/plus/OsmandPlugin.java | 5 +- .../activities/SettingsGeneralActivity.java | 1 + .../development/OsmandDevelopmentPlugin.java | 9 --- .../DistanceCalculatorPlugin.java | 5 -- .../monitoring/OsmandMonitoringPlugin.java | 7 +-- .../osmand/plus/osmedit/OsmEditingPlugin.java | 5 -- .../parkingpoint/ParkingPositionPlugin.java | 6 -- .../rastermaps/OsmandRasterMapsPlugin.java | 5 -- .../RoutePointsPlugin.java | 5 -- .../osmand/plus/srtmplugin/SRTMPlugin.java | 2 +- .../plus/touringview/TouringViewPlugin.java | 62 ------------------- 12 files changed, 6 insertions(+), 111 deletions(-) delete mode 100644 OsmAnd/src/net/osmand/plus/touringview/TouringViewPlugin.java diff --git a/OsmAnd/src/net/osmand/access/AccessibilityPlugin.java b/OsmAnd/src/net/osmand/access/AccessibilityPlugin.java index a096d0c5a4..f49295de57 100644 --- a/OsmAnd/src/net/osmand/access/AccessibilityPlugin.java +++ b/OsmAnd/src/net/osmand/access/AccessibilityPlugin.java @@ -14,11 +14,6 @@ public class AccessibilityPlugin extends OsmandPlugin { this.app = app; } - @Override - public boolean init(OsmandApplication app, Activity activity) { - return true; - } - @Override public String getId() { return ID; diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index f0b2a16de1..2762a5a5c7 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -64,9 +64,10 @@ public abstract class OsmandPlugin { /** * Initialize plugin runs just after creation - * @param activity TODO */ - public abstract boolean init(OsmandApplication app, Activity activity); + public boolean init(OsmandApplication app, Activity activity) { + return true; + } public void setActive(boolean active) { this.active = active; diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java index 8b6d771c61..85bf75c72b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java @@ -461,6 +461,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity { startActivity(intent); } }); + bld.show(); } diff --git a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java index 2d1581c987..4e652b6226 100644 --- a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java +++ b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java @@ -4,16 +4,11 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.views.MapInfoLayer; import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.mapwidgets.TextInfoWidget; import android.app.Activity; -import android.content.Intent; -import android.preference.Preference; -import android.preference.Preference.OnPreferenceClickListener; -import android.preference.PreferenceScreen; public class OsmandDevelopmentPlugin extends OsmandPlugin { private static final String ID = "osmand.development"; @@ -25,10 +20,6 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin { //ApplicationMode.regWidget("fps", new ApplicationMode[0]); } - @Override - public boolean init(OsmandApplication app, Activity activity) { - return true; - } @Override public String getId() { diff --git a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java index 32f4d77a8e..4dcaa6f7cb 100644 --- a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java +++ b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java @@ -96,11 +96,6 @@ public class DistanceCalculatorPlugin extends OsmandPlugin { return app.getString(R.string.osmand_distance_planning_plugin_name); } - @Override - public boolean init(OsmandApplication app, Activity activity) { - return true; - } - @Override public void updateLayers(OsmandMapTileView mapView, MapActivity activity) { if(isActive()) { diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 3b3b01cc0a..ccb316f323 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -54,6 +54,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { liveMonitoringHelper = new LiveMonitoringHelper(app); final List am = ApplicationMode.allPossibleValues(); ApplicationMode.regWidget("monitoring", am.toArray(new ApplicationMode[am.size()])); + settings = app.getSettings(); } @Override @@ -71,12 +72,6 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { return R.drawable.trip_recording; } - @Override - public boolean init(OsmandApplication app, Activity activity) { - settings = app.getSettings(); - return true; - } - @Override public String getId() { return ID; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index 7633189766..f3b864b323 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -63,12 +63,7 @@ public class OsmEditingPlugin extends OsmandPlugin { public OsmEditingPlugin(OsmandApplication app) { this.app = app; - } - - @Override - public boolean init(OsmandApplication app, Activity activity) { settings = app.getSettings(); - return true; } private OsmBugsLayer osmBugsLayer; diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java index da892c8096..8e44975593 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java @@ -144,12 +144,6 @@ public class ParkingPositionPlugin extends OsmandPlugin { return true; } - - @Override - public boolean init(OsmandApplication app, Activity activity) { - return true; - } - @Override public String getId() { return ID; diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java index bd84e15b82..da4a876ccc 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java @@ -50,12 +50,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin { public OsmandRasterMapsPlugin(OsmandApplication app) { this.app = app; - } - - @Override - public boolean init(OsmandApplication app, Activity activity) { settings = app.getSettings(); - return true; } @Override diff --git a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java index 637df91af8..2a94e92cfe 100644 --- a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java +++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java @@ -190,11 +190,6 @@ public class RoutePointsPlugin extends OsmandPlugin { return app.getString(R.string.route_plugin_name); } - @Override - public boolean init(OsmandApplication app, Activity activity) { - return true; - } - private void registerWidget(MapActivity activity) { MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer(); if (mapInfoLayer != null) { diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/SRTMPlugin.java b/OsmAnd/src/net/osmand/plus/srtmplugin/SRTMPlugin.java index 1828840d65..77e4994dba 100644 --- a/OsmAnd/src/net/osmand/plus/srtmplugin/SRTMPlugin.java +++ b/OsmAnd/src/net/osmand/plus/srtmplugin/SRTMPlugin.java @@ -29,6 +29,7 @@ public class SRTMPlugin extends OsmandPlugin { public SRTMPlugin(OsmandApplication app) { this.app = app; + HILLSHADE = app.getSettings().registerBooleanPreference("hillshade_layer", true); } @Override @@ -54,7 +55,6 @@ public class SRTMPlugin extends OsmandPlugin { @Override public boolean init(final OsmandApplication app, Activity activity) { - HILLSHADE = app.getSettings().registerBooleanPreference("hillshade_layer", true); OsmandSettings settings = app.getSettings(); CommonPreference pref = settings.getCustomRenderProperty("contourLines"); if(pref.get().equals("")) { diff --git a/OsmAnd/src/net/osmand/plus/touringview/TouringViewPlugin.java b/OsmAnd/src/net/osmand/plus/touringview/TouringViewPlugin.java deleted file mode 100644 index acda40ad45..0000000000 --- a/OsmAnd/src/net/osmand/plus/touringview/TouringViewPlugin.java +++ /dev/null @@ -1,62 +0,0 @@ -package net.osmand.plus.touringview; - -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.R; -import net.osmand.plus.render.RendererRegistry; -import android.app.Activity; - -public class TouringViewPlugin extends OsmandPlugin { - - public static final String ID = "touringView.plugin"; - public static final String COMPONENT = "net.osmand.touringviewPlugin"; - private static String previousRenderer = RendererRegistry.DEFAULT_RENDER; - private OsmandApplication app; - - public TouringViewPlugin(OsmandApplication app) { - this.app = app; - } - - @Override - public String getDescription() { - return app.getString(net.osmand.plus.R.string.plugin_touringview_descr); - } - - @Override - public int getAssetResourceName() { - return R.drawable.touring_map_view; - } - - @Override - public String getName() { - return app.getString(net.osmand.plus.R.string.plugin_touringview_name); - } - - @Override - public boolean init(final OsmandApplication app, final Activity activity) { - if(activity != null) { - // called from UI - previousRenderer = app.getSettings().RENDERER.get(); - app.getSettings().RENDERER.set(RendererRegistry.TOURING_VIEW); - } - return true; - } - - @Override - public void disable(OsmandApplication app) { - super.disable(app); - if(app.getSettings().RENDERER.get().equals(RendererRegistry.TOURING_VIEW)) { - app.getSettings().RENDERER.set(previousRenderer); - } - } - - @Override - public String getId() { - return ID; - } - - @Override - public Class getSettingsActivity() { - return null; - } -}