Update plugins
This commit is contained in:
parent
f3dbfcd64f
commit
6c406fcedc
18 changed files with 262 additions and 193 deletions
|
@ -14,7 +14,7 @@
|
||||||
<string name="ga_api_key">UA-28342846-2</string>
|
<string name="ga_api_key">UA-28342846-2</string>
|
||||||
<string name="ga_dispatchPeriod">10</string>
|
<string name="ga_dispatchPeriod">10</string>
|
||||||
<string name="ga_debug">true</string>
|
<string name="ga_debug">true</string>
|
||||||
<string name="versionFeatures">+play_market +gps_status -parking_plugin -blackberry -free_version -amazon</string>
|
<string name="versionFeatures">+play_market -amazon -blackberry</string>
|
||||||
<string name="next_tips_and_tricks_not_translate"></string>
|
<string name="next_tips_and_tricks_not_translate"></string>
|
||||||
<string name="openstreetmap_copyright"><a href="http://www.openstreetmap.org/copyright">© OpenStreetMap</a></string>
|
<string name="openstreetmap_copyright"><a href="http://www.openstreetmap.org/copyright">© OpenStreetMap</a></string>
|
||||||
<string name="about_content">Data is powered by OpenStreetMap ODbL, © <a href="http://www.openstreetmap.org/copyright">http://www.openstreetmap.org/copyright</a>.
|
<string name="about_content">Data is powered by OpenStreetMap ODbL, © <a href="http://www.openstreetmap.org/copyright">http://www.openstreetmap.org/copyright</a>.
|
||||||
|
|
|
@ -18,15 +18,17 @@ import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||||
import net.osmand.plus.distancecalculator.DistanceCalculatorPlugin;
|
import net.osmand.plus.distancecalculator.DistanceCalculatorPlugin;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
|
import net.osmand.plus.openseamapsplugin.OpenSeaMapsPlugin;
|
||||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||||
import net.osmand.plus.osmo.OsMoPlugin;
|
import net.osmand.plus.osmo.OsMoPlugin;
|
||||||
import net.osmand.plus.parkingpoint.ParkingPositionPlugin;
|
import net.osmand.plus.parkingpoint.ParkingPositionPlugin;
|
||||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||||
import net.osmand.plus.routepointsnavigation.RoutePointsPlugin;
|
import net.osmand.plus.routepointsnavigation.RoutePointsPlugin;
|
||||||
|
import net.osmand.plus.skimapsplugin.SkiMapsPlugin;
|
||||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -34,13 +36,13 @@ import java.util.Set;
|
||||||
|
|
||||||
public abstract class OsmandPlugin {
|
public abstract class OsmandPlugin {
|
||||||
|
|
||||||
private static List<OsmandPlugin> installedPlugins = new ArrayList<OsmandPlugin>();
|
private static List<OsmandPlugin> allPlugins = new ArrayList<OsmandPlugin>();
|
||||||
private static List<OsmandPlugin> activePlugins = new ArrayList<OsmandPlugin>();
|
|
||||||
private static final Log LOG = PlatformUtil.getLog(OsmandPlugin.class);
|
private static final Log LOG = PlatformUtil.getLog(OsmandPlugin.class);
|
||||||
|
|
||||||
private static final String PARKING_PLUGIN_COMPONENT = "net.osmand.parkingPlugin"; //$NON-NLS-1$
|
|
||||||
private static final String SRTM_PLUGIN_COMPONENT_PAID = "net.osmand.srtmPlugin.paid"; //$NON-NLS-1$
|
private static final String SRTM_PLUGIN_COMPONENT_PAID = "net.osmand.srtmPlugin.paid"; //$NON-NLS-1$
|
||||||
private static final String SRTM_PLUGIN_COMPONENT = "net.osmand.srtmPlugin"; //$NON-NLS-1$
|
private static final String SRTM_PLUGIN_COMPONENT = "net.osmand.srtmPlugin";
|
||||||
|
private boolean active;
|
||||||
|
private String installURL = null;
|
||||||
|
|
||||||
public abstract String getId();
|
public abstract String getId();
|
||||||
|
|
||||||
|
@ -63,45 +65,49 @@ public abstract class OsmandPlugin {
|
||||||
*/
|
*/
|
||||||
public abstract boolean init(OsmandApplication app);
|
public abstract boolean init(OsmandApplication app);
|
||||||
|
|
||||||
|
public void setActive(boolean active) {
|
||||||
|
this.active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean couldBeActivated() {
|
||||||
|
return installURL != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInstallURL(String installURL) {
|
||||||
|
this.installURL = installURL;
|
||||||
|
}
|
||||||
|
|
||||||
public void disable(OsmandApplication app) {};
|
public void disable(OsmandApplication app) {};
|
||||||
|
|
||||||
|
|
||||||
public static void initPlugins(OsmandApplication app) {
|
public static void initPlugins(OsmandApplication app) {
|
||||||
OsmandSettings settings = app.getSettings();
|
OsmandSettings settings = app.getSettings();
|
||||||
OsmandRasterMapsPlugin rasterMapsPlugin = new OsmandRasterMapsPlugin(app);
|
OsmandRasterMapsPlugin rasterMapsPlugin = new OsmandRasterMapsPlugin(app);
|
||||||
installedPlugins.add(rasterMapsPlugin);
|
|
||||||
installedPlugins.add(new OsmandMonitoringPlugin(app));
|
|
||||||
installedPlugins.add(new OsMoPlugin(app));
|
|
||||||
installedPlugins.add(new AudioVideoNotesPlugin(app));
|
|
||||||
installedPlugins.add(new DistanceCalculatorPlugin(app));
|
|
||||||
installedPlugins.add(new AccessibilityPlugin(app));
|
|
||||||
if(!installPlugin(SRTM_PLUGIN_COMPONENT_PAID, SRTMPlugin.ID, app,
|
|
||||||
new SRTMPlugin(app, true))) {
|
|
||||||
installPlugin(SRTM_PLUGIN_COMPONENT, SRTMPlugin.FREE_ID, app,
|
|
||||||
new SRTMPlugin(app, false));
|
|
||||||
}
|
|
||||||
final ParkingPositionPlugin parking = new ParkingPositionPlugin(app);
|
|
||||||
boolean f = installPlugin(PARKING_PLUGIN_COMPONENT, ParkingPositionPlugin.ID, app, parking);
|
|
||||||
if(!f && Version.isParkingPluginInlined(app)) {
|
|
||||||
installedPlugins.add(parking);
|
|
||||||
}
|
|
||||||
Set<String> enabledPlugins = settings.getEnabledPlugins();
|
Set<String> enabledPlugins = settings.getEnabledPlugins();
|
||||||
if(Version.isRouteNavPluginInlined(app)) {
|
allPlugins.add(rasterMapsPlugin);
|
||||||
RoutePointsPlugin routePointsPlugin = new RoutePointsPlugin(app);
|
allPlugins.add(new OsmandMonitoringPlugin(app));
|
||||||
installedPlugins.add(routePointsPlugin);
|
allPlugins.add(new OsMoPlugin(app));
|
||||||
enabledPlugins.add(routePointsPlugin.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// osmodroid disabled
|
checkMarketPlugin(app, new SRTMPlugin(app), true, SRTM_PLUGIN_COMPONENT_PAID, SRTM_PLUGIN_COMPONENT);
|
||||||
// installPlugin(OSMODROID_PLUGIN_COMPONENT, OsMoDroidPlugin.ID, app, new OsMoDroidPlugin(app));
|
checkMarketPlugin(app, new ParkingPositionPlugin(app), false, ParkingPositionPlugin.PARKING_PLUGIN_COMPONENT, null);
|
||||||
installedPlugins.add(new OsmEditingPlugin(app));
|
allPlugins.add(new AudioVideoNotesPlugin(app));
|
||||||
installedPlugins.add(new OsmandDevelopmentPlugin(app));
|
checkMarketPlugin(app, new RoutePointsPlugin(app), false /*FIXME*/, RoutePointsPlugin.ROUTE_POINTS_PLUGIN_COMPONENT, null);
|
||||||
|
checkMarketPlugin(app, new OpenSeaMapsPlugin(app), false, OpenSeaMapsPlugin.COMPONENT, null);
|
||||||
|
checkMarketPlugin(app, new SkiMapsPlugin(app), false, SkiMapsPlugin.COMPONENT, null);
|
||||||
|
allPlugins.add(new DistanceCalculatorPlugin(app));
|
||||||
|
allPlugins.add(new AccessibilityPlugin(app));
|
||||||
|
allPlugins.add(new OsmEditingPlugin(app));
|
||||||
|
allPlugins.add(new OsmandDevelopmentPlugin(app));
|
||||||
|
|
||||||
for (OsmandPlugin plugin : installedPlugins) {
|
for (OsmandPlugin plugin : allPlugins) {
|
||||||
if (enabledPlugins.contains(plugin.getId())) {
|
if (enabledPlugins.contains(plugin.getId()) || plugin.isActive()) {
|
||||||
try {
|
try {
|
||||||
if (plugin.init(app)) {
|
if (plugin.init(app)) {
|
||||||
activePlugins.add(plugin);
|
plugin.setActive(true);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Plugin initialization failed " + plugin.getId(), e);
|
LOG.error("Plugin initialization failed " + plugin.getId(), e);
|
||||||
|
@ -110,15 +116,38 @@ public abstract class OsmandPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void checkMarketPlugin(OsmandApplication app, OsmandPlugin srtm, boolean paid, String id, String id2) {
|
||||||
|
boolean marketEnabled = Version.isMarketEnabled(app);
|
||||||
|
boolean pckg = isPackageInstalled(id, app) ||
|
||||||
|
isPackageInstalled(id2, app);
|
||||||
|
if(Version.isDeveloperVersion(app) && !paid) {
|
||||||
|
// for test reasons
|
||||||
|
marketEnabled = false;
|
||||||
|
}
|
||||||
|
if(pckg || (!marketEnabled && !paid)) {
|
||||||
|
if(pckg && !app.getSettings().getPlugins().contains("-"+srtm.getId())) {
|
||||||
|
srtm.setActive(true);
|
||||||
|
}
|
||||||
|
allPlugins.add(srtm);
|
||||||
|
} else {
|
||||||
|
if(marketEnabled) {
|
||||||
|
srtm.setInstallURL(Version.marketPrefix(app) + id);
|
||||||
|
allPlugins.add(srtm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean enablePlugin(OsmandApplication app, OsmandPlugin plugin, boolean enable) {
|
public static boolean enablePlugin(OsmandApplication app, OsmandPlugin plugin, boolean enable) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
if (!plugin.init(app)) {
|
if (!plugin.init(app)) {
|
||||||
|
plugin.setActive(false);
|
||||||
return false;
|
return false;
|
||||||
|
} else {
|
||||||
|
plugin.setActive(true);
|
||||||
}
|
}
|
||||||
activePlugins.add(plugin);
|
|
||||||
} else {
|
} else {
|
||||||
plugin.disable(app);
|
plugin.disable(app);
|
||||||
activePlugins.remove(plugin);
|
plugin.setActive(false);
|
||||||
}
|
}
|
||||||
app.getSettings().enablePlugin(plugin.getId(), enable);
|
app.getSettings().enablePlugin(plugin.getId(), enable);
|
||||||
return true;
|
return true;
|
||||||
|
@ -170,22 +199,28 @@ public abstract class OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void refreshLayers(OsmandMapTileView mapView, MapActivity activity) {
|
public static void refreshLayers(OsmandMapTileView mapView, MapActivity activity) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.updateLayers(mapView, activity);
|
plugin.updateLayers(mapView, activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<OsmandPlugin> getAvailablePlugins(){
|
public static List<OsmandPlugin> getAvailablePlugins(){
|
||||||
return installedPlugins;
|
return allPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<OsmandPlugin> getEnabledPlugins(){
|
public static Iterable<OsmandPlugin> getEnabledPlugins(){
|
||||||
return activePlugins;
|
ArrayList<OsmandPlugin> lst = new ArrayList<OsmandPlugin>(allPlugins.size());
|
||||||
|
for(OsmandPlugin p : allPlugins) {
|
||||||
|
if(p.isActive()) {
|
||||||
|
lst.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T extends OsmandPlugin> T getEnabledPlugin(Class<T> clz) {
|
public static <T extends OsmandPlugin> T getEnabledPlugin(Class<T> clz) {
|
||||||
for(OsmandPlugin lr : activePlugins) {
|
for(OsmandPlugin lr : getEnabledPlugins()) {
|
||||||
if(clz.isInstance(lr)){
|
if(clz.isInstance(lr)){
|
||||||
return (T) lr;
|
return (T) lr;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +230,7 @@ public abstract class OsmandPlugin {
|
||||||
|
|
||||||
public static List<String> onIndexingFiles(IProgress progress) {
|
public static List<String> onIndexingFiles(IProgress progress) {
|
||||||
List<String> l = new ArrayList<String>();
|
List<String> l = new ArrayList<String>();
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
List<String> ls = plugin.indexingFiles(progress);
|
List<String> ls = plugin.indexingFiles(progress);
|
||||||
if(ls != null && ls.size() > 0) {
|
if(ls != null && ls.size() > 0) {
|
||||||
l.addAll(ls);
|
l.addAll(ls);
|
||||||
|
@ -207,45 +242,45 @@ public abstract class OsmandPlugin {
|
||||||
|
|
||||||
|
|
||||||
public static void onMapActivityCreate(MapActivity activity) {
|
public static void onMapActivityCreate(MapActivity activity) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.mapActivityCreate(activity);
|
plugin.mapActivityCreate(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onMapActivityResume(MapActivity activity) {
|
public static void onMapActivityResume(MapActivity activity) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.mapActivityResume(activity);
|
plugin.mapActivityResume(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onMapActivityPause(MapActivity activity) {
|
public static void onMapActivityPause(MapActivity activity) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.mapActivityPause(activity);
|
plugin.mapActivityPause(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onMapActivityDestroy(MapActivity activity) {
|
public static void onMapActivityDestroy(MapActivity activity) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.mapActivityDestroy(activity);
|
plugin.mapActivityDestroy(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onMapActivityResult(int requestCode, int resultCode, Intent data) {
|
public static void onMapActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.onMapActivityExternalResult(requestCode, resultCode, data);
|
plugin.onMapActivityExternalResult(requestCode, resultCode, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void onSettingsActivityCreate(SettingsActivity activity, PreferenceScreen screen) {
|
public static void onSettingsActivityCreate(SettingsActivity activity, PreferenceScreen screen) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.settingsActivityCreate(activity, screen);
|
plugin.settingsActivityCreate(activity, screen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean onDestinationReached() {
|
public static boolean onDestinationReached() {
|
||||||
boolean b = true;
|
boolean b = true;
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
if(!plugin.destinationReached()){
|
if(!plugin.destinationReached()){
|
||||||
b = false;
|
b = false;
|
||||||
}
|
}
|
||||||
|
@ -255,80 +290,70 @@ public abstract class OsmandPlugin {
|
||||||
|
|
||||||
|
|
||||||
public static void createLayers(OsmandMapTileView mapView, MapActivity activity) {
|
public static void createLayers(OsmandMapTileView mapView, MapActivity activity) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.registerLayers(activity);
|
plugin.registerLayers(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerMapContextMenu(MapActivity map, double latitude, double longitude, ContextMenuAdapter adapter, Object selectedObj) {
|
public static void registerMapContextMenu(MapActivity map, double latitude, double longitude, ContextMenuAdapter adapter, Object selectedObj) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.registerMapContextMenuActions(map, latitude, longitude, adapter, selectedObj);
|
plugin.registerMapContextMenuActions(map, latitude, longitude, adapter, selectedObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerLayerContextMenu(OsmandMapTileView mapView, ContextMenuAdapter adapter, MapActivity mapActivity) {
|
public static void registerLayerContextMenu(OsmandMapTileView mapView, ContextMenuAdapter adapter, MapActivity mapActivity) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.registerLayerContextMenuActions(mapView, adapter, mapActivity);
|
plugin.registerLayerContextMenuActions(mapView, adapter, mapActivity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerOptionsMenu(MapActivity map, ContextMenuAdapter helper) {
|
public static void registerOptionsMenu(MapActivity map, ContextMenuAdapter helper) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.registerOptionsMenuItems(map, helper);
|
plugin.registerOptionsMenuItems(map, helper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void onUpdateLocalIndexDescription(LocalIndexInfo info) {
|
public static void onUpdateLocalIndexDescription(LocalIndexInfo info) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.updateLocalIndexDescription(info);
|
plugin.updateLocalIndexDescription(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onLoadLocalIndexes(List<LocalIndexInfo> result, LoadLocalIndexTask loadTask) {
|
public static void onLoadLocalIndexes(List<LocalIndexInfo> result, LoadLocalIndexTask loadTask) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.loadLocalIndexes(result, loadTask);
|
plugin.loadLocalIndexes(result, loadTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onContextMenuActivity(Activity activity, Fragment fragment, Object info, ContextMenuAdapter adapter) {
|
public static void onContextMenuActivity(Activity activity, Fragment fragment, Object info, ContextMenuAdapter adapter) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.contextMenuLocalIndexes(activity, fragment, info, adapter);
|
plugin.contextMenuLocalIndexes(activity, fragment, info, adapter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void onOptionsMenuActivity(Activity activity, Fragment fragment, ContextMenuAdapter optionsMenuAdapter) {
|
public static void onOptionsMenuActivity(Activity activity, Fragment fragment, ContextMenuAdapter optionsMenuAdapter) {
|
||||||
for (OsmandPlugin plugin : activePlugins) {
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
plugin.optionsMenuLocalIndexes(activity, fragment, optionsMenuAdapter);
|
plugin.optionsMenuLocalIndexes(activity, fragment, optionsMenuAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static boolean installPlugin(String packageInfo,
|
private static boolean isPackageInstalled(String packageInfo,
|
||||||
String pluginId, OsmandApplication app, OsmandPlugin plugin) {
|
OsmandApplication app) {
|
||||||
|
if(packageInfo == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
boolean installed = false;
|
boolean installed = false;
|
||||||
try{
|
try{
|
||||||
installed = app.getPackageManager().getPackageInfo(packageInfo, 0) != null;
|
installed = app.getPackageManager().getPackageInfo(packageInfo, 0) != null;
|
||||||
} catch ( NameNotFoundException e){
|
} catch ( NameNotFoundException e){
|
||||||
}
|
}
|
||||||
|
return installed;
|
||||||
|
|
||||||
if(installed) {
|
|
||||||
installedPlugins.add(plugin);
|
|
||||||
if(!app.getSettings().getPlugins().contains("-"+pluginId)) {
|
|
||||||
app.getSettings().enablePlugin(pluginId, true);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if(app.getSettings().getPlugins().contains(pluginId)) {
|
|
||||||
app.getSettings().enablePlugin(pluginId, false);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean onMapActivityKeyUp(MapActivity mapActivity, int keyCode) {
|
public static boolean onMapActivityKeyUp(MapActivity mapActivity, int keyCode) {
|
||||||
for(OsmandPlugin p : installedPlugins){
|
for(OsmandPlugin p : getEnabledPlugins()){
|
||||||
if(p.mapActivityKeyUp(mapActivity, keyCode))
|
if(p.mapActivityKeyUp(mapActivity, keyCode))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -336,7 +361,7 @@ public abstract class OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateLocationPlugins(net.osmand.Location location) {
|
public static void updateLocationPlugins(net.osmand.Location location) {
|
||||||
for(OsmandPlugin p : installedPlugins){
|
for(OsmandPlugin p : getEnabledPlugins()){
|
||||||
p.updateLocation(location);
|
p.updateLocation(location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class Version {
|
||||||
|
|
||||||
|
|
||||||
public static boolean isGpsStatusEnabled(OsmandApplication ctx) {
|
public static boolean isGpsStatusEnabled(OsmandApplication ctx) {
|
||||||
return ctx.getString(R.string.versionFeatures).contains("+gps_status") && !isBlackberry(ctx);
|
return isGooglePlayEnabled(ctx) && !isBlackberry(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBlackberry(OsmandApplication ctx) {
|
public static boolean isBlackberry(OsmandApplication ctx) {
|
||||||
|
@ -41,18 +41,6 @@ public class Version {
|
||||||
return ctx.getString(R.string.versionFeatures).contains("+play_market");
|
return ctx.getString(R.string.versionFeatures).contains("+play_market");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFreeVersionEnabled(OsmandApplication ctx) {
|
|
||||||
return ctx.getString(R.string.versionFeatures).contains("+free_version");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isParkingPluginInlined(OsmandApplication ctx) {
|
|
||||||
return ctx.getString(R.string.versionFeatures).contains("+parking_plugin");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isRouteNavPluginInlined(OsmandApplication ctx) {
|
|
||||||
return ctx.getString(R.string.versionFeatures).contains("+route_nav");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isSherpafy(OsmandApplication ctx) {
|
public static boolean isSherpafy(OsmandApplication ctx) {
|
||||||
return ctx.getPackageName().equals(SHERPAFY_VERSION_NAME);
|
return ctx.getPackageName().equals(SHERPAFY_VERSION_NAME);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +91,7 @@ public class Version {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFreeVersion(OsmandApplication ctx){
|
public static boolean isFreeVersion(OsmandApplication ctx){
|
||||||
return ctx.getPackageName().equals(FREE_VERSION_NAME) || isFreeVersionEnabled(ctx);
|
return ctx.getPackageName().equals(FREE_VERSION_NAME);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ public class PluginActivity extends OsmandActionBarActivity {
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean isEnabled = OsmandPlugin.getEnabledPlugins().contains(plugin);
|
|
||||||
|
|
||||||
setContentView(R.layout.plugin);
|
setContentView(R.layout.plugin);
|
||||||
getSupportActionBar().setTitle(plugin.getName());
|
getSupportActionBar().setTitle(plugin.getName());
|
||||||
|
@ -64,7 +63,7 @@ public class PluginActivity extends OsmandActionBarActivity {
|
||||||
if (settingsActivity == null) {
|
if (settingsActivity == null) {
|
||||||
settingsButton.setVisibility(View.GONE);
|
settingsButton.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
settingsButton.setEnabled(isEnabled);
|
settingsButton.setEnabled(plugin.isActive());
|
||||||
settingsButton.setVisibility(View.VISIBLE);
|
settingsButton.setVisibility(View.VISIBLE);
|
||||||
settingsButton.setOnClickListener(new View.OnClickListener() {
|
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,13 +75,12 @@ public class PluginActivity extends OsmandActionBarActivity {
|
||||||
|
|
||||||
CompoundButton enableDisableButton = (CompoundButton)findViewById(
|
CompoundButton enableDisableButton = (CompoundButton)findViewById(
|
||||||
R.id.plugin_enable_disable);
|
R.id.plugin_enable_disable);
|
||||||
enableDisableButton.setChecked(isEnabled);
|
enableDisableButton.setChecked(plugin.isActive());
|
||||||
enableDisableButton.setOnCheckedChangeListener(
|
enableDisableButton.setOnCheckedChangeListener(
|
||||||
new CompoundButton.OnCheckedChangeListener() {
|
new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
boolean isEnabled = OsmandPlugin.getEnabledPlugins().contains(plugin);
|
if (plugin.isActive() == isChecked) {
|
||||||
if (isEnabled == isChecked) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,8 +97,7 @@ public class PluginActivity extends OsmandActionBarActivity {
|
||||||
|
|
||||||
CompoundButton enableDisableButton = (CompoundButton)findViewById(
|
CompoundButton enableDisableButton = (CompoundButton)findViewById(
|
||||||
R.id.plugin_enable_disable);
|
R.id.plugin_enable_disable);
|
||||||
boolean isEnabled = OsmandPlugin.getEnabledPlugins().contains(plugin);
|
enableDisableButton.setChecked(plugin.isActive());
|
||||||
enableDisableButton.setChecked(isEnabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -77,7 +77,6 @@ public class PluginsActivity extends OsmandListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
final OsmandPlugin plugin = getItem(position);
|
final OsmandPlugin plugin = getItem(position);
|
||||||
final boolean isEnabled = OsmandPlugin.getEnabledPlugins().contains(plugin);
|
|
||||||
|
|
||||||
view.setTag(plugin);
|
view.setTag(plugin);
|
||||||
|
|
||||||
|
@ -86,7 +85,7 @@ public class PluginsActivity extends OsmandListActivity {
|
||||||
|
|
||||||
TextView pluginName = (TextView)view.findViewById(R.id.plugin_name);
|
TextView pluginName = (TextView)view.findViewById(R.id.plugin_name);
|
||||||
pluginName.setText(plugin.getName());
|
pluginName.setText(plugin.getName());
|
||||||
pluginName.setContentDescription(plugin.getName() + " " + getString(isEnabled
|
pluginName.setContentDescription(plugin.getName() + " " + getString(plugin.isActive()
|
||||||
? R.string.item_checked
|
? R.string.item_checked
|
||||||
: R.string.item_unchecked));
|
: R.string.item_unchecked));
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ public class PluginsActivity extends OsmandListActivity {
|
||||||
pluginDescription.setText(plugin.getDescription());
|
pluginDescription.setText(plugin.getDescription());
|
||||||
|
|
||||||
View pluginIsEnabled = view.findViewById(R.id.plugin_is_enabled);
|
View pluginIsEnabled = view.findViewById(R.id.plugin_is_enabled);
|
||||||
pluginIsEnabled.setVisibility(isEnabled ? View.VISIBLE : View.INVISIBLE);
|
pluginIsEnabled.setVisibility(plugin.isActive() ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
|
||||||
View pluginOptions = view.findViewById(R.id.plugin_options);
|
View pluginOptions = view.findViewById(R.id.plugin_options);
|
||||||
pluginOptions.setOnClickListener(new View.OnClickListener() {
|
pluginOptions.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -109,18 +108,17 @@ public class PluginsActivity extends OsmandListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showOptionsMenu(View v, final OsmandPlugin plugin) {
|
private void showOptionsMenu(View v, final OsmandPlugin plugin) {
|
||||||
final boolean isEnabled = OsmandPlugin.getEnabledPlugins().contains(plugin);
|
|
||||||
final Class<? extends Activity> settingsActivity = plugin.getSettingsActivity();
|
final Class<? extends Activity> settingsActivity = plugin.getSettingsActivity();
|
||||||
|
|
||||||
final PopupMenu optionsMenu = new PopupMenu(this, v);
|
final PopupMenu optionsMenu = new PopupMenu(this, v);
|
||||||
|
|
||||||
MenuItem enableDisableItem = optionsMenu.getMenu().add(isEnabled
|
MenuItem enableDisableItem = optionsMenu.getMenu().add(plugin.isActive()
|
||||||
? R.string.disable_plugin
|
? R.string.disable_plugin
|
||||||
: R.string.enable_plugin);
|
: R.string.enable_plugin);
|
||||||
enableDisableItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
enableDisableItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
enableDisablePlugin(plugin, !isEnabled);
|
enableDisablePlugin(plugin, !plugin.isActive());
|
||||||
optionsMenu.dismiss();
|
optionsMenu.dismiss();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +134,7 @@ public class PluginsActivity extends OsmandListActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
settingsItem.setEnabled(isEnabled);
|
settingsItem.setEnabled(plugin.isActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
optionsMenu.show();
|
optionsMenu.show();
|
||||||
|
|
|
@ -1,21 +1,25 @@
|
||||||
package net.osmand.plus.dashboard;
|
package net.osmand.plus.audionotes;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.view.*;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
|
||||||
import net.osmand.plus.OsmandPlugin;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
|
||||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Denis
|
* Created by Denis
|
|
@ -1,5 +1,13 @@
|
||||||
package net.osmand.plus.dashboard;
|
package net.osmand.plus.audionotes;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||||
|
import net.osmand.plus.helpers.FontCache;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -14,15 +22,6 @@ import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandPlugin;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.activities.MapActivity;
|
|
||||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
|
||||||
import net.osmand.plus.helpers.FontCache;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Denis
|
* Created by Denis
|
||||||
* on 15.12.2014.
|
* on 15.12.2014.
|
|
@ -6,7 +6,6 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.PluginActivity;
|
import net.osmand.plus.activities.PluginActivity;
|
||||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -28,12 +27,9 @@ public class DashPluginsFragment extends DashBaseFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
OsmandPlugin plugin = (OsmandPlugin)buttonView.getTag();
|
OsmandPlugin plugin = (OsmandPlugin)buttonView.getTag();
|
||||||
boolean isEnabled = OsmandPlugin.getEnabledPlugins().contains(plugin);
|
if (plugin.isActive() == isChecked) {
|
||||||
|
|
||||||
if (isEnabled == isChecked) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OsmandPlugin.enablePlugin(getMyApplication(), plugin, isChecked);
|
OsmandPlugin.enablePlugin(getMyApplication(), plugin, isChecked);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -72,7 +68,7 @@ public class DashPluginsFragment extends DashBaseFragment {
|
||||||
});
|
});
|
||||||
|
|
||||||
LinearLayout pluginsContainer = (LinearLayout) contentView.findViewById(R.id.plugins);
|
LinearLayout pluginsContainer = (LinearLayout) contentView.findViewById(R.id.plugins);
|
||||||
List<OsmandPlugin> enabledPlugins = OsmandPlugin.getEnabledPlugins();
|
List<OsmandPlugin> enabledPlugins = OsmandPlugin.getAvailablePlugins();
|
||||||
for(OsmandPlugin plugin : enabledPlugins) {
|
for(OsmandPlugin plugin : enabledPlugins) {
|
||||||
if (plugin instanceof OsmandDevelopmentPlugin) {
|
if (plugin instanceof OsmandDevelopmentPlugin) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -107,11 +103,10 @@ public class DashPluginsFragment extends DashBaseFragment {
|
||||||
}
|
}
|
||||||
LinearLayout pluginsContainer = (LinearLayout) contentView.findViewById(R.id.plugins);
|
LinearLayout pluginsContainer = (LinearLayout) contentView.findViewById(R.id.plugins);
|
||||||
|
|
||||||
List<OsmandPlugin> enabledPlugins = OsmandPlugin.getEnabledPlugins();
|
|
||||||
for (int pluginIndex = 0; pluginIndex < pluginsContainer.getChildCount(); pluginIndex++) {
|
for (int pluginIndex = 0; pluginIndex < pluginsContainer.getChildCount(); pluginIndex++) {
|
||||||
View pluginView = pluginsContainer.getChildAt(pluginIndex);
|
View pluginView = pluginsContainer.getChildAt(pluginIndex);
|
||||||
OsmandPlugin plugin = (OsmandPlugin)pluginView.getTag();
|
OsmandPlugin plugin = (OsmandPlugin)pluginView.getTag();
|
||||||
boolean isEnabled = enabledPlugins.contains(plugin);
|
boolean isEnabled = plugin.isActive();
|
||||||
|
|
||||||
CompoundButton enableDisableButton = (CompoundButton) pluginView.findViewById(
|
CompoundButton enableDisableButton = (CompoundButton) pluginView.findViewById(
|
||||||
R.id.check_item);
|
R.id.check_item);
|
||||||
|
@ -121,7 +116,6 @@ public class DashPluginsFragment extends DashBaseFragment {
|
||||||
|
|
||||||
private void inflatePluginView(LayoutInflater inflater, ViewGroup container,
|
private void inflatePluginView(LayoutInflater inflater, ViewGroup container,
|
||||||
OsmandPlugin plugin) {
|
OsmandPlugin plugin) {
|
||||||
boolean isEnabled = OsmandPlugin.getEnabledPlugins().contains(plugin);
|
|
||||||
|
|
||||||
View view = inflater.inflate(R.layout.dash_plugin_item, container, false);
|
View view = inflater.inflate(R.layout.dash_plugin_item, container, false);
|
||||||
view.setTag(plugin);
|
view.setTag(plugin);
|
||||||
|
@ -143,7 +137,7 @@ public class DashPluginsFragment extends DashBaseFragment {
|
||||||
|
|
||||||
CompoundButton enableDisableButton = (CompoundButton)view.findViewById(R.id.check_item);
|
CompoundButton enableDisableButton = (CompoundButton)view.findViewById(R.id.check_item);
|
||||||
enableDisableButton.setTag(plugin);
|
enableDisableButton.setTag(plugin);
|
||||||
enableDisableButton.setChecked(isEnabled);
|
enableDisableButton.setChecked(plugin.isActive());
|
||||||
enableDisableButton.setOnCheckedChangeListener(enableDisableListener);
|
enableDisableButton.setOnCheckedChangeListener(enableDisableListener);
|
||||||
|
|
||||||
container.addView(view);
|
container.addView(view);
|
||||||
|
|
|
@ -305,7 +305,6 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
||||||
public void categorizationFinished(List<IndexItem> filtered, List<IndexItemCategory> cats) {
|
public void categorizationFinished(List<IndexItem> filtered, List<IndexItemCategory> cats) {
|
||||||
Map<String, String> indexActivatedFileNames = getDownloadActivity().getIndexActivatedFileNames();
|
Map<String, String> indexActivatedFileNames = getDownloadActivity().getIndexActivatedFileNames();
|
||||||
Map<String, String> indexFileNames = getDownloadActivity().getIndexFileNames();
|
Map<String, String> indexFileNames = getDownloadActivity().getIndexFileNames();
|
||||||
DownloadActivityType type = getDownloadActivity().getDownloadType();
|
|
||||||
DownloadIndexAdapter a = ((DownloadIndexAdapter) getExpandableListAdapter());
|
DownloadIndexAdapter a = ((DownloadIndexAdapter) getExpandableListAdapter());
|
||||||
if (a == null){
|
if (a == null){
|
||||||
return;
|
return;
|
||||||
|
@ -314,25 +313,5 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
||||||
a.setIndexFiles(filtered, cats);
|
a.setIndexFiles(filtered, cats);
|
||||||
a.notifyDataSetChanged();
|
a.notifyDataSetChanged();
|
||||||
a.getFilter().filter(getFilterText());
|
a.getFilter().filter(getFilterText());
|
||||||
if ((type == DownloadActivityType.SRTM_COUNTRY_FILE || type == DownloadActivityType.HILLSHADE_FILE)
|
|
||||||
&& OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) instanceof SRTMPlugin
|
|
||||||
&& !OsmandPlugin.getEnabledPlugin(SRTMPlugin.class).isPaid()) {
|
|
||||||
AlertDialog.Builder msg = new AlertDialog.Builder(getDownloadActivity());
|
|
||||||
msg.setTitle(R.string.srtm_paid_version_title);
|
|
||||||
msg.setMessage(R.string.srtm_paid_version_msg);
|
|
||||||
msg.setNegativeButton(R.string.button_upgrade_osmandplus, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:net.osmand.srtmPlugin.paid"));
|
|
||||||
try {
|
|
||||||
getDownloadActivity().startActivity(intent);
|
|
||||||
} catch (ActivityNotFoundException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
msg.setPositiveButton(R.string.default_buttons_ok, null);
|
|
||||||
msg.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
package net.osmand.plus.dashboard;
|
package net.osmand.plus.monitoring;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.IndexConstants;
|
||||||
|
import net.osmand.plus.GPXUtilities;
|
||||||
|
import net.osmand.plus.OsmAndAppCustomization;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||||
|
import net.osmand.plus.helpers.FontCache;
|
||||||
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
@ -10,15 +20,6 @@ import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import net.osmand.IndexConstants;
|
|
||||||
import net.osmand.plus.GPXUtilities;
|
|
||||||
import net.osmand.plus.OsmAndAppCustomization;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.helpers.FontCache;
|
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Denis
|
* Created by Denis
|
|
@ -0,0 +1,45 @@
|
||||||
|
package net.osmand.plus.openseamapsplugin;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
|
public class OpenSeaMapsPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
|
public static final String ID = "openseamaps.plugin";
|
||||||
|
public static final String COMPONENT = "net.osmand.openseamapsPlugin";
|
||||||
|
private OsmandApplication app;
|
||||||
|
|
||||||
|
|
||||||
|
public OpenSeaMapsPlugin(OsmandApplication app) {
|
||||||
|
this.app = app;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "This will be a plugin enabling openseamaps (TODO)";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Open Sea Maps";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init(final OsmandApplication app) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Activity> getSettingsActivity() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,9 @@
|
||||||
package net.osmand.plus.dashboard;
|
package net.osmand.plus.osmedit;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||||
|
import net.osmand.plus.helpers.FontCache;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -7,10 +11,6 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.helpers.FontCache;
|
|
||||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Denis
|
* Created by Denis
|
|
@ -1,5 +1,9 @@
|
||||||
package net.osmand.plus.dashboard;
|
package net.osmand.plus.osmo;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||||
|
import net.osmand.plus.helpers.FontCache;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -7,10 +11,6 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.helpers.FontCache;
|
|
||||||
import net.osmand.plus.osmo.OsMoPlugin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Denis
|
* Created by Denis
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.plus.dashboard;
|
package net.osmand.plus.parkingpoint;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -15,8 +15,8 @@ import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||||
import net.osmand.plus.helpers.FontCache;
|
import net.osmand.plus.helpers.FontCache;
|
||||||
import net.osmand.plus.parkingpoint.ParkingPositionPlugin;
|
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -43,6 +43,7 @@ import android.widget.TimePicker;
|
||||||
public class ParkingPositionPlugin extends OsmandPlugin {
|
public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
public static final String ID = "osmand.parking.position";
|
public static final String ID = "osmand.parking.position";
|
||||||
|
public static final String PARKING_PLUGIN_COMPONENT = "net.osmand.parkingPlugin"; //$NON-NLS-1$
|
||||||
public final static String PARKING_POINT_LAT = "parking_point_lat"; //$NON-NLS-1$
|
public final static String PARKING_POINT_LAT = "parking_point_lat"; //$NON-NLS-1$
|
||||||
public final static String PARKING_POINT_LON = "parking_point_lon"; //$NON-NLS-1$
|
public final static String PARKING_POINT_LON = "parking_point_lon"; //$NON-NLS-1$
|
||||||
public final static String PARKING_TYPE = "parking_type"; //$NON-NLS-1$
|
public final static String PARKING_TYPE = "parking_type"; //$NON-NLS-1$
|
||||||
|
|
|
@ -35,7 +35,7 @@ import android.view.View;
|
||||||
public class RoutePointsPlugin extends OsmandPlugin {
|
public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
public static final String ID = "osmand.route.stepsPlugin";
|
public static final String ID = "osmand.route.stepsPlugin";
|
||||||
|
public static final String ROUTE_POINTS_PLUGIN_COMPONENT = "net.osmand.routePointsPlugin";
|
||||||
private static final String VISITED_KEY = "VISITED_KEY";
|
private static final String VISITED_KEY = "VISITED_KEY";
|
||||||
private static final String DELIVERED_KEY = "DELIVERED_KEY";
|
private static final String DELIVERED_KEY = "DELIVERED_KEY";
|
||||||
|
|
||||||
|
|
43
OsmAnd/src/net/osmand/plus/skimapsplugin/SkiMapsPlugin.java
Normal file
43
OsmAnd/src/net/osmand/plus/skimapsplugin/SkiMapsPlugin.java
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
package net.osmand.plus.skimapsplugin;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
|
public class SkiMapsPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
|
public static final String ID = "skimaps.plugin";
|
||||||
|
public static final String COMPONENT = "net.osmand.skimapsPlugin";
|
||||||
|
private OsmandApplication app;
|
||||||
|
|
||||||
|
public SkiMapsPlugin(OsmandApplication app) {
|
||||||
|
this.app = app;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "This will be a plugin enabling ski maps (TODO)";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Ski Maps";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init(final OsmandApplication app) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Activity> getSettingsActivity() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,24 +27,10 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
return paid ? ID : FREE_ID;
|
return paid ? ID : FREE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SRTMPlugin(OsmandApplication app, boolean paid) {
|
public SRTMPlugin(OsmandApplication app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.paid = paid;
|
|
||||||
OsmandSettings settings = app.getSettings();
|
|
||||||
CommonPreference<String> pref = settings.getCustomRenderProperty("contourLines");
|
|
||||||
if(pref.get().equals("")) {
|
|
||||||
for(ApplicationMode m : ApplicationMode.allPossibleValues()) {
|
|
||||||
if(pref.getModeValue(m).equals("")) {
|
|
||||||
pref.setModeValue(m, "13");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPaid() {
|
|
||||||
return paid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
|
@ -59,6 +45,15 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
@Override
|
@Override
|
||||||
public boolean init(final OsmandApplication app) {
|
public boolean init(final OsmandApplication app) {
|
||||||
HILLSHADE = app.getSettings().registerBooleanPreference("hillshade_layer", true);
|
HILLSHADE = app.getSettings().registerBooleanPreference("hillshade_layer", true);
|
||||||
|
OsmandSettings settings = app.getSettings();
|
||||||
|
CommonPreference<String> pref = settings.getCustomRenderProperty("contourLines");
|
||||||
|
if(pref.get().equals("")) {
|
||||||
|
for(ApplicationMode m : ApplicationMode.allPossibleValues()) {
|
||||||
|
if(pref.getModeValue(m).equals("")) {
|
||||||
|
pref.setModeValue(m, "13");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue