Fix osmo issues

This commit is contained in:
Victor Shcherb 2015-05-25 22:35:06 +02:00
parent e79e8190be
commit 13dfd5b443
3 changed files with 15 additions and 0 deletions

View file

@ -248,6 +248,16 @@ public abstract class OsmandPlugin {
return null;
}
@SuppressWarnings("unchecked")
public static <T extends OsmandPlugin> T getPlugin(Class<T> clz) {
for(OsmandPlugin lr : getAvailablePlugins()) {
if(clz.isInstance(lr)){
return (T) lr;
}
}
return null;
}
public static List<String> onIndexingFiles(IProgress progress) {
List<String> l = new ArrayList<String>();
for (OsmandPlugin plugin : getEnabledPlugins()) {

View file

@ -147,6 +147,10 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
super.onCreate(icicle);
app = (OsmandApplication) getApplication();
osMoPlugin = OsmandPlugin.getEnabledPlugin(OsMoPlugin.class);
if(osMoPlugin == null) {
osMoPlugin = OsmandPlugin.getPlugin(OsMoPlugin.class);
OsmandPlugin.enablePlugin(this, app, osMoPlugin, true);
}
if(getIntent() != null) {
if("http".equals(getIntent().getScheme())) {
new OsMoIntentHandler(app, osMoPlugin).execute(getIntent());

View file

@ -97,6 +97,7 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
@Override
public void disable(OsmandApplication app) {
super.disable(app);
tracker.disableTracker();
service.disconnect();
}