- Fix Tab : SHow all notes / All tracks
- Search coordinates show full cordinates - Search coordinates On Resume don't restore coordinates to let user enter lat & lon separately - Fix SHOW LAT/LON Doesn't save to History
This commit is contained in:
parent
0e3d3c9104
commit
e666da21b1
20 changed files with 95 additions and 88 deletions
|
@ -49,7 +49,7 @@
|
|||
android:id="@+id/LatitudeEdit"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:inputType="phone"></EditText>
|
||||
android:inputType="numberSigned|numberDecimal|time"></EditText>
|
||||
</TableRow>
|
||||
|
||||
<TableRow android:layout_width="fill_parent" android:id="@+id/lon_row">
|
||||
|
@ -67,7 +67,7 @@
|
|||
android:id="@+id/LongitudeEdit"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:inputType="phone"></EditText>
|
||||
android:inputType="numberSigned|numberDecimal|time"></EditText>
|
||||
</TableRow>
|
||||
<TableRow android:layout_width="fill_parent" android:id="@+id/northing_row">
|
||||
|
||||
|
@ -84,7 +84,7 @@
|
|||
android:id="@+id/NorthingEdit"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:inputType="phone"></EditText>
|
||||
android:inputType="numberSigned|numberDecimal|time"></EditText>
|
||||
</TableRow>
|
||||
|
||||
<TableRow android:layout_width="fill_parent" android:id="@+id/easting_row">
|
||||
|
@ -102,7 +102,7 @@
|
|||
android:id="@+id/EastingEdit"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:inputType="phone"></EditText>
|
||||
android:inputType="numberSigned|numberDecimal|time"></EditText>
|
||||
</TableRow>
|
||||
|
||||
<TableRow android:layout_width="fill_parent" android:id="@+id/zone_row">
|
||||
|
|
|
@ -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";
|
||||
|
@ -37,6 +39,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;
|
||||
this.name = name;
|
||||
|
@ -54,6 +62,14 @@ public class PointDescription {
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ public class TargetPointsHelper {
|
|||
List<LatLon> ips = settings.getIntermediatePoints();
|
||||
List<String> 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -460,7 +460,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) {
|
||||
|
@ -480,7 +480,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(),
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
}
|
||||
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()) {
|
||||
|
|
|
@ -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<TabItem> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<String, HistoryEntry> st = new TreeMap<String, HistoryEntry>();
|
||||
Map<PointDescription, HistoryEntry> st = new HashMap<PointDescription, HistoryEntry>();
|
||||
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");
|
||||
|
|
|
@ -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<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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", "<br/>")));
|
||||
} 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()));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue