Merge branch 'master' of github.com:osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2015-11-01 17:04:47 +01:00
commit bfd66a259f
11 changed files with 146 additions and 18 deletions

View file

@ -4,7 +4,7 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?attr/bottom_menu_view_bg"
tools:context="net.osmand.plus.download.ui.DataStoragePlaceDialogFragment">
tools:context="net.osmand.plus.download.ui.popups.DataStoragePlaceDialogFragment">
<ImageView
android:id="@+id/folderIconImageView"

View file

@ -208,4 +208,8 @@
<string name="poi_historic_railway">Historisk jernbane</string>
</resources>
<string name="poi_bathing_no">Bading: nei</string>
<string name="poi_temperature">Temperatur</string>
<string name="poi_bathing_yes">Bading: ja</string>
</resources>

View file

@ -1433,15 +1433,15 @@
<string name="recent_places">Nylige steder</string>
<string name="saved_at_time">Vellykket lagret: %1$s</string>
<string name="new_version">Ny versjon</string>
<string name="begin_with_osmand_menu_group">Begynn med OsmAnd</string>
<string name="begin_with_osmand_menu_group">Første steg med OsmAnd</string>
<string name="features_menu_group">Funksjoner</string>
<string name="help_us_to_improve_menu_group">Hjelp oss å forbedre OsmAnd</string>
<string name="plugins_menu_group">Programtillegg</string>
<string name="first_usage_item">Første bruk</string>
<string name="first_usage_item_description">Hvordan laste ned kart, grunnleggende innstillinger</string>
<string name="first_usage_item_description">Hvordan laste ned kart, angi grunnleggende innstillinger</string>
<string name="faq_item_description">Hvordan bruke programtillegg</string>
<string name="map_viewing_item">Kartvisning</string>
<string name="search_on_the_map_item">Søk på kartet</string>
<string name="search_on_the_map_item">Kartsøking</string>
<string name="contour_lines_and_hillshade_maps_item">Kart med koter og relieffskygger</string>
<string name="osmand_ski_maps_item">OsmAnd skikart</string>
<string name="nautical_charts_item">Sjøkart</string>
@ -1449,4 +1449,5 @@
<string name="osm_editing_item">OSM-redigering</string>
<string name="versions_item">Versjoner</string>
<string name="contact_us">Kontakt oss</string>
</resources>
<string name="planning_trip_item">Planlegge en tur</string>
</resources>

View file

@ -36,11 +36,11 @@ import net.osmand.plus.activities.TabActivity;
import net.osmand.plus.base.BasicProgressAsyncTask;
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.download.ui.ActiveDownloadsDialogFragment;
import net.osmand.plus.download.ui.DataStoragePlaceDialogFragment;
import net.osmand.plus.download.ui.popups.DataStoragePlaceDialogFragment;
import net.osmand.plus.download.ui.LocalIndexesFragment;
import net.osmand.plus.download.ui.UpdatesIndexFragment;
import net.osmand.plus.download.ui.popups.AskMapDownloadFragment;
import net.osmand.plus.download.ui.popups.DownloadResourceGroupFragment;
import net.osmand.plus.download.ui.DownloadResourceGroupFragment;
import net.osmand.plus.download.ui.popups.GoToMapFragment;
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
import net.osmand.plus.srtmplugin.SRTMPlugin;

View file

@ -1,4 +1,4 @@
package net.osmand.plus.download.ui.popups;
package net.osmand.plus.download.ui;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
@ -31,8 +31,6 @@ import net.osmand.plus.download.DownloadResourceGroup;
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.download.ui.ItemViewHolder;
import net.osmand.plus.download.ui.SearchDialogFragment;
import net.osmand.util.Algorithms;
import java.util.ArrayList;

View file

@ -33,7 +33,6 @@ import net.osmand.plus.download.DownloadResourceGroup;
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.download.ui.popups.DownloadResourceGroupFragment;
import net.osmand.util.Algorithms;
import java.util.ArrayList;

View file

@ -1,4 +1,4 @@
package net.osmand.plus.download.ui;
package net.osmand.plus.download.ui.popups;
import android.app.Activity;
import android.app.Dialog;

View file

