diff --git a/OsmAnd/res/layout/navigate_point.xml b/OsmAnd/res/layout/navigate_point.xml
index 8761c4bab0..74098994ca 100644
--- a/OsmAnd/res/layout/navigate_point.xml
+++ b/OsmAnd/res/layout/navigate_point.xml
@@ -49,7 +49,7 @@
android:id="@+id/LatitudeEdit"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
- android:inputType="phone">
+ android:inputType="numberSigned|numberDecimal|time">
@@ -67,7 +67,7 @@
android:id="@+id/LongitudeEdit"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
- android:inputType="phone">
+ android:inputType="numberSigned|numberDecimal|time">
@@ -84,7 +84,7 @@
android:id="@+id/NorthingEdit"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
- android:inputType="phone">
+ android:inputType="numberSigned|numberDecimal|time">
@@ -102,7 +102,7 @@
android:id="@+id/EastingEdit"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
- android:inputType="phone">
+ android:inputType="numberSigned|numberDecimal|time">
diff --git a/OsmAnd/src/net/osmand/data/PointDescription.java b/OsmAnd/src/net/osmand/data/PointDescription.java
index c22c5a4424..213830d190 100644
--- a/OsmAnd/src/net/osmand/data/PointDescription.java
+++ b/OsmAnd/src/net/osmand/data/PointDescription.java
@@ -19,6 +19,8 @@ public class PointDescription {
private String type = "";
private String name = "";
private String typeName;
+ private double lat = 0;
+ private double lon = 0;
public static final String POINT_TYPE_FAVORITE = "favorite";
public static final String POINT_TYPE_WPT = "wpt";
@@ -36,6 +38,12 @@ public class PointDescription {
public static final PointDescription LOCATION_POINT = new PointDescription(POINT_TYPE_LOCATION, "");
+
+ public PointDescription(double lat, double lon) {
+ this(POINT_TYPE_LOCATION, "");
+ this.lat = lat;
+ this.lon = lon;
+ }
public PointDescription(String type, String name) {
this.type = type;
@@ -53,6 +61,14 @@ public class PointDescription {
this.name = "";
}
}
+
+ public void setLat(double lat) {
+ this.lat = lat;
+ }
+
+ public void setLon(double lon) {
+ this.lon = lon;
+ }
public void setTypeName(String typeName){
this.typeName = typeName;
@@ -72,7 +88,7 @@ public class PointDescription {
}
@NonNull
- public String getSimpleName(Context ctx, double lat, double lon, boolean addTypeName) {
+ public String getSimpleName(Context ctx, boolean addTypeName) {
if (isLocation()) {
return getLocationName(ctx, lat, lon, true).replace('\n', ' ');
}
@@ -86,7 +102,7 @@ public class PointDescription {
return name;
}
- public String getFullPlainName(Context ctx, double lat, double lon) {
+ public String getFullPlainName(Context ctx) {
if (isLocation()) {
return getLocationName(ctx, lat, lon, false);
} else {
@@ -167,6 +183,8 @@ public class PointDescription {
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((typeName == null) ? 0 : typeName.hashCode());
+ result = prime * result + ((lat == 0) ? 0 : new Double(lat).hashCode());
+ result = prime * result + ((lon == 0) ? 0 : new Double(lon).hashCode());
return result;
}
@@ -179,6 +197,8 @@ public class PointDescription {
PointDescription other = (PointDescription) obj;
if (Algorithms.objectEquals(other.name, name)
&& Algorithms.objectEquals(other.type, type)
+ && Algorithms.objectEquals(other.lat, lat)
+ && Algorithms.objectEquals(other.lon, lon)
&& Algorithms.objectEquals(other.typeName, typeName)) {
return true;
}
@@ -188,7 +208,7 @@ public class PointDescription {
public static String getSimpleName(LocationPoint o, Context ctx) {
PointDescription pd = o.getPointDescription(ctx);
- return pd.getSimpleName(ctx, o.getLatitude(), o.getLongitude(), true);
+ return pd.getSimpleName(ctx, true);
// return o.getPointDescription(ctx).getFullPlainName(ctx, o.getLatitude(), o.getLongitude());
}
@@ -203,20 +223,25 @@ public class PointDescription {
return tp + "#" + p.name;
}
- public static PointDescription deserializeFromString(String s) {
+ public static PointDescription deserializeFromString(String s, LatLon l) {
+ PointDescription pd = null;
if (s != null && s.length() > 0) {
int in = s.indexOf('#');
if (in >= 0) {
String nm = s.substring(in + 1).trim();
String tp = s.substring(0, in);
if(tp.contains(".")) {
- return new PointDescription(tp.substring(0, tp.indexOf('.')), tp.substring(tp.indexOf('.') + 1), nm);
+ pd = new PointDescription(tp.substring(0, tp.indexOf('.')), tp.substring(tp.indexOf('.') + 1), nm);
} else {
- return new PointDescription(tp, nm);
+ pd = new PointDescription(tp, nm);
}
}
}
- return null;
+ if(pd != null && pd.isLocation() && l != null) {
+ pd.setLat(l.getLatitude());
+ pd.setLon(l.getLongitude());
+ }
+ return pd;
}
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index 61180b2e7d..b2043f9f99 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -1322,10 +1322,10 @@ public class OsmandSettings {
return new LatLon(lat, lon);
}
- public PointDescription getAndClearMapLabelToShow(){
+ public PointDescription getAndClearMapLabelToShow(LatLon l){
String label = settingsAPI.getString(globalPreferences,MAP_LABEL_TO_SHOW, null);
settingsAPI.edit(globalPreferences).remove(MAP_LABEL_TO_SHOW).commit();
- return PointDescription.deserializeFromString(label);
+ return PointDescription.deserializeFromString(label, l);
}
private Object objectToShow;
@@ -1414,12 +1414,12 @@ public class OsmandSettings {
public PointDescription getStartPointDescription() {
return
- PointDescription.deserializeFromString(settingsAPI.getString(globalPreferences, START_POINT_DESCRIPTION, ""));
+ PointDescription.deserializeFromString(settingsAPI.getString(globalPreferences, START_POINT_DESCRIPTION, ""), getPointToStart());
}
public PointDescription getPointNavigateDescription() {
return
- PointDescription.deserializeFromString(settingsAPI.getString(globalPreferences, POINT_NAVIGATE_DESCRIPTION, ""));
+ PointDescription.deserializeFromString(settingsAPI.getString(globalPreferences, POINT_NAVIGATE_DESCRIPTION, ""), getPointToNavigate());
}
diff --git a/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java b/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java
index 50221b738c..c6c1f18435 100644
--- a/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java
+++ b/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java
@@ -102,7 +102,7 @@ public class TargetPointsHelper {
List ips = settings.getIntermediatePoints();
List desc = settings.getIntermediatePointDescriptions(ips.size());
for(int i = 0; i < ips.size(); i++) {
- intermediatePoints.add(new TargetPoint(ips.get(i), PointDescription.deserializeFromString(desc.get(i)), i));
+ intermediatePoints.add(new TargetPoint(ips.get(i), PointDescription.deserializeFromString(desc.get(i), ips.get(i)), i));
}
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index 79c5f727fe..d1063bf693 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -461,7 +461,7 @@ public class MapActivity extends AccessibleActivity {
public void readLocationToShow() {
LatLon cur = new LatLon(mapView.getLatitude(), mapView.getLongitude());
LatLon latLonToShow = settings.getAndClearMapLocationToShow();
- PointDescription mapLabelToShow = settings.getAndClearMapLabelToShow();
+ PointDescription mapLabelToShow = settings.getAndClearMapLabelToShow(latLonToShow);
Object toShow = settings.getAndClearObjectToShow();
int status = settings.isRouteToPointNavigateAndClear();
if (status != 0) {
@@ -481,7 +481,7 @@ public class MapActivity extends AccessibleActivity {
if (mapLabelToShow != null) {
mapLayers.getContextMenuLayer().setSelectedObject(toShow);
mapLayers.getContextMenuLayer().setLocation(latLonToShow,
- mapLabelToShow.getFullPlainName(this, latLonToShow.getLatitude(), latLonToShow.getLongitude()));
+ mapLabelToShow.getFullPlainName(this));
}
if (!latLonToShow.equals(cur)) {
mapView.getAnimatedDraggingThread().startMoving(latLonToShow.getLatitude(),
diff --git a/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java b/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java
index 6b19bccd3c..a8dc08be81 100644
--- a/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java
@@ -11,6 +11,7 @@ import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.helpers.AndroidUiHelper;
+import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import android.app.Dialog;
import android.content.Intent;
@@ -178,26 +179,19 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
public void onResume() {
super.onResume();
- //Hardy: onResume() code is needed so that search origin is properly reflected in tab contents when origin has been changed on one tab, then tab is changed to another one.
- location = null;
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
- //Intent intent = getSherlockActivity().getIntent();
- //if (intent != null) {
- // if (intent.hasExtra(SearchActivity.SEARCH_LAT) && intent.hasExtra(SearchActivity.SEARCH_LON)) {
- // double lat = intent.getDoubleExtra(SearchActivity.SEARCH_LAT, 0);
- // double lon = intent.getDoubleExtra(SearchActivity.SEARCH_LON, 0);
- // if (lat != 0 || lon != 0) {
- // location = new LatLon(lat, lon);
- // }
- // }
- //}
- if (location == null && getActivity() instanceof SearchActivity) {
- location = ((SearchActivity) getActivity()).getSearchPoint();
+
+ LatLon loc = null;
+ if (getActivity() instanceof SearchActivity) {
+ loc = ((SearchActivity) getActivity()).getSearchPoint();
}
- if (location == null) {
- location = app.getSettings().getLastKnownMapLocation();
+ if (loc == null) {
+ loc = app.getSettings().getLastKnownMapLocation();
+ }
+ if(!Algorithms.objectEquals(loc, location)) {
+ location = loc;
+ locationUpdate(location);
}
- locationUpdate(location);
}
@Override
@@ -385,19 +379,20 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
LatLon loc = parseLocation();
double lat = loc.getLatitude();
double lon = loc.getLongitude();
+ PointDescription pd = new PointDescription(lat, lon);
if(mode == ADD_TO_FAVORITE) {
Bundle b = new Bundle();
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(getActivity(), b);
dlg.show();
- FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, lat, lon, PointDescription.LOCATION_POINT);
+ FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, lat, lon, pd);
} else if (mode == NAVIGATE_TO) {
- DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), lat, lon, PointDescription.LOCATION_POINT);
+ DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), lat, lon, pd);
} else if (mode == ADD_WAYPOINT) {
- DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), lat, lon, PointDescription.LOCATION_POINT);
+ DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), lat, lon, pd);
} else if (mode == SHOW_ON_MAP){
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
app.getSettings().setMapLocationToShow(lat, lon, Math.max(12, app.getSettings().getLastKnownMapZoom()),
- PointDescription.LOCATION_POINT);
+ pd);
MapActivity.launchMapActivityMoveToTop(getActivity());
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/TabActivity.java b/OsmAnd/src/net/osmand/plus/activities/TabActivity.java
index 9a645237a1..5ac931fb5d 100644
--- a/OsmAnd/src/net/osmand/plus/activities/TabActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/TabActivity.java
@@ -14,14 +14,16 @@ import android.support.v4.view.ViewPager;
public class TabActivity extends ActionBarProgressActivity {
public TabItem getTabIndicator(int resId, Class> fragment){
- return new TabItem(getString(resId), fragment);
+ return new TabItem(resId, getString(resId), fragment);
}
public static class TabItem {
public final CharSequence mTitle;
public final Class> fragment;
+ public final int resId;
- public TabItem(CharSequence mTitle, Class> fragment) {
+ public TabItem(int resId, CharSequence mTitle, Class> fragment) {
+ this.resId = resId;
this.mTitle = mTitle;
this.fragment = fragment;
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java
index 196a2e5dc7..930f8b312a 100644
--- a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java
@@ -168,7 +168,7 @@ public class GeoIntentActivity extends OsmandListActivity {
} else {
distanceLabel.setText(""); //$NON-NLS-1$
}
- label.setText(getString(model).getFullPlainName(getApplication(), 0, 0));
+ label.setText(getString(model).getFullPlainName(getApplication()));
return row;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java
index 57f090e18e..2347d0a705 100644
--- a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java
@@ -252,7 +252,7 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
}
distanceText.setText(distance);
PointDescription pd = historyEntry.getName();
- nameText.setText(pd.getSimpleName(activity, historyEntry.getLat(), historyEntry.getLon(), false), BufferType.SPANNABLE);
+ nameText.setText(pd.getSimpleName(activity, false), BufferType.SPANNABLE);
ImageView icon = ((ImageView) row.findViewById(R.id.icon));
if (historyEntry.getName().isAddress()) {
diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
index 5d099d0d1d..b89f0d8f22 100644
--- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
@@ -83,6 +83,7 @@ import android.widget.Toast;
public class AudioVideoNotesPlugin extends OsmandPlugin {
+ public static final int NOTES_TAB = R.string.notes;
public static final String ID = "osmand.audionotes";
public static final String THREEGP_EXTENSION = "3gp";
public static final String MPEG4_EXTENSION = "mp4";
@@ -994,9 +995,9 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
@Override
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List mTabs, Intent intent) {
if (getAllRecordings().size() > 0) {
- mTabs.add(favoritesActivity.getTabIndicator(R.string.notes, NotesFragment.class));
+ mTabs.add(favoritesActivity.getTabIndicator(NOTES_TAB, NotesFragment.class));
if (intent != null && "AUDIO".equals(intent.getStringExtra("TAB"))) {
- app.getSettings().FAVORITES_TAB.set(FavoritesActivity.NOTES_TAB);
+ app.getSettings().FAVORITES_TAB.set(NOTES_TAB);
}
}
}
diff --git a/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java
index 9b4fe6f54c..9a44fcca3c 100644
--- a/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/audionotes/DashAudioVideoNotesFragment.java
@@ -38,7 +38,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- startFavoritesActivity(FavoritesActivity.NOTES_TAB);
+ startFavoritesActivity(AudioVideoNotesPlugin.NOTES_TAB);
}
});
return view;
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java
index 4375dc082b..cf800535e9 100644
--- a/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashFavoritesFragment.java
@@ -39,7 +39,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- startFavoritesActivity(FavoritesActivity.FAVORITES_TAB);
+ startFavoritesActivity(FavoritesActivity.FAV_TAB);
}
});
return view;
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
index 1d939541f5..b02cb4c33a 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
@@ -99,9 +99,12 @@ public class DownloadActivity extends BaseDownloadActivity {
ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
PagerSlidingTabStrip mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
- mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_local), LocalIndexesFragment.class));
- mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_downloads), DownloadIndexFragment.class));
- mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_updates), UpdatesIndexFragment.class));
+ mTabs.add(new TabActivity.TabItem(R.string.download_tab_local,
+ getString(R.string.download_tab_local), LocalIndexesFragment.class));
+ mTabs.add(new TabActivity.TabItem(R.string.download_tab_downloads,
+ getString(R.string.download_tab_downloads), DownloadIndexFragment.class));
+ mTabs.add(new TabActivity.TabItem(R.string.download_tab_updates,
+ getString(R.string.download_tab_updates), UpdatesIndexFragment.class));
viewPager.setAdapter(new TabActivity.OsmandFragmentPagerAdapter(getSupportFragmentManager(), mTabs));
mSlidingTabLayout.setViewPager(viewPager);
diff --git a/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java b/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java
index 7098ea7393..ccedb506b5 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java
@@ -3,12 +3,12 @@ package net.osmand.plus.helpers;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@@ -416,22 +416,22 @@ public class SearchHistoryHelper {
"SELECT " + HISTORY_COL_NAME + ", " + HISTORY_COL_LAT + "," + HISTORY_COL_LON +", " +
HISTORY_COL_TIME + ", " + HISTORY_COL_FREQ_INTERVALS + ", " + HISTORY_COL_FREQ_VALUES +
" FROM " + HISTORY_TABLE_NAME , null); //$NON-NLS-1$//$NON-NLS-2$
- Map st = new TreeMap();
+ Map st = new HashMap();
if (query.moveToFirst()) {
boolean reinsert = false;
do {
String name = query.getString(0);
+ PointDescription p = PointDescription.deserializeFromString(name, new LatLon(query.getDouble(1), query.getDouble(2)));
HistoryEntry e = new HistoryEntry(query.getDouble(1), query.getDouble(2),
- PointDescription.deserializeFromString(name));
+ p);
long time = query.getLong(3);
e.setLastAccessTime(time);
e.setFrequency(query.getString(4), query.getString(5));
- if(st.containsKey(name) || st.containsKey(e.getSerializedName())
- || !Algorithms.objectEquals(name, e.getSerializedName())) {
+ if(st.containsKey(p)) {
reinsert = true;
}
entries.add(e);
- st.put(e.getSerializedName(), e);
+ st.put(p, e);
} while (query.moveToNext());
if(reinsert) {
System.err.println("Reinsert all values");
diff --git a/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java
index d884d27a5a..7bd2c89e05 100644
--- a/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java
+++ b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java
@@ -15,7 +15,6 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.FavoritesTreeFragment;
import net.osmand.plus.activities.TabActivity;
-import net.osmand.plus.myplaces.AvailableGPXFragment;
import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
import android.app.Activity;
@@ -24,12 +23,10 @@ import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.SearchView;
-import android.support.v7.widget.Toolbar;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ImageSpan;
import android.view.MenuItem;
-import android.view.View;
import android.widget.ImageView;
/**
@@ -39,12 +36,9 @@ public class FavoritesActivity extends TabActivity {
// private static final String FAVOURITES_INFO = "FAVOURITES_INFO";
private static final String TRACKS = "TRACKS";
+ public static final int GPX_TAB = R.string.shared_string_my_tracks;
+ public static final int FAV_TAB = R.string.shared_string_my_favorites;
// private static final String SELECTED_TRACK = "SELECTED_TRACK";
- public static int FAVORITES_TAB = 0;
- public static int GPX_TAB = 1;
- public static int SELECTED_GPX_TAB = 2;
- public static int NOTES_TAB = 3;
- public static int OSM_EDITS_TAB = 4;
public static String TAB_PARAM = "TAB_PARAM";
protected List> fragList = new ArrayList>();
@@ -79,25 +73,15 @@ public class FavoritesActivity extends TabActivity {
mTabs.add(getTabIndicator(R.string.shared_string_my_tracks, AvailableGPXFragment.class));
}
OsmandPlugin.addMyPlacesTabPlugins(this, mTabs, getIntent());
-
- Integer tab = settings.FAVORITES_TAB.get();
- if (tab == NOTES_TAB) {
- if (OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class) != null){
- tab = mTabs.size() - 2;
- } else {
- tab = mTabs.size() - 1;
+ Integer tabId = settings.FAVORITES_TAB.get();
+ int tab = 0;
+ for(int i = 0; i < mTabs.size(); i++) {
+ if(mTabs.get(i).resId == tabId) {
+ tab = i;
}
-
- } else if (tab == OSM_EDITS_TAB) {
- tab = mTabs.size() - 1;
}
-
setViewPagerAdapter(mViewPager, mTabs);
mSlidingTabLayout.setViewPager(mViewPager);
-
- if (tab > mTabs.size() - 1){
- tab = 0;
- }
mViewPager.setCurrentItem(tab);
// setupHomeButton();
}
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java
index 9766536def..b694422c27 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java
@@ -46,7 +46,7 @@ public class DashOsmEditsFragment extends DashBaseFragment implements OsmEditsUp
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- startFavoritesActivity(FavoritesActivity.OSM_EDITS_TAB);
+ startFavoritesActivity(R.string.osm_edits);
}
});
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java
index 5f60900652..c64ca69a30 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java
@@ -155,7 +155,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
if (dbpoi.getOpenstreetmapPoints().size() > 0 || dbbug.getOsmbugsPoints().size() > 0){
mTabs.add(favoritesActivity.getTabIndicator(R.string.osm_edits, OsmEditsFragment.class));
if (intent != null && "OSM".equals(intent.getStringExtra("TAB"))) {
- app.getSettings().FAVORITES_TAB.set(FavoritesActivity.OSM_EDITS_TAB);
+ app.getSettings().FAVORITES_TAB.set(R.string.osm_edits);
}
}
}
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/SettingsOsmEditingActivity.java b/OsmAnd/src/net/osmand/plus/osmedit/SettingsOsmEditingActivity.java
index 2807c5ea43..564258af68 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/SettingsOsmEditingActivity.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/SettingsOsmEditingActivity.java
@@ -46,7 +46,7 @@ public class SettingsOsmEditingActivity extends SettingsBaseActivity {
final Intent favorites = new Intent(SettingsOsmEditingActivity.this,
appCustomization.getFavoritesActivity());
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
- getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.OSM_EDITS_TAB);
+ getMyApplication().getSettings().FAVORITES_TAB.set(R.string.osm_edits);
startActivity(favorites);
return true;
}
diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java
index 1ca963756b..16b9306006 100644
--- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java
@@ -179,7 +179,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
latLon = loc;
if(latLon != null){
if(description == null){
- description = PointDescription.LOCATION_POINT.getFullPlainName(activity, loc.getLatitude(), loc.getLongitude());
+ description = new PointDescription(loc.getLatitude(), loc.getLongitude()).getFullPlainName(activity);
}
textView.setText(Html.fromHtml(description.replace("\n", "
")));
} else {
@@ -321,9 +321,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
}
if(name) {
PointDescription nm = e.getValue().getObjectName(e.getKey());
- LatLon ll = e.getValue().getObjectLocation(e.getKey());
- description.append(nm.getFullPlainName(activity, ll == null? 0 : ll.getLatitude(), ll == null? 0
- : ll.getLongitude()));
+ description.append(nm.getFullPlainName(activity));
} else {
description.append(e.getValue().getObjectDescription(e.getKey()));
}
diff --git a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java
index 844a575e14..c2d75bd38f 100644
--- a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java
@@ -205,8 +205,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
@Override
public String getObjectDescription(Object o) {
if (o instanceof TargetPoint) {
- return ((TargetPoint) o).getPointDescription(view.getContext()).getFullPlainName(view.getContext(),
- ((TargetPoint) o).getLatitude(), ((TargetPoint) o).getLongitude());
+ return ((TargetPoint) o).getPointDescription(view.getContext()).getFullPlainName(view.getContext());
}
return null;
}