This commit is contained in:
Alexey Kulish 2016-02-04 19:23:38 +03:00
parent 8d929d7304
commit 2131a52926
5 changed files with 48 additions and 11 deletions

View file

@ -911,9 +911,10 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
}
public void showOnMap(final FavouritePoint point) {
getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.FAV_TAB);
final OsmandSettings settings = getMyApplication().getSettings();
LatLon location = new LatLon(point.getLatitude(), point.getLongitude());
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
settings.getLastKnownMapZoom(),
new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getName()),

View file

@ -103,6 +103,8 @@ import java.util.regex.Pattern;
public class MapActivity extends AccessibleActivity implements DownloadEvents,
ActivityCompat.OnRequestPermissionsResultCallback, IRouteInformationListener {
public static final String INTENT_KEY_PARENT_MAP_ACTIVITY = "intent_parent_map_activity_key";
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
private static final int LONG_KEYPRESS_DELAY = 500;
@ -420,6 +422,12 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
if (prevActivityIntent != null && getSupportFragmentManager().getBackStackEntryCount() == 0) {
prevActivityIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
LatLon loc = getMapLocation();
prevActivityIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());
prevActivityIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
if (mapViewTrackingUtilities.isMapLinkedToLocation()) {
prevActivityIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
}
this.startActivity(prevActivityIntent);
prevActivityIntent = null;
} else {
@ -1019,9 +1027,10 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
((MapActivity) activity).readLocationToShow();
} else {
prevActivityIntent = new Intent(((Activity) activity).getIntent());
prevActivityIntent.putExtra(INTENT_KEY_PARENT_MAP_ACTIVITY, true);
Intent newIntent = new Intent(activity, ((OsmandApplication) activity.getApplicationContext())
.getAppCustomization().getMapActivity());
newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TOP);
activity.startActivity(newIntent);
}

View file

@ -593,15 +593,12 @@ public class MapActivityActions implements DialogProvider {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getSearchActivity());
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
LatLon loc = mapActivity.getMapLocation();
newIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());
newIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
if (mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation()) {
newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
}
//newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(newIntent);
return true;

View file

@ -13,13 +13,17 @@ import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.myplaces.SelectedGPXFragment;
import net.osmand.plus.myplaces.TrackPointFragment;
import net.osmand.plus.myplaces.TrackRoutePointFragment;
import net.osmand.plus.myplaces.TrackSegmentFragment;
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
@ -172,6 +176,13 @@ public class TrackActivity extends TabActivity {
int itemId = item.getItemId();
switch (itemId) {
case android.R.id.home:
if (getIntent().hasExtra(MapActivity.INTENT_KEY_PARENT_MAP_ACTIVITY)) {
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
final Intent favorites = new Intent(this, appCustomization.getFavoritesActivity());
getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.GPX_TAB);
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(favorites);
}
finish();
return true;

View file

@ -848,12 +848,31 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == DELETE_FILTER) {
removePoiFilter();
return true;
} else if (item.getItemId() == SAVE_FILTER) {
savePoiFilter();
return true;
int itemId = item.getItemId();
switch (itemId) {
case android.R.id.home:
if (getIntent().hasExtra(MapActivity.INTENT_KEY_PARENT_MAP_ACTIVITY)) {
Intent newIntent = new Intent(this, app.getAppCustomization().getSearchActivity());
if (location != null) {
newIntent.putExtra(SearchActivity.SEARCH_LAT, location.getLatitude());
newIntent.putExtra(SearchActivity.SEARCH_LON, location.getLongitude());
if (searchNearBy) {
newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
}
}
newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(newIntent);
finish();
return true;
}
break;
case DELETE_FILTER:
removePoiFilter();
return true;
case SAVE_FILTER:
savePoiFilter();
return true;
}
return super.onOptionsItemSelected(item);
}