diff --git a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java index 01b2b413e5..3c27ce8e25 100644 --- a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java @@ -36,6 +36,7 @@ import java.util.List; public class TrackActivity extends TabActivity { public static final String TRACK_FILE_NAME = "TRACK_FILE_NAME"; + public static final String OPEN_POINTS_TAB = "OPEN_POINTS_TAB"; public static final String CURRENT_RECORDING = "CURRENT_RECORDING"; protected List> fragList = new ArrayList<>(); protected PagerSlidingTabStrip slidingTabLayout; @@ -47,6 +48,7 @@ public class TrackActivity extends TabActivity { private List displayGroups; private List originalGroups = new ArrayList<>(); private boolean stopped = false; + public boolean openPointsTab = false; public PagerSlidingTabStrip getSlidingTabLayout() { return slidingTabLayout; @@ -75,6 +77,9 @@ public class TrackActivity extends TabActivity { } actionBar.setElevation(0); } + if (intent.hasExtra(OPEN_POINTS_TAB)) { + openPointsTab = true; + } setContentView(R.layout.tab_content); } @@ -188,6 +193,9 @@ public class TrackActivity extends TabActivity { if (isHavingWayPoints() || isHavingRoutePoints()) { ((OsmandFragmentPagerAdapter) mViewPager.getAdapter()).addTab( getTabIndicator(R.string.points, TrackPointFragment.class)); + if (openPointsTab) { + mViewPager.setCurrentItem(1, false); + } } else { slidingTabLayout.setVisibility(View.GONE); getSupportActionBar().setElevation(AndroidUtils.dpToPx(getMyApplication(), 4f)); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditor.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditor.java index 8e46cb0379..dfee74d78b 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditor.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditor.java @@ -13,6 +13,7 @@ public class WptPtEditor extends PointEditor { private GPXFile gpxFile; private WptPt wpt; private boolean gpxSelected; + private boolean newGpxPointProcessing; public static final String TAG = "WptPtEditorFragment"; @@ -20,8 +21,16 @@ public class WptPtEditor extends PointEditor { super(mapActivity); } + public void setNewGpxPointProcessing(boolean newGpxPointProcessing) { + this.newGpxPointProcessing = newGpxPointProcessing; + } + + public boolean isNewGpxPointProcessing() { + return newGpxPointProcessing; + } + public interface OnDismissListener { - void openTrackActivity(); + void onDismiss(); } public void setOnDismissListener(OnDismissListener listener) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java index fa2d9657e9..565c940f86 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java @@ -14,6 +14,7 @@ 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.mapcontextmenu.editors.WptPtEditor.OnDismissListener; import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; @@ -75,12 +76,13 @@ public class WptPtEditorFragment extends PointEditorFragment { } @Override - public void dismiss() { - super.dismiss(); - WptPtEditor.OnDismissListener listener = editor.getOnDismissListener(); + public void dismiss(boolean includingMenu) { + super.dismiss(includingMenu); + OnDismissListener listener = editor.getOnDismissListener(); if (listener != null) { - listener.openTrackActivity(); + listener.onDismiss(); } + editor.setNewGpxPointProcessing(false); editor.setOnDismissListener(null); } @@ -91,10 +93,14 @@ public class WptPtEditorFragment extends PointEditorFragment { @Override public String getToolbarTitle() { - if (editor.isNew()) { - return getMapActivity().getResources().getString(R.string.context_menu_item_add_waypoint); + if (editor.isNewGpxPointProcessing()) { + return getMapActivity().getResources().getString(R.string.save_gpx_waypoint); } else { - return getMapActivity().getResources().getString(R.string.shared_string_edit); + if (editor.isNew()) { + return getMapActivity().getResources().getString(R.string.context_menu_item_add_waypoint); + } else { + return getMapActivity().getResources().getString(R.string.shared_string_edit); + } } } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java index 6b2d684d39..d4bd49e319 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java @@ -178,6 +178,10 @@ public class TrackPointFragment extends OsmandExpandableListFragment { } private void addPoint(PointDescription pointDescription) { + Intent currentIntent = getTrackActivity().getIntent(); + if (currentIntent != null) { + currentIntent.putExtra(TrackActivity.OPEN_POINTS_TAB, true); + } final OsmandSettings settings = app.getSettings(); GPXFile gpx = getGpx(); LatLon location = settings.getLastKnownMapLocation(); @@ -339,6 +343,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment { @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); + getTrackActivity().getClearToolbar(false); MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_dark, R.drawable.ic_action_search_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); searchView = new SearchView(getActivity()); diff --git a/OsmAnd/src/net/osmand/plus/views/AddGpxPointBottomSheetHelper.java b/OsmAnd/src/net/osmand/plus/views/AddGpxPointBottomSheetHelper.java index 1a3305d14e..51f736222b 100644 --- a/OsmAnd/src/net/osmand/plus/views/AddGpxPointBottomSheetHelper.java +++ b/OsmAnd/src/net/osmand/plus/views/AddGpxPointBottomSheetHelper.java @@ -52,10 +52,12 @@ public class AddGpxPointBottomSheetHelper implements OnDismissListener { if (pointDescription.isWpt()) { WptPtEditor editor = activity.getContextMenu().getWptPtPointEditor(); editor.setOnDismissListener(AddGpxPointBottomSheetHelper.this); + editor.setNewGpxPointProcessing(true); editor.add(gpx, latLon, titleText); } else if (pointDescription.isRte()) { RtePtEditor editor = activity.getContextMenu().getRtePtPointEditor(); editor.setOnDismissListener(AddGpxPointBottomSheetHelper.this); + editor.setNewGpxPointProcessing(true); editor.add(gpx, latLon, titleText); } } @@ -126,9 +128,10 @@ public class AddGpxPointBottomSheetHelper implements OnDismissListener { } @Override - public void openTrackActivity() { + public void onDismiss() { Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getTrackActivity()); newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, newGpxPoint.getGpx().path); + newIntent.putExtra(TrackActivity.OPEN_POINTS_TAB, true); newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); mapActivity.startActivity(newIntent); }