diff --git a/OsmAnd/res/layout/points_tree.xml b/OsmAnd/res/layout/points_tree.xml index 296e09695b..fabb898d62 100644 --- a/OsmAnd/res/layout/points_tree.xml +++ b/OsmAnd/res/layout/points_tree.xml @@ -109,4 +109,44 @@ + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/track_segments_tree.xml b/OsmAnd/res/layout/track_segments_tree.xml index df56f12a0f..b084bde401 100644 --- a/OsmAnd/res/layout/track_segments_tree.xml +++ b/OsmAnd/res/layout/track_segments_tree.xml @@ -104,4 +104,44 @@ android:text="@string/add_route_point"/> + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index a32a2ac34c..6ed9ecce85 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -2665,6 +2665,7 @@ Retry Add Route Point Add Waypoint + Add Line Save GPX Waypoint Save Route Point Waypoint 1 diff --git a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java index ff238d8b59..1fb2824599 100644 --- a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java @@ -108,6 +108,10 @@ public class TrackActivity extends TabActivity { } } + public void addLine() { + + } + protected void setGpxDataItem(GpxDataItem gpxDataItem) { this.gpxDataItem = gpxDataItem; } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java index 84e293891c..8cbd52b5d6 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java @@ -99,6 +99,8 @@ public class TrackPointFragment extends OsmandExpandableListFragment { private View waypointTextLayout; private FloatingActionButton routePointFab; private View routePointTextLayout; + private FloatingActionButton lineFab; + private View lineTextLayout; @Override public void onCreate(@Nullable Bundle savedInstanceState) { @@ -166,6 +168,15 @@ public class TrackPointFragment extends OsmandExpandableListFragment { }); routePointTextLayout = view.findViewById(R.id.route_text_layout); + lineFab = (FloatingActionButton) view.findViewById(R.id.line_fab); + lineFab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + addLine(); + } + }); + lineTextLayout = view.findViewById(R.id.line_text_layout); + TextView tv = new TextView(getActivity()); tv.setText(R.string.none_selected_gpx); tv.setTextSize(24); @@ -181,12 +192,18 @@ public class TrackPointFragment extends OsmandExpandableListFragment { getTrackActivity().addPoint(pointDescription); } + private void addLine() { + getTrackActivity().addLine(); + } + private void openMenu() { menuFab.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_action_remove_dark)); waypointFab.setVisibility(View.VISIBLE); waypointTextLayout.setVisibility(View.VISIBLE); routePointFab.setVisibility(View.VISIBLE); routePointTextLayout.setVisibility(View.VISIBLE); + lineFab.setVisibility(View.VISIBLE); + lineTextLayout.setVisibility(View.VISIBLE); menuOpened = true; } @@ -196,6 +213,8 @@ public class TrackPointFragment extends OsmandExpandableListFragment { waypointTextLayout.setVisibility(View.GONE); routePointFab.setVisibility(View.GONE); routePointTextLayout.setVisibility(View.GONE); + lineFab.setVisibility(View.GONE); + lineTextLayout.setVisibility(View.GONE); menuOpened = false; } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java index 6e6ad2846a..ba65930194 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java @@ -148,6 +148,8 @@ public class TrackSegmentFragment extends OsmAndListFragment { private View waypointTextLayout; private FloatingActionButton routePointFab; private View routePointTextLayout; + private FloatingActionButton lineFab; + private View lineTextLayout; @Override public void onCreate(@Nullable Bundle savedInstanceState) { @@ -158,6 +160,20 @@ public class TrackSegmentFragment extends OsmAndListFragment { @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); + getListView().setOnScrollListener(new AbsListView.OnScrollListener() { + @Override + public void onScrollStateChanged(AbsListView absListView, int i) { + if (i == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { + if (menuOpened) { + closeMenu(); + } + } + } + + @Override + public void onScroll(AbsListView absListView, int i, int i1, int i2) { + } + }); getListView().setBackgroundColor(getResources().getColor( getMyApplication().getSettings().isLightContent() ? R.color.ctx_menu_info_view_bg_light : R.color.ctx_menu_info_view_bg_dark)); @@ -209,6 +225,15 @@ public class TrackSegmentFragment extends OsmAndListFragment { }); routePointTextLayout = view.findViewById(R.id.route_text_layout); + lineFab = (FloatingActionButton) view.findViewById(R.id.line_fab); + lineFab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + addLine(); + } + }); + lineTextLayout = view.findViewById(R.id.line_text_layout); + paint = new Paint(); paint.setStyle(Paint.Style.STROKE); paint.setAntiAlias(true); @@ -236,12 +261,18 @@ public class TrackSegmentFragment extends OsmAndListFragment { getTrackActivity().addPoint(pointDescription); } + private void addLine() { + getTrackActivity().addLine(); + } + private void openMenu() { menuFab.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_action_remove_dark)); waypointFab.setVisibility(View.VISIBLE); waypointTextLayout.setVisibility(View.VISIBLE); routePointFab.setVisibility(View.VISIBLE); routePointTextLayout.setVisibility(View.VISIBLE); + lineFab.setVisibility(View.VISIBLE); + lineTextLayout.setVisibility(View.VISIBLE); menuOpened = true; } @@ -251,6 +282,8 @@ public class TrackSegmentFragment extends OsmAndListFragment { waypointTextLayout.setVisibility(View.GONE); routePointFab.setVisibility(View.GONE); routePointTextLayout.setVisibility(View.GONE); + lineFab.setVisibility(View.GONE); + lineTextLayout.setVisibility(View.GONE); menuOpened = false; }