Merge branch 'master' of github.com:osmandapp/Osmand
This commit is contained in:
commit
bf060c12d9
17 changed files with 387 additions and 66 deletions
|
@ -2020,4 +2020,6 @@
|
||||||
<string name="save_poi_without_poi_type_message">Gem IP uden at angive type?</string>
|
<string name="save_poi_without_poi_type_message">Gem IP uden at angive type?</string>
|
||||||
<string name="poi_context_menu_modify_osm_change">Rediger OSM ændring</string>
|
<string name="poi_context_menu_modify_osm_change">Rediger OSM ændring</string>
|
||||||
<string name="shared_string_location">Placering</string>
|
<string name="shared_string_location">Placering</string>
|
||||||
|
<string name="context_menu_item_delete_waypoint">Slet GPX-rutepunkt?</string>
|
||||||
|
<string name="context_menu_item_edit_waypoint">Rediger GPX-rutepunkt</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1388,4 +1388,66 @@
|
||||||
<string name="poi_payment_credit_cards_no">Neprijíma kreditné karty</string>
|
<string name="poi_payment_credit_cards_no">Neprijíma kreditné karty</string>
|
||||||
<string name="poi_traffic_calming_island">Ostrovček v ceste</string>
|
<string name="poi_traffic_calming_island">Ostrovček v ceste</string>
|
||||||
<string name="poi_tourism_yes">Turistický objekt</string>
|
<string name="poi_tourism_yes">Turistický objekt</string>
|
||||||
|
<string name="poi_buoy_isolated_danger">Bója izolovaného nebezpečenstva</string>
|
||||||
|
<string name="poi_seamark_light">Svetlo, námorná značka</string>
|
||||||
|
<string name="poi_seamark_light_major">Významné svetlo, námorná značka</string>
|
||||||
|
<string name="poi_seamark_light_minor">Druhoradé svetlo, námorná značka</string>
|
||||||
|
<string name="poi_seamark_light_float">Plávajúce svetlo, námorná značka</string>
|
||||||
|
<string name="poi_seamark_light_vessel">Svetlo plavidla, námorná značka</string>
|
||||||
|
<string name="poi_notice">Upozornenie, námorná značka</string>
|
||||||
|
<string name="poi_radar_transponder">Radarový vysielač, námorná značka</string>
|
||||||
|
<string name="poi_debris">Trosky</string>
|
||||||
|
<string name="poi_jersey_barrier">Skladacia bariéra</string>
|
||||||
|
<string name="poi_animal_shelter">Prístrešok pre zvieratá</string>
|
||||||
|
<string name="poi_payment_notes_yes">Prijíma bankovky</string>
|
||||||
|
<string name="poi_payment_notes_no">Neprijíma bankovky</string>
|
||||||
|
<string name="poi_payment_electronic_purses_yes">Prijíma elektronické peňaženky</string>
|
||||||
|
<string name="poi_payment_electronic_purses_no">Neprijíma elektronické peňaženky</string>
|
||||||
|
<string name="poi_payment_cash_yes">Prijíma hotovosť</string>
|
||||||
|
<string name="poi_payment_cash_no">Neprijíma hotovosť</string>
|
||||||
|
<string name="poi_payment_debit_cards_yes">Prijíma debetné karty</string>
|
||||||
|
<string name="poi_payment_debit_cards_no">Neprijíma debetné karty</string>
|
||||||
|
<string name="poi_payment_bitcoin_yes">Prijíma Bitcoin</string>
|
||||||
|
<string name="poi_payment_bitcoin_no">Neprijíma Bitcoin</string>
|
||||||
|
<string name="poi_payment_visa_yes">Prijíma Visa karty</string>
|
||||||
|
<string name="poi_payment_visa_no">Neprijíma Visa karty</string>
|
||||||
|
<string name="poi_payment_mastercard_yes">Prijíma MasterCard karty</string>
|
||||||
|
<string name="poi_payment_mastercard_no">Neprijíma MasterCard karty</string>
|
||||||
|
<string name="poi_payment_none">Bez poplatku</string>
|
||||||
|
<string name="poi_payment_account_cards_yes">Prijíma účtové karty</string>
|
||||||
|
<string name="poi_payment_account_cards_no">Neprijíma účtové karty</string>
|
||||||
|
<string name="poi_payment_maestro_yes">Prijíma Maestro karty</string>
|
||||||
|
<string name="poi_payment_maestro_no">Neprijíma Maestro karty</string>
|
||||||
|
<string name="poi_payment_american_express_yes">Prijíma American Express (AMEX) karty</string>
|
||||||
|
<string name="poi_payment_american_express_no">Neprijíma American Express (AMEX) karty</string>
|
||||||
|
<string name="poi_payment_diners_club_yes">Prijíma Diners Club karty</string>
|
||||||
|
<string name="poi_payment_diners_club_no">Neprijíma Diners Club karty</string>
|
||||||
|
<string name="poi_payment_dkv_yes">Prijíma DKV</string>
|
||||||
|
<string name="poi_payment_dkv_no">Neprijíma DKV</string>
|
||||||
|
<string name="poi_payment_uta_yes">Prijíma UTA karty</string>
|
||||||
|
<string name="poi_payment_uta_no">Neprijíma UTA karty</string>
|
||||||
|
<string name="poi_payment_efectivo_yes">Prijíma Efectivo</string>
|
||||||
|
<string name="poi_payment_efectivo_no">Neprijíma Efectivo</string>
|
||||||
|
<string name="poi_payment_girocard_yes">Prijíma Girocard</string>
|
||||||
|
<string name="poi_payment_girocard_no">Neprijíma Girocard</string>
|
||||||
|
<string name="poi_payment_discover_card_yes">Prijíma Discover karty</string>
|
||||||
|
<string name="poi_payment_discover_card_no">Neprijíma Discover karty</string>
|
||||||
|
<string name="poi_payment_visa_electron_yes">Prijíma Visa Electron karty</string>
|
||||||
|
<string name="poi_payment_visa_electron_no">Neprijíma Visa Electron karty</string>
|
||||||
|
<string name="poi_payment_litecoin_yes">Prijíma Litecoin</string>
|
||||||
|
<string name="poi_payment_litecoin_no">Neprijíma Litecoin</string>
|
||||||
|
<string name="poi_payment_cheque_yes">Prijíma šeky</string>
|
||||||
|
<string name="poi_payment_cheque_no">Neprijíma šeky</string>
|
||||||
|
<string name="poi_payment_pikepass_yes">Prijíma PIKEPASS</string>
|
||||||
|
<string name="poi_payment_pikepass_no">Neprijíma PIKEPASS</string>
|
||||||
|
<string name="poi_payment_pikepass_designated">Prijíma PIKEPASS (designated)</string>
|
||||||
|
<string name="poi_payment_visa_debit_yes">Prijíma Visa debetné karty</string>
|
||||||
|
<string name="poi_payment_visa_debit_no">Neprijíma Visa debetné karty</string>
|
||||||
|
<string name="poi_payment_cryptocurrencies_no">Neprijíma kryptomeny</string>
|
||||||
|
<string name="poi_payment_others_yes">Prijíma iné spôsoby platby</string>
|
||||||
|
<string name="poi_payment_others_no">Neprijíma iné spôsoby platby</string>
|
||||||
|
<string name="poi_payment_routex_yes">Prijíma Routex palivové karty</string>
|
||||||
|
<string name="poi_payment_routex_no">Neprijíma Routex palivové karty</string>
|
||||||
|
<string name="poi_payment_bancomat_yes">Prijíma Bancomat</string>
|
||||||
|
<string name="poi_payment_bancomat_no">Prijíma Bancomat</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||||
-->
|
-->
|
||||||
|
<string name="context_menu_item_delete_waypoint">Delete GPX waypoint?</string>
|
||||||
|
<string name="context_menu_item_edit_waypoint">Edit GPX waypoint</string>
|
||||||
<string name="shared_string_location">Location</string>
|
<string name="shared_string_location">Location</string>
|
||||||
<string name="share_osm_edits_subject">Osm Edits shared via OsmAnd</string>
|
<string name="share_osm_edits_subject">Osm Edits shared via OsmAnd</string>
|
||||||
<string name="lang_nds">Low German</string>
|
<string name="lang_nds">Low German</string>
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.graphics.Color;
|
||||||
|
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.LocationPoint;
|
import net.osmand.data.LocationPoint;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -581,7 +582,7 @@ public class GPXUtilities {
|
||||||
return g ;
|
return g ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean hasRtePt() {
|
public boolean hasRtePt() {
|
||||||
for(Route r : routes) {
|
for(Route r : routes) {
|
||||||
if(r.points.size() > 0) {
|
if(r.points.size() > 0) {
|
||||||
|
@ -605,7 +606,23 @@ public class GPXUtilities {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateWptPt(WptPt pt, double lat, double lon, long time, String description, String name, String category, int color) {
|
||||||
|
pt.lat = lat;
|
||||||
|
pt.lon = lon;
|
||||||
|
pt.time = time;
|
||||||
|
pt.desc = description;
|
||||||
|
pt.name = name;
|
||||||
|
pt.category = category;
|
||||||
|
if (color != 0) {
|
||||||
|
pt.setColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean deleteWptPt(WptPt pt) {
|
||||||
|
return points.remove(pt);
|
||||||
|
}
|
||||||
|
|
||||||
public List<TrkSegment> processRoutePoints() {
|
public List<TrkSegment> processRoutePoints() {
|
||||||
List<TrkSegment> tpoints = new ArrayList<TrkSegment>();
|
List<TrkSegment> tpoints = new ArrayList<TrkSegment>();
|
||||||
if (routes.size() > 0) {
|
if (routes.size() > 0) {
|
||||||
|
|
|
@ -52,7 +52,19 @@ public class GpxSelectionHelper {
|
||||||
public List<SelectedGpxFile> getSelectedGPXFiles() {
|
public List<SelectedGpxFile> getSelectedGPXFiles() {
|
||||||
return selectedGPXFiles;
|
return selectedGPXFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SelectedGpxFile getSelectedGPXFile(WptPt point) {
|
||||||
|
for (SelectedGpxFile g : selectedGPXFiles) {
|
||||||
|
List<WptPt> pts = g.getGpxFile().points;
|
||||||
|
for (WptPt n : pts) {
|
||||||
|
if (n == point) {
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public final String getString(int resId, Object... formatArgs) {
|
public final String getString(int resId, Object... formatArgs) {
|
||||||
return app.getString(resId, formatArgs);
|
return app.getString(resId, formatArgs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
double longitude = args.getDouble(KEY_LONGITUDE);
|
double longitude = args.getDouble(KEY_LONGITUDE);
|
||||||
String name = editText.getText().toString();
|
String name = editText.getText().toString();
|
||||||
SavingTrackHelper savingTrackHelper = mapActivity.getMyApplication().getSavingTrackHelper();
|
SavingTrackHelper savingTrackHelper = mapActivity.getMyApplication().getSavingTrackHelper();
|
||||||
savingTrackHelper.insertPointData(latitude, longitude, System.currentTimeMillis(), null, name, null);
|
savingTrackHelper.insertPointData(latitude, longitude, System.currentTimeMillis(), null, name, null, 0);
|
||||||
AccessibleToast.makeText(mapActivity, MessageFormat.format(getString(R.string.add_waypoint_dialog_added), name), Toast.LENGTH_SHORT)
|
AccessibleToast.makeText(mapActivity, MessageFormat.format(getString(R.string.add_waypoint_dialog_added), name), Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
|
|
@ -33,7 +33,7 @@ import android.text.format.DateFormat;
|
||||||
public class SavingTrackHelper extends SQLiteOpenHelper {
|
public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
public final static String DATABASE_NAME = "tracks"; //$NON-NLS-1$
|
public final static String DATABASE_NAME = "tracks"; //$NON-NLS-1$
|
||||||
public final static int DATABASE_VERSION = 4;
|
public final static int DATABASE_VERSION = 5;
|
||||||
|
|
||||||
public final static String TRACK_NAME = "track"; //$NON-NLS-1$
|
public final static String TRACK_NAME = "track"; //$NON-NLS-1$
|
||||||
public final static String TRACK_COL_DATE = "date"; //$NON-NLS-1$
|
public final static String TRACK_COL_DATE = "date"; //$NON-NLS-1$
|
||||||
|
@ -50,12 +50,13 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
public final static String POINT_COL_NAME = "pname"; //$NON-NLS-1$
|
public final static String POINT_COL_NAME = "pname"; //$NON-NLS-1$
|
||||||
public final static String POINT_COL_CATEGORY = "category"; //$NON-NLS-1$
|
public final static String POINT_COL_CATEGORY = "category"; //$NON-NLS-1$
|
||||||
public final static String POINT_COL_DESCRIPTION = "description"; //$NON-NLS-1$
|
public final static String POINT_COL_DESCRIPTION = "description"; //$NON-NLS-1$
|
||||||
|
public final static String POINT_COL_COLOR = "color"; //$NON-NLS-1$
|
||||||
|
|
||||||
public final static Log log = PlatformUtil.getLog(SavingTrackHelper.class);
|
public final static Log log = PlatformUtil.getLog(SavingTrackHelper.class);
|
||||||
|
|
||||||
private String updateScript;
|
private String updateScript;
|
||||||
private String updatePointsScript;
|
private String insertPointsScript;
|
||||||
|
|
||||||
private long lastTimeUpdated = 0;
|
private long lastTimeUpdated = 0;
|
||||||
private final OsmandApplication ctx;
|
private final OsmandApplication ctx;
|
||||||
|
|
||||||
|
@ -73,10 +74,12 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
gx.showCurrentTrack = true;
|
gx.showCurrentTrack = true;
|
||||||
this.currentTrack.setGpxFile(gx);
|
this.currentTrack.setGpxFile(gx);
|
||||||
prepareCurrentTrackForRecording();
|
prepareCurrentTrackForRecording();
|
||||||
|
|
||||||
updateScript = "INSERT INTO " + TRACK_NAME + " (" + TRACK_COL_LAT + ", " + TRACK_COL_LON + ", "
|
updateScript = "INSERT INTO " + TRACK_NAME + " (" + TRACK_COL_LAT + ", " + TRACK_COL_LON + ", "
|
||||||
+ TRACK_COL_ALTITUDE + ", " + TRACK_COL_SPEED + ", " + TRACK_COL_HDOP + ", " + TRACK_COL_DATE + ")"
|
+ TRACK_COL_ALTITUDE + ", " + TRACK_COL_SPEED + ", " + TRACK_COL_HDOP + ", " + TRACK_COL_DATE + ")"
|
||||||
+ " VALUES (?, ?, ?, ?, ?, ?)"; //$NON-NLS-1$ //$NON-NLS-2$
|
+ " VALUES (?, ?, ?, ?, ?, ?)"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
updatePointsScript = "INSERT INTO " + POINT_NAME + " VALUES (?, ?, ?, ?, ?, ?)"; //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
|
insertPointsScript = "INSERT INTO " + POINT_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?)"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -86,15 +89,16 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTableForTrack(SQLiteDatabase db){
|
private void createTableForTrack(SQLiteDatabase db){
|
||||||
db.execSQL("CREATE TABLE " + TRACK_NAME+ " ("+TRACK_COL_LAT +" double, " + TRACK_COL_LON+" double, " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
db.execSQL("CREATE TABLE " + TRACK_NAME + " (" + TRACK_COL_LAT + " double, " + TRACK_COL_LON + " double, " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
+ TRACK_COL_ALTITUDE+" double, " + TRACK_COL_SPEED+" double, " //$NON-NLS-1$ //$NON-NLS-2$
|
+ TRACK_COL_ALTITUDE + " double, " + TRACK_COL_SPEED + " double, " //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
+ TRACK_COL_HDOP +" double, " + TRACK_COL_DATE +" long )" ); //$NON-NLS-1$ //$NON-NLS-2$
|
+ TRACK_COL_HDOP + " double, " + TRACK_COL_DATE + " long )"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTableForPoints(SQLiteDatabase db){
|
private void createTableForPoints(SQLiteDatabase db){
|
||||||
try {
|
try {
|
||||||
db.execSQL("CREATE TABLE " + POINT_NAME + " (" + POINT_COL_LAT + " double, " + POINT_COL_LON + " double, " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
db.execSQL("CREATE TABLE " + POINT_NAME + " (" + POINT_COL_LAT + " double, " + POINT_COL_LON + " double, " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
+ POINT_COL_DATE + " long, " + POINT_COL_DESCRIPTION + " text, " + POINT_COL_NAME + " text, " + POINT_COL_CATEGORY + " text" + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
+ POINT_COL_DATE + " long, " + POINT_COL_DESCRIPTION + " text, " + POINT_COL_NAME + " text, "
|
||||||
|
+ POINT_COL_CATEGORY + " text, " + POINT_COL_COLOR + " long" + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// ignore if already exists
|
// ignore if already exists
|
||||||
}
|
}
|
||||||
|
@ -112,6 +116,9 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
db.execSQL("ALTER TABLE " + POINT_NAME + " ADD " + POINT_COL_NAME + " text");
|
db.execSQL("ALTER TABLE " + POINT_NAME + " ADD " + POINT_COL_NAME + " text");
|
||||||
db.execSQL("ALTER TABLE " + POINT_NAME + " ADD " + POINT_COL_CATEGORY + " text");
|
db.execSQL("ALTER TABLE " + POINT_NAME + " ADD " + POINT_COL_CATEGORY + " text");
|
||||||
}
|
}
|
||||||
|
if(oldVersion < 5){
|
||||||
|
db.execSQL("ALTER TABLE " + POINT_NAME + " ADD " + POINT_COL_COLOR + " long");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,7 +128,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
try {
|
try {
|
||||||
Cursor query = db.rawQuery("SELECT " + TRACK_COL_DATE + " FROM " + TRACK_NAME+" ORDER BY " + TRACK_COL_DATE +" DESC", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
Cursor query = db.rawQuery("SELECT " + TRACK_COL_DATE + " FROM " + TRACK_NAME + " ORDER BY " + TRACK_COL_DATE + " DESC", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
if(query.moveToFirst()) {
|
if(query.moveToFirst()) {
|
||||||
res = query.getLong(0);
|
res = query.getLong(0);
|
||||||
}
|
}
|
||||||
|
@ -243,7 +250,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
private void collectDBPoints(SQLiteDatabase db, Map<String, GPXFile> dataTracks) {
|
private void collectDBPoints(SQLiteDatabase db, Map<String, GPXFile> dataTracks) {
|
||||||
Cursor query = db.rawQuery("SELECT " + POINT_COL_LAT + "," + POINT_COL_LON + "," + POINT_COL_DATE + "," //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
Cursor query = db.rawQuery("SELECT " + POINT_COL_LAT + "," + POINT_COL_LON + "," + POINT_COL_DATE + "," //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
+ POINT_COL_DESCRIPTION + "," + POINT_COL_NAME + "," + POINT_COL_CATEGORY + " FROM " + POINT_NAME+" ORDER BY " + POINT_COL_DATE +" ASC", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
+ POINT_COL_DESCRIPTION + "," + POINT_COL_NAME + "," + POINT_COL_CATEGORY + "," + POINT_COL_COLOR + " FROM " + POINT_NAME+" ORDER BY " + POINT_COL_DATE +" ASC", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
if (query.moveToFirst()) {
|
if (query.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
WptPt pt = new WptPt();
|
WptPt pt = new WptPt();
|
||||||
|
@ -254,6 +261,10 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
pt.desc = query.getString(3);
|
pt.desc = query.getString(3);
|
||||||
pt.name = query.getString(4);
|
pt.name = query.getString(4);
|
||||||
pt.category = query.getString(5);
|
pt.category = query.getString(5);
|
||||||
|
int color = query.getInt(6);
|
||||||
|
if (color != 0) {
|
||||||
|
pt.setColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
// check if name is extension (needed for audio/video plugin & josm integration)
|
// check if name is extension (needed for audio/video plugin & josm integration)
|
||||||
if(pt.name != null && pt.name.length() > 4 && pt.name.charAt(pt.name.length() - 4) == '.') {
|
if(pt.name != null && pt.name.length() > 4 && pt.name.charAt(pt.name.length() - 4) == '.') {
|
||||||
|
@ -334,7 +345,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
lastTimeUpdated = 0;
|
lastTimeUpdated = 0;
|
||||||
lastPoint = null;
|
lastPoint = null;
|
||||||
execWithClose(updateScript, new Object[] { 0, 0, 0, 0, 0, System.currentTimeMillis()});
|
execWithClose(updateScript, new Object[] { 0, 0, 0, 0, 0, System.currentTimeMillis()});
|
||||||
addTrackPoint( null, true, System.currentTimeMillis());
|
addTrackPoint(null, true, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateLocation(net.osmand.Location location) {
|
public void updateLocation(net.osmand.Location location) {
|
||||||
|
@ -403,17 +414,126 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
currentTrack.getModifiableGpxFile().modifiedTime = time;
|
currentTrack.getModifiableGpxFile().modifiedTime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertPointData(double lat, double lon, long time, String description, String name, String category) {
|
public WptPt insertPointData(double lat, double lon, long time, String description, String name, String category, int color) {
|
||||||
final WptPt pt = new WptPt(lat, lon, time, Double.NaN, 0, Double.NaN);
|
final WptPt pt = new WptPt(lat, lon, time, Double.NaN, 0, Double.NaN);
|
||||||
pt.name = name;
|
pt.name = name;
|
||||||
pt.category = category;
|
pt.category = category;
|
||||||
pt.desc = description;
|
pt.desc = description;
|
||||||
|
if (color != 0) {
|
||||||
|
pt.setColor(color);
|
||||||
|
}
|
||||||
currentTrack.getModifiableGpxFile().points.add(pt);
|
currentTrack.getModifiableGpxFile().points.add(pt);
|
||||||
currentTrack.getModifiableGpxFile().modifiedTime = time;
|
currentTrack.getModifiableGpxFile().modifiedTime = time;
|
||||||
points++;
|
points++;
|
||||||
execWithClose(updatePointsScript, new Object[] { lat, lon, time, description, name, category });
|
execWithClose(insertPointsScript, new Object[] { lat, lon, time, description, name, category, color });
|
||||||
|
return pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updatePointData(WptPt pt, double lat, double lon, long time, String description, String name, String category, int color) {
|
||||||
|
currentTrack.getModifiableGpxFile().modifiedTime = time;
|
||||||
|
|
||||||
|
List<Object> params = new ArrayList<>();
|
||||||
|
params.add(lat);
|
||||||
|
params.add(lon);
|
||||||
|
params.add(time);
|
||||||
|
params.add(description);
|
||||||
|
params.add(name);
|
||||||
|
params.add(category);
|
||||||
|
params.add(color);
|
||||||
|
|
||||||
|
params.add(pt.getLatitude());
|
||||||
|
params.add(pt.getLongitude());
|
||||||
|
params.add(pt.time);
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
String prefix = "UPDATE " + POINT_NAME
|
||||||
|
+ " SET "
|
||||||
|
+ POINT_COL_LAT + "=?, "
|
||||||
|
+ POINT_COL_LON + "=?, "
|
||||||
|
+ POINT_COL_DATE + "=?, "
|
||||||
|
+ POINT_COL_DESCRIPTION + "=?, "
|
||||||
|
+ POINT_COL_NAME + "=?, "
|
||||||
|
+ POINT_COL_CATEGORY + "=?, "
|
||||||
|
+ POINT_COL_COLOR + "=? "
|
||||||
|
+ "WHERE "
|
||||||
|
+ POINT_COL_LAT + "=? AND "
|
||||||
|
+ POINT_COL_LON + "=? AND "
|
||||||
|
+ POINT_COL_DATE + "=?";
|
||||||
|
|
||||||
|
sb.append(prefix);
|
||||||
|
if (pt.desc != null) {
|
||||||
|
sb.append(" AND ").append(POINT_COL_DESCRIPTION).append("=?");
|
||||||
|
params.add(pt.desc);
|
||||||
|
} else {
|
||||||
|
sb.append(" AND ").append(POINT_COL_DESCRIPTION).append(" IS NULL");
|
||||||
|
}
|
||||||
|
if (pt.name != null) {
|
||||||
|
sb.append(" AND ").append(POINT_COL_NAME).append("=?");
|
||||||
|
params.add(pt.name);
|
||||||
|
} else {
|
||||||
|
sb.append(" AND ").append(POINT_COL_NAME).append(" IS NULL");
|
||||||
|
}
|
||||||
|
if (pt.category != null) {
|
||||||
|
sb.append(" AND ").append(POINT_COL_CATEGORY).append("=?");
|
||||||
|
params.add(pt.category);
|
||||||
|
} else {
|
||||||
|
sb.append(" AND ").append(POINT_COL_CATEGORY).append(" IS NULL");
|
||||||
|
}
|
||||||
|
|
||||||
|
execWithClose(sb.toString(), params.toArray());
|
||||||
|
|
||||||
|
pt.lat = lat;
|
||||||
|
pt.lon = lon;
|
||||||
|
pt.time = time;
|
||||||
|
pt.desc = description;
|
||||||
|
pt.name = name;
|
||||||
|
pt.category = category;
|
||||||
|
if (color != 0) {
|
||||||
|
pt.setColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deletePointData(WptPt pt) {
|
||||||
|
currentTrack.getModifiableGpxFile().points.remove(pt);
|
||||||
|
currentTrack.getModifiableGpxFile().modifiedTime = System.currentTimeMillis();
|
||||||
|
points--;
|
||||||
|
|
||||||
|
List<Object> params = new ArrayList<>();
|
||||||
|
params.add(pt.getLatitude());
|
||||||
|
params.add(pt.getLongitude());
|
||||||
|
params.add(pt.time);
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
String prefix = "DELETE FROM "
|
||||||
|
+ POINT_NAME
|
||||||
|
+ " WHERE "
|
||||||
|
+ POINT_COL_LAT + "=? AND "
|
||||||
|
+ POINT_COL_LON + "=? AND "
|
||||||
|
+ POINT_COL_DATE + "=?";
|
||||||
|
|
||||||
|
sb.append(prefix);
|
||||||
|
if (pt.desc != null) {
|
||||||
|
sb.append(" AND ").append(POINT_COL_DESCRIPTION).append("=?");
|
||||||
|
params.add(pt.desc);
|
||||||
|
} else {
|
||||||
|
sb.append(" AND ").append(POINT_COL_DESCRIPTION).append(" IS NULL");
|
||||||
|
}
|
||||||
|
if (pt.name != null) {
|
||||||
|
sb.append(" AND ").append(POINT_COL_NAME).append("=?");
|
||||||
|
params.add(pt.name);
|
||||||
|
} else {
|
||||||
|
sb.append(" AND ").append(POINT_COL_NAME).append(" IS NULL");
|
||||||
|
}
|
||||||
|
if (pt.category != null) {
|
||||||
|
sb.append(" AND ").append(POINT_COL_CATEGORY).append("=?");
|
||||||
|
params.add(pt.category);
|
||||||
|
} else {
|
||||||
|
sb.append(" AND ").append(POINT_COL_CATEGORY).append(" IS NULL");
|
||||||
|
}
|
||||||
|
|
||||||
|
execWithClose(sb.toString(), params.toArray());
|
||||||
|
}
|
||||||
|
|
||||||
private synchronized void execWithClose(String script, Object[] objects) {
|
private synchronized void execWithClose(String script, Object[] objects) {
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1168,7 +1168,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
&& OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
|
&& OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
|
||||||
String name = f.getName();
|
String name = f.getName();
|
||||||
SavingTrackHelper savingTrackHelper = app.getSavingTrackHelper();
|
SavingTrackHelper savingTrackHelper = app.getSavingTrackHelper();
|
||||||
savingTrackHelper.insertPointData(rec.lat, rec.lon, System.currentTimeMillis(), null, name, null);
|
savingTrackHelper.insertPointData(rec.lat, rec.lon, System.currentTimeMillis(), null, name, null, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,6 +203,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
originalGPX = null;
|
originalGPX = null;
|
||||||
measurementPoints.clear();
|
measurementPoints.clear();
|
||||||
calculateDistance();
|
calculateDistance();
|
||||||
|
activity.getContextMenu().close();
|
||||||
} else if (id == R.string.shared_string_save_as_gpx) {
|
} else if (id == R.string.shared_string_save_as_gpx) {
|
||||||
saveGpx(activity);
|
saveGpx(activity);
|
||||||
} else if (id == R.string.distance_measurement_load_gpx) {
|
} else if (id == R.string.distance_measurement_load_gpx) {
|
||||||
|
@ -637,25 +638,40 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) {
|
public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) {
|
||||||
if(o instanceof WptPt) {
|
if(o instanceof WptPt) {
|
||||||
final WptPt p = (WptPt) o;
|
final WptPt p = (WptPt) o;
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
boolean containsPoint = false;
|
||||||
|
for (int i = 0; i < measurementPoints.size(); i++) {
|
||||||
@Override
|
Iterator<WptPt> it = measurementPoints.get(i).iterator();
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
while (it.hasNext()) {
|
||||||
if (itemId == R.string.delete_point) {
|
if (it.next() == p) {
|
||||||
for (int i = 0; i < measurementPoints.size(); i++) {
|
containsPoint = true;
|
||||||
Iterator<WptPt> it = measurementPoints.get(i).iterator();
|
break;
|
||||||
while (it.hasNext()) {
|
}
|
||||||
if (it.next() == p) {
|
}
|
||||||
it.remove();
|
}
|
||||||
|
if (containsPoint) {
|
||||||
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
if (itemId == R.string.delete_point) {
|
||||||
|
for (int i = 0; i < measurementPoints.size(); i++) {
|
||||||
|
Iterator<WptPt> it = measurementPoints.get(i).iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
if (it.next() == p) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
calculateDistance();
|
||||||
|
if (adapter.getContext() instanceof MapActivity) {
|
||||||
|
((MapActivity)adapter.getContext()).getContextMenu().close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
calculateDistance();
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
};
|
||||||
}
|
adapter.item(R.string.delete_point).iconColor(R.drawable.ic_action_delete_dark).listen(listener).reg();
|
||||||
};
|
}
|
||||||
adapter.item(R.string.delete_point).iconColor(R.drawable.ic_action_delete_dark).listen(listener).reg();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -240,7 +240,10 @@ public class GpxUiHelper {
|
||||||
@Override
|
@Override
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
// User super class to create the View
|
// User super class to create the View
|
||||||
View v = activity.getLayoutInflater().inflate(layout, null);
|
View v = convertView;
|
||||||
|
if (v == null) {
|
||||||
|
v = activity.getLayoutInflater().inflate(layout, null);
|
||||||
|
}
|
||||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||||
icon.setImageDrawable(adapter.getImage(app, position, light));
|
icon.setImageDrawable(adapter.getImage(app, position, light));
|
||||||
final ArrayAdapter<String> arrayAdapter = this;
|
final ArrayAdapter<String> arrayAdapter = this;
|
||||||
|
|
|
@ -212,7 +212,7 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
mapActivity.getMapView().setMapPosition(0);
|
mapActivity.getMapView().setMapPosition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
mapActivity.getMapView().refreshMap();
|
mapActivity.refreshMap();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -246,12 +246,14 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
active = false;
|
if (active) {
|
||||||
if (this.object != null) {
|
active = false;
|
||||||
clearSelectedObject(this.object);
|
if (this.object != null) {
|
||||||
|
clearSelectedObject(this.object);
|
||||||
|
}
|
||||||
|
hide();
|
||||||
|
mapActivity.refreshMap();
|
||||||
}
|
}
|
||||||
hide();
|
|
||||||
mapActivity.getMapView().refreshMap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hide() {
|
public void hide() {
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
||||||
} else {
|
} else {
|
||||||
helper.editFavouriteName(favorite, name, category, description);
|
helper.editFavouriteName(favorite, name, category, description);
|
||||||
}
|
}
|
||||||
getMapActivity().getMapView().refreshMap(true);
|
getMapActivity().refreshMap();
|
||||||
if (needDismiss) {
|
if (needDismiss) {
|
||||||
dismiss(false);
|
dismiss(false);
|
||||||
}
|
}
|
||||||
|
@ -173,10 +173,12 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
helper.deleteFavourite(favorite);
|
helper.deleteFavourite(favorite);
|
||||||
|
saved = true;
|
||||||
if (needDismiss) {
|
if (needDismiss) {
|
||||||
dismiss(true);
|
dismiss(true);
|
||||||
|
} else {
|
||||||
|
getMapActivity().refreshMap();
|
||||||
}
|
}
|
||||||
getMapActivity().getMapView().refreshMap(true);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.osmand.plus.mapcontextmenu.editors;
|
package net.osmand.plus.mapcontextmenu.editors;
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
|
|
@ -288,7 +288,6 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
|
|
||||||
public void dismiss(boolean includingMenu) {
|
public void dismiss(boolean includingMenu) {
|
||||||
if (includingMenu) {
|
if (includingMenu) {
|
||||||
//getMapActivity().getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
|
||||||
getMapActivity().getSupportFragmentManager().popBackStack();
|
getMapActivity().getSupportFragmentManager().popBackStack();
|
||||||
getMapActivity().getContextMenu().close();
|
getMapActivity().getContextMenu().close();
|
||||||
} else {
|
} else {
|
||||||
|
@ -320,7 +319,7 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
public String getCategoryTextValue() {
|
public String getCategoryTextValue() {
|
||||||
AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) view.findViewById(R.id.category_edit);
|
AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) view.findViewById(R.id.category_edit);
|
||||||
String name = categoryEdit.getText().toString().trim();
|
String name = categoryEdit.getText().toString().trim();
|
||||||
return name.equals(getString(R.string.shared_string_favorites)) ? "" : name;
|
return name.equals(getDefaultCategoryName()) ? "" : name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescriptionTextValue() {
|
public String getDescriptionTextValue() {
|
||||||
|
|
|
@ -4,10 +4,17 @@ import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
||||||
|
import net.osmand.plus.GPXUtilities;
|
||||||
|
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||||
import net.osmand.plus.GPXUtilities.WptPt;
|
import net.osmand.plus.GPXUtilities.WptPt;
|
||||||
|
import net.osmand.plus.GpxSelectionHelper;
|
||||||
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
|
@ -15,18 +22,23 @@ import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class WptPtEditorFragment extends PointEditorFragment {
|
public class WptPtEditorFragment extends PointEditorFragment {
|
||||||
private WptPtEditor editor;
|
private WptPtEditor editor;
|
||||||
private WptPt wpt;
|
private WptPt wpt;
|
||||||
private SavingTrackHelper helper;
|
private SavingTrackHelper savingTrackHelper;
|
||||||
|
private GpxSelectionHelper selectedGpxHelper;
|
||||||
|
private SelectedGpxFile selectedGpxFile;
|
||||||
|
|
||||||
private boolean saved;
|
private boolean saved;
|
||||||
private int defaultColor;
|
private int color;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
helper = getMapActivity().getMyApplication().getSavingTrackHelper();
|
savingTrackHelper = getMapActivity().getMyApplication().getSavingTrackHelper();
|
||||||
|
selectedGpxHelper = getMapActivity().getMyApplication().getSelectedGpxHelper();
|
||||||
editor = getMapActivity().getContextMenu().getWptPtPointEditor();
|
editor = getMapActivity().getContextMenu().getWptPtPointEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,9 +46,10 @@ public class WptPtEditorFragment extends PointEditorFragment {
|
||||||
public void onCreate(final Bundle savedInstanceState) {
|
public void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
defaultColor = getResources().getColor(R.color.gpx_color_point);
|
|
||||||
|
|
||||||
wpt = editor.getWptPt();
|
wpt = editor.getWptPt();
|
||||||
|
selectedGpxFile = selectedGpxHelper.getSelectedGPXFile(wpt);
|
||||||
|
int defaultColor = getResources().getColor(R.color.gpx_color_point);
|
||||||
|
color = wpt.getColor(defaultColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,9 +91,9 @@ public class WptPtEditorFragment extends PointEditorFragment {
|
||||||
if (editor.isNew()) {
|
if (editor.isNew()) {
|
||||||
doAddWpt(name, category, description);
|
doAddWpt(name, category, description);
|
||||||
} else {
|
} else {
|
||||||
//todo save wpt
|
doUpdateWpt(name, category, description);
|
||||||
}
|
}
|
||||||
getMapActivity().getMapView().refreshMap(true);
|
getMapActivity().refreshMap();
|
||||||
if (needDismiss) {
|
if (needDismiss) {
|
||||||
dismiss(false);
|
dismiss(false);
|
||||||
}
|
}
|
||||||
|
@ -98,27 +111,70 @@ public class WptPtEditorFragment extends PointEditorFragment {
|
||||||
wpt.name = name;
|
wpt.name = name;
|
||||||
wpt.category = category;
|
wpt.category = category;
|
||||||
wpt.desc = description;
|
wpt.desc = description;
|
||||||
helper.insertPointData(wpt.getLatitude(), wpt.getLongitude(), System.currentTimeMillis(), description, name, category);
|
if (color != 0) {
|
||||||
|
wpt.setColor(color);
|
||||||
|
}
|
||||||
|
wpt = savingTrackHelper.insertPointData(wpt.getLatitude(), wpt.getLongitude(), System.currentTimeMillis(), description, name, category, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isCurrentTrack() {
|
||||||
|
return selectedGpxFile != null && selectedGpxFile.isShowCurrentTrack();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doUpdateWpt(String name, String category, String description) {
|
||||||
|
if (isCurrentTrack()) {
|
||||||
|
savingTrackHelper.updatePointData(wpt, wpt.getLatitude(), wpt.getLongitude(),
|
||||||
|
System.currentTimeMillis(), description, name, category, color);
|
||||||
|
} else if (selectedGpxFile != null) {
|
||||||
|
GPXFile gpx = selectedGpxFile.getModifiableGpxFile();
|
||||||
|
gpx.updateWptPt(wpt, wpt.getLatitude(), wpt.getLongitude(),
|
||||||
|
System.currentTimeMillis(), description, name, category, color);
|
||||||
|
new SaveGpxAsyncTask(getMyApplication(), gpx).execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void delete(final boolean needDismiss) {
|
protected void delete(final boolean needDismiss) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setMessage(getString(R.string.favourites_remove_dialog_msg, wpt.name));
|
builder.setMessage(getString(R.string.context_menu_item_delete_waypoint));
|
||||||
builder.setNegativeButton(R.string.shared_string_no, null);
|
builder.setNegativeButton(R.string.shared_string_no, null);
|
||||||
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
//helper.deleteFavourite(wpt); todo delete wpt
|
|
||||||
|
if (isCurrentTrack()) {
|
||||||
|
savingTrackHelper.deletePointData(wpt);
|
||||||
|
} else {
|
||||||
|
GPXFile gpx = selectedGpxFile.getModifiableGpxFile();
|
||||||
|
gpx.deleteWptPt(wpt);
|
||||||
|
new SaveGpxAsyncTask(getMyApplication(), gpx).execute();
|
||||||
|
}
|
||||||
|
saved = true;
|
||||||
|
|
||||||
if (needDismiss) {
|
if (needDismiss) {
|
||||||
dismiss(true);
|
dismiss(true);
|
||||||
|
} else {
|
||||||
|
getMapActivity().refreshMap();
|
||||||
}
|
}
|
||||||
getMapActivity().getMapView().refreshMap(true);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCategory(String name) {
|
||||||
|
FavoriteGroup group = getMyApplication().getFavorites().getGroup(name);
|
||||||
|
if (group != null) {
|
||||||
|
color = group.color;
|
||||||
|
}
|
||||||
|
super.setCategory(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDefaultCategoryName() {
|
||||||
|
return getString(R.string.shared_string_favorites);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHeaderCaption() {
|
public String getHeaderCaption() {
|
||||||
return getMapActivity().getResources().getString(R.string.gpx_wpt);
|
return getMapActivity().getResources().getString(R.string.gpx_wpt);
|
||||||
|
@ -141,13 +197,28 @@ public class WptPtEditorFragment extends PointEditorFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable getNameIcon() {
|
public Drawable getNameIcon() {
|
||||||
int color = wpt.getColor(defaultColor);
|
|
||||||
return FavoriteImageDrawable.getOrCreate(getMapActivity(), color, false);
|
return FavoriteImageDrawable.getOrCreate(getMapActivity(), color, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable getCategoryIcon() {
|
public Drawable getCategoryIcon() {
|
||||||
int color = wpt.getColor(defaultColor);
|
|
||||||
return getPaintedIcon(R.drawable.ic_action_folder_stroke, color);
|
return getPaintedIcon(R.drawable.ic_action_folder_stroke, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class SaveGpxAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
|
private final OsmandApplication app;
|
||||||
|
private final GPXFile gpx;
|
||||||
|
|
||||||
|
public SaveGpxAsyncTask(OsmandApplication app, GPXFile gpx) {
|
||||||
|
this.app = app;
|
||||||
|
this.gpx = gpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(Void... params) {
|
||||||
|
GPXUtilities.writeGpxFile(new File(gpx.path), gpx, app);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import net.osmand.ValueHolder;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||||
|
import net.osmand.plus.GPXUtilities.WptPt;
|
||||||
import net.osmand.plus.NavigationService;
|
import net.osmand.plus.NavigationService;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmAndTaskManager.OsmAndTaskRunnable;
|
import net.osmand.plus.OsmAndTaskManager.OsmAndTaskRunnable;
|
||||||
|
@ -133,12 +134,21 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||||
if (resId == R.string.context_menu_item_add_waypoint) {
|
if (resId == R.string.context_menu_item_add_waypoint) {
|
||||||
mapActivity.getContextMenu().addWptPt();
|
mapActivity.getContextMenu().addWptPt();
|
||||||
|
} else if (resId == R.string.context_menu_item_edit_waypoint) {
|
||||||
|
mapActivity.getContextMenu().editWptPt();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.context_menu_item_add_waypoint).iconColor(R.drawable.ic_action_gnew_label_dark)
|
adapter.item(R.string.context_menu_item_add_waypoint).iconColor(R.drawable.ic_action_gnew_label_dark)
|
||||||
.listen(listener).reg();
|
.listen(listener).reg();
|
||||||
|
if (selectedObj instanceof WptPt) {
|
||||||
|
WptPt pt = (WptPt) selectedObj;
|
||||||
|
if (app.getSelectedGpxHelper().getSelectedGPXFile(pt) != null) {
|
||||||
|
adapter.item(R.string.context_menu_item_edit_waypoint).iconColor(R.drawable.ic_action_edit_dark)
|
||||||
|
.listen(listener).reg();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int[] SECONDS = new int[] {0, 1, 2, 3, 5, 10, 15, 30, 60, 90};
|
public static final int[] SECONDS = new int[] {0, 1, 2, 3, 5, 10, 15, 30, 60, 90};
|
||||||
|
|
|
@ -83,18 +83,22 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return menu.isActive();
|
return menu.isActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings nightMode) {
|
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
|
||||||
if(menu.isActive()) {
|
if (menu.isActive()) {
|
||||||
LatLon latLon = menu.getLatLon();
|
LatLon latLon = menu.getLatLon();
|
||||||
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
int x = (int) tileBox.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||||
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
int y = (int) tileBox.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||||
canvas.translate(x - contextMarker.getWidth() / 2, y - contextMarker.getHeight());
|
canvas.translate(x - contextMarker.getWidth() / 2, y - contextMarker.getHeight());
|
||||||
contextMarker.draw(canvas);
|
contextMarker.draw(canvas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings nightMode) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setSelectOnMap(CallbackWithObject<LatLon> selectOnMap) {
|
public void setSelectOnMap(CallbackWithObject<LatLon> selectOnMap) {
|
||||||
this.selectOnMap = selectOnMap;
|
this.selectOnMap = selectOnMap;
|
||||||
|
|
Loading…
Reference in a new issue