@ -7,6 +7,8 @@ import net.osmand.data.Amenity;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
@ -23,6 +25,7 @@ import net.osmand.plus.mapcontextmenu.controllers.ParkingPositionMenuController;
import net.osmand.plus.mapcontextmenu.controllers.PointDescriptionMenuController;
import net.osmand.plus.mapcontextmenu.controllers.AudioVideoNoteMenuController;
import net.osmand.plus.mapcontextmenu.controllers.TargetPointMenuController;
import net.osmand.plus.mapcontextmenu.controllers.WptPtMenuController;
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
import net.osmand.plus.osmedit.OsmPoint;
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
@ -99,6 +102,8 @@ public abstract class MenuController extends BaseMenuController {
menuController = new AudioVideoNoteMenuController(app, mapActivity, (Recording) object);
} else if (object instanceof OsmPoint) {
menuController = new EditPOIMenuController(app, mapActivity, pointDescription, (OsmPoint) object);
} else if (object instanceof WptPt) {
menuController = new WptPtMenuController(app, mapActivity, (WptPt) object);
} else if (object instanceof LatLon) {
if (pointDescription.isParking()) {
menuController = new ParkingPositionMenuController(app, mapActivity, pointDescription);

View file

@ -0,0 +1,36 @@
package net.osmand.plus.mapcontextmenu.builders;
import android.view.View;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.util.Algorithms;
public class WptPtMenuBuilder extends MenuBuilder {
private final WptPt wpt;
public WptPtMenuBuilder(OsmandApplication app, final WptPt wpt) {
super(app);
this.wpt = wpt;
}
@Override
protected boolean needBuildPlainMenuItems() {
return false;
}
@Override
public void build(View view) {
super.build(view);
if (!Algorithms.isEmpty(wpt.desc)) {
buildRow(view, R.drawable.ic_action_note_dark, wpt.desc, 0);
}
buildPlainMenuItems(view);
}
}

View file

@ -0,0 +1,77 @@
package net.osmand.plus.mapcontextmenu.controllers;
import android.graphics.drawable.Drawable;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.builders.FavouritePointMenuBuilder;
import net.osmand.plus.mapcontextmenu.builders.WptPtMenuBuilder;
import net.osmand.util.Algorithms;
public class WptPtMenuController extends MenuController {
private WptPt wpt;
public WptPtMenuController(OsmandApplication app, MapActivity mapActivity, final WptPt wpt) {
super(new WptPtMenuBuilder(app, wpt), mapActivity);
this.wpt = wpt;
}
@Override
protected int getSupportedMenuStatesPortrait() {
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
}
/*
@Override
public boolean handleSingleTapOnMap() {
Fragment fragment = getMapActivity().getSupportFragmentManager().findFragmentByTag(FavoritePointEditor.TAG);
if (fragment != null) {
((FavoritePointEditorFragment)fragment).dismiss();
return true;
}
return false;
}
*/
@Override
public boolean needStreetName() {
return false;
}
@Override
public boolean needTypeStr() {
return true;
}
@Override
public Drawable getLeftIcon() {
return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), wpt.getColor(), 0);
}
@Override
public Drawable getSecondLineIcon() {
return getIcon(R.drawable.ic_small_group);
}
/*
@Override
public int getFavActionIconId() {
return R.drawable.ic_action_edit_dark;
}
*/
@Override
public String getTypeStr() {
return wpt.category != null ? wpt.category : getMapActivity().getString(R.string.shared_string_none);
}
@Override
public String getNameStr() {
return wpt.name != null ? wpt.name : getMapActivity().getString(R.string.gpx_wpt);
}
}

View file

@ -261,6 +261,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
}
addOrRemoveParkingEvent(false);
setParkingPosition(mapActivity, latitude, longitude, false);
showContextMenuIfNeeded(mapActivity);
mapActivity.getMapView().refreshMap();
}
});
@ -269,6 +270,16 @@ public class ParkingPositionPlugin extends OsmandPlugin {
}
private void showContextMenuIfNeeded(final MapActivity mapActivity) {
if (parkingLayer != null) {
MapContextMenu menu = mapActivity.getContextMenu();
if (menu.isVisible()) {
menu.show(new LatLon(parkingPosition.getLatitude(), parkingPosition.getLongitude()),
parkingLayer.getObjectName(parkingPosition), parkingPosition);
}
}
}
/**
* Method creates confirmation dialog for deletion of a parking location.
*/
@ -361,6 +372,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
} else {
addOrRemoveParkingEvent(false);
}
showContextMenuIfNeeded(mapActivity);
}
});
setTime.create();
@ -412,10 +424,6 @@ public class ParkingPositionPlugin extends OsmandPlugin {
setParkingType(isLimited);
setParkingStartTime(Calendar.getInstance().getTimeInMillis());
if (parkingLayer != null) {
MapContextMenu menu = mapActivity.getContextMenu();
if (menu.isVisible()) {
menu.show(new LatLon(latitude, longitude), parkingLayer.getObjectName(parkingPosition), parkingPosition);
}
parkingLayer.refresh();
}
}