Fix crash & change app theme

This commit is contained in:
Victor Shcherb 2015-07-04 17:28:42 +03:00
parent bd10fc71ff
commit 39482e3ea6
12 changed files with 6 additions and 111 deletions

View file

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

View file

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

View file

@ -461,6 +461,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
startActivity(intent);
}
});
bld.show();
}

View file

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

View file

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

View file

@ -54,6 +54,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
liveMonitoringHelper = new LiveMonitoringHelper(app);
final List<ApplicationMode> 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;

View file

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

View file

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

View file

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

View file

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

View file

@ -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<String> pref = settings.getCustomRenderProperty("contourLines");
if(pref.get().equals("")) {

View file

@ -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<? extends Activity> getSettingsActivity() {
return null;
}
}